OBBDetection is a oriented object detection library, which is based on MMdetection.

Overview

OBBDetection

news: We are now updating OBBDetection to new vision based on MMdetection v2.10, which has more advanced models and more efficient features.

introduction

OBBDetection is a open source oriented object detection toolbox based on the MMdetection.

demo image

Major features

  • MMdetection inheritance

    OBBDetection is modified from MMdetection v2.2, where all additive codes are put at newly created folders named obb. The structure of MMdetection isn't change, so our OBBDetection inherits all features from MMdetection.

  • Support of multiple frameworks out of box

    Except for horizontal detection frameworks, the toolbox supports popular oriented detection frameworks, e.g. Faster RCNN OBB, RoI Transformer, Gliding Vertex.

  • Flexible representation of boxes

    This toolbox supports three type of bounding boxes, horizontal bounding boxes (HBB), oriented bounding boxes (OBB), and 4 point boxes (POLY). Each type of boxes can transforms to others directly.

  • Efficiency of training and testing big images

    We optimize the training and testing process of big image datasets. It can directly generate full image results without any postprocessing in AerialDetection. Besides, our OBBDtection also has a better proformance than AerialDetection.

License

This project is released under the Apache 2.0 license.

Benchmark and model zoo

Results and models are available in the model zoo.

Supported backbones:

  • ResNet
  • ResNeXt
  • VGG
  • HRNet
  • RegNet
  • Res2Net

Supported oriented detection methods:

Supported horizontal detection methods:

Installation

Please refer to install.md for installation and dataset preparation.

Get Started

Oriented models training and testing

If you want to train or test a oriented model, please refer to oriented_model_starting.md.

How to use MMDetection

If you are not familiar with MMdetection, please see getting_started.md for the basic usage of MMDetection. There are also tutorials for finetuning models, adding new dataset, designing data pipeline, and adding new modules.

Acknowledgement

This toolbox is based on MMdetection. If you use this toolbox or benchmark in your research, please cite the following information.

