Git Product home page Git Product logo

aerialdetection's Introduction

Benchmarks for Object Detection in Aerial Images

Introduction

This codebase is created to build benchmarks for object detection in aerial images. It is modified from mmdetection. The master branch works with PyTorch 1.1 or higher. If you would like to use PyTorch 0.4.1, please checkout to the pytorch-0.4.1 branch.

detected_results

Main Features

To adapt to object detection in aerial images, this repo has several unique and new features compared to the original mmdetection

  • Support Oriented Object Detection

    In aerial images, objects are usually annotated by oriented bounding box (OBB). To support oriented object detection, we implement OBB Head (OBBRoIHead and OBBDenseHead). Also, we provide functions to transfer mask predictions to OBBs.

  • Cython Bbox Overlaps

    Since one patch image with the size of 1024 × 1024 may contain over 1000 instances in DOTA, which make the bbox overlaps memroy consuming. To avoid out of GPU memory, we calculate the bbox overlaps in cython. The speed of cython version is close to the GPU version.

  • Rotation Augmentation

    Since there are many orientation variations in aerial images, we implement the online rotation augmentation.

  • Rotated RoI Warping

    Currently, we implement two types of rotated RoI Warping (Rotated RoI Align and Rotated Position Sensitive RoI Align).

License

This project is released under the Apache 2.0 license.

Benchmark and model zoo

Installation

Please refer to INSTALL.md for installation.

Get Started

Please see GETTING_STARTED.md for the basic usage of mmdetection.

Contributing

We appreciate all contributions to improve benchmarks for object detection in aerial images.

Citing

If you use DOTA dataset, codebase or models in your research, please consider cite .

@misc{ding2021object,
      title={Object Detection in Aerial Images: A Large-Scale Benchmark and Challenges}, 
      author={Jian Ding and Nan Xue and Gui-Song Xia and Xiang Bai and Wen Yang and Micheal Ying Yang and Serge Belongie and Jiebo Luo and Mihai Datcu and Marcello Pelillo and Liangpei Zhang},
      year={2021},
      eprint={2102.12219},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
@inproceedings{xia2018dota,
  title={DOTA: A large-scale dataset for object detection in aerial images},
  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},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={3974--3983},
  year={2018}
}

@article{chen2019mmdetection,
  title={MMDetection: Open mmlab detection toolbox and benchmark},
  author={Chen, Kai and Wang, Jiaqi and Pang, Jiangmiao and Cao, Yuhang and Xiong, Yu and Li, Xiaoxiao and Sun, Shuyang and Feng, Wansen and Liu, Ziwei and Xu, Jiarui and others},
  journal={arXiv preprint arXiv:1906.07155},
  year={2019}
}

@InProceedings{Ding_2019_CVPR,
author = {Ding, Jian and Xue, Nan and Long, Yang and Xia, Gui-Song and Lu, Qikai},
title = {Learning RoI Transformer for Oriented Object Detection in Aerial Images},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}

Thanks to the Third Party Libs

Pytorch

mmdetection

aerialdetection's People

Contributors

dingjiansw101 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

aerialdetection's Issues

Run in win10

First,I want to thanks for you works. and then I want to ask: this code could run in win10?
I would appreciate your prompt reply!

可以直接用来检测HRSC2016吗?

我用DOTA_devkit里的HRSC2COCO生成了对应的文件,但是用DOTA_devkit里的测试代码测的map只有0.000几,请问这个代码可以直接用来检测HRSC2016吗?

训练出错

