rmmdet 0.1.1
Rotated Bounding Box Detection Toolbox and Benchmark
License: Apache License 2.0
Keywords: computer vision,object detection

# mmrotate 


[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

![framework](framework.png)

## Introduction
- mmrotate is a rotate object detection kit for  [MMdetection v2.17](https://github.com/open-mmlab/mmdetection). 
- It is decoupled from mmdetection source code and only focuses on rotate bboxes.
- If you can run mmdetection, you are very close to running mmrotate directly.
 

## Installation

```shell
# install mmdetection first.

# compile OBB ops
bash compile.sh

pip install -r requirements.txt
```

## Quick Start

```shell
# train
CUDA_VISIBLE_DEVICES=0 PORT=29500 \
./tools/dist_train.sh configs/rretinanet/rretinanet_r50_fpn_1x_dota_v3.py 1

# submission
CUDA_VISIBLE_DEVICES=0 PORT=29500 \
./tools/dist_test.sh configs/rretinanet/rretinanet_r50_fpn_1x_dota_v3.py  \
                     work_dirs/rretinanet_r50_fpn_1x_dota_v3/epoch_12.pth 1 \
                     --format-only  --eval-options submission_dir=work_dirs/rretinanet_r50_fpn_1x_dota_v3/Task1_results 
```

For DOTA dataset, you need crop the original images into 1024×1024 patches with an overlap of 200 by run 
```shell
python tools/split/img_split.py --base_json tools/split/split_configs/split_configs/dota1_0/ss_trainval.json
python tools/split/img_split.py --base_json tools/split/split_configs/dota1_0/ss_test.json

```
**Note you need change path in `ss_trainval.json`, `ss_test.json` and `rretinanet_r50_fpn_1x_dota_v3.py` to your path.** 


## Model Zoo

### Support Model
- [x] RetinaNet-OBB
- [x] FasterRCNN-OBB
- [ ] FCOS-OBB
- [ ] DETR-OBB
- [x] RoI Transformer [CVPR2019]
- [ ] R<sup>3</sup>Det [AAAI2021]
- [x] Gliding Vertex [TPAMI]
- [x] DAL [AAAI2021]
- [ ] S<sup>2</sup>A-Net [TGRS]
- [x] ReDet [CVPR2021]
- [x] Oriented R-CNN [ICCV2021]
- [x] GWD [ICML2021]
- [x] KLD [NeurIPS2021]
- [ ] DAFNe [arXiv]
- [ ] DARNet [arXiv]
- [ ] KFIoU [arXiv]
- [ ] RIDet [GRSL]


### Support Backbone 
- [x] ReResNet (from ReDet)

### Support Neck 
- [x] ReFPN (from ReDet)

### Support OPS
- [x] RoIAlignRotated (from mmcv)
- [x] RiRoIAlign (from RoI Transformer)
- [x] FeatureRefineModule (from R<sup>3</sup>Det)

### Support Loss Function
- [ ] Rotate IoU Loss
- [ ] Rotate GIoU Loss
- [ ] Smooth IoU Loss
- [x] GWD Loss (from GWD)
- [x] KLD Loss (from KLD)

### Support Datasets
- [x] RSSDD
- [x] HRSID
- [x] DOTA




### Support Augmentation
- [ ] Rotate
- [ ] Flip

### Angle Representations
Built in three angle representations, which can be freely switched in the cfg.

- v1 (R<sup>3</sup>Det): [-PI/2, 0) 
- v2 (S<sup>2</sup>ANet): [-Pi/4, 3PI/4)
- v3 (OBBDetection): [-PI/2, PI/2)


### Performance

#### DOTA1.0 (Task1)

| Model | Backbone |   Data  | Lr schd | Ms | Rotate | Angle Representations | box AP |  
|:--------:|:--------:|:-------:|:-------:|:--:|:------:|:--------:|:------:|
|RRetinaNet |  R50-FPN | DOTA1.0 |    1x   |  - |    -   | v2 |  66.22  |
|RRetinaNet + GWD|  R50-FPN | DOTA1.0 |    1x   |  - |    -   | v1 |  68.13  |
|RFaster RCNN|  R50-FPN | DOTA1.0 |    1x   |  - |    -   | v2 |  68.60  |
|RoI Transformer|  R50-FPN | DOTA1.0 |    1x   |  - |    -   | v2 |  69.56  |
|Gliding Vertex |  R50-FPN | DOTA1.0 |    1x   |  - |    -   | v2 |  70.09  |
|ReDet|  R50-FPN | DOTA1.0 |    1x   |  - |    -   | v2 |  71.31  |

See more detail in configs.

## Acknowledgement

We refered [OBBDetection](https://github.com/jbwang1997/OBBDetection) and [ReDet](https://github.com/csuhan/ReDet) when develping mmrotate.

This toolbox is modified from [MMdetection](https://github.com/open-mmlab/mmdetection). If you use this toolbox or benchmark in your research, please cite the following information.