洞察探索小游戏大厅如何提升用户体验与企业转型效率
1115
2022-11-01
Scatteract是一个自动从散点图中提取数据的框架
Scatteract
Scatteract is a framework to automatically extract data from the image of scatter plots. We use TensorBox1 to detect the relevant objects (points, tick marks and tick values), Tesseract for the OCR, and several heuristics to extract the points in chart coordinates. See the paper for details. This repository is meant to support the paper and is not an attempt at creating an actual open source project.
1Disclaimer: We vendored the TensorBox dependency into the tensorbox folder since there is no way to pull it in from pypi. We have made no change to this code.
Requirements:
tensorflow==0.10.0rc0 scipy (tested on 0.17.1) scikit-learn (tested on 0.17.1) pandas (tested on 0.18.1) Pillow (PIL) (tested on 3.2.0) numpy (tested on 1.10.4) opencv-python (cv2) (tested on 2.4.10) matplotlib (tested on 1.5.1) runcython (tested on 0.25) pyocr (tested on 0.4.6) tesseract-ocr (tested on 3.02)
On Python 2.7+, the following compatibility module is also required:
backports.functools_lru_cache
How to use:
Generate training and testing data
$ python generate_random_scatter.py --directory plots_v1 --n_train 25000 --n_test 500
Train object detection models
Note that we are using an older version of TensorBox which crashes once training is done because of threading issues, nevertheless the trained models are successfully saved.
& cd tensorbox/utils/ && make && cd ../..$ python tensorbox/train_obj_model.py --hypes hypes/lstm_rezoom_plot_points.json --gpu 0 --logdir output --name points_v1$ python tensorbox/train_obj_model.py --hypes hypes/lstm_rezoom_plot_ticks.json --gpu 0 --logdir output --name ticks_v1$ python tensorbox/train_obj_model.py --hypes hypes/lstm_rezoom_plot_labels.json --gpu 0 --logdir output --name labels_v1
IPython Notebook
The ipython notebook can be used after the object detection models are trained. It allows you to interact with the building blocks of Scatteract and visualize their outputs.
Test object detection models
On the randomly generated test set:$ chmod +x tensorbox -R$ python test_obj_model.py --model_dir output/points_v1 --iteration 125000 --image_dir data/plots_v1 --true_idl data/plots_v1/test_points.idl $ python test_obj_model.py --model_dir output/ticks_v1 --iteration 125000 --image_dir data/plots_v1 --true_idl data/plots_v1/test_ticks.idl $ python test_obj_model.py --model_dir output/labels_v1 --iteration 125000 --image_dir data/plots_v1 --true_idl data/plots_v1/test_labels.idl On a currated randomly generated test set:$ chmod +x tensorbox -R$ python test_obj_model.py --model_dir output/points_v1 --iteration 125000 --image_dir data/plot_test --true_idl data/plot_test/points.idl$ python test_obj_model.py --model_dir output/ticks_v1 --iteration 125000 --image_dir data/plot_test --true_idl data/plot_test/ticks.idl$ python test_obj_model.py --model_dir output/labels_v1 --iteration 125000 --image_dir data/plot_test --true_idl data/plot_test/labels.idl
Test OCR
On the randomly generated test set:$ python generate_test_tesseract.py --image_dir data/plots_v1 --label_values_idl data/plots_v1/test_label_values.idl $ python tesseract.py --tsv_truth data/plots_v1/label_image_values.tsv --image_dir data/plots_v1/label_imagesOn a currated randomly generated test set:$ python tesseract.py --tsv_truth data/plot_test/label_image_values.tsv --image_dir data/plot_test/label_images
Test end-to-end system
On a currated randomly generated test set:& python scatter_extract.py --model_dict '{"ticks":"./output/ticks_v1", "labels":"./output/labels_v1","points":"./output/points_v1"}' \--true_idl_dict '{"ticks":"./data/plot_test/ticks.idl","labels":"./data/plot_test/labels.idl", "points":"./data/plot_test/points.idl"}' \--image_output_dir image_output --csv_output_dir csv_output --true_coord_idl ./data/plot_test/coords.idl \--iteration 125000 --image_dir data/plot_test/
Predict with end-to-end system (i.e. extract data points from plots with no ground truth)
On a set of plots scrapped from the web:$ python scatter_extract.py --model_dict '{"ticks":"./output/ticks_v1", "labels":"./output/labels_v1","points":"./output/points_v1"}' \--iteration 125000 --image_dir data/plot_real/ --predict_idl ./data/plot_real/test_real.idl --image_output_dir image_output --csv_output_dir csv_output
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~