(A) ff@ff:~/DG/AerialDetection$ bash ./tools/dist_train.sh configs/DOTA/faster_rcnn_h-obb_r50_fpn_1x_dota.py 2
2020-08-07 11:15:06,651 - INFO - Distributed training: True
2020-08-07 11:15:06,978 - INFO - load model from: modelzoo://resnet50
/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/mmcv/runner/checkpoint.py:145: UserWarning: The URL scheme of "modelzoo://" is deprecated, please use "torchvision://" instead
warnings.warn('The URL scheme of "modelzoo://" is deprecated, please '
/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/mmcv/runner/checkpoint.py:145: UserWarning: The URL scheme of "modelzoo://" is deprecated, please use "torchvision://" instead
warnings.warn('The URL scheme of "modelzoo://" is deprecated, please '
2020-08-07 11:15:09,074 - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: fc.weight, fc.bias

loading annotations into memory...
loading annotations into memory...
Done (t=0.98s)
creating index...
Done (t=1.00s)
creating index...
index created!
index created!
Traceback (most recent call last):
File "./tools/train.py", line 95, in
main()
File "./tools/train.py", line 91, in main
logger=logger)
File "/home/ff/DG/AerialDetection/mmdet/apis/train.py", line 59, in train_detector
_dist_train(model, dataset, cfg, validate=validate)
File "/home/ff/DG/AerialDetection/mmdet/apis/train.py", line 144, in _dist_train
model = MMDistributedDataParallel(model.cuda())
File "/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 288, in init
self._ddp_init_helper()
File "/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 306, in _ddp_init_helper
self._module_copies = replicate(self.module, self.device_ids, detach=True)
File "/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/torch/nn/parallel/replicate.py", line 97, in replicate
param_copies = _broadcast_coalesced_reshape(params, devices, detach)
File "/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/torch/nn/parallel/replicate.py", line 76, in _broadcast_coalesced_reshape
return comm.broadcast_coalesced(tensors, devices)
File "/home/ff/anaconda3/envs/A/lib/python3.7/site-packages/torch/cuda/comm.py", line 39, in broadcast_coalesced
return torch._C._broadcast_coalesced(tensors, devices, buffer_size)
RuntimeError: all tensors must be on devices[0]
2020-08-07 11:15:12,288 - INFO - Start running, host: ff@ff, work_dir: /home/ff/DG/AerialDetection/work_dirs/faster_rcnn_h-obb_r50_fpn_1x_dota
2020-08-07 11:15:12,288 - INFO - workflow: [('train', 1)], max: 12 epochs

到这里卡住不动,我在单卡1060上可以运行,在双卡2070的机子上,就会出现此问题

About MaskRCNN

It's really an excellent work!
I'm confused that it seems there are no mask annotations attached to DOTA dataset, but there exists mask_head inside mask rcnn config file.
why?

How are the positive and negative angles defined

Hello, thank you very much for posting the code. I was reading “roi_align_rotated_kernel.cu” and found that you made changes when you did "Rotate by theta around the center and translate". My understanding of this is that your definition of positive and negative angles is opposite to RRPN. I don't know if I understand it right.

Looking forward to your reply

在训练过程中加入--validate,但是计算出的MAP全是0

我使用的训练命令是:
./tools/dist_train.sh ${CONFIG_FILE} ${GPU_NUM} --validate
但是计算出的map都是0
我使用训练出的权重,去跑demo_large_image.py可视化出来的结果是正确的
请问这是什么原因?
大佬,求告知

Adjusting Loss Function and Class Imbalance

So, if I wanted to adjust the loss function to account for class imbalance ..... where would I do that? Anyone have any thoughts on compensating for class imbalance in the training data?

How can I integrate the OBB and HBB Heads into MMdetection?

First of all, I thank you for creating such a amazing toolkit. My data set consists of aerial images which is different from DOTA. I convert my dataset to DOTA format and I can train. As a result of the training, all AP and mAP values ​​are 0 in Eval process. This is because; the --validate use the coco API for evaluation which is different from the DOTA evaluation API.

To solve this problem, how can I integrate OBB and HBB Heads into MMdetection?

ModuleNotFoundError: No module named 'mmdet.core.bbox.bbox'

Traceback (most recent call last):
File "tools/train.py", line 7, in
from mmdet.datasets import get_dataset
File "/home/lab716/xukaiyan/AerialDetection/mmdet/datasets/init.py", line 1, in
from .custom import CustomDataset
File "/home/lab716/xukaiyan/AerialDetection/mmdet/datasets/custom.py", line 11, in
from .extra_aug import ExtraAugmentation
File "/home/lab716/xukaiyan/AerialDetection/mmdet/datasets/extra_aug.py", line 5, in
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
File "/home/lab716/xukaiyan/AerialDetection/mmdet/core/init.py", line 1, in
from .anchor import * # noqa: F401, F403
File "/home/lab716/xukaiyan/AerialDetection/mmdet/core/anchor/init.py", line 2, in
from .anchor_target import anchor_target, anchor_inside_flags
File "/home/lab716/xukaiyan/AerialDetection/mmdet/core/anchor/anchor_target.py", line 3, in
from ..bbox import assign_and_sample, build_assigner, PseudoSampler, bbox2delta
File "/home/lab716/xukaiyan/AerialDetection/mmdet/core/bbox/init.py", line 1, in
from .bbox import bbox_overlaps_cython
ModuleNotFoundError: No module named 'mmdet.core.bbox.bbox'

What is the problem?

Scale and Aspect ratio

When I modified the Anchor scale and aspect ratio for HRSC2016 to [1/3, 1/2, 1.0, 2.0, 3.0] and [8, 16, 32, 64], I meet this issue:

Traceback (most recent call last):
File "/home/zhaolei/pytorch_code/AerialDetection-master/tools/train.py", line 95, in
main()
File "/home/zhaolei/pytorch_code/AerialDetection-master/tools/train.py", line 91, in main
logger=logger)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/apis/train.py", line 61, in train_detector
_non_dist_train(model, dataset, cfg, validate=validate)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/apis/train.py", line 197, in _non_dist_train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/zhaolei/.conda/envs/torch-1.1/lib/python3.6/site-packages/mmcv/runner/runner.py", line 384, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/zhaolei/.conda/envs/torch-1.1/lib/python3.6/site-packages/mmcv/runner/runner.py", line 283, in train
self.model, data_batch, train_mode=True, **kwargs)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/apis/train.py", line 39, in batch_processor
losses = model(**data)
File "/home/zhaolei/.conda/envs/torch-1.1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/zhaolei/.conda/envs/torch-1.1/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/zhaolei/.conda/envs/torch-1.1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/models/detectors/base_new.py", line 95, in forward
return self.forward_train(img, img_meta, **kwargs)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/models/detectors/RoITransformer.py", line 142, in forward_train
*rpn_loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/models/anchor_heads/rpn_head.py", line 51, in loss
gt_bboxes_ignore=gt_bboxes_ignore)
File "/home/zhaolei/pytorch_code/AerialDetection-master/mmdet/models/anchor_heads/anchor_head.py", line 161, in loss
assert len(featmap_sizes) == len(self.anchor_generators)
AssertionError

