download PASVAL VOC 2007 into data/VOCdevkit/
download pretrained ResNet101 into data/pretrained_model
Install all the python dependencies using pip:
pip install -r requirements.txt
Compile the cuda dependencies using following simple commands:
cd lib
python setup.py build develop
Before training, set the right directory to save and load the trained models. Change the arguments "save_dir" and "load_dir" in trainval_net.py and test_net.py to adapt to your environment.
To train a faster R-CNN model with resnet101 on pascal_voc, run:
CUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \
--dataset pascal_voc --net res101 \
--bs $BATCH_SIZE --nw $WORKER_NUMBER \
--lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \
--cuda --use_tfb
or just simply python trainval_net.py --use_tfb
If you want to evlauate the detection performance of a pre-trained resnet101 model on pascal_voc test set, simply run
python test_net.py --dataset pascal_voc --net res101 \
--checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \
--cuda
Specify the specific model session, chechepoch and checkpoint, or just simply python test_net.py
by default SESSION=1, EPOCH=20, CHECKPOINT=2504.
Visualize the proposal boxes on four testing images.
Please download the pretrained model listed above or train your own models at first, then add images to folder $ROOT/images
, and then run
python demo.py --net resnet101 \
--checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \
--cuda --load_dir path/to/model/directoy
The results is saved in $ROOT/images/proposal_box
If you want to run detection on your own images with a pre-trained model, download the pretrained model listed above or train your own models at first, then add images to folder $ROOT/images, and then run
python demo.py --net resnet101 \
--checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \
--cuda --load_dir path/to/model/directoy
Then you will find the detection results in folder $ROOT/images/det
and corresponding proposal boxes are saved in $ROOT/images/proposal_box
PASCAL VOC 2007 (Train/Test: 07trainval/07test, scale=600, ROI Align)
model | batch size | lr | lr_decay | epoch | mAP ---------|-----|--------|-----|-----|-------|----- Res-101 | 1 | 1e-3 | 5 | 20 | 75.2 Res-101 | 4 | 4e-3 | 5 | 20 | 74.9