Home

Awesome

Cascade-RCNN_Tensorflow

Abstract

This is a tensorflow re-implementation of Cascade R-CNN Delving into High Quality Object Detection .

This project is completed by YangXue and WangYashan.

Train on VOC 2007 trainval and test on VOC 2007 test (PS. This project also support coco training.)

1

Comparison

use_voc2012_metric

StageAP50AP60AP70AP75AP80AP85AP90AP95
baseline75.8067.2552.1541.4127.9812.632.730.11
1+2+375.8068.7457.0948.6837.7022.527.510.54
1+275.9868.4056.0146.8935.6720.426.440.39
174.8965.9852.4540.6327.7913.222.940.11
275.6768.6956.7347.8235.520.296.460.38
374.3567.6256.6448.6538.0223.198.050.54

use_voc2007_metric

StageAP50AP60AP70AP75AP80AP85AP90AP95
baseline73.6265.2851.9342.5229.4816.25.841.32
1+2+373.6966.5956.1948.8239.4725.5712.092.5
1+274.0166.555.5346.5336.9623.611.332.15
172.9264.2952.4148.830.36165.642.15
273.5566.7555.7848.3537.3923.6110.662.69
371.5865.7356.6449.0839.6826.2512.282.32

Requirements

1、tensorflow >= 1.2
2、cuda8.0
3、python2.7 (anaconda2 recommend)
4、opencv(cv2)

Download Model

1、please download resnet50_v1resnet101_v1 pre-trained models on Imagenet, put it to $PATH_ROOT/data/pretrained_weights.
2、please download mobilenet_v2 pre-trained model on Imagenet, put it to $PATH_ROOT/data/pretrained_weights/mobilenet.
3、please download trained model by this project, put it to $PATH_ROOT/output/trained_weights.

Data Format

├── VOCdevkit
│   ├── VOCdevkit_train
│       ├── Annotation
│       ├── JPEGImages
│   ├── VOCdevkit_test
│       ├── Annotation
│       ├── JPEGImages

Compile

cd $PATH_ROOT/libs/box_utils/cython_utils
python setup.py build_ext --inplace

Demo

Select a configuration file in the folder ($PATH_ROOT/libs/configs/) and copy its contents into cfgs.py, then download the corresponding weights.

cd $PATH_ROOT/tools
python inference.py --data_dir='/PATH/TO/IMAGES/' 
                    --save_dir='/PATH/TO/SAVE/RESULTS/' 
                    --GPU='0'

Eval

cd $PATH_ROOT/tools
python eval.py --eval_imgs='/PATH/TO/IMAGES/'  
               --annotation_dir='/PATH/TO/TEST/ANNOTATION/'
               --GPU='0'

Train

1、If you want to train your own data, please note:

(1) Modify parameters (such as CLASS_NUM, DATASET_NAME, VERSION, etc.) in $PATH_ROOT/libs/configs/cfgs.py
(2) Add category information in $PATH_ROOT/libs/label_name_dict/lable_dict.py     
(3) Add data_name to line 76 of $PATH_ROOT/data/io/read_tfrecord.py 

2、make tfrecord

cd $PATH_ROOT/data/io/  
python convert_data_to_tfrecord.py --VOC_dir='/PATH/TO/VOCdevkit/VOCdevkit_train/' 
                                   --xml_dir='Annotation'
                                   --image_dir='JPEGImages'
                                   --save_name='train' 
                                   --img_format='.jpg' 
                                   --dataset='pascal'

3、train

cd $PATH_ROOT/tools
python train.py

Tensorboard

cd $PATH_ROOT/output/summary
tensorboard --logdir=.

2 1

Reference

1、https://github.com/endernewton/tf-faster-rcnn
2、https://github.com/zengarden/light_head_rcnn
3、https://github.com/tensorflow/models/tree/master/research/object_detection