could anyone tell me, how to solve it ?

训练问题

File "tools/train.py", line 95, in
main()
File "tools/train.py", line 91, in main
logger=logger)
File "/data-input/AerialDetection/mmdet/apis/train.py", line 61, in train_detector
_non_dist_train(model, dataset, cfg, validate=validate)
File "/data-input/AerialDetection/mmdet/apis/train.py", line 189, in _non_dist_train
cfg.log_level)
File "/opt/conda/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 169, in init
super().init(*args, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 88, in init
raise TypeError(f'logger must be a logging.Logger object, '
TypeError: logger must be a logging.Logger object, but got <class 'str'>

Train on HRSC2016

Ding,Thx for your contribution. and I have one issue about you model. That is when I use it to train HRSC2016 Datasets. what should I focus on ? and how to test it by myself use you code?

Checkpoints

Hi,

some sections in the GETTING_STARTED.mddocument mention pretrained weights/checkpoint files in work_dir.
Where can we download the checkpoints?
Thanks.

qq group for timely discussion

This is an excellent work for object detection in aerial images, for better discussion you can add me up via QQ 1343545543, and I'll invite you into the temp group.
But issue submission here is recommended, cause more people can catch it, and I'll disband the qq group in several weeks.

Question about inference speed.

R-RetinaNet can reach 24 fps when I conduct evaluation on HRSC dataset.
However it dropped to 2fps when I inference on picture, why?
They should have been almost same, right?

执行prepare_dota1.py时报错,请问如何解决?

img name: P1452
img name: P0962
img name: P1838
img name: P1770
img name: P2220
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/zhouqc/anaconda3/envs/AerialDetection/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/home/zhouqc/anaconda3/envs/AerialDetection/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/home/zhouqc/project/objectDetection/AerialDetection/DOTA_devkit/SplitOnlyImage_multi_process.py", line 45, in SplitSingle
assert np.shape(img) != ()
AssertionError
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "prepare_dota1.py", line 102, in
prepare(srcpath, dstpath)
File "prepare_dota1.py", line 93, in prepare
split_test.splitdata(1)
File "/home/zhouqc/project/objectDetection/AerialDetection/DOTA_devkit/SplitOnlyImage_multi_process.py", line 85, in splitdata
self.pool.map(worker, imagenames)
File "/home/zhouqc/anaconda3/envs/AerialDetection/lib/python3.7/multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/home/zhouqc/anaconda3/envs/AerialDetection/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
AssertionError

在执行到P2220时,报出错误?请问是什么意思?怎么解决?

ImportError: cannot import name 'poly_nms_cuda'

Thanks for your code, but I met a mistake when training the model.
ImportError: cannot import name 'poly_nms_cuda'
I have installed the environment according to INSTALL.md and my CUDA version is 9.0. How should I do to solve it?

Running ./compile.sh gives an error

/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/util/Exception.h:314:13: note: declared here
inline void deprecated_AT_CHECK() {}
^
In file included from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/core/Device.h:5:0,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/core/Allocator.h:6,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/ATen/ATen.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
from src/poly_nms_cuda.cpp:1:
/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/util/Exception.h:339:40: warning: ‘void c10::detail::deprecated_AT_CHECK()’ is deprecated [-Wdeprecated-declarations]
::c10::detail::deprecated_AT_CHECK();
^
src/poly_nms_cuda.cpp:3:23: note: in expansion of macro ‘AT_CHECK’
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
^
src/poly_nms_cuda.cpp:8:5: note: in expansion of macro ‘CHECK_CUDA’
CHECK_CUDA(dets);
^
In file included from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/core/Device.h:5:0,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/core/Allocator.h:6,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/ATen/ATen.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
from src/poly_nms_cuda.cpp:1:
/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/c10/util/Exception.h:314:13: note: declared here
inline void deprecated_AT_CHECK() {}
^
/usr/local/cuda/bin/nvcc -I/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include -I/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/TH -I/home/kyq/anaconda3/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/kyq/anaconda3/include/python3.7m -c src/poly_nms_kernel.cu -o build/temp.linux-x86_64-3.7/src/poly_nms_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=poly_nms_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -B /home/kyq/anaconda3/compiler_compat -L/home/kyq/anaconda3/lib -Wl,-rpath=/home/kyq/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/src/poly_nms_cuda.o build/temp.linux-x86_64-3.7/src/poly_nms_kernel.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/poly_nms_cuda.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/poly_nms_cuda.cpython-37m-x86_64-linux-gnu.so ->
Building cpu_nms...
running build_ext
skipping 'bbox.c' Cython extension (up-to-date)

I used ubuntu16.04 cuda10 pytorch1.2

subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

I run the compile.sh with this step

Compile cuda extensions.
./compile.sh

but it has some problem as following:

/media/miki/ubuntu/deep_learning/huoyan/AerialDetection-master/mmdet/ops/poly_nms/src/poly_nms_cuda.cpp:3:23: error: ‘AT_CHECK’ was not declared in this scope
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
^
/media/miki/ubuntu/deep_learning/huoyan/AerialDetection-master/mmdet/ops/poly_nms/src/poly_nms_cuda.cpp:8:5: note: in expansion of macro ‘CHECK_CUDA’
CHECK_CUDA(dets);
^~~~~~~~~~
/media/miki/ubuntu/deep_learning/huoyan/AerialDetection-master/mmdet/ops/poly_nms/src/poly_nms_cuda.cpp:3:23: note: suggested alternative: ‘DCHECK’
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
^
/media/miki/ubuntu/deep_learning/huoyan/AerialDetection-master/mmdet/ops/poly_nms/src/poly_nms_cuda.cpp:8:5: note: in expansion of macro ‘CHECK_CUDA’
CHECK_CUDA(dets);
^~~~~~~~~~
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/miki/anaconda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build
env=env)
File "/home/miki/anaconda/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "setup.py", line 74, in
cmdclass={'build_ext': BuildExtension})
File "/home/miki/anaconda/lib/python3.7/site-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/home/miki/anaconda/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/miki/anaconda/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/miki/anaconda/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/miki/anaconda/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/home/miki/anaconda/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/miki/anaconda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 649, in build_extensions
build_ext.build_extensions(self)
File "/home/miki/anaconda/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/home/miki/anaconda/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/miki/anaconda/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 205, in build_extension
_build_ext.build_extension(self, ext)
File "/home/miki/anaconda/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/home/miki/anaconda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 478, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/miki/anaconda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/miki/anaconda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension
Building cpu_nms...
running build_ext
skipping 'bbox.c' Cython extension (up-to-date)

