forked from open-mmlab/mmrazor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support single stage rotated detector in MMRotate (open-mmlab#428)
* fix lint * fix lint * add mmrotate part * update * update * fix * remove init_detector * success run with bs=1 * nms_rotated support batch * support [batch_id, class_id, box_id] * fix * fix * Create test_mmrotate_core.py * add ut * add ut * Update nms_rotated.py * fix * Revert "fix" This reverts commit f792387fb449ba091c1d932f29d28214805fb6e3. * add mmrotate into requirements * add ut * update doc * update * skip test because mmcv version < 1.4.6 * update * Update rotated-detection_static.py * Update rotated-detection_static.py * Update rotated-detection_static.py * fix bug of memory leak. * Update rotated_detection_model.py
- Loading branch information
Showing
32 changed files
with
2,290 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
_base_ = ['./rotated-detection_onnxruntime_static.py'] | ||
onnx_config = dict( | ||
dynamic_axes={ | ||
'input': { | ||
0: 'batch', | ||
2: 'height', | ||
3: 'width' | ||
}, | ||
'dets': { | ||
0: 'batch', | ||
1: 'num_dets', | ||
}, | ||
'labels': { | ||
0: 'batch', | ||
1: 'num_dets', | ||
}, | ||
}, ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
_base_ = ['./rotated-detection_static.py', '../_base_/backends/onnxruntime.py'] | ||
|
||
onnx_config = dict(output_names=['dets', 'labels'], input_shape=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
_base_ = ['../_base_/onnx_config.py'] | ||
codebase_config = dict( | ||
type='mmrotate', | ||
task='RotatedDetection', | ||
post_processing=dict( | ||
score_threshold=0.05, | ||
iou_threshold=0.1, | ||
pre_top_k=3000, | ||
keep_top_k=2000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# MMRotate Support | ||
|
||
[MMRotate](https://github.com/open-mmlab/mmrotate) is an open-source toolbox for rotated object detection based on PyTorch. It is a part of the [OpenMMLab](https://openmmlab.com/) project. | ||
|
||
## MMRotate installation tutorial | ||
|
||
Please refer to [official installation guide](https://mmrotate.readthedocs.io/en/latest/install.html) to install the codebase. | ||
|
||
## MMRotate models support | ||
|
||
| Model | Task | ONNX Runtime | TensorRT | NCNN | PPLNN | OpenVINO | Model config | | ||
|:----------------------|:--------------|:------------:|:--------:|:----:|:-----:|:--------:|:-------------------------------------------------------------------------------------------:| | ||
| RotatedRetinaNet | RotatedDetection | Y | N | N | N | N | [config](https://github.com/open-mmlab/mmrotate/blob/main/configs/rotated_retinanet/README.md) | | ||
|
||
### Example | ||
|
||
```bash | ||
# convert ort | ||
python tools/deploy.py \ | ||
configs/mmrotate/rotated-detection_onnxruntime_dynamic.py \ | ||
$MMROTATE_DIR/configs/rotated_retinanet/rotated_retinanet_obb_r50_fpn_1x_dota_le135.py \ | ||
$MMROTATE_DIR/checkpoints/rotated_retinanet_obb_r50_fpn_1x_dota_le135-e4131166.pth \ | ||
$MMROTATE_DIR/demo/demo.jpg \ | ||
--work-dir work-dirs/mmrotate/rotated_retinanet/ort \ | ||
--device cpu | ||
|
||
# compute metric | ||
python tools/test.py \ | ||
configs/mmrotate/rotated-detection_onnxruntime_dynamic.py \ | ||
$MMROTATE_DIR/configs/rotated_retinanet/rotated_retinanet_obb_r50_fpn_1x_dota_le135.py \ | ||
--model work-dirs/mmrotate/rotated_retinanet/ort/end2end.onnx \ | ||
--metrics mAP | ||
|
||
# generate submit file | ||
python tools/test.py \ | ||
configs/mmrotate/rotated-detection_onnxruntime_dynamic.py \ | ||
$MMROTATE_DIR/configs/rotated_retinanet/rotated_retinanet_obb_r50_fpn_1x_dota_le135.py \ | ||
--model work-dirs/mmrotate/rotated_retinanet/ort/end2end.onnx \ | ||
--format-only \ | ||
--metric-options submission_dir=work-dirs/mmrotate/rotated_retinanet/ort/Task1_results | ||
``` | ||
|
||
Note | ||
|
||
- Usually, mmrotate models need some extra information for the input image, but we can't get it directly. So, when exporting the model, you can use `$MMROTATE_DIR/demo/demo.jpg` as input. | ||
|
||
## Reminder | ||
|
||
None | ||
|
||
## FAQs | ||
|
||
None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from .core import * # noqa: F401,F403 | ||
from .deploy import * # noqa: F401,F403 | ||
from .models import * # noqa: F401,F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from .bbox import * # noqa: F401,F403 | ||
from .post_processing import * # noqa: F401,F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from .delta_xywha_rbbox_coder import * # noqa: F401,F403 |
Oops, something went wrong.