Home

Awesome

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

ModelNeckBackboneTraining/test datasetmAPModel LinkAnchorAngle Pred.Reg. LossAngle RangeData AugmentationConfigs
RetinaNet-HFPNResNet50_v1d 600->800DOTA1.0 trainval/test64.17Baidu Drive (j5l0)HReg.smooth L1180×-
RetinaNet-HFPNResNet50_v1d 600->800DOTA1.0 trainval/test65.73Baidu Drive (jum2)HReg.smooth L190×-
RSDetFPNResNet50_v1d 600->800DOTA1.0 trainval/test66.87Baidu Drive (6nt5)HReg.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}
}