my evironment as follow:
ubuntu18.04
Python 3.7.4
PyTorch 1.6.0
CUDA 10.2
NCCL 2.7.8
GCC 7.5
mmcv 1.1.5

however ,I can run mmdetection successfully in above evironment.

Could you publish the results on the val set (with training on the train set)?

Could you publish the results on the val set (with training on the train set) ?want to replicate your results and follow your work abd I can't evulate the results on test set.
您好,请问是否可以公布在DOTA1.5验证集上的MAP呢(只在训练集上训练时)?我想复现您的论文结果,但是却无法评估,因为必须注册账号并通过服务器提交才能评估准确率。

CUDA out of memory

When i was training, the memory has ran out.

My env:

sys.platform: linux
Python: 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0]
CUDA available: True
CUDA_HOME: /usr/local/cuda-9.0
NVCC: Cuda compilation tools, release 9.0, V9.0.176
GPU 0,1: TITAN V
GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
PyTorch: 1.3.1

It seems there are so many gt boxes in a single photo, may i ask how to solve?

Traceback (most recent call last):
  File "tools/train.py", line 130, in <module>
    main()
  File "tools/train.py", line 126, in main
    timestamp=timestamp)
  File "/disk1/NiCholas/mmdetection/mmdet/apis/train.py", line 111, in train_detector
    timestamp=timestamp)
  File "/disk1/NiCholas/mmdetection/mmdet/apis/train.py", line 297, in _non_dist_train
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
  File "/disk1/NiCholas/anaconda3/envs/nick_rs/lib/python3.7/site-packages/mmcv/runner/runner.py", line 364, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/disk1/NiCholas/anaconda3/envs/nick_rs/lib/python3.7/site-packages/mmcv/runner/runner.py", line 268, in train
    self.model, data_batch, train_mode=True, **kwargs)
  File "/disk1/NiCholas/mmdetection/mmdet/apis/train.py", line 78, in batch_processor
    losses = model(**data)
  File "/disk1/NiCholas/anaconda3/envs/nick_rs/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/disk1/NiCholas/anaconda3/envs/nick_rs/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/disk1/NiCholas/anaconda3/envs/nick_rs/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/disk1/NiCholas/mmdetection/mmdet/core/fp16/decorators.py", line 49, in new_func
    return old_func(*args, **kwargs)
  File "/disk1/NiCholas/mmdetection/mmdet/models/detectors/base.py", line 137, in forward
    return self.forward_train(img, img_meta, **kwargs)
  File "/disk1/NiCholas/mmdetection/mmdet/models/detectors/two_stage.py", line 176, in forward_train
    *rpn_loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
  File "/disk1/NiCholas/mmdetection/mmdet/models/anchor_heads/rpn_head.py", line 51, in loss
    gt_bboxes_ignore=gt_bboxes_ignore)
  File "/disk1/NiCholas/mmdetection/mmdet/core/fp16/decorators.py", line 127, in new_func
    return old_func(*args, **kwargs)
  File "/disk1/NiCholas/mmdetection/mmdet/models/anchor_heads/anchor_head.py", line 189, in loss
    sampling=self.sampling)
  File "/disk1/NiCholas/mmdetection/mmdet/core/anchor/anchor_target.py", line 63, in anchor_target
    unmap_outputs=unmap_outputs)
  File "/disk1/NiCholas/mmdetection/mmdet/core/utils/misc.py", line 24, in multi_apply
    return tuple(map(list, zip(*map_results)))
  File "/disk1/NiCholas/mmdetection/mmdet/core/anchor/anchor_target.py", line 116, in anchor_target_single
    anchors, gt_bboxes, gt_bboxes_ignore, None, cfg)
  File "/disk1/NiCholas/mmdetection/mmdet/core/bbox/assign_sampling.py", line 30, in assign_and_sample
    gt_labels)
  File "/disk1/NiCholas/mmdetection/mmdet/core/bbox/assigners/max_iou_assigner.py", line 99, in assign
    overlaps = bbox_overlaps(gt_bboxes, bboxes)
  File "/disk1/NiCholas/mmdetection/mmdet/core/bbox/geometry.py", line 74, in bbox_overlaps
    rb = torch.min(bboxes1[:, None, 2:], bboxes2[:, 2:])  # [rows, cols, 2]
