diff --git a/README.md b/README.md index 50fb768b..358afebb 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,11 @@ And the figure of P6 model is in [model_design.md](docs/en/algorithm_description ## What's New +💎 **v0.1.3** was released on 10/11/2022: + +1. Fix training failure when saving best weights based on mmengine 0.3.1 +2. Fix `add_dump_metric` error based on mmdet 3.0.0rc3 + 💎 **v0.1.2** was released on 3/11/2022: 1. Support [YOLOv5/YOLOv6/YOLOX/RTMDet deployments](https://github.com/open-mmlab/mmyolo/blob/main/configs/deploy) for ONNXRuntime and TensorRT @@ -137,6 +142,7 @@ For different parts from MMDetection, we have also prepared user guides and adva - [Data flow](docs/en/advanced_guides/data_flow.md) - [How to](docs/en/advanced_guides/how_to.md) + - [Plugins](docs/en/advanced_guides/plugins.md) ## Overview of Benchmark and Model Zoo diff --git a/README_zh-CN.md b/README_zh-CN.md index cecc9ab1..25271372 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -71,6 +71,11 @@ P6 模型图详见 [model_design.md](docs/zh_CN/algorithm_descriptions/model_des ## 最新进展 +💎 **v0.1.3** 版本已经在 2022.11.10 发布: + +1. 基于 mmengine 0.3.1 修复保存最好权重时训练失败问题 +2. 基于 mmdet 3.0.0rc3 修复 `add_dump_metric` 报错 (#253) + 💎 **v0.1.2** 版本已经在 2022.11.3 发布: 1. 支持 ONNXRuntime 和 TensorRT 的 [YOLOv5/YOLOv6/YOLOX/RTMDet 部署](https://github.com/open-mmlab/mmyolo/blob/main/configs/deploy) @@ -147,6 +152,7 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也 - [数据流](docs/zh_cn/advanced_guides/data_flow.md) - [How to](docs/zh_cn/advanced_guides/how_to.md) + - [插件](docs/zh_cn/advanced_guides/plugins.md) - [解读文章和资源汇总](docs/zh_cn/article.md) diff --git a/demo/featmap_vis_demo.py b/demo/featmap_vis_demo.py index 9e8ce3e0..c9fb8eda 100644 --- a/demo/featmap_vis_demo.py +++ b/demo/featmap_vis_demo.py @@ -21,10 +21,7 @@ def parse_args(): parser.add_argument('config', help='Config file') parser.add_argument('checkpoint', help='Checkpoint file') parser.add_argument( - '--out-dir', - default='', - help='Path to output directory, ' - 'if the user not set this flag then will show each image') + '--out-dir', default='./output', help='Path to output file') parser.add_argument( '--target-layers', default=['backbone'], @@ -41,6 +38,8 @@ def parse_args(): '--device', default='cuda:0', help='Device used for inference') parser.add_argument( '--score-thr', type=float, default=0.3, help='Bbox score threshold') + parser.add_argument( + '--show', action='store_true', help='Show the featmap results') parser.add_argument( '--channel-reduction', default='select_max', @@ -112,7 +111,7 @@ def main(): model = init_detector(args.config, args.checkpoint, device=args.device) - if not os.path.exists(args.out_dir): + if not os.path.exists(args.out_dir) and not args.show: os.mkdir(args.out_dir) if args.preview_model: @@ -158,8 +157,7 @@ def main(): filename = os.path.relpath(image_path, args.img).replace('/', '_') else: filename = os.path.basename(image_path) - out_file = None if args.out_dir != '' else os.path.join( - args.out_dir, filename) + out_file = None if args.show else os.path.join(args.out_dir, filename) # show the results shown_imgs = [] @@ -183,14 +181,13 @@ def main(): arrangement=args.arrangement) shown_imgs.append(shown_img) - # Add original image - shown_imgs.append(img) shown_imgs = auto_arrange_images(shown_imgs) progress_bar.update() if out_file: mmcv.imwrite(shown_imgs[..., ::-1], out_file) - else: + + if args.show: visualizer.show(shown_imgs) print(f'All done!' diff --git a/demo/image_demo.py b/demo/image_demo.py index 51aabd66..5ccc7aef 100644 --- a/demo/image_demo.py +++ b/demo/image_demo.py @@ -46,7 +46,7 @@ def main(): if args.deploy: switch_to_deploy(model) - if not os.path.exists(args.out_dir): + if not os.path.exists(args.out_dir) and not args.show: os.mkdir(args.out_dir) # init visualizer diff --git a/docs/en/advanced_guides/index.rst b/docs/en/advanced_guides/index.rst index 06827c1a..bd72cd2e 100644 --- a/docs/en/advanced_guides/index.rst +++ b/docs/en/advanced_guides/index.rst @@ -14,3 +14,12 @@ How to :maxdepth: 1 how_to.md + + +Plugins +************************ + +.. toctree:: + :maxdepth: 1 + + plugins.md diff --git a/docs/en/advanced_guides/plugins.md b/docs/en/advanced_guides/plugins.md new file mode 100644 index 00000000..779d515c --- /dev/null +++ b/docs/en/advanced_guides/plugins.md @@ -0,0 +1 @@ +# Plugins diff --git a/docs/en/notes/changelog.md b/docs/en/notes/changelog.md index 218b9c4f..90175b7b 100644 --- a/docs/en/notes/changelog.md +++ b/docs/en/notes/changelog.md @@ -1,5 +1,30 @@ # Changelog +## v0.1.3(10/11/2022) + +### New Features + +1. Support CBAM plug-in and provide plug-in documentation (#246) +2. Add YOLOv5 P6 model structure diagram and related descriptions (#273) + +### Bug Fixes + +1. Fix training failure when saving best weights based on mmengine 0.3.1 +2. Fix `add_dump_metric` error based on mmdet 3.0.0rc3 (#253) +3. Fix backbone does not support `init_cfg` issue (#272) +4. Change typing import method based on mmdet 3.0.0rc3 (#261) + +### Improvements + +1. `featmap_vis_demo` support for folder and url input (#248) +2. Deploy docker file refinement (#242) + +#### Contributors + +A total of 10 developers contributed to this release. + +Thank @kitecats, @triple-Mu, @RangeKing, @PeterH0323, @Zheng-LinXiao, @tkhe, @weikai520, @zytx121, @wanghonglie, @hhaAndroid + ## v0.1.2(3/11/2022) ### Highlights diff --git a/docs/en/overview.md b/docs/en/overview.md index 6927c21c..339bcfa3 100644 --- a/docs/en/overview.md +++ b/docs/en/overview.md @@ -53,3 +53,4 @@ The detailed instruction of MMYOLO is as follows. - [Data flow](https://mmyolo.readthedocs.io/en/latest/advanced_guides/index.html#data-flow) - [How to](https://mmyolo.readthedocs.io/en/latest/advanced_guides/index.html#how-to) + - [Plugins](https://mmyolo.readthedocs.io/en/latest/advanced_guides/index.html#plugins) diff --git a/docs/zh_cn/advanced_guides/index.rst b/docs/zh_cn/advanced_guides/index.rst index 10553f84..81810a88 100644 --- a/docs/zh_cn/advanced_guides/index.rst +++ b/docs/zh_cn/advanced_guides/index.rst @@ -14,3 +14,12 @@ How to :maxdepth: 1 how_to.md + + +插件 +************************ + +.. toctree:: + :maxdepth: 1 + + plugins.md diff --git a/docs/zh_cn/advanced_guides/plugins.md b/docs/zh_cn/advanced_guides/plugins.md index 7fcbc2bf..338d280f 100644 --- a/docs/zh_cn/advanced_guides/plugins.md +++ b/docs/zh_cn/advanced_guides/plugins.md @@ -27,7 +27,7 @@ model = dict( <details open> <summary><b>支持的插件</b></summary> -- [x] [CBAM](mmyolo/models/plugins) +- [x] [CBAM](https://github.com/open-mmlab/mmyolo/blob/dev/mmyolo/models/plugins/cbam.py#L84) - [x] [GeneralizedAttention](https://github.com/open-mmlab/mmcv/blob/2.x/mmcv/cnn/bricks/generalized_attention.py#L13) - [x] [NonLocal2d](https://github.com/open-mmlab/mmcv/blob/2.x/mmcv/cnn/bricks/non_local.py#L250) - [x] [ContextBlock](https://github.com/open-mmlab/mmcv/blob/2.x/mmcv/cnn/bricks/context_block.py#L18) diff --git a/docs/zh_cn/notes/changelog.md b/docs/zh_cn/notes/changelog.md index a1ceb35e..2aac408c 100644 --- a/docs/zh_cn/notes/changelog.md +++ b/docs/zh_cn/notes/changelog.md @@ -1,5 +1,30 @@ # 更新日志 +## v0.1.3(10/11/2022) + +### 新特性 + +1. 支持 CBAM 插件并提供插件文档 (#246) +2. 新增 YOLOv5 P6 模型结构图和相关说明 (#273) + +### Bug 修复 + +1. 基于 mmengine 0.3.1 修复保存最好权重时训练失败问题 +2. 基于 mmdet 3.0.0rc3 修复 `add_dump_metric` 报错 (#253) +3. 修复 backbone 不支持 `init_cfg` 问题 (#272) +4. 基于 mmdet 3.0.0rc3 改变 typing 导入方式 (#261) + +### 完善 + +1. `featmap_vis_demo` 支持文件夹和 url 输入 (#248) +2. 部署 docker 文件完善 (#242) + +### 贡献者 + +总共 10 位开发者参与了本次版本 + +谢谢 @kitecats, @triple-Mu, @RangeKing, @PeterH0323, @Zheng-LinXiao, @tkhe, @weikai520, @zytx121, @wanghonglie, @hhaAndroid + ## v0.1.2(3/11/2022) ### 亮点 diff --git a/docs/zh_cn/overview.md b/docs/zh_cn/overview.md index 37bdab91..1515b038 100644 --- a/docs/zh_cn/overview.md +++ b/docs/zh_cn/overview.md @@ -53,5 +53,6 @@ MMYOLO 文件结构和 MMDetection 完全一致。为了能够充分复用 MMDet - [数据流](https://mmyolo.readthedocs.io/zh_CN/latest/advanced_guides/index.html#id1) - [How to](https://mmyolo.readthedocs.io/zh_CN/latest/advanced_guides/index.html#how-to) + - [插件](https://mmyolo.readthedocs.io/zh_CN/latest/advanced_guides/index.html#id3) 6. [解读文章和资源汇总](article.md) diff --git a/mmyolo/models/plugins/cbam.py b/mmyolo/models/plugins/cbam.py index 512cf21f..0741fe9f 100644 --- a/mmyolo/models/plugins/cbam.py +++ b/mmyolo/models/plugins/cbam.py @@ -10,14 +10,15 @@ from mmyolo.registry import MODELS class ChannelAttention(BaseModule): - """ChannelAttention + """ChannelAttention. + Args: channels (int): The input (and output) channels of the ChannelAttention. reduce_ratio (int): Squeeze ratio in ChannelAttention, the intermediate - channel will be ``int(channels/ratio)``. Default: 16. + channel will be ``int(channels/ratio)``. Defaults to 16. act_cfg (dict): Config dict for activation layer - Default: (dict(type='ReLU'), dict(type='Sigmoid')). + Defaults to dict(type='ReLU'). """ def __init__(self, @@ -57,7 +58,7 @@ class SpatialAttention(BaseModule): """SpatialAttention Args: kernel_size (int): The size of the convolution kernel in - SpatialAttention. Default: 7. + SpatialAttention. Defaults to 7. """ def __init__(self, kernel_size: int = 7): @@ -82,29 +83,27 @@ class SpatialAttention(BaseModule): @MODELS.register_module() class CBAM(BaseModule): - """Convolutional Block Attention Module. + """Convolutional Block Attention Module. arxiv link: + https://arxiv.org/abs/1807.06521v2. - arxiv link: https://arxiv.org/abs/1807.06521v2 Args: in_channels (int): The input (and output) channels of the CBAM. reduce_ratio (int): Squeeze ratio in ChannelAttention, the intermediate - channel will be ``int(channels/ratio)``. Default: 16. + channel will be ``int(channels/ratio)``. Defaults to 16. kernel_size (int): The size of the convolution kernel in - SpatialAttention. Default: 7. + SpatialAttention. Defaults to 7. act_cfg (dict): Config dict for activation layer in ChannelAttention - Defaults: dict(type='ReLU'). + Defaults to dict(type='ReLU'). init_cfg (dict or list[dict], optional): Initialization config dict. Defaults to None. """ - def __init__( - self, - in_channels: int, - reduce_ratio: int = 16, - kernel_size: int = 7, - act_cfg: dict = dict(type='ReLU'), - init_cfg: OptMultiConfig = None, - ): + def __init__(self, + in_channels: int, + reduce_ratio: int = 16, + kernel_size: int = 7, + act_cfg: dict = dict(type='ReLU'), + init_cfg: OptMultiConfig = None): super().__init__(init_cfg) self.channel_attention = ChannelAttention( channels=in_channels, reduce_ratio=reduce_ratio, act_cfg=act_cfg) diff --git a/mmyolo/version.py b/mmyolo/version.py index dd6b2919..3d43f2df 100644 --- a/mmyolo/version.py +++ b/mmyolo/version.py @@ -1,6 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. -__version__ = '0.1.2' +__version__ = '0.1.3' from typing import Tuple