vineethbabu / DeepRule

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

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.

cd <CornerNet dir>/data
git clone git@github.com:cocodataset/cocoapi.git coco
cd <CornerNet dir>/data/coco/PythonAPI
make

Downloading CHARTEX Data

Data Description (Updated on 11/21/2021)

  • For Pie data
    {"image_id": 74999, "category_id": 0, "bbox": [135.0, 60.0, 132.0, 60.0, 134.0, 130.0], "area": 105.02630551355209, "id": 433872}
    The meaning of the bbox is [center_x, center_y, edge_1_x, edge_1_y, edge_2_x, edge_2_y]
    It’s the three critical points for a sector of the pie graph.

  • For the line data
    {"image_id": 120596, "category_id": 0, "bbox": [137.0, 131.0, 174.0, 113.0, 210.0, 80.0, 247.0, 85.0], "area": 0, "id": 288282}
    The meaning of the bbox is [d_1_x, d_1_y, …., d_n_x,d_n_y]
    It’s the data points for a line in the image with image_id.
    instancesLineClsEx is used for training the LineCls.

  • For the Bar data
    Just the bounding box of the bars.

  • For the cls data
    Just the bounding box.
    But different category_id refers to different components like the draw area, title and legends.

Downloading Trained File

  • data link
  • Unzip the file to current root path

Training and Evaluation

To train and evaluate a network, you will need to create a configuration file, which defines the hyperparameters, and a model file, which defines the network architecture. The configuration file should be in JSON format and placed in config/. Each configuration file should have a corresponding model file in models/. i.e. If there is a <model>.json in config/, there should be a <model>.py in models/. There is only one exception which we will mention later. The cfg file names of our proposed modules are as follows:

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

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 96.9%Language:Cython 1.5%Language:C++ 1.5%Language:HTML 0.2%