/RPN_DLA

RPN approach to DLA problem

Primary LanguagePythonApache License 2.0Apache-2.0

RPN_DLA

RPN approach to DLA problem

Requirements

  • Linux (OSX may work, but untested.).
  • Python (3.7 under conda virtual environment is recomended)
  • Pytorch (1.5.1)
  • Detectron2

Installation

  1. Install python dependencies using requirements file
  2. Install detectron2

Usage

  1. Input data must follow the folder structure data_tag/page, where images must be into the data_tag folder and xml files into page. For example:
mkdir -p data/{train,val,test,prod}/page;
tree data;
data
├── prod
│   ├── page
│   │   ├── prod_0.xml
│   │   └── prod_1.xml
│   ├── prod_0.jpg
│   └── prod_1.jpg
├── test
│   ├── page
│   │   ├── test_0.xml
│   │   └── test_1.xml
│   ├── test_0.jpg
│   └── test_1.jpg
├── train
│   ├── page
│   │   ├── train_0.xml
│   │   └── train_1.xml
│   ├── train_0.jpg
│   └── train_1.jpg
└── val
    ├── page
    │   ├── val_0.xml
    │   └── val_1.xml
    ├── val_0.jpg
    └── val_1.jpg
  1. Convert PAGE-XML data into COCO-JSON
python utils/page2coco.py --page_dir <> --include <> --classes <> --output <>
  1. Run the tool
python train_net.py --num-gpus <1> --config-file <configs/> SOLVER.IMS_PER_BATCH <4> SOLVER.BASE_LR <0.01>

An example config file can be found in configs folder

  1. Convert results fron JSON to PAGE-XML
python utils/detectronCoco2page.py --results_json <> --dataset_json <> --output <>
  1. Gen the baselines if required
python utils/baselines/baselines.py --img_dir <> --page_dir <> --out_dir <>

License

Apache 2.0 license. See LICENSE to see the full text.