RuntimeError: CUDA out of memory. Tried to allocate 5.78 GiB (GPU 0; 11.75 GiB total capacity; 7.11 GiB already allocated; 3.41 GiB free; 167.14 MiB cached)

I am getting horizontal BB rather than Oriented and I can't change Batch Size

Hey,
I am trying to train on my custom dataset with 2 classes, both are rotated and are annotated in DOTA format.

I tested using custom DOTA data and this cfg - faster_rcnn_RoITrans_r50_fpn_1x_dota to see results and got some txt files in work_dirs for each class, when I plotted the boxes with custom opencv I didn't get rotated bounding boxes but horizontal ones. I used test.py and set type = "OBB" while testing.

Now, I want rotated bounding boxes on my custom dataset, so do I have to use any other cfg file for that like -
/DOTA1_5/faster_rcnn_obb_r50_fpn_1x_dota1_5.py
or the one I'm using will do the job of rotating. ?

Also is there any option to increase batch size or is it still 1 like the mxnet version of ROI_trans?
Thank you in advance. :)

PS: love your work, I've used ROI_trans on mxnet also which helped me to learn a great deal, I'm a student exploring better CV techniques.

Docker

Did anybody manage to build the environment in a docker ? That would be really helpful

DOAI1_5 performance is too low for the baseline model

