This repository was forked from https://github.com/apple2373/figure-separator. If you find this tool useful, please cite the original paper:
@inproceedings{tsutsui2017data,
title={A data driven approach for compound figure separation using convolutional neural networks},
author={Tsutsui, Satoshi and Crandall, David J},
booktitle={2017 14th IAPR International Conference on Document Analysis and Recognition (ICDAR)},
volume={1},
pages={533--540},
year={2017},
organization={IEEE}
}
$ pip install -r requirements.txt
The model can be found at
$ python split_figure.py --split --output ./results imgs/*
See the results
directory. Output json is something like:
[
{
"x": (x coordinate of left top point of the sub-figure),
"y": (y coordinate of left top point of the sub-figure),
"w": (width of the sub-figure),
"h": (height of the sub-figure),
"conf": (confidence value of the extaction),
} ,....
]
Here is other options:
$ python split_figure.py --help
Usage:
main.py [options] --output=<dir> <inputs>...
Options:
--thresh <float> sub-figure detection threshold. [default: 0.5]
--model <file> model pb file. [default: ./data/figure-separation-model-submitted-544.pb]
--split split the image.
--overwrite Overwrite.
from figure_separator import FigureSeparator
fig_separator=FigureSeparator(MODEL)
sub_figures=fig_separator.extract(IMAGE)
print(sub_figures)