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
-
Clone the this repository.
git clone https://github.com/TreB1eN/Lighthead-RCNN-in-Pytorch0.4.1.git cd Lighthead-RCNN-in-Pytorch0.4.1/
-
Prepare COCO dataset.
It is recommended to symlink the dataset root to
$Lighthead-RCNN-Pytorch/data
. -
pretrained model to work_space/final
Create following folders and download the
Lighthead-RCNN-Pytorch
├── functions
├── models
├── utils
├── data
│ ├── coco2014
│ │ ├── annotations
│ │ ├── train2014
│ │ ├── val2014
├── work_space
│ ├── model
│ ├── log
│ ├── final
│ ├── save
Installation
-
Install PyTorch 0.4.1 and torchvision following the official instructions.
-
Install dependencies
pip install -r requirements.txt
-
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
-
Download the pretrained backbone Res101 model to
models
folder -
python train.py
-
More detailed configuration is in utils/config.py
References
Demos
Contact
Email : [email protected]
Questions and PRs are welcome