qianwen96 / RSDet-8P-4R

the 8-para version of RSDet which regress from the 4 points of the anchors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learning Modulated Loss for Rotated Object Detection

License arXiv

Abstract

Code for AAAI 2021 paper (RSDet): Learning Modulated Loss for Rotated Object Detection. RSDet is completed by Qianwen.

Thanks for yangxue who helps me a lot. We also provide a modified version in a rotation detection benchmark, which achieve better perfirmance.

Performance

DOTA1.0

Model Neck Backbone Training/test dataset mAP Model Link Anchor Angle Pred. Reg. Loss Angle Range Data Augmentation Configs
RetinaNet-H FPN ResNet50_v1d 600->800 DOTA1.0 trainval/test 64.17 Baidu Drive (j5l0) H Reg. smooth L1 180 × -
RetinaNet-H FPN ResNet50_v1d 600->800 DOTA1.0 trainval/test 65.73 Baidu Drive (jum2) H Reg. smooth L1 90 × -
RSDet FPN ResNet50_v1d 600->800 DOTA1.0 trainval/test 66.87 Baidu Drive (6nt5) H Reg. modulated loss - × cfgs_res50_dota_rsdet_v2.py

My Development Environment

docker images: docker pull yangxue2docker/yx-tf-det:tensorflow1.13.1-cuda10-gpu-py3

  1. python3.5 (anaconda recommend)
  2. cuda 10.0
  3. opencv(cv2)
  4. tfplot 0.2.0 (optional)
  5. tensorflow-gpu 1.13
  6. tqdm 4.54.0

Download Model

Pretrain weights

  1. Please download resnet50_v1, resnet101_v1, resnet152_v1, efficientnet, mobilenet_v2, darknet53 (Baidu Drive (1jg2), Google Drive) pre-trained models on Imagenet, put them to $PATH_ROOT/dataloader/pretrained_weights.
  2. (Recommend in this repo) Or you can choose to use better backbones (resnet_v1d), refer to gluon2TF.

Compile

cd $PATH_ROOT/libs/box_utils/cython_utils
python setup.py build_ext --inplace (or make)

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

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/label_dict.py     
(3) Add data_name to $PATH_ROOT/data/io/read_tfrecord_multi_gpu.py

2、make tfrecord
For DOTA dataset:

cd $PATH_ROOT\data\io\DOTA
python data_crop.py
cd $PATH_ROOT/data/io/  
python convert_data_to_tfrecord.py --VOC_dir='/PATH/TO/DOTA/' 
                                   --xml_dir='labeltxt'
                                   --image_dir='images'
                                   --save_name='train' 
                                   --img_format='.png' 
                                   --dataset='DOTA'

3、Multi-gpu train

cd $PATH_ROOT/tools
python multi_gpu_train.py

Test

cd $PATH_ROOT/tools
python test_dota.py --test_dir='/PATH/TO/IMAGES/'  
                    --gpus=0,1,2,3,4,5,6,7          

Citation

If you find our code useful for your research, please consider cite.

@article{qian2019learning,
    title={Learning modulated loss for rotated object detection},
    author={Qian, Wen and Yang, Xue and Peng, Silong and Guo, Yue and Yan, Chijun},
    journal={arXiv preprint arXiv:1911.08299},
    year={2019}
}

About

the 8-para version of RSDet which regress from the 4 points of the anchors

License:Apache License 2.0


Languages

Language:Python 97.3%Language:Cuda 2.6%Language:Shell 0.1%Language:C++ 0.1%Language:Makefile 0.0%