An easy implementation of Faster R-CNN in PyTorch.
Model | Training Speed | Inference Speed | mAP |
---|---|---|---|
VGG-16 | ~7 examples/sec | ~13 examples/sec | 0.7015 |
ResNet-101 (freeze 0~4) | ~5.4 examples/sec | ~11 examples/sec | 0.7496 |
ResNet-101 (freeze 0~5) | ~5.7 examples/sec | ~11 examples/sec | 0.7466 |
ResNet-101 (freeze 0~6) | ~7.5 examples/sec | ~11 examples/sec | 0.7523 |
ResNet-101 (freeze 0~7) | ~8.4 examples/sec | ~11 examples/sec | 0.6983 |
All the experiments above are running on GTX-1080-Ti
-
Python 3.6
-
torch 0.4.1
-
torchvision 0.2.1
-
tqdm
$ pip install tqdm
-
Download VOC 2007 Dataset
- Training / Validation (5011 images)
- Test (4952 images)
-
Extract to data folder, now your folder structure should be like:
easy-faster-rcnn.pytorch - data - VOCdevkit - VOC2007 - Annotations - 000001.xml - 000002.xml ... - ImageSets - Main ... test.txt ... trainval.txt ... - JPEGImages - 000001.jpg - 000002.jpg ...
-
Build non-maximum-suppression module
$ nvcc -arch=sm_61 -c --compiler-options -fPIC -o nms/src/nms_cuda.o nms/src/nms_cuda.cu $ python nms/build.py $ python -m nms.test.test_nms
sm_61 is for GTX-1080-Ti, to see others visit here
-
Train
$ python train.py -b=vgg16 -d=./data -c=./checkpoints
-
Evaluate
$ python eval.py ./checkpoints/model-100.pth -b=vgg16 -d=./data -r=./results
-
Clean
$ rm -rf ./checkpoints $ rm -rf ./results
-
Infer
$ python infer.py input-image.jpg output-image.jpg -c=./checkpoints/model-100.pth -b=vgg16