Giter VIP home page Giter VIP logo

h2rbox-mmrotate's Introduction

H2RBox (ICLR 2023)

H2RBox: Horizontal Box Annotation is All You Need for Oriented Object Detection

Abstract

Oriented object detection emerges in many applications from aerial images to autonomous driving, while many existing detection benchmarks are annotated with horizontal bounding box only which is also less costive than fine-grained rotated box, leading to a gap between the readily available training corpus and the rising demand for oriented object detection. This paper proposes a simple yet effective oriented object detection approach called H2RBox merely using horizontal box annotation for weakly-supervised training, which closes the above gap and shows competitive performance even against those trained with rotated boxes. The cores of our method are weakly- and self-supervised learning, which predicts the angle of the object by learning the consistency of two different views. To our best knowledge, H2RBox is the first horizontal box annotation-based oriented object detector. Compared to an alternative i.e. horizontal box-supervised instance segmentation with our post adaption to oriented object detection, our approach is not susceptible to the prediction quality of mask and can perform more robustly in complex scenes containing a large number of dense objects and outliers. Experimental results show that H2RBox has significant performance and speed advantages over horizontal box-supervised instance segmentation methods, as well as lower memory requirements. While compared to rotated box-supervised oriented object detectors, our method shows very close performance and speed, and even surpasses them in some cases.

Results and models

DOTA1.0

Backbone mAP Angle lr schd Mem (GB) Inf Time (fps) MS Batch Size Configs Download
ResNet50 (1024,1024,200) 67.24 le135 1x 5.50 25.7 - 2 h2rbox_atss_r50_adamw_fpn_1x_dota_le135 -
ResNet50 (1024,1024,200) 67.45 le90 1x 7.02 28.5 - 2 h2rbox_r50_adamw_fpn_1x_dota_le90 model | log
ResNet50 (1024,1024,200) 70.77 le90 3x 7.02 28.5 - 2 h2rbox_r50_adamw_fpn_3x_dota_le90 model | log
ResNet50 (1024,1024,200) 74.53 le90 1x 8.58 - 2 h2rbox_r50_adamw_fpn_1x_dota_ms_le90 model | log

DOTA1.5

Backbone mAP Angle lr schd Mem (GB) Inf Time (fps) MS Batch Size Configs Download
ResNet50 (1024,1024,200) 59.02 le135 1x 6.29 24.8 - 2 h2rbox_atss_r50_adamw_fpn_1x_dotav15_le135 -
ResNet50 (1024,1024,200) 60.19 le90 1x 10.68 25.8 - 2 h2rbox_r50_adamw_fpn_1x_dotav15_le90 -
ResNet50 (1024,1024,200) 62.60 le90 1x 10.68 25.8 - 2 h2rbox_r50_adamw_fpn_3x_dotav15_le90 -

DOTA2.0

Backbone mAP Angle lr schd Mem (GB) Inf Time (fps) MS Batch Size Configs Download
ResNet50 (1024,1024,200) 45.35 le135 1x 6.43 24.7 - 2 h2rbox_atss_r50_adamw_fpn_1x_dotav2_le135 -
ResNet50 (1024,1024,200) 45.87 le90 1x 11.57 25.0 - 2 h2rbox_r50_adamw_fpn_1x_dotav2_le90 -
ResNet50 (1024,1024,200) 47.86 le90 1x 11.57 25.0 - 2 h2rbox_r50_adamw_fpn_3x_dotav2_le90 -

Notes:

Get Started

Please refer to the official guide of MMRotate 0.x or here.

Citation

@inproceedings{yang2023h2rbox,
  title={H2RBox: Horizontal Box Annotation is All You Need for Oriented Object Detection},
  author={Yang, Xue and Zhang, Gefan and Li, Wentong and Wang, Xuehui and Zhou, Yue and Yan, Junchi},
  booktitle={International Conference on Learning Representations},
  year={2023}
}

h2rbox-mmrotate's People

Contributors

yangxue0827 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

h2rbox-mmrotate's Issues

visualization of test resuts

大佬您好,测试结果可视化的检测框输出默认的是水平的,想问下怎么在图像上可视化输出预测得到的旋转框呢,感谢!

---检查发现是config里面rec_class修改导致没学到角度,抱歉打扰了。

Want each category mAP

作者您好,我认为您的工作非常好,我想请问一下您能否公布一下DOTA-v1.0中1x schdule using MS的每一个类别的mAP吗,谢谢!

