Skip to content

Commit

Permalink
[Docs] Add an ionogram example in MMYOLO application (#643)
Browse files Browse the repository at this point in the history
* [Fix] fix the config link for rtmdet_tiny

* fir the lint

* upload configs

* [Docs]Add doc for application examples

* [Doc] fix h1 title for ionogram_detection.md

* [Fix] update doc links for project/misc/

* Update links for application_examples in README

* Update links for application_examples in README

* Fix the bad commit caused by a mistake merge.

* Fix unnecessary modification on Table of Contents

* Add description of dataset preparation

* Add description of dataset preparation

* Update dataset analysis and pipeline visualization

* fix line too long

* Update rtmdet_s in the benchmark

* fix typo in the doc

* Replace local ckpt path with url

* Update file tree, check out for spaces

* Beautify configs

* Beautify configs

* Add introduction of annotation tool

* Update rtmdet benchmark

* Update rtmdet configs

* Fix typo

* Add English doc

* Minor revisio

* Fix typo

* Revision - check labels

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - sentence structure

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - fix typo

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - parameters and FLOPs

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - replace flops with FLOPs

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - enhance readability

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - fix typo

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - correct grammatical errors

Co-authored-by: Range King <RangeKingHZ@gmail.com>

* Revision - enhance

Co-authored-by: Range King <RangeKingHZ@gmail.com>

---------

Co-authored-by: Range King <RangeKingHZ@gmail.com>
  • Loading branch information
VoyagerXvoyagerx and RangeKing committed Mar 13, 2023
1 parent cbf5a80 commit 71fc567
Show file tree
Hide file tree
Showing 29 changed files with 1,678 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ For different parts from MMDetection, we have also prepared user guides and adva
- [Visualization](docs/en/recommended_topics/visualization.md)
- [Model deployment](docs/en/recommended_topics/deploy/)
- [Troubleshooting steps](docs/en/recommended_topics/troubleshooting_steps.md)
- [MMYOLO industry examples](docs/en/recommended_topics/industry_examples.md)
- [MMYOLO application examples](docs/en/recommended_topics/application_examples/)
- [MM series repo essential basics](docs/en/recommended_topics/mm_basics.md)
- [Dataset preparation and description](docs/en/recommended_topics/dataset_preparation.md)

Expand Down
2 changes: 1 addition & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也
- [关于可视化的一切](docs/zh_cn/recommended_topics/visualization.md)
- [模型部署流程](docs/zh_cn/recommended_topics/deploy/)
- [常见错误排查步骤](docs/zh_cn/recommended_topics/troubleshooting_steps.md)
- [MMYOLO 产业范例介绍](docs/zh_cn/recommended_topics/industry_examples.md)
- [MMYOLO 应用范例介绍](docs/zh_cn/recommended_topics/application_examples/)
- [MM 系列 Repo 必备基础](docs/zh_cn/recommended_topics/mm_basics.md)
- [数据集准备和说明](docs/zh_cn/recommended_topics/dataset_preparation.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ You can switch between Chinese and English documents in the top-right corner of
recommended_topics/contributing.md
recommended_topics/model_design.md
recommended_topics/algorithm_descriptions/index.rst
recommended_topics/application_examples/index.rst
recommended_topics/replace_backbone.md
recommended_topics/complexity_analysis.md
recommended_topics/labeling_to_deployment_tutorials.md
recommended_topics/visualization.md
recommended_topics/deploy/index.rst
recommended_topics/troubleshooting_steps.md
recommended_topics/industry_examples.md
recommended_topics/mm_basics.md
recommended_topics/dataset_preparation.md

Expand Down
7 changes: 7 additions & 0 deletions docs/en/recommended_topics/application_examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MMYOLO application examples
********************

.. toctree::
:maxdepth: 1

ionogram_detection.md
307 changes: 307 additions & 0 deletions docs/en/recommended_topics/application_examples/ionogram_detection.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/en/recommended_topics/industry_examples.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/zh_cn/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
recommended_topics/contributing.md
recommended_topics/model_design.md
recommended_topics/algorithm_descriptions/index.rst
recommended_topics/application_examples/index.rst
recommended_topics/replace_backbone.md
recommended_topics/complexity_analysis.md
recommended_topics/labeling_to_deployment_tutorials.md
recommended_topics/visualization.md
recommended_topics/deploy/index.rst
recommended_topics/troubleshooting_steps.md
recommended_topics/industry_examples.md
recommended_topics/mm_basics.md
recommended_topics/dataset_preparation.md

Expand Down
7 changes: 7 additions & 0 deletions docs/zh_cn/recommended_topics/application_examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MMYOLO 应用范例介绍
********************

.. toctree::
:maxdepth: 1

ionogram_detection.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/zh_cn/recommended_topics/industry_examples.md

This file was deleted.

4 changes: 2 additions & 2 deletions projects/misc/custom_dataset/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Tips: 这个是自定义数据集的 config 文件,请结合 [自定义数据集教程](https://github.com/open-mmlab/mmyolo/blob/dev/docs/zh_cn/user_guides/custom_dataset.md) 来使用。
Tips: 这个是自定义数据集的 config 文件,请结合 [标注+训练+测试+部署全流程](https://github.com/open-mmlab/mmyolo/blob/main/docs/zh_cn/recommended_topics/labeling_to_deployment_tutorials.md) 来使用。

Tips: This is the config file of the custom dataset. Please use it in combination with [custom dataset](https://github.com/open-mmlab/mmyolo/blob/dev/docs/en/user_guides/custom_dataset.md).
Tips: This is the config file of the custom dataset. Please use it in combination with [Annotation-to-deployment workflow for custom dataset](https://github.com/open-mmlab/mmyolo/blob/main/docs/en/recommended_topics/labeling_to_deployment_tutorials.md).
3 changes: 3 additions & 0 deletions projects/misc/ionogram_detection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Tips: 这是 MMYOLO 应用范例的配置文件,请结合 [基于 MMYOLO 的频高图实时目标检测 benchmark](/docs/zh_cn/recommended_topics/application_examples/ionogram_detection.md) 来使用。

Tips: This is the config file of the MMYOLO application examples. Please use it in combination with [A Benchmark for Ionogram Detection Based on MMYOLO](/docs/en/recommended_topics/application_examples/ionogram_detection.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
_base_ = 'mmyolo::rtmdet/rtmdet_l_syncbn_fast_8xb32-300e_coco.py'

# ======================== Modified parameters ======================
# -----data related-----
data_root = './Iono4311/'
train_ann_file = 'annotations/train.json'
train_data_prefix = 'train_images/'
val_ann_file = 'annotations/val.json'
val_data_prefix = 'val_images/'
test_ann_file = 'annotations/test.json'
test_data_prefix = 'test_images/'

class_name = ('E', 'Es-l', 'Es-c', 'F1', 'F2', 'Spread-F')
num_classes = len(class_name)
metainfo = dict(
classes=class_name,
palette=[(250, 165, 30), (120, 69, 125), (53, 125, 34), (0, 11, 123),
(130, 20, 12), (120, 121, 80)])

train_batch_size_per_gpu = 32
train_num_workers = 8
val_batch_size_per_gpu = train_batch_size_per_gpu

# Config of batch shapes. Only on val.
batch_shapes_cfg = dict(batch_size=val_batch_size_per_gpu)

# -----train val related-----
load_from = 'https://download.openmmlab.com/mmyolo/v0/rtmdet/rtmdet_l_syncbn_fast_8xb32-300e_coco/rtmdet_l_syncbn_fast_8xb32-300e_coco_20230102_135928-ee3abdc4.pth' # noqa

# default hooks
save_epoch_intervals = 10
max_epochs = 100
max_keep_ckpts = 1

# learning rate
param_scheduler = [
dict(
type='LinearLR', start_factor=1.0e-5, by_epoch=False, begin=0,
end=300),
dict(
# use cosine lr from 20 to 100 epoch
type='CosineAnnealingLR',
eta_min=_base_.base_lr * 0.05,
begin=max_epochs // 5,
end=max_epochs,
T_max=max_epochs * 4 // 5,
by_epoch=True,
convert_to_iter_based=True),
]

# train_cfg
val_interval = 2
val_begin = 20

tta_model = None
tta_pipeline = None

visualizer = dict(
vis_backends=[dict(type='LocalVisBackend'),
dict(type='WandbVisBackend')])

# ===================== Unmodified in most cases ==================
model = dict(
bbox_head=dict(head_module=dict(num_classes=num_classes)),
train_cfg=dict(assigner=dict(num_classes=num_classes)))

train_dataloader = dict(
batch_size=train_batch_size_per_gpu,
num_workers=train_num_workers,
dataset=dict(
metainfo=metainfo,
data_root=data_root,
ann_file=train_ann_file,
data_prefix=dict(img=train_data_prefix)))

val_dataloader = dict(
batch_size=val_batch_size_per_gpu,
num_workers=train_num_workers,
dataset=dict(
metainfo=metainfo,
data_root=data_root,
data_prefix=dict(img=val_data_prefix),
ann_file=val_ann_file))

test_dataloader = dict(
batch_size=val_batch_size_per_gpu,
num_workers=train_num_workers,
dataset=dict(
metainfo=metainfo,
data_root=data_root,
data_prefix=dict(img=test_data_prefix),
ann_file=test_ann_file))

default_hooks = dict(
checkpoint=dict(
interval=save_epoch_intervals,
max_keep_ckpts=max_keep_ckpts,
save_best='auto'))

val_evaluator = dict(ann_file=data_root + val_ann_file)
test_evaluator = dict(ann_file=data_root + test_ann_file)

train_cfg = dict(
type='EpochBasedTrainLoop',
max_epochs=max_epochs,
val_begin=val_begin,
val_interval=val_interval)
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
_base_ = './rtmdet_l_fast_1xb32-100e_ionogram.py'

load_from = 'https://download.openmmlab.com/mmyolo/v0/rtmdet/rtmdet_s_syncbn_fast_8xb32-300e_coco/rtmdet_s_syncbn_fast_8xb32-300e_coco_20221230_182329-0a8c901a.pth' # noqa

# ======================= Modified parameters =====================
deepen_factor = 0.33
widen_factor = 0.5
img_scale = _base_.img_scale

# ratio range for random resize
random_resize_ratio_range = (0.5, 2.0)
# Number of cached images in mosaic
mosaic_max_cached_images = 40
# Number of cached images in mixup
mixup_max_cached_images = 20

# ===================== Unmodified in most cases ==================
model = dict(
backbone=dict(deepen_factor=deepen_factor, widen_factor=widen_factor),
neck=dict(
deepen_factor=deepen_factor,
widen_factor=widen_factor,
),
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))

train_pipeline = [
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='Mosaic',
img_scale=img_scale,
use_cached=True,
max_cached_images=mosaic_max_cached_images,
pad_val=114.0),
dict(
type='mmdet.RandomResize',
# img_scale is (width, height)
scale=(img_scale[0] * 2, img_scale[1] * 2),
ratio_range=random_resize_ratio_range, # note
resize_type='mmdet.Resize',
keep_ratio=True),
dict(type='mmdet.RandomCrop', crop_size=img_scale),
dict(type='mmdet.YOLOXHSVRandomAug'),
dict(type='mmdet.RandomFlip', prob=0.5),
dict(type='mmdet.Pad', size=img_scale, pad_val=dict(img=(114, 114, 114))),
dict(
type='YOLOv5MixUp',
use_cached=True,
max_cached_images=mixup_max_cached_images),
dict(type='mmdet.PackDetInputs')
]

train_pipeline_stage2 = [
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='mmdet.RandomResize',
scale=img_scale,
ratio_range=random_resize_ratio_range, # note
resize_type='mmdet.Resize',
keep_ratio=True),
dict(type='mmdet.RandomCrop', crop_size=img_scale),
dict(type='mmdet.YOLOXHSVRandomAug'),
dict(type='mmdet.RandomFlip', prob=0.5),
dict(type='mmdet.Pad', size=img_scale, pad_val=dict(img=(114, 114, 114))),
dict(type='mmdet.PackDetInputs')
]

train_dataloader = dict(dataset=dict(pipeline=train_pipeline))

custom_hooks = [
dict(
type='EMAHook',
ema_type='ExpMomentumEMA',
momentum=0.0002,
update_buffers=True,
strict_load=False,
priority=49),
dict(
type='mmdet.PipelineSwitchHook',
switch_epoch=_base_.max_epochs - _base_.num_epochs_stage2,
switch_pipeline=train_pipeline_stage2)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
_base_ = './rtmdet_s_fast_1xb32-100e_ionogram.py'

# ======================= Modified parameters ======================
deepen_factor = 0.167
widen_factor = 0.375
img_scale = _base_.img_scale

load_from = 'https://download.openmmlab.com/mmyolo/v0/rtmdet/rtmdet_tiny_syncbn_fast_8xb32-300e_coco/rtmdet_tiny_syncbn_fast_8xb32-300e_coco_20230102_140117-dbb1dc83.pth' # noqa

# learning rate
param_scheduler = [
dict(
type='LinearLR', start_factor=1.0e-5, by_epoch=False, begin=0,
end=300),
dict(
# use cosine lr from 50 to 100 epoch
type='CosineAnnealingLR',
eta_min=_base_.base_lr * 0.05,
begin=_base_.max_epochs // 2,
end=_base_.max_epochs,
T_max=_base_.max_epochs // 2,
by_epoch=True,
convert_to_iter_based=True),
]

# =======================Unmodified in most cases==================
model = dict(
backbone=dict(deepen_factor=deepen_factor, widen_factor=widen_factor),
neck=dict(deepen_factor=deepen_factor, widen_factor=widen_factor),
bbox_head=dict(head_module=dict(widen_factor=widen_factor)))

train_pipeline = [
dict(type='LoadImageFromFile', file_client_args=_base_.file_client_args),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='Mosaic',
img_scale=img_scale,
use_cached=True,
max_cached_images=20, # note
random_pop=False, # note
pad_val=114.0),
dict(
type='mmdet.RandomResize',
# img_scale is (width, height)
scale=(img_scale[0] * 2, img_scale[1] * 2),
ratio_range=(0.5, 2.0),
resize_type='mmdet.Resize',
keep_ratio=True),
dict(type='mmdet.RandomCrop', crop_size=img_scale),
dict(type='mmdet.YOLOXHSVRandomAug'),
dict(type='mmdet.RandomFlip', prob=0.5),
dict(type='mmdet.Pad', size=img_scale, pad_val=dict(img=(114, 114, 114))),
dict(
type='YOLOv5MixUp',
use_cached=True,
random_pop=False,
max_cached_images=10,
prob=0.5),
dict(type='mmdet.PackDetInputs')
]

train_dataloader = dict(dataset=dict(pipeline=train_pipeline))
Loading

0 comments on commit 71fc567

Please sign in to comment.