Skip to content

mmaaz60/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 mAP@0.5:0.95/all mAP@0.5/all mAP@0.75/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/mmaaz60/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.

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

  • From the main Lighthead-RCNN-in-Pytorch0.4.1 directory run the script download_coco_data.sh to download and extract the coco dataset.

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

Installation

  • Following configurations are tested

    • Ubuntu 16.04 LTS
    • Python 3.6 (Conda Environment has been used)
    • Cuda 9.0
    • GCC 5 (GCC 6 does not work)
    • GPU Tesla K80
  • What will not work?

    • I tried Python3.5, Python3.7 and Python2.7. None of these python versions worked for me.
    • GCC 6 (On Debian, GCC 5 is not officially supported. So you may need to shift to Ubuntu. There will be workaround though that I didn't explore)
  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


About

Pytorch0.4.1 codes for Lighthead-RCNN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.3%
  • Cuda 16.8%
  • Jupyter Notebook 15.8%
  • C 7.6%
  • Shell 1.4%
  • C++ 1.1%