{"id":20064774,"url":"https://github.com/thinklab-sjtu/dcl_retinanet_tensorflow","last_synced_at":"2025-05-05T18:30:54.094Z","repository":{"id":107471946,"uuid":"309303104","full_name":"Thinklab-SJTU/DCL_RetinaNet_Tensorflow","owner":"Thinklab-SJTU","description":"Code for CVPR 2021 paper: Dense Label Encoding for Boundary Discontinuity Free Rotation Detection","archived":false,"fork":false,"pushed_at":"2021-04-13T08:01:30.000Z","size":12877,"stargazers_count":39,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-09T02:13:35.558Z","etag":null,"topics":["object-detection","remote-sensing","tensorflow"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2011.09670","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,"governance":null}},"created_at":"2020-11-02T08:23:56.000Z","updated_at":"2024-10-24T04:36:24.000Z","dependencies_parsed_at":"2023-05-17T13:30:18.654Z","dependency_job_id":null,"html_url":"https://github.com/Thinklab-SJTU/DCL_RetinaNet_Tensorflow","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"1d14c9800c3eb1975e8832978f7a263783d171ec"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FDCL_RetinaNet_Tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FDCL_RetinaNet_Tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FDCL_RetinaNet_Tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinklab-SJTU%2FDCL_RetinaNet_Tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thinklab-SJTU","download_url":"https://codeload.github.com/Thinklab-SJTU/DCL_RetinaNet_Tensorflow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252552929,"owners_count":21766798,"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":["object-detection","remote-sensing","tensorflow"],"created_at":"2024-11-13T13:47:43.784Z","updated_at":"2025-05-05T18:30:51.024Z","avatar_url":"https://github.com/Thinklab-SJTU.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dense Label Encoding for Boundary Discontinuity Free Rotation Detection\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%3A2011.09670-B31B1B.svg)](https://arxiv.org/abs/2011.09670)\n\n## Abstract\nThis repo is 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**We also recommend a tensorflow-based [rotation detection benchmark](https://github.com/yangxue0827/RotationDetection), which is led by [YangXue](https://yangxue0827.github.io/).**\n\nTechniques:     \n- [x] [ResNet](https://arxiv.org/abs/1512.03385), [MobileNetV2](https://arxiv.org/abs/1801.04381), [EfficientNet](https://arxiv.org/abs/1905.11946)\n- [x] [RetinaNet-H, RetinaNet-R](https://arxiv.org/abs/1908.05612)\n- [x] [R\u003csup\u003e3\u003c/sup\u003eDet: Feature Refinement Module (FRM)](https://arxiv.org/abs/1908.05612)\n- [x] [Circular Smooth Label (CSL)](https://arxiv.org/abs/2003.05597)\n- [x] [Densely Coded Label (DCL)](https://arxiv.org/abs/2011.09670)\n- [x] Dataset support: DOTA, HRSC2016, ICDAR2015, ICDAR2017 MLT, UCAS-AOD, FDDB, OHD-SJTU, SSDD++\n\n\n## Pipeline\n![5](CSL_DCL.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 | 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| [RetinaNet-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) |\n| [RetinaNet-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) |\n| [RetinaNet-DCL]() | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 67.02 | [Baidu Drive (mcfg)](https://pan.baidu.com/s/1sadSnSdQDjJyqSTJviWHdg) | H | **Cls.: GCL (w=180/256)** | smooth L1 | 180 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_dcl_v10.py](./libs/configs/DOTA1.0/dcl/cfgs_res50_dota_dcl_v10.py) |\n| [RetinaNet-DCL]() | ResNet152_v1 **600-\u003eMS** | DOTA1.0 trainval | DOTA1.0 test | 73.88 | [Baidu Drive (a7du)](https://pan.baidu.com/s/1J9gmrYLINfjtgDkVAqp-Ww) | H | **Cls.: BCL (w=180/256)** | smooth L1 | 180 | 2x | √ | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res152_dota_dcl_v1.py](./libs/configs/DOTA1.0/dcl/cfgs_res152_dota_dcl_v1.py) |\n| **[Refine-DCL]()** | ResNet50_v1 600-\u003e800 | DOTA1.0 trainval | DOTA1.0 test | 70.63| [Baidu Drive (6bv5)](https://pan.baidu.com/s/1IlIjK6NLPQfLqMnPo7p6sw) | H-\u003eR | **Cls.: BCL (w=180/256)** | iou-smooth L1 | 90-\u003e180 | 2x | × | 3X GeForce RTX 2080 Ti | 1 | [cfgs_res50_dota_refine_dcl_v1.py](./libs/configs/DOTA1.0/r3det_dcl/cfgs_res50_dota_refine_dcl_v1.py) |\n| **[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) |\n| **[R\u003csup\u003e3\u003c/sup\u003eDet-DCL]()** | ResNet152_v1 600-\u003eMS (+Flip) | DOTA1.0 trainval | DOTA1.0 test | 76.70 (+0.27) | [Baidu Drive (2iov)](https://pan.baidu.com/s/1UVcCrhcUwTFvWpJaoIToCA) | H-\u003eR | **Cls.: BCL (w=180/256)** | iou-smooth L1 | 90-\u003e180 | 4x | √ | 4X GeForce RTX 2080 Ti | 1 | [cfgs_res152_dota_r3det_dcl_v1.py](./libs/configs/DOTA1.0/r3det_dcl/cfgs_res152_dota_r3det_dcl_v1.py) |\n\n\u003c!-- **Notice:**      --\u003e\n\u003c!-- **Please refer to [new repo](https://github.com/Thinklab-SJTU/R3Det_Tensorflow) for the latest progress.** --\u003e\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_dcl.py\n```\n\n## Test\n```  \ncd $PATH_ROOT/tools\npython test_dota_dcl_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## Feature Visualization\n```  \ncd $PATH_ROOT/tsne\npython feature_extract_dcl.py\n```\n\n```  \npython tsne.py\n```\n\n```  \ncd $PATH_ROOT/tsne/dcl_log\ntensorboard --logdir=.\n```\n\n![6](feature_vis.png)\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{yang2020dense,\n    title={Dense Label Encoding for Boundary Discontinuity Free Rotation Detection},\n    author={Yang, Xue and Hou, Liping and Zhou, Yue and Wang, Wentao and Yan, Junchi},\n    journal={arXiv preprint arXiv:2011.09670},\n    year={2020}\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@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%2Fdcl_retinanet_tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinklab-sjtu%2Fdcl_retinanet_tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinklab-sjtu%2Fdcl_retinanet_tensorflow/lists"}