Thanks for sharing the code!

I have tested the repo on DOAI 1.5 and submit it to the online evaluation task 1. But the result is too low.

mAP: 0.07475452980149473
ap of each class: plane:0.010195412064570943, baseball-diamond:0.06983930026884663, bridge:0.01515151515151515, ground-track-field:0.03823953823953824, small-vehicle:0.042740171646495316, large-vehicle:0.12425185385654987, ship:0.03718538569783553, tennis-court:0.30461315579188125, basketball-court:0.07774816494045518, storage-tank:0.09090909090909091, soccer-ball-field:0.10014430014430015, roundabout:0.09976556394894504, harbor:0.0556564329231872, swimming-pool:0.03222999383810684, helicopter:0.09090909090909091, container-crane:0.006493506493506493

This is my script to reproduce the result above

python ./tools/test.py ./configs/DOTA1_5/faster_rcnn_RoITrans_r50_fpn_1x_dota1_5.py work_dirs/faster_rcnn_RoITrans_r50_fpn_1x_dota1_5/epoch_12.pth --out work_dirs/faster_rcnn_RoITrans_r50_fpn_1x_dota1_5/results.pkl
python ./tools/parse_results.py --config ./configs/DOTA1_5/faster_rcnn_RoITrans_r50_fpn_1x_dota1_5.py --type OBB

How could I fix it? Thanks

Note that, the inference for the demo image is still good.

P0009_out1

RuntimeError: copy_if failed to synchronize: device-side assert triggered

Hi,

When I was training the model to a ten class problem, I found this error:

/content/AerialDetection/mmdet/models/rbbox_heads/rbbox_head.py in loss(self, cls_score, bbox_pred, labels, label_weights, bbox_targets, bbox_weights, reduce)
164 pos_inds = labels > 0
165 if self.reg_class_agnostic:
--> 166 pos_bbox_pred = bbox_pred.view(bbox_pred.size(0), 5)[pos_inds]
167 else:
168 pos_bbox_pred = bbox_pred.view(bbox_pred.size(0), -1,

RuntimeError: copy_if failed to synchronize: device-side assert triggered

May i ask how to solve?

IndexError: string index out of range

你好:
我在自己的数据集上进行了训练,也生成了测试结果文件results.pkl。然而在使用parse_results.py进行分析的时候出现了下面问题。

Traceback (most recent call last):
File "tools/parse_results.py", line 129, in
parse_results(config_file, pkl_file, output_path, type)
File "tools/parse_results.py", line 67, in parse_results
obb_results_dict = OBBDetComp4(dataset, outputs)
File "/dat01/baijing/wenzheng/AerialDetection/mmdet/core/evaluation/dota_utils.py", line 188, in OBBDetComp4
cls_name = dataset.CLASSES[label]
IndexError: string index out of range

请问有没有人遇到过,能不能帮我解释一下这个问题。

Results Problem?

Hello,
Really amazing work.
While doing inference, i faced the results are not as good as shown.
I tested using the pre trained models:

  1. faster_rcnn_RoITrans_r50_fpn_1x_dota
    eduardo-drapier-beFUbu1Nrcc-unsplash

  2. faster_rcnn_RoITrans_r50_fpn_1x_dota1_5
    mike-mari-lh1AhhKa7RQ-unsplash

Can You help Explain why?

mask转poly中的异常

您好,我在实验过程中,一开始将dota原图像剪切为10241024,gap512,然后训练模型,没有问题。但是当我重新剪切了一个600600,gap150的数据集,并用同样的模型训练,训练时scale为800*800时,在transforms_rbbox.py的mask2poly_single中抛出了异常:
/mmdet/core/bbox/transforms_rbbox.py(577)mask2poly_single()
-> return poly
(Pdb)
似乎是mask的值有问题导致进入这个异常。这是剪切图像的问题还是什么其他的的原因么?请问我应该如何处理?

Custom Dataset

I have a dataset of coco format. The annotations for the boxes are formatted as boxes = [x, y, w, h, theta]
I was looking at class DOTA1_5Dataset_v2(CocoDataset) so that I could get a sense of how to load the data. But I didn't see any theta and the boxes seem to have a format (x,y,w,h) instead of (x1,y1,x2,y2........). can I get some clarification on how & where theta comes in? Also what modifications I need to add to the dataset so that it can run with data of this format?

ImportError

The following error occurred when I run demo_large_image.py.
Traceback (most recent call last):
File "demo_large_image.py", line 1, in
from mmdet.apis import init_detector, inference_detector, show_result, draw_poly_detections
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/apis/init.py", line 2, in
from .train import train_detector
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/apis/train.py", line 10, in
from mmdet import datasets
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/datasets/init.py", line 1, in
from .custom import CustomDataset
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/datasets/custom.py", line 11, in
from .extra_aug import ExtraAugmentation
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/datasets/extra_aug.py", line 5, in
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/core/init.py", line 1, in
from .anchor import * # noqa: F401, F403
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/core/anchor/init.py", line 2, in
from .anchor_target import anchor_target, anchor_inside_flags
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/core/anchor/anchor_target.py", line 3, in
from ..bbox import assign_and_sample, build_assigner, PseudoSampler, bbox2delta
File "/home/46211/Code/yaogan/AerialDetection/AerialDetection-master/mmdet/core/bbox/init.py", line 1, in
from .bbox import bbox_overlaps_cython
ImportError: dynamic module does not define module export function (PyInit_bbox)

gradcheck of psroi_align_rotated

Thank you for making the code public. I have some question of gradcheck.py of psroi_align_rotated.
I modified psroi_align_rotated_kernel.cu so that it can be used in my code.
I ran the gradcheck.py file, but the first test failed.
I want to confirm with you whether you passed both of the following tests.

Looking forward to your reply

AttributeError: 'NoneType' object has no attribute 'shape'

where I run tools/test.py ,I have the following problems:
for i, data in enumerate(data_loader):
File "/home/zjr/anaconda3/envs/AerialDetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in next
return self._process_next_batch(batch)
File "/home/zjr/anaconda3/envs/AerialDetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
AttributeError: Traceback (most recent call last):
File "/home/zjr/anaconda3/envs/AerialDetection/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/zjr/anaconda3/envs/AerialDetection/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/media/sdc/zjr/code/AerialDetection/mmdet/datasets/custom.py", line 197, in getitem
return self.prepare_test_img(idx)
File "/media/sdc/zjr/code/AerialDetection/mmdet/datasets/custom.py", line 378, in prepare_test_img
img, scale, False, proposal)
File "/media/sdc/zjr/code/AerialDetection/mmdet/datasets/custom.py", line 332, in prepare_single
img, scale, flip, keep_ratio=self.resize_keep_ratio)
File "/media/sdc/zjr/code/AerialDetection/mmdet/datasets/transforms.py", line 33, in call
img, scale_factor = mmcv.imrescale(img, scale, return_scale=True)
File "/home/zjr/anaconda3/envs/AerialDetection/lib/python3.7/site-packages/mmcv/image/resize.py", line 132, in imrescale
h, w = img.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'

