{"id":20064737,"url":"https://github.com/thinklab-sjtu/r3det_tensorflow","last_synced_at":"2025-04-05T11:12:48.215Z","repository":{"id":43414292,"uuid":"204724111","full_name":"Thinklab-SJTU/R3Det_Tensorflow","owner":"Thinklab-SJTU","description":"Code for AAAI 2021 paper: R3Det: Refined Single-Stage Detector with Feature Refinement for Rotating Object","archived":false,"fork":false,"pushed_at":"2021-08-29T01:54:05.000Z","size":7186,"stargazers_count":546,"open_issues_count":14,"forks_count":118,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-29T10:10:12.420Z","etag":null,"topics":["dota","object-detection","rotation","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thinklab-SJTU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-27T14:42:38.000Z","updated_at":"2025-03-06T05:52:31.000Z","dependencies_parsed_at":"2022-09-15T17:21:13.335Z","dependency_job_id":null,"html_url":"https://github.com/Thinklab-SJTU/R3Det_Tensorflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FR3Det_Tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FR3Det_Tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FR3Det_Tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FR3Det_Tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thinklab-SJTU","download_url":"https://codeload.github.com/Thinklab-SJTU/R3Det_Tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325695,"owners_count":20920714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dota","object-detection","rotation","tensorflow"],"created_at":"2024-11-13T13:47:33.845Z","updated_at":"2025-04-05T11:12:48.178Z","avatar_url":"https://github.com/Thinklab-SJTU.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# R\u003csup\u003e3\u003c/sup\u003eDet: Refined Single-Stage Detector with Feature Refinement for Rotating Object\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![arXiv](http://img.shields.io/badge/cs.CV-arXiv%3A1908.05612-B31B1B.svg)](https://arxiv.org/abs/1908.05612)\n\n## Abstract\n[R\u003csup\u003e3\u003c/sup\u003eDet](https://arxiv.org/abs/1908.05612) and [R\u003csup\u003e3\u003c/sup\u003eDet++](https://arxiv.org/abs/2004.13316) are based on [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002.pdf), and it is completed by [YangXue](https://yangxue0827.github.io/).\n\n**[mmdetection version](https://github.com/SJTU-Thinklab-Det/r3det-on-mmdetection) is released. We also recommend a tensorflow-based [rotation detection benchmark](https://github.com/yangxue0827/RotationDetection), which is led by [YangXue](https://yangxue0827.github.io/).**\n\n\u003c!-- Techniques:      --\u003e\n\u003c!-- - [x] [ResNet](https://arxiv.org/abs/1512.03385), [MobileNetV2](https://arxiv.org/abs/1801.04381), [EfficientNet](https://arxiv.org/abs/1905.11946) --\u003e\n\u003c!-- - [x] [RetinaNet-H, RetinaNet-R](https://arxiv.org/abs/1908.05612) --\u003e\n\u003c!-- - [x] [R\u003csup\u003e3\u003c/sup\u003eDet: Feature Refinement Module (FRM)](https://arxiv.org/abs/1908.05612) --\u003e\n\u003c!-- - [x] [R\u003csup\u003e3\u003c/sup\u003eDet++: Instance Level Denoising (InLD)](https://arxiv.org/abs/2004.13316) --\u003e\n\u003c!-- - [x] [IoU-Smooth L1 Loss](https://arxiv.org/abs/1811.07126) --\u003e\n\u003c!-- - [x] [Circular Smooth Label (CSL)](https://arxiv.org/abs/2003.05597) --\u003e\n\u003c!-- - [x] [Densely Coded Label (DCL)]() --\u003e\n\u003c!-- - [x] [mmdetection version](https://github.com/SJTU-Thinklab-Det/r3det-on-mmdetection) is released --\u003e\n\u003c!-- - [x] Dataset support: DOTA, HRSC2016, ICDAR2015, ICDAR2017 MLT, UCAS-AOD, FDDB, OHD-SJTU, SSDD++ --\u003e\n\u003c!-- - [x] [OHDet: Object Heading Detection](https://github.com/SJTU-Thinklab-Det/OHDet_Tensorflow) --\u003e\n\n## Pipeline\n![5](pipeline.png)\n\n## Latest Performance\n### DOTA1.0 (Task1)\n| Model |    Backbone    |    Training data    |    Val data    |    mAP   | Model Link | Anchor | Angle Pred. | Reg. Loss| Angle Range | lr schd | Data Augmentation | GPU | Image/GPU | Configs |      \n|:------------:|:------------:|:------------:|:---------:|:-----------:|:----------:|:-----------:|:-----------:|:-----------:|:---------:|:---------:|:---------:|:---------:|:---------:|:---------:|    \n| [RetinaNet-H](https://arxiv.org/abs/1908.05612) | ResNet50_v1d 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 65.73 | [Baidu Drive (jum2)](https://pan.baidu.com/s/19-hEtCGxLfYuluTATQJpdg) | H | Reg. | smooth L1 | 90 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_v4.py](./libs/configs/DOTA1.0/baseline/cfgs_res50_dota_v4.py) |\n| [RetinaNet-H](https://arxiv.org/abs/1908.05612) | ResNet50_v1d 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 64.17 | [Baidu Drive (j5l0)](https://pan.baidu.com/s/1Qh_LE6QeGsOBYqMzjAESsA) | H | Reg. | smooth L1 | **180** | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_v15.py](./libs/configs/DOTA1.0/baseline/cfgs_res50_dota_v15.py) |\n| [R\u003csup\u003e3\u003c/sup\u003eDet](https://arxiv.org/abs/1908.05612) | ResNet50_v1d 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 70.66 | [Baidu Drive (30lt)](https://pan.baidu.com/s/143sGeLNjXzcpxi9GV7FVyA) | H + R | Reg. | smooth L1 | 90 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_r3det_v1.py](./libs/configs/DOTA1.0/r3det/cfgs_res50_dota_r3det_v1.py) |\n| [R\u003csup\u003e3\u003c/sup\u003eDet*](https://arxiv.org/abs/1908.05612) | ResNet101_v1d 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 73.79 | [Baidu Drive (d7qp)](https://pan.baidu.com/s/1GnRbedKDfpgeYB1rUlwObQ) | H + R | Reg. | iou-smooth L1 | 90 | 3x | √ | 4X GeForce RTX 2080 Ti | 1 | [cfgs_res101_dota_r3det_v19.py](./libs/configs/DOTA1.0/r3det/cfgs_res101_dota_r3det_v19.py) |\n| [R\u003csup\u003e3\u003c/sup\u003eDet*](https://arxiv.org/abs/1908.05612) | ResNet152_v1d 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 74.54 | [Baidu Drive (73bc)](https://pan.baidu.com/s/1WElLJwx15Gmu_gWUj4gE3A) | H + R | Reg. | iou-smooth L1 | 90 | 3x | √ | 4X GeForce RTX 2080 Ti | 1 | [cfgs_res152_dota_r3det_v25.py](./libs/configs/DOTA1.0/r3det/cfgs_res152_dota_r3det_v25.py) |\n| [R\u003csup\u003e3\u003c/sup\u003eDet](https://arxiv.org/abs/1908.05612) | ResNet152_v1d 600-\u003eMS (+Flip) | DOTA1.0 trainval | DOTA1.0 test | 76.23 (+0.24) | [model](https://drive.google.com/file/d/1GkpiSPN-cAnvDISk5d4kjrV3Tqti_mbj/view?usp=sharing) | H + R | Reg. | iou-smooth L1 | 90 | 4x | √ | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res152_dota_r3det_v3.py](./libs/configs/DOTA1.0/r3det/cfgs_res152_dota_r3det_v3.py) |     \n\u003c!-- | [CSL](https://arxiv.org/abs/2003.05597) | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 65.69 | [Baidu Drive (kgr3)](https://pan.baidu.com/s/1gvkLhyoIMqVKWsSK38wyrw) | H | **Cls.: Gaussian (r=6, w=1)** | smooth L1 | 180 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_v1.py](./libs/configs/DOTA1.0/csl/cfgs_res50_dota_v1.py) | --\u003e\n\u003c!-- | [CSL](https://arxiv.org/abs/2003.05597) | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 67.38 | [Baidu Drive (g3wt)](https://pan.baidu.com/s/1nrIs-oYA53qQzlPjqYkMJQ) | H | **Cls.: Gaussian (r=1, w=10)** | smooth L1 | 180 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_v45.py](./libs/configs/DOTA1.0/csl/cfgs_res50_dota_v45.py) | --\u003e\n\u003c!-- | [CSL](https://arxiv.org/abs/2003.05597) | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 68.73 | [Baidu Drive (3a4t)](https://pan.baidu.com/s/1yC-b9Y4ZVgVkQvpPRRLmhw) | H | **Cls.: Pulse (w=1)** | smooth L1 | 180 | 2x | × | 2X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_v41.py](./libs/configs/DOTA1.0/csl/cfgs_res50_dota_v41.py) | --\u003e\n\u003c!-- | [DCL]() | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 67.39 | [Baidu Drive (p9tu)](https://pan.baidu.com/s/1TZ9V0lTTQnMhiepxK1mdqg) | H | **Cls.: BCL (w=180/256)** | smooth L1 | 180 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_dcl_v5.py](./libs/configs/DOTA1.0/dcl/cfgs_res50_dota_dcl_v5.py) | --\u003e\n\u003c!-- | **[R\u003csup\u003e3\u003c/sup\u003eDet-DCL]()** | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 71.21| [Baidu Drive (jueq)](https://pan.baidu.com/s/1XR31i3T-C5R16giBxQUNWw) | H-\u003eR | **Cls.: BCL (w=180/256)** | iou-smooth L1 | 90-\u003e180 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_r3det_dcl_v1.py](./libs/configs/DOTA1.0/r3det_dcl/cfgs_res50_dota_r3det_dcl_v1.py) | --\u003e\n\n[R\u003csup\u003e3\u003c/sup\u003eDet*](https://arxiv.org/abs/1908.05612): R\u003csup\u003e3\u003c/sup\u003eDet with two refinement stages      \n**Due to the improvement of the code, the performance of this repo is gradually improving, so the experimental results in other configuration files are for reference only.**        \n\n### Visualization\n![1](demo1.png)\n\n## My Development Environment\n**docker images: docker pull yangxue2docker/yx-tf-det:tensorflow1.13.1-cuda10-gpu-py3**      \n1、python3.5 (anaconda recommend)               \n2、cuda 10.0                     \n3、[opencv(cv2)](https://pypi.org/project/opencv-python/)       \n4、[tfplot 0.2.0](https://github.com/wookayin/tensorflow-plot) (optional)            \n5、tensorflow-gpu 1.13                              \n\n## Download Model\n### Pretrain weights\n1、Please download [resnet50_v1](http://download.tensorflow.org/models/resnet_v1_50_2016_08_28.tar.gz), [resnet101_v1](http://download.tensorflow.org/models/resnet_v1_101_2016_08_28.tar.gz), [resnet152_v1](http://download.tensorflow.org/models/resnet_v1_152_2016_08_28.tar.gz), [efficientnet](https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet), [mobilenet_v2](https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.0_224.tgz) pre-trained models on Imagenet, put it to data/pretrained_weights.       \n2、**(Recommend in this repo)** Or you can choose to use a better backbone (resnet_v1d), refer to [gluon2TF](https://github.com/yangJirui/gluon2TF).    \n* [Baidu Drive](https://pan.baidu.com/s/1GpqKg0dOaaWmwshvv1qWGg), password: 5ht9.          \n* [Google Drive](https://drive.google.com/drive/folders/1BM8ffn1WnsRRb5RcuAcyJAHX8NS2M1Gz?usp=sharing)      \n\n## Compile\n```  \ncd $PATH_ROOT/libs/box_utils/cython_utils\npython setup.py build_ext --inplace (or make)\n\ncd $PATH_ROOT/libs/box_utils/\npython setup.py build_ext --inplace\n```\n\n## Train \n\n1、If you want to train your own data, please note:  \n```     \n(1) Modify parameters (such as CLASS_NUM, DATASET_NAME, VERSION, etc.) in $PATH_ROOT/libs/configs/cfgs.py\n(2) Add category information in $PATH_ROOT/libs/label_name_dict/label_dict.py     \n(3) Add data_name to $PATH_ROOT/data/io/read_tfrecord_multi_gpu.py  \n```     \n\n2、Make tfrecord     \nFor DOTA dataset:      \n```  \ncd $PATH_ROOT/data/io/DOTA\npython data_crop.py\n```  \n\n```  \ncd $PATH_ROOT/data/io/  \npython convert_data_to_tfrecord.py --VOC_dir='/PATH/TO/DOTA/' \n                                   --xml_dir='labeltxt'\n                                   --image_dir='images'\n                                   --save_name='train' \n                                   --img_format='.png' \n                                   --dataset='DOTA'\n```      \n\n3、Multi-gpu train\n```  \ncd $PATH_ROOT/tools\npython multi_gpu_train_r3det.py\n```\n\n## Test\n```  \ncd $PATH_ROOT/tools\npython test_dota_r3det_ms.py --test_dir='/PATH/TO/IMAGES/'  \n                             --gpus=0,1,2,3,4,5,6,7  \n                             -ms (multi-scale testing, optional)\n                             -s (visualization, optional)\n``` \n\n**Notice: In order to set the breakpoint conveniently, the read and write mode of the file is' a+'. If the model of the same #VERSION needs to be tested again, the original test results need to be deleted.**      \n\n## Tensorboard\n```  \ncd $PATH_ROOT/output/summary\ntensorboard --logdir=.\n``` \n\n![3](images.png)\n\n![4](scalars.png)\n\n## Citation\n\nIf this is useful for your research, please consider cite.\n\n```\n@article{yang2020arbitrary,\n    title={Arbitrary-Oriented Object Detection with Circular Smooth Label},\n    author={Yang, Xue and Yan, Junchi},\n    journal={European Conference on Computer Vision (ECCV)},\n    year={2020}\n    organization={Springer}\n}\n\n@article{yang2019r3det,\n    title={R3Det: Refined Single-Stage Detector with Feature Refinement for Rotating Object},\n    author={Yang, Xue and Yan, Junchi and Feng, Ziming and He, Tao},\n    journal={arXiv preprint arXiv:1908.05612},\n    year={2019}\n}\n\n@article{yang2020scrdet++,\n    title={SCRDet++: Detecting Small, Cluttered and Rotated Objects via Instance-Level Feature Denoising and Rotation Loss Smoothing},\n    author={Yang, Xue and Yan, Junchi and Yang, Xiaokang and Tang, Jin and Liao, Wenglong and He, Tao},\n    journal={arXiv preprint arXiv:2004.13316},\n    year={2020}\n}\n\n@inproceedings{xia2018dota,\n    title={DOTA: A large-scale dataset for object detection in aerial images},\n    author={Xia, Gui-Song and Bai, Xiang and Ding, Jian and Zhu, Zhen and Belongie, Serge and Luo, Jiebo and Datcu, Mihai and Pelillo, Marcello and Zhang, Liangpei},\n    booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},\n    pages={3974--3983},\n    year={2018}\n}\n\n```\n\n## Reference\n1、https://github.com/endernewton/tf-faster-rcnn   \n2、https://github.com/zengarden/light_head_rcnn   \n3、https://github.com/tensorflow/models/tree/master/research/object_detection    \n4、https://github.com/fizyr/keras-retinanet     \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinklab-sjtu%2Fr3det_tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinklab-sjtu%2Fr3det_tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinklab-sjtu%2Fr3det_tensorflow/lists"}