@article{mmdetection,
  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 Zhang, Zheng and Cheng, Dazhi and
             Zhu, Chenchen and Cheng, Tianheng and Zhao, Qijie and Li, Buyu and
             Lu, Xin and Zhu, Rui and Wu, Yue and Dai, Jifeng and Wang, Jingdong
             and Shi, Jianping and Ouyang, Wanli and Loy, Chen Change and Lin, Dahua},
  journal= {arXiv preprint arXiv:1906.07155},
  year={2019}
}
Comments
  • convex_ext

    convex_ext

    hi tnx for implementation im using forked orginal ReDet i need add Poly IoU Loss but in adding ext i dont know how to that in colab cell i put this:

     #!/usr/bin/env python
    import os
    import subprocess
    import time
    # from setuptools import find_packages, setup
    
    
    import torch
    from torch.utils.cpp_extension import (BuildExtension, CppExtension,
                                           CUDAExtension)
     
     
     
     def make_cuda_ext(name, module, sources, sources_cuda=[]):
    
        define_macros = []
        extra_compile_args = {'cxx': []}
    
        if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1':
            define_macros += [('WITH_CUDA', None)]
            extension = CUDAExtension
            extra_compile_args['nvcc'] = [
                '-D__CUDA_NO_HALF_OPERATORS__',
                '-D__CUDA_NO_HALF_CONVERSIONS__',
                '-D__CUDA_NO_HALF2_OPERATORS__',
            ]
            sources += sources_cuda
        else:
            print(f'Compiling {name} without CUDA')
            extension = CppExtension
            # raise EnvironmentError('CUDA is required to compile MMDetection!')
    
        return extension(
            name=f'{module}.{name}',
            sources=[os.path.join(*module.split('.'), p) for p in sources],
            define_macros=define_macros,
            extra_compile_args=extra_compile_args)
    
      setup(
          ext_modules=[
                          make_cuda_ext(
                            name='convex_ext',
                            module='mmdet.ops.convex',
                            sources=[
                                'src/convex_cpu.cpp',
                                'src/convex_ext.cpp'
                            ],
                            sources_cuda=['src/convex_cuda.cu']),
                   ],
            cmdclass={'build_ext': BuildExtension},
            zip_safe=False
            )
    

    and got err:

    File "<ipython-input-44-a399c1bfcad4>", line 38
        setup(
              ^
    IndentationError: unindent does not match any outer indentation level
    

    i want add it seperatly what should i do??

    opened by mmoghadam11 12
  • IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

    IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

    Traceback (most recent call last): File "tools/test.py", line 153, in main() File "tools/test.py", line 147, in main dataset.format_results(outputs, **kwargs) File "/root/wtl2/OBBDetection/mmdet/datasets/obb/dota.py", line 123, in format_results bboxes, scores = dets[:, :-1], dets[:, [-1]] dets的shape是(6,),我怀疑是dets.shape的问题

    opened by wtl2001 10
  • dota格式修改类别报错

    dota格式修改类别报错

    1修改类别为我自己数据集的类别,但继续用dota1格式。 'DOTA1_0': ('ore-oil', 'Container', 'Fishing', 'yacht', 'LawEnforce', 'Small', 'Passenger'), #'DOTA1_0': ('large-vehicle', 'swimming-pool', 'helicopter', 'bridge', # 'plane', 'ship', 'soccer-ball-field', 'basketball-court', # 'ground-track-field', 'small-vehicle', 'baseball-diamond', # 'tennis-court', 'roundabout', 'storage-tank', 'harbor'),

    2配置文件里面修改类别数目 num_classes=7,

    3运行报错:2021-08-31 20:17:55,895 - mmdet - INFO - workflow: [('train', 1)], max: 12 epochs Traceback (most recent call last): File "tools/train.py", line 153, in main() File "tools/train.py", line 142, in main train_detector( File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/apis/train.py", line 129, in train_detector runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 122, in run epoch_runner(data_loaders[i], **kwargs) File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 27, in train for i, data_batch in enumerate(data_loader): File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) ValueError: Caught ValueError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/asus/anaconda3/envs/Beta/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/datasets/custom.py", line 187, in getitem data = self.prepare_train_img(idx) File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/datasets/custom.py", line 210, in prepare_train_img return self.pipeline(results) File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/datasets/pipelines/compose.py", line 40, in call data = t(data) File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/datasets/pipelines/obb/base.py", line 393, in call results['angle'] = self.get_random_angle(results) File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/datasets/pipelines/obb/base.py", line 303, in get_random_angle vert_lbls = [results['cls'].index(c) for c in self.vert_cls] File "/media/asus/299D817A2D97AD94/ok_PROJs/OBBDetection/mmdet/datasets/pipelines/obb/base.py", line 303, in vert_lbls = [results['cls'].index(c) for c in self.vert_cls] ValueError: tuple.index(x): x not in tuple

    仿佛是类别哪里还需要修改,想问下,你有什么好的建议或者知道修改哪里么

    opened by HeuristicLU 9
  • question about mAP for DOTA dataset

    question about mAP for DOTA dataset

    I re-implemented your work for training Dota dataset but I got much lower mAP for dota test dataset.

    *** training & validation**---------------------------------------------------------------------------------------------------------------

    • dataset : DOTA - v1.0 (training, validation dataset -- all cropped by using your img_split.py)
    • configuration : faster_rcnn_orpn_r101_fpn_1x_ms_rr_dota10.py
    • parameters : not changed at all (same with your implementation)

    *** test**-------------------------------------------------------------------------------------------------------------------------------------

    • dataset : DOTA - v1.0 (test dataset -- all cropped by using your img_split.py)
    • configuration : faster_rcnn_orpn_r101_fpn_1x_ms_rr_dota10.py
    • used epoch 12 checkpoint
    • sent to DOTA v 1.0 server - Evaluation of DOTA Task1 and got this result ---> mAP: 0.41229681978600863 ap of each class: plane:0.5396662332791309, baseball-diamond:0.2710892710892711, bridge:0.5154165616433038, ground-track-field:0.1484848484848485, small-vehicle:0.27250426663927574, large-vehicle:0.2622058637252267, ship:0.7108541529636384, tennis-court:0.5453417550191744, basketball-court:0.33560606060606063, storage-tank:0.09090909090909091, soccer-ball- field:0.22898154477101842, roundabout:0.19935158396696856, harbor:0.7828865404399028, swimming- pool:0.7302785521014554, helicopter:0.5508759711517627

    According to your report, it should be 80.52 (backbone resnet101). What have I done wrong? What should I change? Waiting for your quick response! Thank you!

    opened by teeinn 8
  • obb fcos hrsc testing > IndexError: tuple index out of range

    obb fcos hrsc testing > IndexError: tuple index out of range

    I am trying to run OBB with FCOS in dataset HRSC2016. To do so I have based the config.py on an example of OBB with FCOS in dataset DOTA and removed these two parts: dict(type='LoadDOTASpecialInfo') dict(type='DOTASpecialIgnore', ignore_size=2)

    I managed to execute the training with no problem. Then, when I try to run the testing, I get this error. What am I doing wrong?

    Starting loading HRSC dataset information.
    Finishing loading HRSC, get 2124 images, using 0.171s.
    load checkpoint from local path: work_dirs/fcos_obb_r50_caffe_fpn_gn-head_4x4_1x_hrsc/latest.pth
    [>>>>>>>>>>>>>>>                                   ] 137/453, 17.9 task/s, elapsed: 8s, ETA:    18s
    [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 453/453, 17.9 task/s, elapsed: 25s, ETA:     0sTraceback (most recent call last):
      File "tools/test.py", line 153, in <module>
        main()
      File "tools/test.py", line 149, in main
        dataset.evaluate(outputs, args.eval, **kwargs)
      File "/work/OBBDetection/mmdet/datasets/obb/hrsc.py", line 126, in evaluate
        logger=logger)
      File "/work/OBBDetection/mmdet/core/evaluation/obb/obb_mean_ap.py", line 291, in eval_arb_map
        mean_ap, eval_results, dataset, area_ranges, logger=logger)
      File "/work/OBBDetection/mmdet/core/evaluation/obb/obb_mean_ap.py", line 354, in print_map_summary
        label_names[j], num_gts[i, j], results[j]['num_dets'],
    IndexError: tuple index out of range
    

    The configuration file is:

    _base_ = [
        '../_base_/datasets/hrsc.py',
        '../_base_/schedules/schedule_1x.py',
        '../../_base_/default_runtime.py'
    ]
    # model settings
    model = dict(
        type='FCOSOBB',
        pretrained='open-mmlab://detectron/resnet50_caffe',
        backbone=dict(
            type='ResNet',
            depth=50,
            num_stages=4,
            out_indices=(0, 1, 2, 3),
            frozen_stages=1,
            norm_cfg=dict(type='BN', requires_grad=False),
            norm_eval=True,
            style='caffe'),
        neck=dict(
            type='FPN',
            in_channels=[256, 512, 1024, 2048],
            out_channels=256,
            start_level=1,
            add_extra_convs=True,
            extra_convs_on_inputs=False,  # use P5
            num_outs=5,
            relu_before_extra_convs=True),
        bbox_head=dict(
            type='OBBFCOSHead',
            num_classes=15,
            in_channels=256,
            stacked_convs=4,
            feat_channels=256,
            strides=[8, 16, 32, 64, 128],
            scale_theta=True,
            loss_cls=dict(
                type='FocalLoss',
                use_sigmoid=True,
                gamma=2.0,
                alpha=0.25,
                loss_weight=1.0),
            loss_bbox=dict(type='PolyIoULoss', loss_weight=1.0),
            loss_centerness=dict(
                type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)))
    # training and testing settings
    train_cfg = dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.5,
            neg_iou_thr=0.4,
            min_pos_iou=0,
            ignore_iof_thr=-1),
        allowed_border=-1,
        pos_weight=-1,
        debug=False)
    test_cfg = dict(
        nms_pre=1000,
        min_bbox_size=0,
        score_thr=0.05,
        nms=dict(type='obb_nms', iou_thr=0.1),
        max_per_img=2000)
    img_norm_cfg = dict(
        mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=False)
    train_pipeline = [
        dict(type='LoadImageFromFile'),
        dict(type='LoadOBBAnnotations', with_bbox=True,
             with_label=True, obb_as_mask=True),
        dict(type='Resize', img_scale=(1024, 1024), keep_ratio=True),
        dict(type='OBBRandomFlip', h_flip_ratio=0.5, v_flip_ratio=0.5),
        dict(type='Normalize', **img_norm_cfg),
        dict(type='RandomOBBRotate', rotate_after_flip=True,
             angles=(0, 0), vert_rate=0.5, vert_cls=['roundabout', 'storage-tank']),
        dict(type='Pad', size_divisor=32),
        #dict(type='DOTASpecialIgnore', ignore_size=2),
        dict(type='FliterEmpty'),
        dict(type='Mask2OBB', obb_type='obb'),
        dict(type='OBBDefaultFormatBundle'),
        dict(type='OBBCollect', keys=['img', 'gt_bboxes', 'gt_obboxes', 'gt_labels'])
    ]
    test_pipeline = [
        dict(type='LoadImageFromFile'),
        dict(
            type='MultiScaleFlipRotateAug',
            img_scale=[(1024, 1024)],
            h_flip=False,
            v_flip=False,
            rotate=False,
            transforms=[
                dict(type='Resize', keep_ratio=True),
                dict(type='OBBRandomFlip'),
                dict(type='Normalize', **img_norm_cfg),
                dict(type='RandomOBBRotate', rotate_after_flip=True),
                dict(type='Pad', size_divisor=32),
                dict(type='ImageToTensor', keys=['img']),
                dict(type='OBBCollect', keys=['img']),
            ])
    ]
    data = dict(
        samples_per_gpu=2,
        workers_per_gpu=4,
        train=dict(pipeline=train_pipeline),
        val=dict(pipeline=test_pipeline),
        test=dict(pipeline=test_pipeline))
    # optimizer
    optimizer = dict(
        lr=0.0025, paramwise_cfg=dict(bias_lr_mult=2., bias_decay_mult=0.))
    optimizer_config = dict(
        _delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
    # learning policy
    lr_config = dict(
        policy='step',
        warmup='constant',
        warmup_iters=500,
        warmup_ratio=1.0 / 3,
        step=[8, 11])
    total_epochs = 36
    
    
    opened by geobao 7
  • 关于train过程出现CUDA error的问题

    关于train过程出现CUDA error的问题

    当我运行训练命令: python train.py OBBDetection/tools/work_dirs/faster_rcnn_orpn_r50_fpn_1x_dota10/faster_rcnn_orpn_r50_fpn_1x_dota10.py 会出现下面报错: RuntimeError: CUDA error: invalid device function CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1. Segmentation fault (core dumped) 我的环境如下: TorchVision: 0.10.0 OpenCV: 4.5.3 MMCV: 0.6.2 MMDetection: 2.2.0+6505a9d MMDetection Compiler: GCC 7.3 MMDetection CUDA Compiler: 10.0 如果您能提供帮助将万分感谢~

    opened by RyanChanli 7
  • RoIAlignRotated能在多gpu上执行吗

    RoIAlignRotated能在多gpu上执行吗

    感谢您提供优质的代码! 您好, 我在我的项目中用到了您关于RoIAlignRotated部分的代码, 在单gpu模式下它十分有效, 运行也很快(此时我裁剪的是feature, 所以我将feature和roi都放到了gpu上). 但是当我使用多gpu加载模型时, 产生了以下报错: line 32, in forward features, rois, spatial_scale, out_h, out_w, sample_num, aligned) RuntimeError: CUDA error: an illegal memory access was encountered 我尝试将RoIAlignRotated其他变量都放在同一个gpu上, 但是结果依然是错误的. 请问您有什么方法吗? 期待您的回复!

    opened by qfwysw 6
  • The results of retinanet-obb cannot be reproduced.

    The results of retinanet-obb cannot be reproduced.

    The mAP we got only 66.95, not 69 as you said.

    mAP: 0.6695016721761877 ap of each class: plane:0.8933495268168008, baseball-diamond:0.7374626613068532, bridge:0.4122850723332845, ground-track-field:0.6670794506088387, small-vehicle:0.760291145560589, large-vehicle:0.6047573582066816, ship:0.7630074552316077, tennis-court:0.9088855421686749, basketball-court:0.7977999161008033, storage-tank:0.8171024978735246, soccer-ball-field:0.5278917624380285, roundabout:0.635699247940088, harbor:0.514493570948177, swimming-pool:0.6264466877239606, helicopter:0.3759731873849022

    I don't know what went wrong?

    Here is our cfg:

    2021-10-21 15:01:46,198 - mmdet - INFO - Environment info:

    sys.platform: linux Python: 3.7.7 (default, Mar 23 2020, 22:36:06) [GCC 7.3.0] CUDA available: True CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 10.1, V10.1.243 GPU 0: GeForce RTX 2080 Ti GCC: gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 PyTorch: 1.7.1 PyTorch compiling details: PyTorch built with:

    • GCC 7.3
    • C++ Version: 201402
    • Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
    • Intel(R) MKL-DNN v1.6.0 (Git Hash 5ef631a030a6f73131c77892041042805a06064f)
    • OpenMP 201511 (a.k.a. OpenMP 4.5)
    • NNPACK is enabled
    • CPU capability usage: AVX2
    • CUDA Runtime 10.2
    • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75
    • CuDNN 7.6.5
    • Magma 2.5.2
    • Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

    TorchVision: 0.8.2 OpenCV: 4.2.0 MMCV: 0.6.2 MMDetection: 2.2.0+unknown MMDetection Compiler: GCC 7.4 MMDetection CUDA Compiler: 10.1

    2021-10-21 15:01:46,199 - mmdet - INFO - Distributed training: True 2021-10-21 15:01:46,373 - mmdet - INFO - Config: dataset_type = 'DOTADataset' data_root = '/data/zy/datasets/split_ss_dota1_0/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict( type='LoadOBBAnnotations', with_bbox=True, with_label=True, with_poly_as_mask=True), dict(type='LoadDOTASpecialInfo'), dict(type='Resize', img_scale=(1024, 1024), keep_ratio=True), dict(type='OBBRandomFlip', h_flip_ratio=0.5, v_flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict( type='RandomOBBRotate', rotate_after_flip=True, angles=(0, 0), vert_rate=0.5, vert_cls=['roundabout', 'storage-tank']), dict(type='Pad', size_divisor=32), dict(type='DOTASpecialIgnore', ignore_size=2), dict(type='FliterEmpty'), dict(type='Mask2OBB', obb_type='obb'), dict(type='OBBDefaultFormatBundle'), dict( type='OBBCollect', keys=['img', 'gt_bboxes', 'gt_obboxes', 'gt_labels']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipRotateAug', img_scale=[(1024, 1024)], h_flip=False, v_flip=False, rotate=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='OBBRandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='RandomOBBRotate', rotate_after_flip=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='OBBCollect', keys=['img']) ]) ] data = dict( samples_per_gpu=2, workers_per_gpu=4, train=dict( type='DOTADataset', task='Task1', ann_file='/data/zy/datasets/split_ss_dota1_0/trainval/annfiles/', img_prefix='/data/zy/datasets/split_ss_dota1_0/trainval/images/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='LoadOBBAnnotations', with_bbox=True, with_label=True, with_poly_as_mask=True), dict(type='LoadDOTASpecialInfo'), dict(type='Resize', img_scale=(1024, 1024), keep_ratio=True), dict(type='OBBRandomFlip', h_flip_ratio=0.5, v_flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict( type='RandomOBBRotate', rotate_after_flip=True, angles=(0, 0), vert_rate=0.5, vert_cls=['roundabout', 'storage-tank']), dict(type='Pad', size_divisor=32), dict(type='DOTASpecialIgnore', ignore_size=2), dict(type='FliterEmpty'), dict(type='Mask2OBB', obb_type='obb'), dict(type='OBBDefaultFormatBundle'), dict( type='OBBCollect', keys=['img', 'gt_bboxes', 'gt_obboxes', 'gt_labels']) ]), test=dict( type='DOTADataset', task='Task1', ann_file='/data/zy/datasets/split_ss_dota1_0/test/annfiles/', img_prefix='/data/zy/datasets/split_ss_dota1_0/test/images/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipRotateAug', img_scale=[(1024, 1024)], h_flip=False, v_flip=False, rotate=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='OBBRandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='RandomOBBRotate', rotate_after_flip=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='OBBCollect', keys=['img']) ]) ])) evaluation = None optimizer = dict(type='SGD', lr=0.0025, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[8, 11]) total_epochs = 12 checkpoint_config = dict(interval=1) log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] model = dict( type='RetinaNetOBB', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'), neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=1, add_extra_convs='on_input', num_outs=5), bbox_head=dict( type='OBBRetinaHead', num_classes=15, in_channels=256, stacked_convs=4, feat_channels=256, anchor_generator=dict( type='Theta0AnchorGenerator', octave_base_scale=4, scales_per_octave=3, ratios=[0.5, 1.0, 2.0], strides=[8, 16, 32, 64, 128]), bbox_coder=dict( type='OBB2OBBDeltaXYWHTCoder', target_means=[0.0, 0.0, 0.0, 0.0, 0.0], target_stds=[1.0, 1.0, 1.0, 1.0, 1.0]), loss_cls=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0), loss_bbox=dict(type='L1Loss', loss_weight=1.0))) train_cfg = dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.4, min_pos_iou=0, gpu_assign_thr=-1, ignore_iof_thr=-1, iou_calculator=dict(type='OBBOverlaps')), allowed_border=-1, pos_weight=-1, debug=False) test_cfg = dict( nms_pre=2000, min_bbox_size=0, score_thr=0.05, nms=dict(type='obb_nms', iou_thr=0.1), max_per_img=2000) work_dir = './work_dirs/retinanet_obb_r50_fpn_1x_dota10' gpu_ids = range(0, 1)

    opened by zytx121 6
  • About the results on DOTA-v1.5

    About the results on DOTA-v1.5

    Hi,

    Thanks for the great work, I wonder if you have done experiments on the DOTA-v1.5 which is a more challenging dataset.

    Because our results with your Orient RCNN code on DOTA-v1.5 is only about 71% mAP.

    opened by Richardych 6
  • 关于推理过程可视化的问题

    关于推理过程可视化的问题

    感谢您辛勤付出的工作! 在使用python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [--out ${RESULT_FILE}] [--eval ${EVAL_METRICS}] [--show]进行测试之后,在文件夹中所生成的图片是裁剪后的1024*1024的sub image而并非原始图片,另外所有的标注框均是绿色,想问下应该如何将图片重新拼接?并且将不同类别设置成不同颜色方便观察?

    opened by RyanChanli 6
  • 运行 tool/test.py 出现IndexError

    运行 tool/test.py 出现IndexError

    作者您好!

    我正常训练DOTA1.0数据后,在运行:

    python test/tools.py config/obb/oriented_rcnn/faster_rcnn_orpn_r101_1x_data10.py work_dirs/faster_rcnn_orpn_r101_1x_data10/latest.pth --show-dir

    出现以下Bug:

    在 File " / 00D / 0bbdetection / Bboxtoolkit / Bboxtoolkit / visualization / show . py " , line 70 , in < Listcomp > bboxes=[ boxes [ labels == i ] for i in range ( labels . max() ) + 1 ) ] 出现:

    Indexerror : boolean index did not match indexed array along dimension 0 ; dimension is 9 but corresponding boolean dimension is 17

    只修改了配置路径,其它未做修改。

    opened by ZhouHuang23 4
  • test问题

    test问题

    请问使用DOTA格式的数据集(不是DOTA数据集)进行训练,请问还要进行测试吗?最后要如何计算mAP呢? Please use DOTA format dataset (not DOTA dataset) for training. Do you still need to test? Finally, how to calculate mAP?

    opened by LeiaJ520 0
  • Aborted (core dumped)

    Aborted (core dumped)

    The following error occurs when using DOTA data set for training. The server uses RTX 2080 Ti; frame #4: + 0x6ea43a (0x7f34d219543a in /home/lxj/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/lib/libtorch_python.so) frame #5: + 0x6ea4e1 (0x7f34d21954e1 in /home/lxj/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/lib/libtorch_python.so) frame #6: python() [0x4d76aa] frame #7: python() [0x4ad077] frame #8: python() [0x4c21db] frame #9: python() [0x4c21db] frame #10: python() [0x4bcd88] frame #11: python() [0x4d0f00] frame #12: python() [0x4d0f16] frame #13: python() [0x4d0f16] frame #14: python() [0x4d0f16] frame #15: python() [0x4d0f16] frame #16: python() [0x4d0f16] frame #17: python() [0x4d0f16] frame #18: python() [0x4a0cf7] frame #22: python() [0x549129] frame #24: __libc_start_main + 0xf0 (0x7f34e9db0840 in /lib/x86_64-linux-gnu/libc.so.6) frame #25: python() [0x548e9e]

    Aborted (core dumped)

    opened by LeiaJ520 0
  • How to set roi extend_factor?

    How to set roi extend_factor?

    bbox_roi_extractor=dict(
                type='OBBSingleRoIExtractor',
                roi_layer=dict(type='RoIAlignRotated', out_size=7, sample_num=2),
                out_channels=256,
                extend_factor=(1.4, 1.2),
                featmap_strides=[4, 8, 16, 32])
    

    Thank you for your great work! I want to how why extend roi here? How to set extend_factor?

    opened by BeJane 0
  • 显示OrientedRCNN is not in the models registry'

    显示OrientedRCNN is not in the models registry'

    训练的指令·是python tools/train.py configs/obb/oriented_rcnn/faster_rcnn_orpn_r50_fpn_1x_dota10.py,小白,请问哪里出现了问题,其中mmdet/detectors/init.py文件中__all__列表中已经加入了OrientedRCNN

    opened by myheal000 7
  • invalid syntax

    invalid syntax

    Hello, I want to train model with different hyperparameters so I changed the hyperparameter of cfg.data.train like img_scale in the loop but I get the below error:

    raceback (most recent call last): File "/miniconda3/envs/myenv/lib/python3.7/site-packages/yapf/yapflib/yapf_api.py", line 183, in FormatCode tree = pytree_utils.ParseCodeToTree(unformatted_source) File "/miniconda3/envs/myenv/lib/python3.7/site-packages/yapf/yapflib/pytree_utils.py", line 131, in ParseCodeToTree raise e File "/miniconda3/envs/myenv/lib/python3.7/site-packages/yapf/yapflib/pytree_utils.py", line 129, in ParseCodeToTree ast.parse(code) File "/miniconda3/envs/myenv/lib/python3.7/ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST) File "", line 152 config='dataset_type = 'DOTADataset' ^ SyntaxError: invalid syntax

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "tools/train.py", line 211, in main() File "tools/train.py", line 195, in main config=cfg.pretty_text, File "h/miniconda3/envs/myenv/lib/python3.7/site-packages/mmcv/utils/config.py", line 508, in pretty_text text, _ = FormatCode(text, style_config=yapf_style, verify=True) File "/miniconda3/envs/myenv/lib/python3.7/site-packages/yapf/yapflib/yapf_api.py", line 186, in FormatCode raise errors.YapfError(errors.FormatErrorMsg(e)) yapf.yapflib.errors.YapfError: :152:43: invalid syntax

    I changed train.py like this: backbone = {'pretrained':['torchvision://resnet101', 'torchvision://resnet50'], 'backbone':{'depth':[101,50]}} data_train = {'img_scale' : [(512, 512),(1024,1024), (640, 640)]}

    for b in range(len(backbone['pretrained'])): cfg.model['pretrained'] = backbone['pretrained'][b] cfg.model['backbone']['depth'] = backbone['backbone']['depth'][b] # print("model***************************************************************************************************") # print(type(cfg.model)) # print(cfg.model) # print("***************************************************************************************************") model = build_detector(cfg.model, train_cfg=cfg.train_cfg, test_cfg=cfg.test_cfg)
    for d in range(len(data_train['img_scale'])): cfg.data.train.pipeline[3].img_scale = data_train['img_scale'][d] cfg.data.train.pipeline[3].img_scale = data_train['img_scale'][d] print(cfg.data.train['pipeline'][3]['img_scale'], " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " ,data_train['img_scale'][d]) datasets = [build_dataset(cfg.data.train)] if len(cfg.workflow) == 2: val_dataset = copy.deepcopy(cfg.data.val) val_dataset.pipeline = cfg.data.train.pipeline datasets.append(build_dataset(val_dataset)) if cfg.checkpoint_config is not None: # save mmdet version, config file content and class names in # checkpoints as meta data cfg.checkpoint_config.meta = dict( mmdet_version=version, config=cfg.pretty_text, CLASSES=datasets[0].CLASSES) # add an attribute for visualization convenience model.CLASSES = datasets[0].CLASSES train_detector( model, datasets, cfg, distributed=distributed, validate=(not args.no_validate), timestamp=timestamp, meta=meta)

    opened by fhaji75 0
