GGHL: A General Gaussian Heatmap Labeling for Arbitrary-Oriented Object Detection
👋
👋
👋
This is the implementation of GGHL [Arxiv] [Google Drive][Baidu Disk (password: yn04)]
⭐️
if this project helped you. If you use it, please consider citing:
Give a article{huang2021general,
title = {A General Gaussian Heatmap Labeling for Arbitrary-Oriented Object Detection},
author = {Huang, Zhanchao and Li, Wei and Xia, Xiang-Gen and Tao, Ran},
year = {2021},
journal = {arXiv preprint arXiv:2109.12848},
eprint = {2109.12848},
eprinttype = {arxiv},
archiveprefix = {arXiv}
}
🤡
🤡
🤡
Clone不Star,都是耍流氓
👹
Abstract of the paper
Recently, many arbitrary-oriented object detection (AOOD) methods have been proposed and attracted widespread attention in many fields. However, most of them are based on anchor-boxes or standard Gaussian heatmaps. Such label assignment strategy may not only fail to reflect the shape and direction characteristics of arbitrary-oriented objects, but also have high parameter-tuning efforts. In this paper, a novel AOOD method called General Gaussian Heatmap Labeling (GGHL) is proposed. Specifically, an anchor-free object adaptation label assignment (OLA) strategy is presented to define the positive candidates based on two-dimensional (2-D) oriented Gaussian heatmaps, which reflect the shape and direction features of arbitrary-oriented objects. Based on OLA, an oriented-boundingbox (OBB) representation component (ORC) is developed to indicate OBBs and adjust the Gaussian center prior weights to fit the characteristics of different objects adaptively through neural network learning. Moreover, a joint-optimization loss (JOL) with area normalization and dynamic confidence weighting is designed to refine the misalign optimal results of different subtasks. Extensive experiments on public datasets demonstrate that the proposed GGHL improves the AOOD performance with low parameter-tuning and time costs. Furthermore, it is generally applicable to most AOOD methods to improve their performance including lightweight models on embedded platforms.
🦞
🦀
🦑
0.News -
12.17 今天没有更新。感慨一句,对于一个深度学习任务而言,有一个成熟的benchmark是一件幸事也是最大的不幸,当大家乐此不疲于此,这个领域就死掉了。
-
12.15🤪 The trained models for DOTAv1.5 and DOTAv2.0 dataset are available. Google Drive or Baidu Disk(password: yn04)
-
12.13😭 改论文改的头昏脑胀,补了一堆实验和解释,改论文比写论文难产多了~/(ㄒoㄒ)/~我可以选择剖腹产吗... -
12.11😁 修复了两个索引的bug。调整了学习率重新训练了,conf_thresh调到0.005,DOTA数据集精度能到79+了。顺便回复一句,总是有人问area normalization那个公式设计怎么来的,我睡觉梦到的。 -
12.9😳 终于收到一审的审稿意见了,感谢审稿人大大。 -
11.22👺 Notice. Due to a bug in the cv2.minAreaRect() function of different versions of opencv, I updated datasets_obb.py, datasets_obb_pro.py, augmentations.py, and DOTA2Train.py. Opencv supports version 4.5.3 and above. Please note the update. Thank you. Thanks @Fly-dream12 for the feedback.
不同版本opencv的cv2.minAreaRect()函数不一致且存在一些角度转换的bug (我用的低版本角度是(0,-90],新版的是[0,90],所以可能有一些bug,我全部更新统一到新版了现在。还有就是cv2.minAreaRect()函数本身的一些bug,有很多博客介绍过了我就不重复了,由于我的原版为了解决这些bug做的判断函数和新版cv2.minAreaRect()的输出不太一样,这里也有一些问题,我也修改了),我更新了datasets_obb.py, datasets_obb_pro.py, augmentations.py, DOTA2Train.py文件,全部按长边表示法计算(角度范围是[0,180)),请大家及时更新,opencv版本也请更新到4.5.3及以上。谢谢。
-
11.21😸 😸 Thanks @trungpham2606 for the suggestions and feedback. -
11.20❤️ 修复了一些bug,谢谢大家的建议。大家有啥问题可以在issues里面详细描述,我会及时回复,你的问题也可能帮助到其他人。 -
11.19😶 During label conversion, it should be noted that the vertices in the paper are in order (see the paper for details).
11.19-11.20 更新修复了标签转换脚本的一些bug (对于custom data的顶点顺序可能与DOTA不一致的问题)
-
11.18😺 Fixed some bugs, please update the codes -
🙏 🙏 🙏 11.17 Release Notes
There are still some uncompleted content that is being continuously updated. Thank you for your feedback and suggestions.
-
🐟 🐡 11.16 The script for generating datasets in the format required by GGHL is added in ./datasets_tools/DOTA2Train.py
更新了用于生成GGHL所需格式数据集的工具(./datasets_tools/DOTA2Train.py)
-
👾 11.15 The models for the SKU dataset are available
其他数据的权重近期会陆续上传和更新
-
🤖 11.14 更新预告
即将更新更多的backbone和模型,以及mosaic数据增强,一周内更完。下周会更新第一版的代码注释和教程,即dataloadR/datasets_obb.py文件,主要是GGHL中最重要的标签分配策略。 另外GGHLv2.0正在准备和实验中,立个flag今年更新完。
-
🎅 11.10 Add DCNv2 for automatic mixed precision (AMP) training.
增加了DCNv2的混合精度训练和onnx转换 (推理阶段要记得把offsets改成FP16)
-
🐣 🐤 🐥 11.9: The model weight has been released. You can download it and put it in the ./weight folder, and then modify the weight path in test.py to test and get the results reported in the paper. The download link is given in the introduction later.
论文结果对应的模型权重可以下载了(终于发工资把网盘续上了~)
-
🐞 11.8:I plan to write a tutorial on data preprocessing and explanation of algorithms and codes, which is expected to be launched in December
打算写一个数据预处理的教程和算法、代码的讲解,预计12月上线
-
🦄 11.7: All updates of GGHL have been completed. Welcome to use it. If you have any questions, you can leave a message at the issue. Thank you.
1.0版本全部更新完成了,欢迎使用,有任何问题可以在issue留言,谢谢。接下来会不断更新和完善
🌈
1.Environments
Linux (Ubuntu 18.04, GCC>=5.4) & Windows (Win10)
CUDA > 11.1, Cudnn > 8.0.4
First, install CUDA, Cudnn, and Pytorch. Second, install the dependent libraries in requirements.txt.
conda install pytorch==1.8.1 torchvision==0.9.1 torchaudio==0.8.1 cudatoolkit=11.1 -c pytorch -c conda-forge
pip install -r requirements.txt
🌟
2.Installation
- git clone this repository
- Install the libraries in the ./lib folder
(1) DCNv2
cd ./GGHL/lib/DCNv2/
sh make.sh
- Polygen NMS
The poly_nms in this version is implemented using shapely and numpy libraries to ensure that it can work in different systems and environments without other dependencies. But doing so will slow down the detection speed in dense object scenes. If you want faster speed, you can compile and use the poly_iou library (C++ implementation version) in datasets_tools/DOTA_devkit. The compilation method is described in detail in DOTA_devkit .
cd datasets_tools/DOTA_devkit
sudo apt-get install swig
swig -c++ -python polyiou.i
python setup.py build_ext --inplace
🎃
3.Datasets
- DOTA dataset and its devkit
(1) Training Format
You need to write a script to convert them into the train.txt file required by this repository and put them in the ./dataR folder.
For the specific format of the train.txt file, see the example in the /dataR folder.
image_path xmin,ymin,xmax,ymax,class_id,x1,y1,x2,y2,x3,y3,x4,y4,area_ratio,angle[0,180) xmin,ymin,xmax,ymax,class_id,x1,y1,x2,y2,x3,y3,x4,y4,area_ratio,angle[0,180)...
The calculation method of angle is explained in Issues #1 and our paper.
(2) Testing Format
The same as the Pascal VOC Format
(3) DataSets Files Structure
cfg.DATA_PATH = "/opt/datasets/DOTA/"
├── ...
├── JPEGImages
| ├── 000001.png
| ├── 000002.png
| └── ...
├── Annotations (DOTA Dataset Format)
| ├── 000001.txt (class_idx x1 y1 x2 y2 x3 y3 x4 y4)
| ├── 000002.txt
| └── ...
├── ImageSets
├── test.txt (testing filename)
├── 000001
├── 000002
└── ...
There is a DOTA2Train.py file in the datasets_tools folder that can be used to generate training and test format labels. First, you need to use DOTA_devkit , the official tools of the DOTA dataset, for image and label splitting. Then, run DOTA2Train.py to convert them to the format required by GGHL. For the use of DOTA_devkit, please refer to the tutorial in the official repository.
🌠
🌠
🌠
4.Usage Example
(1) Training
python train_GGHL.py
(2) For Distributed Training
sh train_GGHL_dist.sh
(3) Testing
python test.py
☃️
❄️
5.Weights
1)The trained model for DOTA dataset is available from Google Drive or Baidu Disk (password: 2dm8)
Put them in. /weight folder
2)The trained model for SKU dataset is available from Google Drive or Baidu Disk(password: c3jv)
3)The trained model for SKU dataset is available from Google Drive or Baidu Disk(password: vdf5)
4)The pre-trained weights of Darknet53 on ImageNet are available from Google_Drive or Baidu_Disk(password:0blv)
-
The trained model for DOTAv1.5 dataset is available from Google Drive or Baidu Disk(password: wxlj)
-
The trained model for DOTAv2.0 dataset is available from Google Drive or Baidu Disk(password: dmu7)
💖
💖
💖
6.Reference
https://github.com/Peterisfar/YOLOV3
https://github.com/argusswift/YOLOv4-pytorch
https://github.com/ultralytics/yolov5
https://github.com/jinfagang/DCNv2_latest
📝
License
Copyright © 2021 Shank2358.
This project is GNU General Public License v3.0 licensed.
🤐
To be continued
💣
11.6 更新了标签分配和dataload。更新了pytorch1.10版本的支持。预告一下,下周会更新分布式训练的内容。
(预训练权重的链接在NPMMR-Det和LO-Det的仓库说明里)
🙈
正文开始前的惯例的碎碎念(可以跳过直接看正文使用说明)
投稿排队实在太慢了,三个月了还在形式审查没分配AE,555~ 先在arxiv上挂出来了。
我会尽最大努力帮助大家跑通代码和复现出接近论文报道结果的实验,因为我自己也被坑多了,好多遥感领域的论文不开源代码或者根本复现不出来,或者就是模型复杂到眼花缭乱换个数据/参数就失灵,实在是太难了。论文里关于NPMMR-Det和LO-Det的实验代码会在那两个仓库里面更新,NPMMRDet的baseline目前已经更新完了,你们可以试试看能不能跑。LO-Det的正在更新中,可以看那边的说明(11.1也更新了)。 万一有AE或者审稿人大佬看到这个仓库,跪求千万别忘了审稿啊~ 求求,希望能顺利毕业
😸
😸
10.24 终于分配AE和审稿人了
🐌
🐌
🐌
,不容易啊。这投稿流程可太慢了,担心能不能赶上毕业,真的是瑟瑟发抖
😭
😭
😭
🙉
🙉
关于论文超参数合实验的一些说明。
另外,请不要做伸手党,如果你们想训练自己的数据集,以下已经详细描述了GGHL的数据格式和使用说明,在tools文件夹中提供了转换脚本。我也在许多论文以外的数据集和大家提供的数据集上进行了实验,都可以正常工作,请花些时间阅读说明和issues #1中的一些解释,如果还有疑问可以在issues中留言给我,都会得到回复。我没有义务直接帮你们改代码和训练你们的数据。