soap117 / DeepRule

BSD 3-Clause "New" or "Revised" License
128 stars 44 forks source link

DeepRule

Compete code of DeepRule

Getting Started

Please first install Anaconda and create an Anaconda environment using the provided package list.

 conda create  --name DeepRule --file DeepRule.txt

After you create the environment, activate it.

source activate DeepRule

Our current implementation only supports GPU so you need a GPU and need to have CUDA installed on your machine.

Compiling Corner Pooling Layers

You need to compile the C++ implementation of corner pooling layers. Please check the latest CornerNet on github if you find problems.

Just fix some warning bugs. (Updated on 06/30/2023).

https://github.com/princeton-vl/CornerNet

cd <CornerNet dir>/models/py_utils/_cpools/
python setup.py build_ext --inplace

Compiling NMS

You also need to compile the NMS code (originally from Faster R-CNN and Soft-NMS).

cd <CornerNet dir>/external
make

Installing MS COCO APIs

You also need to install the MS COCO APIs.

pip install pycocotools

Downloading CHARTEX Data

Bar: CornerNetPureBar

Pie: CornerNetPurePie

Line: CornerNetLine

Query: CornerNetLineClsReal

Cls: CornerNetCls

To train a model:

python train.py --cfg_file <model> --data_dir <data path> 
e.g. 
python train_chart.py --cfg_file CornerNetBar --data_dir /home/data/bardata(1031)

To use the trained model as a web server pipeline:

python manage.py runserver 8800

Access localhost:8800 to interact.

If you want to test batch of data directly, here you have to pre-assign the type of charts.

python test_pipe_type_cloud.py --image_path <image_path> --save_path <save_path> --type <type>
e.g.
python test_pipe_type_cloud.py --image_path /data/bar_test --save_path save --type Bar