Skip to content

TreB1eN/Lighthead-RCNN-in-Pytorch0.4.1

Repository files navigation

Lighthead - RCNN

Implementation of Lighthead-RCNN in Pytorch 0.4.1 codes

Contributions

  • The first reimplementation of Lighthead-RCNN in full stable Pytorch codes
  • A new implementation of CUDA codes of Position Sensitive ROI Pooling is provided, in case all previous ones don't work under the Pytorch version >= 0.4
  • Pretrained model is provided

  • At the time being, this repo only support single batch training.
  • Dataloader from chainercv is used in training

Pretrained model and Performance

res101_lighthead_rcnn@ Google drive

Implementation [email protected]:0.95/all [email protected]/all [email protected]/all mAP:0.5:0.95/small mAP:0.5:0.95/medium mAP:0.5:0.95/large
Original 0.400 0.621 0.429 0.225 0.446 0.540
Ours 0.3963 0.601 0.432 0.217 0.447 0.539
map/iou=0.50:0.95/area=all/max_dets=100: 0.396344
map/iou=0.50/area=all/max_dets=100: 0.601353
map/iou=0.75/area=all/max_dets=100: 0.432155
map/iou=0.50:0.95/area=small/max_dets=100: 0.217397
map/iou=0.50:0.95/area=medium/max_dets=100: 0.447772
map/iou=0.50:0.95/area=large/max_dets=100: 0.538968
mar/iou=0.50:0.95/area=all/max_dets=1: 0.319597
mar/iou=0.50:0.95/area=all/max_dets=10: 0.496089
mar/iou=0.50:0.95/area=all/max_dets=100: 0.513308
mar/iou=0.50:0.95/area=small/max_dets=100: 0.296478
mar/iou=0.50:0.95/area=medium/max_dets=100: 0.578120
mar/iou=0.50:0.95/area=large/max_dets=100: 0.692352

I have only trained it with 18 epochs instead of 30 epochs in the original paper due to it took too long time on my single 1080TI card system.

How to use

Preparation

  1. Clone the this repository.

    git clone https://github.com/TreB1eN/Lighthead-RCNN-in-Pytorch0.4.1.git
    cd Lighthead-RCNN-in-Pytorch0.4.1/
  2. Prepare COCO dataset.

    It is recommended to symlink the dataset root to $Lighthead-RCNN-Pytorch/data.

  3. Create following folders and download the pretrained model to work_space/final

Lighthead-RCNN-Pytorch
├── functions
├── models
├── utils
├── data
│   ├── coco2014
│   │   ├── annotations
│   │   ├── train2014
│   │   ├── val2014
├── work_space
│   ├── model
│   ├── log
│   ├── final
│   ├── save

Installation

  1. Install PyTorch 0.4.1 and torchvision following the official instructions.

  2. Install dependencies

    pip install -r requirements.txt
  3. Compile cuda extensions.

    ./compile.sh  # or "PYTHON=python3 ./compile.sh" if you use system python3 without virtual environments

Inference

python detect.py -f data/person.jpg -o data/person_detected.jpg

Evaluate

python eval.py

Train

  1. Download the pretrained backbone Res101 model to models folder

  2. python train.py 
  3. More detailed configuration is in utils/config.py

References

chainer-light-head-rcnn

light_head_rcnn

paper

Demos


Contact

Email : [email protected]

Questions and PRs are welcome

About

Pytorch0.4.1 codes for Lighthead-RCNN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published