no module name h2rbox

(zyf) root@container-b8cd11b052-650e1e62:~/autodl-tmp/h2rbox-mmrotate# python tools/train.py configs/h2rbox/h2rbox_r50_fpn_3x_ssdd_le90.py
/root/miniconda3/envs/zyf/lib/python3.7/site-packages/mmcv/init.py:21: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
'On January 1, 2023, MMCV will release v2.0.0, in which it will remove '
Traceback (most recent call last):
File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/mmcv/utils/misc.py", line 73, in import_modules_from_strings
imported_tmp = import_module(imp)
File "/root/miniconda3/envs/zyf/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'h2rbox'

A placeholder for the command.
  1. Did you make any modifications on the code or config? Did you understand what you have modified?
  2. What dataset did you use?

Environment

  1. Please run python mmrotate/utils/collect_env.py to collect necessary environment information and paste it here.
  2. You may add addition that may be helpful for locating the problem, such as
    • How you installed PyTorch [e.g., pip, conda, source]
    • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback
If applicable, paste the error trackback here.

A placeholder for trackback.

Bug fix
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

Welcome update to OpenMMLab 2.0

Welcome update to OpenMMLab 2.0

I am Vansin, the technical operator of OpenMMLab. In September of last year, we announced the release of OpenMMLab 2.0 at the World Artificial Intelligence Conference in Shanghai. We invite you to upgrade your algorithm library to OpenMMLab 2.0 using MMEngine, which can be used for both research and commercial purposes. If you have any questions, please feel free to join us on the OpenMMLab Discord at https://discord.gg/amFNsyUBvm or add me on WeChat (van-sin) and I will invite you to the OpenMMLab WeChat group.

Here are the OpenMMLab 2.0 repos branches:

OpenMMLab 1.0 branch OpenMMLab 2.0 branch
MMEngine 0.x
MMCV 1.x 2.x
MMDetection 0.x 、1.x、2.x 3.x
MMAction2 0.x 1.x
MMClassification 0.x 1.x
MMSegmentation 0.x 1.x
MMDetection3D 0.x 1.x
MMEditing 0.x 1.x
MMPose 0.x 1.x
MMDeploy 0.x 1.x
MMTracking 0.x 1.x
MMOCR 0.x 1.x
MMRazor 0.x 1.x
MMSelfSup 0.x 1.x
MMRotate 1.x 1.x
MMYOLO 0.x

Attention: please create a new virtual environment for OpenMMLab 2.0.

What is the dotav1 annotation box file used for h2rbox?

First of all, thank you for your open source code.
My question is very simple. As mentioned in the paper, you use horizontal boxes to predict rotation boxes, but the dotav1 dataset has both horizontal box and rotation box annotations. I also saw a preprocessing operation in the code to convert the rotation box annotation to the horizontal box annotation. So when I download and process the dataset, should I use the rotation box annotation file "labelTxt. zip" or the horizontal box annotation file "Train_Task2ugt. zip"?
I did not see any similar instructions in the readme file. I hope you can solve my confusion, thank you!

KFIOU的3D实现

`def kfiou3d_loss(pred, target, fun='expm1', tau=0.0, alpha=1.0, sqrt=False):
xyz_p, Rwh_p, Swh_p, Sl_p = pred
xyz_t, Rwh_t, Swh_t, Sl_t = target

Sigmawh_p = Rwh_p.bmm(Swh_p.square()).bmm(Rwh_p.permute(0, 2, 1))
Sigmawh_t = Rwh_t.bmm(Swh_t.square()).bmm(Rwh_t.permute(0, 2, 1))
Sigmawh_sum = Sigmawh_p + Sigmawh_t
Sigmawh_sum_det = (Sigmawh_sum[..., 0, 0] * Sigmawh_sum[..., 1, 1] -
                   Sigmawh_sum[..., 1, 0] * Sigmawh_sum[..., 0, 1])
Sigmal_sum_det = (Sl_p.square() + Sl_t.square())
Sigma_sum_det = Sigmawh_sum_det * Sigmal_sum_det

vol_p = Swh_p.diagonal(dim1=-2, dim2=-1).prod(dim=-1) * Sl_p
vol_t = Swh_t.diagonal(dim1=-2, dim2=-1).prod(dim=-1) * Sl_t

kf_intersection = vol_p * vol_t / Sigma_sum_det.clamp(min=1e-7).sqrt()

kf_union = (vol_p + vol_t - kf_intersection).clamp(min=1e-7)
kfiou = kf_intersection / kf_union
loss_kfiou = postprocess(1 - 4.656854249492381 * kfiou, fun=fun, tau=0.0)
return loss_kfiou`