Owner
jbwang1997
A postgraduate majoring in deep learning.
jbwang1997
The official implementation of Equalization Loss v1 & v2 (CVPR 2020, 2021) based on MMDetection.

The Equalization Losses for Long-tailed Object Detection and Instance Segmentation This repo is official implementation CVPR 2021 paper: Equalization

Jingru Tan 129 Dec 16, 2022
mmdetection version of TinyBenchmark.

introduction This project is an mmdetection version of TinyBenchmark. TODO list: add TinyPerson dataset and evaluation add crop and merge for image du

null 34 Aug 27, 2022
Convert openmmlab (not only mmdetection) series model to tensorrt

MMDet to TensorRT This project aims to convert the mmdetection model to TensorRT model end2end. Focus on object detection for now. Mask support is exp

JinTian 4 Dec 17, 2021
Fang Zhonghao 13 Nov 19, 2022
CFC-Net: A Critical Feature Capturing Network for Arbitrary-Oriented Object Detection in Remote Sensing Images

CFC-Net This project hosts the official implementation for the paper: CFC-Net: A Critical Feature Capturing Network for Arbitrary-Oriented Object Dete

ming71 55 Dec 12, 2022
Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

ming71 56 Nov 28, 2022
Official implementation of "Dynamic Anchor Learning for Arbitrary-Oriented Object Detection" (AAAI2021).

