/YOLOX_OBB

Primary LanguagePythonOtherNOASSERTION

YOLOX OBB -- YOLOX 旋转框

version


result_vis


前言

  1. 在开始本项目之前,你需要了解旋转检测任务的主要步骤

  2. 本项目是基于YOLOX的旋转框的检测任务,主要针对DOTA数据

  3. 本项目与原版的YOLOX start基本一致,所有有关旋转的脚本都用obb标识

  4. 如果想要了解更多有关旋转框检测的方法,关注OBBDetection

Update

  1. Support ignore empty images
  2. Support ignore to apply rotate augmentation to horizontal targets
  3. Support dota2 train eval test demo
  4. Add the scripts which can convert coco datasets format to dota format, reference coco2dota.py
  5. Add Copy-Paste Augmention
  6. Add Resampling Augmention (PS: It means that the class which contains smaller numbers instances will be chosen with higher probability when copy paste)
  7. Add TensorRT Demo reference OBB

Some Ideas

  1. dota1的小目标有很多没有标注,而如果多尺度缩放后会,将一些中心目标变为小目标,这个不利于检测的精确性,因此训练dota1的时候可以关掉多尺度增强

Introduction

Method

  1. For Oriented Bounding Box Detection, I just regress the the angle and did't apply any special tricks.

  2. You can view the item as baseline and apply you method on it. Next step, I will add some efficient methods into the project.

The item condition:

  1. Support
    • It support YOLOX DOTA dataset train test demo

    • Support train different type of orietend datasets

  2. Unspport
    • Unspport fp16 train and it will apply hbb nms to inference when using fp16 (It causes by PolyIoU calculation which is programmed by CUDA)

Content

Quick Start

Firstly, create python environment

$ conda create -n yolox_obb python=3.7 -y

then, clone the github of the item

$ git clone --recursive https://github.com/DDGRCF/YOLOX_OBB.git

install BboxToolkit

$ cd BboxToolkit
$ python setup.py develop

then, you can adjust follow the original quick start

Instruction

Data

If We want to train your datasets, firstly you first convert your data as dota datasets format. If you have a coco annotation-style datasets, you can just convert it annoatations into dota format. We perpare a script for you.

$ cd my_exps
$ bash coco2dota.sh
# PS: you should change filename、diranme and so on.

Demo

I want to attention that we can't support fp16 again. I prepare the shell the demo script so that you can quick run obb demo as:

$ cd my_exps
$ bash demo_dota_obb.sh [data_type] 0 /path/to/you
# PS: 0 is to assign the train environment to 0 gpu, you can change it by youself and /path/to/you is your demo images. data_type can be selected in [dota1_0, dota2_0]

Train

Three points:

  1. you must follow the BboxToolkit to prepare your dataset(#PS: if you is not dota dataset format, you can convert into dota dataset format first)
  2. We define the model default training parameters as following:
  3. If you want to debug with visualizing the augmentation images, you can add enable_debug=True to the config and the vis images will be outputed into the work dir.
model max epoch enable_mixup enable_mosaic no aug epoch obj_loss_weight cls_loss_weight iou_loss_weight reg_loss_weight
yolox_l 40 True True 5 1.0 1.0 5.0 1.0

Of course, this group parameters is not the best one, so you can try youself. And for the quick train, I have prepare the shell scripts, too.

$ cd my_exps
$ bash train_dota_obb.sh data_type 0

As I set parameters above with 4 batch size per gpu, results show as following:

model mAP lowest mAP highest mAP
yolox_l 63.98 helicopter 29.92 tennis-court 90.87

Adopt yolox_s model and get results as following:

model mAP lowest mAP highest mAP
yolox_s 58.26 helicopter 33.96 tennis-court 90.81

Adopt yolox_s model(60 epochs) and get results as following:

model mAP lowest mAP highest mAP
yolox_s 62.62 soccer-ball-field 35.58 tennis-court 90.80

After add Copy Paste and Resample:

model mAP lowest mAP highest mAP
yolox_s 70.78 helicopter 49.42 tennis-court 90.86

Test

Test contains eval online and generate submission file, they are all convenient.

  • for eval online
$ cd my_exps
$ ./eval_dota_obb.sh [data_type] eval 0
# PS: for convenience, I set default parameters. So, eval means evaluating DOTA val datasets.
  • for generate submission file
$ cd my_exps
$ ./eval_dota_obb.sh [data_type] test 0

Ralated Hub