请问在kfiou3d版本的计算中,xyz_p, Rwh_p, Swh_p, Sl_p的含义分别是什么,如何获取?

数据增强

作者您好,请问在您的框架下可以正常使用图片的mosaic增强方法吗?还想期待一下H2RBox-v2大概什么时候发布呢?

sar图像旋转检测

SAR图像与光学图像不一致性,SSDD在H2rbox上的效果不佳,包括在mmrotate上的一些旋转检测器效果也不是很好,我也才接触旋转检测算法,想请教您如何看待SAR舰船的旋转检测,希望能得到您的宝贵建议。

Some small questions for r2h function.

image

I would like to know if the meaning in eq.5 in your paper is the same as in my figure. I found there is a gap between r2h(rbox) and gtbox. Looking forward to your reply.

模型训练

hello,我直接用mmrotation 2.0训练h2rbox模型,直接用普通的检测标注数据就行了吗?

ImportError

raceback (most recent call last):
File "/root/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/misc.py", line 73, in import_modules_from_strings
imported_tmp = import_module(imp)
File "/root/anaconda3/envs/openmmlab/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'h2rbox'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "tools/train.py", line 192, in
main()
File "tools/train.py", line 85, in main
cfg = Config.fromfile(args.config)
File "/root/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/config.py", line 343, in fromfile
import_modules_from_strings(**cfg_dict['custom_imports'])
File "/root/anaconda3/envs/openmmlab/lib/python3.7/site-packages/mmcv/utils/misc.py", line 80, in import_modules_from_strings
raise ImportError
ImportError

您好,我的基础配置如下
image

python 3.8 torch 1.8.0 cuda10.2
不知道是什么环境配置错了,希望能够得到您的解答,非常感谢

H2RBoxHead' object has no attribute 'seprate_angle'

Describe the bug
H2RBoxHead' object has no attribute 'seprate_angle'

Reproduction

python -m torch.distributed.launch --nproc_per_node=2 --nnodes=1 \
    ./tools/train.py  configs/h2rbox/h2rbox_r50_fpn_1x_dota_le90.py\
    --launcher pytorch \
    --work-dir ./output \

Bug fix
The RotatedFCOSHead has attribute 'separate_angle' not 'seprate_angle' , it seems that you have spelt it wrong.

About training on HRSID

Can you give your config file and results on the HRSID dataset?
I trained on HRSID but the result looks bad.

RuntimeError encountered when multi-gpu training

Hi,

Thanks for your excellent work. I tried to run your code with 8 GPUs (with mmrotate 1.x), but runtimeError was encountered. I also tried to train with 1 GPU, it works fine. Did you run your code with multiple GPUs? Any suggestions?

Error traceback
If applicable, paste the error trackback here.

raceback (most recent call last):
  File "tools/train.py", line 122, in <module>
    main()
  File "tools/train.py", line 118, in main
    runner.train()
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1686, in train
    model = self.train_loop.run()  # type: ignore
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/loops.py", line 90, in run
    self.run_epoch()
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/loops.py", line 106, in run_epoch
    self.run_iter(idx, data_batch)
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/loops.py", line 122, in run_iter
    outputs = self.runner.model.train_step(
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/model/wrappers/distributed.py", line 121, in train_step
    losses = self._run_forward(data, mode='loss')
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/mmengine/model/wrappers/distributed.py", line 161, in _run_forward
    results = self(**data, mode=mode)
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/opt/conda/envs/openmmlab/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 692, in forward
    if self.reducer._rebuild_buckets():
RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by (1) passing the ke
yword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`; (2) making sure all `forward` function outputs participate in calculating loss. If you already have done the above two steps, then the distributed data parallel
module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the loss function and the structure of the return value of `forward` of your module when reporting this issue (e.g. list, dict, iterab
le).

code

Excuse me, what is the extraction code of the SSDD dataset? Thanks

HRSC dataset test result

In your h2rbox v2 paper, it was stated that v1's code can only run 7% on the HRSC dataset, but during my experiment, I ran 76% with original configuration files. What do you think is the problem with this。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.