DAL This project hosts the official implementation for our AAAI 2021 paper: Dynamic Anchor Learning for Arbitrary-Oriented Object Detection [arxiv] [c

ming71 215 Nov 28, 2022
DAFNe: A One-Stage Anchor-Free Deep Model for Oriented Object Detection

DAFNe: A One-Stage Anchor-Free Deep Model for Oriented Object Detection Code for our Paper DAFNe: A One-Stage Anchor-Free Deep Model for Oriented Obje

Steven Lang 58 Dec 19, 2022
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

null 3 Jan 26, 2022
Python Classes: Medical Insurance Project using Object Oriented Programming Concepts

Medical-Insurance-Project-OOP Python Classes: Medical Insurance Project using Object Oriented Programming Concepts Classes are an incredibly useful pr

Hugo B. 0 Feb 4, 2022
Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera.

Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera. This project prepares training and testing data for various deep learning projects such as 6D object pose estimation projects singleshotpose, as well as object detection and instance segmentation projects.

null 305 Dec 16, 2022
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
CLOCs: Camera-LiDAR Object Candidates Fusion for 3D Object Detection

CLOCs is a novel Camera-LiDAR Object Candidates fusion network. It provides a low-complexity multi-modal fusion framework that improves the performance of single-modality detectors. CLOCs operates on the combined output candidates of any 3D and any 2D detector, and is trained to produce more accurate 3D and 2D detection results.

Su Pang 254 Dec 16, 2022
Object Detection and Multi-Object Tracking

Object Detection and Multi-Object Tracking

Bobby Chen 1.6k Jan 4, 2023
Object tracking and object detection is applied to track golf puts in real time and display stats/games.

Putting_Game Object tracking and object detection is applied to track golf puts in real time and display stats/games. Works best with the Perfect Prac

Max 1 Dec 29, 2021
Auto-Lama combines object detection and image inpainting to automate object removals

Auto-Lama Auto-Lama combines object detection and image inpainting to automate object removals. It is build on top of DE:TR from Facebook Research and

null 44 Dec 9, 2022