I'm sure the image exists and no Chinese path.
If you have already identified the reason, you can provide the information here. Thanks

DOTA_devkit/prepare_dota1.py freezed at "img name: P0027"

Hi, guys,
I am learning this repo this days.
When I tried splitting the dataset using
python DOTA_devkit/prepare_dota1.py --srcpath data/dota --dstpath da ta/dota1_1024, the program would freeze at,

...
img name: P1483
img name: P1742
img name: P1821
img name: P0249
img name: P1806
img name: P0476
img name: P0027

So how can I solve this and accomplish splitting the dataset?

Any answer or idea will be appreciated!

Is there a part about larger separable convolution in the code?

Hello, thank you very much for posting the code.In your paper, I learned that the features entered into RROI Learner are features processed by separable convolution.But the features entered into RROI Learner in the code seem to be the features obtained by FPN without separable convolution. I don’t know if I missed some code or you didn’t publish the separable convolution code.

Looking forward to your reply

Maybe some bug in hbb2obb_v2 function in ./mmdet/core/bbox/transforms_rbbox.py?

Hello,
Thanks for your excellent framework for rotation detection. And I have experiments the configs, such
as retina_obb, roiTransformer_obb etc...And I can reach, even surpass, the performance of the original paper.
But I find a possible bug in hbb2obb_v2 function in transforms_rbbox.py, the
ex_heights = boxes[..., 2] - boxes[..., 0] + 1.0
ex_widths = boxes[..., 3] - boxes[..., 1] + 1.0
may be replaced by
ex_widths = boxes[..., 2] - boxes[..., 0] + 1.0
ex_heights = boxes[..., 3] - boxes[..., 1] + 1.0
Am I right?
I check the code of hbb2obb, it seems right.

So on the one hand, I don't know why define v2 of hbb2obb; on the other hand, why the function works well?...

dota_aug

Hello, I would like to ask, after the data augmentation prepare_dota1_aug.py, do we need to remove the slices and txt files that do not exist object and the object where difficult equal to 2,

在parse_results.py中检测结果和img_id是如何进行匹配的?

您好,我想要用我的检测器的检测结果来测mAP,我把我的检测结果和您代码的检测结果转换成相同的格式,但是总是测不出来mAP,我发现是检测结果和图片id不匹配导致,但是我看您的代码中OBBDetComp4中只是用idx就能确保检测结果和图片的id匹配成功?麻烦您帮忙解答一下谢谢

Train issue

Hi,Why my mAP decrease when I use some data augment?

results reproduction?

Thanks for your excellent work and code.

I have some question about the results evaluation and reproduction

  1. Does the mAP is the results of test set from evaluation server of DOTA website?
    I use the downloaded roi-transformer model and inference on test set(subSize=1024, gap=512, rate=1.0), and get the mAP=0.7341825026925208(where
    model_zoo) give 73.76 on OBB task.
    Meanwhile the mAP on valset is 0.8287
  2. Does the official model is trained on train+val set?
    I train the roi-transformer model on train set(subSize=1024, gap=200, rate=1.0), not contain val set. And the mAP on val set and test set(subSize=1024, gap=512, rate=1.0) is 0.7213, 0.7111493312926

cannot draw RBBOX during Inference

Hey,
Thank you for the repo, I am using this repo to learn and train my own model on rotated images dataset. I trained the model on my images successfully and now trying to run some inference. I used test.py from tools folder with type=OBB and then parsed the pkl file using parse_result.py

I got txt files by class names with bounding boxes. I wanted to plot RBBOX on the image itself during inference and save plotted images, is there any way I can do this directly?

I tried --show parameter but it returns this error -
assert bboxes.shape[1] == 4 or bboxes.shape[1] == 5

JSON Log Validation

After training, the logs in JSON format are not structured correctly and can not be parsed by standard JSON parsers.

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.