chainer-fpn
chainer-fpn copied to clipboard
Implementation of FPN (Feature Pyramid Networks) using Chainer
This repository is not maintained. Please use ChainerCV.
Feature Pyramid Networks for Object Detection
This is an implementation of FPN (Feature Pyramid Networks) using Chainer
Performance
mmAP on COCO 2014 minival
backbone | original (Detectron) | ours (inference only) | ours (train & inference) |
---|---|---|---|
ResNet50 | 36.7 % | 35.7 % | 37.1 % |
ResNet101 | 39.4 % | 38.2 % | 39.5 % |
Requirements
- Python 3.6
- Chainer 4.0+
- CuPy 4.0+
- ChainerCV (we need to build from master branch)
- ChainerMN 1.3
- pycocotools
Demo
$ curl -LO https://github.com/Hakuyume/chainer-fpn/releases/download/assets/faster_rcnn_fpn_resnet50_coco.npz
$ python3 demo.py [--gpu <gpu>] --model resnet50 --pretrained-model faster_rcnn_fpn_resnet50_coco.npz <image>
Training
$ mpiexec -n <#gpu> python3 train_coco.py --model resnet50
Our experiments were conducted with 8 GPUs.
Evaluation
$ python3 eval_coco.py [--gpu <gpu>] --model resnet50 --pretrained-model faster_rcnn_fpn_resnet50_coco.npz
or
$ python3 eval_coco.py [--gpu <gpu>] --model resnet50 --snapshot result/snapshot_iter_90000
Convert weights from Detectron
- Download weights from Detectron's model zoo.
$ curl -L https://s3-us-west-2.amazonaws.com/detectron/35857345/12_2017_baselines/e2e_faster_rcnn_R-50-FPN_1x.yaml.01_36_30.cUF7QR7I/output/train/coco_2014_train%3Acoco_2014_valminusminival/generalized_rcnn/model_final.pkl -o e2e_faster_rcnn_R-50-FPN_1x.pkl
$ curl -L https://s3-us-west-2.amazonaws.com/detectron/35857890/12_2017_baselines/e2e_faster_rcnn_R-101-FPN_1x.yaml.01_38_50.sNxI7sX7/output/train/coco_2014_train%3Acoco_2014_valminusminival/generalized_rcnn/model_final.pkl -o e2e_faster_rcnn_R-101-FPN_1x.pkl
- Convert weights.
$ python3 detectron2npz.py e2e_faster_rcnn_R-50-FPN_1x.pkl faster_rcnn_fpn_resnet50_coco.npz
Note: Since the mean value in Detectron is different from that in ChainerCV,
--mean=detectron
option should be specified for converted weights.
$ python3 eval_coco.py [--gpu <gpu>] --model resnet50 --mean=detectron --pretrained-model faster_rcnn_fpn_resnet50_coco.npz
References
- Tsung-Yi Lin et al. "Feature Pyramid Networks for Object Detection" CVPR 2017
- Detectron
- Mask R-CNN by @wkentaro (for the implementation of RoIAlign)