From 260509a5741fce3ee83646906b533497b3b8ba05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Haian=20Huang=28=E6=B7=B1=E5=BA=A6=E7=9C=B8=29?=
<1286304229@qq.com>
Date: Tue, 21 Feb 2023 17:19:01 +0800
Subject: [PATCH] [Update] Refactor Docs (#573)
* update get_started
* update
* update
* update
* update
* update
* update
* fix
* fix
* refactor en
* update
* update
* update
---
README.md | 116 +++-
README_zh-CN.md | 36 +-
.../yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py | 52 ++
.../cross-library_application.md | 1 +
docs/en/advanced_guides/how_to.md | 572 ------------------
docs/en/advanced_guides/index.rst | 25 -
docs/en/common_usage/amp_training.md | 1 +
docs/en/common_usage/freeze_layers.md | 28 +
docs/en/common_usage/mim_usage.md | 89 +++
docs/en/common_usage/module_combination.md | 1 +
docs/en/common_usage/multi_necks.md | 37 ++
docs/en/common_usage/output_predictions.md | 40 ++
.../plugins.md | 0
docs/en/common_usage/resume_training.md | 1 +
docs/en/common_usage/set_random_seed.md | 18 +
docs/en/common_usage/set_syncbn.md | 1 +
docs/en/common_usage/specify_device.md | 23 +
docs/en/deploy/index.rst | 16 -
docs/en/get_started.md | 280 ---------
.../15_minutes_instance_segmentation.md | 3 +
.../15_minutes_object_detection.md | 3 +
.../15_minutes_rotated_object_detection.md | 3 +
docs/en/get_started/article.md | 1 +
docs/en/get_started/dependencies.md | 44 ++
docs/en/get_started/installation.md | 123 ++++
docs/en/get_started/overview.md | 1 +
docs/en/index.rst | 114 ++--
docs/en/{community => notes}/code_style.md | 2 +-
docs/en/overview.md | 56 --
.../algorithm_descriptions/index.rst | 9 -
.../rtmdet_description.md | 0
.../yolov5_description.md | 0
.../yolov8_description.md | 0
.../contributing.md | 36 +-
.../recommended_topics/dataset_preparation.md | 1 +
.../deploy/easydeploy_guide.md | 1 +
docs/en/recommended_topics/deploy/index.rst | 16 +
.../deploy/mmdeploy_guide.md} | 0
.../deploy/mmdeploy_yolov5.md} | 10 +-
.../recommended_topics/industry_examples.md | 1 +
.../labeling_to_deployment_tutorials.md} | 0
docs/en/recommended_topics/mm_basics.md | 1 +
.../model_design.md | 0
.../en/recommended_topics/replace_backbone.md | 306 ++++++++++
.../troubleshooting_steps.md | 1 +
.../visualization.md | 53 ++
docs/en/{user_guides => tutorials}/config.md | 2 -
docs/en/tutorials/custom_installation.md | 109 ++++
.../data_flow.md | 2 +-
docs/en/{notes => tutorials}/faq.md | 4 +-
docs/en/useful_tools/browse_coco_json.md | 62 ++
docs/en/useful_tools/browse_dataset.md | 42 ++
docs/en/useful_tools/dataset_analysis.md | 79 +++
docs/en/useful_tools/dataset_converters.md | 55 ++
docs/en/useful_tools/download_dataset.md | 11 +
docs/en/useful_tools/extract_subcoco.md | 60 ++
docs/en/useful_tools/log_analysis.md | 82 +++
docs/en/useful_tools/model_converters.md | 54 ++
docs/en/useful_tools/optimize_anchors.md | 38 ++
docs/en/useful_tools/print_config.md | 20 +
docs/en/useful_tools/vis_scheduler.md | 44 ++
docs/en/user_guides/index.rst | 28 -
docs/en/user_guides/useful_tools.md | 520 ----------------
docs/en/user_guides/yolov5_tutorial.md | 235 -------
docs/zh_cn/common_usage/output_predictions.md | 4 +-
.../15_minutes_object_detection.md | 401 ++++++++----
docs/zh_cn/get_started/article.md | 6 +-
docs/zh_cn/get_started/dependencies.md | 22 +-
docs/zh_cn/get_started/installation.md | 134 +---
docs/zh_cn/get_started/overview.md | 71 ++-
docs/zh_cn/index.rst | 36 +-
docs/zh_cn/notes/code_style.md | 40 +-
.../algorithm_descriptions/index.rst | 0
.../rtmdet_description.md | 0
.../yolov5_description.md | 0
.../yolov6_description.md | 0
.../yolov8_description.md | 0
.../contributing.md | 36 +-
.../dataset_preparation.md | 0
.../deploy/easydeploy_guide.md | 2 +-
.../deploy/index.rst | 9 -
.../deploy/mmdeploy_guide.md | 4 +-
.../deploy/mmdeploy_yolov5.md | 2 +-
.../industry_examples.md | 0
.../labeling_to_deployment_tutorials.md | 0
docs/zh_cn/recommended_topics/mm_basics.md | 1 +
.../model_design.md | 0
.../replace_backbone.md | 274 ++++-----
.../troubleshooting_steps.md | 0
.../visualization.md | 4 +-
docs/zh_cn/tutorials/config.md | 2 +-
docs/zh_cn/tutorials/custom_installation.md | 111 ++++
docs/zh_cn/tutorials/data_flow.md | 2 +-
docs/zh_cn/useful_tools/browse_dataset.md | 2 +-
docs/zh_cn/useful_tools/dataset_converters.md | 2 -
docs/zh_cn/useful_tools/vis_scheduler.md | 2 +-
96 files changed, 2409 insertions(+), 2327 deletions(-)
create mode 100644 configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py
create mode 100644 docs/en/advanced_guides/cross-library_application.md
delete mode 100644 docs/en/advanced_guides/how_to.md
delete mode 100644 docs/en/advanced_guides/index.rst
create mode 100644 docs/en/common_usage/amp_training.md
create mode 100644 docs/en/common_usage/freeze_layers.md
create mode 100644 docs/en/common_usage/mim_usage.md
create mode 100644 docs/en/common_usage/module_combination.md
create mode 100644 docs/en/common_usage/multi_necks.md
create mode 100644 docs/en/common_usage/output_predictions.md
rename docs/en/{advanced_guides => common_usage}/plugins.md (100%)
create mode 100644 docs/en/common_usage/resume_training.md
create mode 100644 docs/en/common_usage/set_random_seed.md
create mode 100644 docs/en/common_usage/set_syncbn.md
create mode 100644 docs/en/common_usage/specify_device.md
delete mode 100644 docs/en/deploy/index.rst
delete mode 100644 docs/en/get_started.md
create mode 100644 docs/en/get_started/15_minutes_instance_segmentation.md
create mode 100644 docs/en/get_started/15_minutes_object_detection.md
create mode 100644 docs/en/get_started/15_minutes_rotated_object_detection.md
create mode 100644 docs/en/get_started/article.md
create mode 100644 docs/en/get_started/dependencies.md
create mode 100644 docs/en/get_started/installation.md
create mode 100644 docs/en/get_started/overview.md
rename docs/en/{community => notes}/code_style.md (89%)
delete mode 100644 docs/en/overview.md
rename docs/en/{ => recommended_topics}/algorithm_descriptions/index.rst (67%)
rename docs/en/{ => recommended_topics}/algorithm_descriptions/rtmdet_description.md (100%)
rename docs/en/{ => recommended_topics}/algorithm_descriptions/yolov5_description.md (100%)
rename docs/en/{ => recommended_topics}/algorithm_descriptions/yolov8_description.md (100%)
rename docs/en/{community => recommended_topics}/contributing.md (96%)
create mode 100644 docs/en/recommended_topics/dataset_preparation.md
create mode 100644 docs/en/recommended_topics/deploy/easydeploy_guide.md
create mode 100644 docs/en/recommended_topics/deploy/index.rst
rename docs/en/{deploy/basic_deployment_guide.md => recommended_topics/deploy/mmdeploy_guide.md} (100%)
rename docs/en/{deploy/yolov5_deployment.md => recommended_topics/deploy/mmdeploy_yolov5.md} (97%)
create mode 100644 docs/en/recommended_topics/industry_examples.md
rename docs/en/{user_guides/custom_dataset.md => recommended_topics/labeling_to_deployment_tutorials.md} (100%)
create mode 100644 docs/en/recommended_topics/mm_basics.md
rename docs/en/{algorithm_descriptions => recommended_topics}/model_design.md (100%)
create mode 100644 docs/en/recommended_topics/replace_backbone.md
create mode 100644 docs/en/recommended_topics/troubleshooting_steps.md
rename docs/en/{user_guides => recommended_topics}/visualization.md (90%)
rename docs/en/{user_guides => tutorials}/config.md (99%)
create mode 100644 docs/en/tutorials/custom_installation.md
rename docs/en/{advanced_guides => tutorials}/data_flow.md (99%)
rename docs/en/{notes => tutorials}/faq.md (81%)
create mode 100644 docs/en/useful_tools/browse_coco_json.md
create mode 100644 docs/en/useful_tools/browse_dataset.md
create mode 100644 docs/en/useful_tools/dataset_analysis.md
create mode 100644 docs/en/useful_tools/dataset_converters.md
create mode 100644 docs/en/useful_tools/download_dataset.md
create mode 100644 docs/en/useful_tools/extract_subcoco.md
create mode 100644 docs/en/useful_tools/log_analysis.md
create mode 100644 docs/en/useful_tools/model_converters.md
create mode 100644 docs/en/useful_tools/optimize_anchors.md
create mode 100644 docs/en/useful_tools/print_config.md
create mode 100644 docs/en/useful_tools/vis_scheduler.md
delete mode 100644 docs/en/user_guides/index.rst
delete mode 100644 docs/en/user_guides/useful_tools.md
delete mode 100644 docs/en/user_guides/yolov5_tutorial.md
rename docs/zh_cn/{featured_topics => recommended_topics}/algorithm_descriptions/index.rst (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/algorithm_descriptions/rtmdet_description.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/algorithm_descriptions/yolov5_description.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/algorithm_descriptions/yolov6_description.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/algorithm_descriptions/yolov8_description.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/contributing.md (95%)
rename docs/zh_cn/{featured_topics => recommended_topics}/dataset_preparation.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/deploy/easydeploy_guide.md (90%)
rename docs/zh_cn/{featured_topics => recommended_topics}/deploy/index.rst (70%)
rename docs/zh_cn/{featured_topics => recommended_topics}/deploy/mmdeploy_guide.md (98%)
rename docs/zh_cn/{featured_topics => recommended_topics}/deploy/mmdeploy_yolov5.md (99%)
rename docs/zh_cn/{featured_topics => recommended_topics}/industry_examples.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/labeling_to_deployment_tutorials.md (100%)
create mode 100644 docs/zh_cn/recommended_topics/mm_basics.md
rename docs/zh_cn/{featured_topics => recommended_topics}/model_design.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/replace_backbone.md (52%)
rename docs/zh_cn/{featured_topics => recommended_topics}/troubleshooting_steps.md (100%)
rename docs/zh_cn/{featured_topics => recommended_topics}/visualization.md (99%)
create mode 100644 docs/zh_cn/tutorials/custom_installation.md
diff --git a/README.md b/README.md
index ee2d7cba..98d2f964 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@
[](https://github.com/open-mmlab/mmyolo/issues)
[📘Documentation](https://mmyolo.readthedocs.io/en/latest/) |
-[🛠️Installation](https://mmyolo.readthedocs.io/en/latest/get_started.html) |
+[🛠️Installation](https://mmyolo.readthedocs.io/en/latest/get_started/installation.html) |
[👀Model Zoo](https://mmyolo.readthedocs.io/en/latest/model_zoo.html) |
[🆕Update News](https://mmyolo.readthedocs.io/en/latest/notes/changelog.html) |
[🤔Reporting Issues](https://github.com/open-mmlab/mmyolo/issues/new/choose)
@@ -129,13 +129,13 @@ The master branch works with **PyTorch 1.6+**.
The figure above is contributed by RangeKing@GitHub, thank you very much!
-And the figure of P6 model is in [model_design.md](docs/en/algorithm_descriptions/model_design.md).
+And the figure of P6 model is in [model_design.md](docs/en/recommended_topics/model_design.md).
## 🛠️ Installation [🔝](#-table-of-contents)
-MMYOLO relies on PyTorch, MMCV, MMEngine, and MMDetection. Below are quick steps for installation. Please refer to the [Install Guide](docs/en/get_started.md) for more detailed instructions.
+MMYOLO relies on PyTorch, MMCV, MMEngine, and MMDetection. Below are quick steps for installation. Please refer to the [Install Guide](docs/en/get_started/installation.md) for more detailed instructions.
```shell
conda create -n open-mmlab python=3.8 pytorch==1.10.1 torchvision==0.11.2 cudatoolkit=11.3 -c pytorch -y
@@ -160,38 +160,96 @@ The usage of MMYOLO is almost identical to MMDetection and all tutorials are str
For different parts from MMDetection, we have also prepared user guides and advanced guides, please read our [documentation](https://mmyolo.readthedocs.io/zenh_CN/latest/).
-- User Guides
+
+Get Started
- - [Train & Test](https://mmyolo.readthedocs.io/en/latest/user_guides/index.html#train-test)
- - [Learn about Configs with YOLOv5](docs/en/user_guides/config.md)
- - [From getting started to deployment](https://mmyolo.readthedocs.io/en/latest/user_guides/index.html#get-started-to-deployment)
- - [Custom Dataset](docs/en/user_guides/custom_dataset.md)
- - [From getting started to deployment with YOLOv5](docs/en/user_guides/yolov5_tutorial.md)
- - [Useful Tools](https://mmdetection.readthedocs.io/en/latest/user_guides/index.html#useful-tools)
- - [Visualization](docs/en/user_guides/visualization.md)
- - [Useful Tools](docs/en/user_guides/useful_tools.md)
+- [Overview](docs/en/get_started/overview.md)
+- [Dependencies](docs/en/get_started/dependencies.md)
+- [Installation](docs/en/get_started/installation.md)
+- [15 minutes object detection](docs/en/get_started/15_minutes_object_detection.md)
+- [15 minutes rotated object detection](docs/en/get_started/15_minutes_rotated_object_detection.md)
+- [15 minutes instance segmentation](docs/en/get_started/15_minutes_instance_segmentation.md)
+- [Resources summary](docs/en/get_started/article.md)
-- Algorithm description
+
- - [Essential Basics](https://mmyolo.readthedocs.io/en/latest/algorithm_descriptions/index.html#essential-basics)
- - [Model design-related instructions](docs/en/algorithm_descriptions/model_design.md)
- - [Algorithm principles and implementation](https://mmyolo.readthedocs.io/en/latest/algorithm_descriptions/index.html#algorithm-principles-and-implementation)
- - [Algorithm principles and implementation with YOLOv5](docs/en/algorithm_descriptions/yolov5_description.md)
- - [Algorithm principles and implementation with RTMDet](docs/en/algorithm_descriptions/rtmdet_description.md)
- - [Algorithm principles and implementation with YOLOv8](docs/en/algorithm_descriptions/yolov8_description.md)
+
+Recommended Topics
-- Deployment Guides
+- [How to contribute code to MMYOLO](docs/en/recommended_topics/contributing.md)
+- [MMYOLO model design](docs/en/recommended_topics/model_design.md)
+- [Algorithm principles and implementation](docs/en/recommended_topics/algorithm_descriptions/)
+- [Replace the backbone network](docs/en/recommended_topics/replace_backbone.md)
+- [Annotation-to-deployment workflow for custom dataset](docs/en/recommended_topics/labeling_to_deployment_tutorials.md)
+- [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)
+- [MM series repo essential basics](docs/en/recommended_topics/mm_basics.md)
+- [Dataset preparation and description](docs/en/recommended_topics/dataset_preparation.md)
- - [Basic Deployment Guide](https://mmyolo.readthedocs.io/en/latest/deploy/index.html#basic-deployment-guide)
- - [Basic Deployment Guide](docs/en/deploy/basic_deployment_guide.md)
- - [Deployment Tutorial](https://mmyolo.readthedocs.io/en/latest/deploy/index.html#deployment-tutorial)
- - [YOLOv5 Deployment](docs/en/deploy/yolov5_deployment.md)
+
-- Advanced Guides
+
+Common Usage
- - [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)
+- [Resume training](docs/en/common_usage/resume_training.md)
+- [Enabling and disabling SyncBatchNorm](docs/en/common_usage/syncbn.md)
+- [Enabling AMP](docs/en/common_usage/amp_training.md)
+- [Add plugins to the backbone network](docs/en/common_usage/plugins.md)
+- [Freeze layers](docs/en/common_usage/common_usage/freeze_layers.md)
+- [Output model predictions](docs/en/common_usage/output_predictions.md)
+- [Set random seed](docs/en/common_usage/set_random_seed.md)
+- [Module combination](docs/en/common_usage/module_combination.md)
+- [Cross-library calls using mim](docs/en/common_usage/mim_usage.md)
+- [Apply multiple Necks](docs/en/common_usage/multi_necks.md)
+- [Specify specific device training or inference](docs/en/common_usage/specify_device.md)
+
+
+
+
+Useful Tools
+
+- [Browse coco json](docs/en/useful_tools/browse_coco_json.md)
+- [Browse dataset](docs/en/useful_tools/browse_dataset.md)
+- [Print config](docs/en/useful_tools/print_config.md)
+- [Dataset analysis](docs/en/useful_tools/dataset_analysis.md)
+- [Optimize anchors](docs/en/useful_tools/optimize_anchors.md)
+- [Extract subcoco](docs/en/useful_tools/extract_subcoco.md)
+- [Visualization scheduler](docs/en/useful_tools/vis_scheduler.md)
+- [Dataset converters](docs/en/useful_tools/dataset_converters.md)
+- [Download dataset](docs/en/useful_tools/download_dataset.md)
+- [Log analysis](docs/en/useful_tools/log_analysis.md)
+- [Model converters](docs/en/useful_tools/model_converters.md)
+
+
+
+
+Basic Tutorials
+
+- [Learn about configs with YOLOv5](docs/en/tutorials/config.md)
+- [Data flow](docs/en/tutorials/data_flow.md)
+- [Custom Installation](docs/en/tutorials/custom_installation.md)
+- [FAQ](docs/en/tutorials/faq.md)
+
+
+
+
+Advanced Tutorials
+
+- [MMYOLO cross-library application](docs/en/advanced_guides/cross-library_application.md)
+
+
+
+
+Descriptions
+
+- [Changelog](docs/en/notes/changelog.md)
+- [Compatibility](docs/en/notes/compatibility.md)
+- [Conventions](docs/en/notes/conventions.md)
+- [Code Style](docs/en/notes/code_style.md)
+
+
## 📊 Overview of Benchmark and Model Zoo [🔝](#-table-of-contents)
@@ -276,7 +334,7 @@ Results and models are available in the [model zoo](docs/en/model_zoo.md).
## ❓ FAQ [🔝](#-table-of-contents)
-Please refer to the [FAQ](docs/en/notes/faq.md) for frequently asked questions.
+Please refer to the [FAQ](docs/en/tutorials/faq.md) for frequently asked questions.
## 🙌 Contributing [🔝](#-table-of-contents)
diff --git a/README_zh-CN.md b/README_zh-CN.md
index 991dc6c5..4c9c5201 100644
--- a/README_zh-CN.md
+++ b/README_zh-CN.md
@@ -150,7 +150,7 @@ MMYOLO 是一个基于 PyTorch 和 MMDetection 的 YOLO 系列算法开源工具
图为 RangeKing@GitHub 提供,非常感谢!
-P6 模型图详见 [model_design.md](docs/zh_cn/featured_topics/model_design.md)。
+P6 模型图详见 [model_design.md](docs/zh_cn/recommended_topics/model_design.md)。
@@ -197,16 +197,17 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也
推荐专题
-- [如何给 MMYOLO 贡献代码](docs/zh_cn/featured_topics/contributing.md)
-- [MMYOLO 模型结构设计](docs/zh_cn/featured_topics/model_design.md)
-- [MMYOLO 产业范例介绍](docs/zh_cn/featured_topics/industry_examples.md)
-- [数据集准备和说明](docs/zh_cn/featured_topics/dataset_preparation.md)
-- [原理和实现全解析](docs/zh_cn/featured_topics/algorithm_descriptions/)
-- [轻松更换主干网络](docs/zh_cn/featured_topics/replace_backbone.md)
-- [标注+训练+测试+部署全流程](docs/zh_cn/featured_topics/labeling_to_deployment_tutorials.md)
-- [关于可视化的一切](docs/zh_cn/featured_topics/visualization.md)
-- [模型部署流程](docs/zh_cn/featured_topics/deploy/)
-- [常见错误排查步骤](docs/zh_cn/featured_topics/troubleshooting_steps.md)
+- [如何给 MMYOLO 贡献代码](docs/zh_cn/recommended_topics/contributing.md)
+- [MMYOLO 模型结构设计](docs/zh_cn/recommended_topics/model_design.md)
+- [原理和实现全解析](docs/zh_cn/recommended_topics/algorithm_descriptions/)
+- [轻松更换主干网络](docs/zh_cn/recommended_topics/replace_backbone.md)
+- [标注+训练+测试+部署全流程](docs/zh_cn/recommended_topics/labeling_to_deployment_tutorials.md)
+- [关于可视化的一切](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)
+- [MM 系列 Repo 必备基础](docs/zh_cn/recommended_topics/mm_basics.md)
+- [数据集准备和说明](docs/zh_cn/recommended_topics/dataset_preparation.md)
@@ -220,10 +221,10 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也
- [冻结指定网络层权重](docs/zh_cn/common_usage/common_usage/freeze_layers.md)
- [输出模型预测结果](docs/zh_cn/common_usage/output_predictions.md)
- [设置随机种子](docs/zh_cn/common_usage/set_random_seed.md)
+- [算法组合替换教程](docs/zh_cn/common_usage/module_combination.md)
- [使用 mim 跨库调用其他 OpenMMLab 仓库的脚本](docs/zh_cn/common_usage/mim_usage.md)
- [应用多个 Neck](docs/zh_cn/common_usage/multi_necks.md)
- [指定特定设备训练或推理](docs/zh_cn/common_usage/specify_device.md)
-- [算法组合替换教程](docs/zh_cn/common_usage/module_combination.md)
@@ -232,15 +233,15 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也
- [可视化 COCO 标签](docs/zh_cn/useful_tools/browse_coco_json.md)
- [可视化数据集](docs/zh_cn/useful_tools/browse_dataset.md)
+- [打印完整配置文件](docs/zh_cn/useful_tools/print_config.md)
- [可视化数据集分析结果](docs/zh_cn/useful_tools/dataset_analysis.md)
+- [优化锚框尺寸](docs/zh_cn/useful_tools/optimize_anchors.md)
+- [提取 COCO 子集](docs/zh_cn/useful_tools/extract_subcoco.md)
+- [可视化优化器参数策略](docs/zh_cn/useful_tools/vis_scheduler.md)
- [数据集转换](docs/zh_cn/useful_tools/dataset_converters.md)
- [数据集下载](docs/zh_cn/useful_tools/download_dataset.md)
-- [提取 COCO 子集](docs/zh_cn/useful_tools/extract_subcoco.md)
- [日志分析](docs/zh_cn/useful_tools/log_analysis.md)
- [模型转换](docs/zh_cn/useful_tools/model_converters.md)
-- [优化锚框尺寸](docs/zh_cn/useful_tools/optimize_anchors.md)
-- [打印完整配置文件](docs/zh_cn/useful_tools/print_config.md)
-- [可视化优化器参数策略](docs/zh_cn/useful_tools/vis_scheduler.md)
@@ -249,6 +250,7 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也
- [学习 YOLOv5 配置文件](docs/zh_cn/tutorials/config.md)
- [数据流](docs/zh_cn/tutorials/data_flow.md)
+- [自定义安装](docs/zh_cn/tutorials/custom_installation.md)
- [常见问题](docs/zh_cn/tutorials/faq.md)
@@ -353,7 +355,7 @@ MMYOLO 用法和 MMDetection 几乎一致,所有教程都是通用的,你也
## ❓ 常见问题 [🔝](#-table-of-contents)
-请参考 [FAQ](docs/zh_cn/featured_topics/faq.md) 了解其他用户的常见问题。
+请参考 [FAQ](docs/zh_cn/tutorials/faq.md) 了解其他用户的常见问题。
## 🙌 贡献指南 [🔝](#-table-of-contents)
diff --git a/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py b/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py
new file mode 100644
index 00000000..61c24356
--- /dev/null
+++ b/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py
@@ -0,0 +1,52 @@
+_base_ = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
+
+data_root = './data/cat/'
+class_name = ('cat', )
+num_classes = len(class_name)
+metainfo = dict(classes=class_name, palette=[(20, 220, 60)])
+
+anchors = [
+ [(68, 69), (154, 91), (143, 162)], # P3/8
+ [(242, 160), (189, 287), (391, 207)], # P4/16
+ [(353, 337), (539, 341), (443, 432)] # P5/32
+]
+
+max_epochs = 40
+train_batch_size_per_gpu = 12
+train_num_workers = 4
+
+load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
+
+model = dict(
+ backbone=dict(frozen_stages=4),
+ bbox_head=dict(
+ head_module=dict(num_classes=num_classes),
+ prior_generator=dict(base_sizes=anchors)))
+
+train_dataloader = dict(
+ batch_size=train_batch_size_per_gpu,
+ num_workers=train_num_workers,
+ dataset=dict(
+ data_root=data_root,
+ metainfo=metainfo,
+ ann_file='annotations/trainval.json',
+ data_prefix=dict(img='images/')))
+
+val_dataloader = dict(
+ dataset=dict(
+ metainfo=metainfo,
+ data_root=data_root,
+ ann_file='annotations/trainval.json',
+ data_prefix=dict(img='images/')))
+
+test_dataloader = val_dataloader
+
+val_evaluator = dict(ann_file=data_root + 'annotations/trainval.json')
+test_evaluator = val_evaluator
+
+default_hooks = dict(
+ checkpoint=dict(interval=10, max_keep_ckpts=2, save_best='auto'),
+ param_scheduler=dict(max_epochs=max_epochs),
+ logger=dict(type='LoggerHook', interval=5))
+train_cfg = dict(max_epochs=max_epochs, val_interval=10)
+# visualizer = dict(vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')]) # noqa
diff --git a/docs/en/advanced_guides/cross-library_application.md b/docs/en/advanced_guides/cross-library_application.md
new file mode 100644
index 00000000..271d1290
--- /dev/null
+++ b/docs/en/advanced_guides/cross-library_application.md
@@ -0,0 +1 @@
+# MMYOLO cross-library application
diff --git a/docs/en/advanced_guides/how_to.md b/docs/en/advanced_guides/how_to.md
deleted file mode 100644
index 37a3671f..00000000
--- a/docs/en/advanced_guides/how_to.md
+++ /dev/null
@@ -1,572 +0,0 @@
-# How to xxx
-
-This tutorial collects answers to any `How to xxx with MMYOLO`. Feel free to update this doc if you meet new questions about `How to` and find the answers!
-
-## Add plugins to the backbone network
-
-Please see [Plugins](plugins.md).
-
-## Apply multiple Necks
-
-If you want to stack multiple Necks, you can directly set the Neck parameters in the config. MMYOLO supports concatenating multiple Necks in the form of `List`. You need to ensure that the output channel of the previous Neck matches the input channel of the next Neck. If you need to adjust the number of channels, you can insert the `mmdet.ChannelMapper` module to align the number of channels between multiple Necks. The specific configuration is as follows:
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-deepen_factor = _base_.deepen_factor
-widen_factor = _base_.widen_factor
-model = dict(
- type='YOLODetector',
- neck=[
- dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=[256, 512, 1024],
- out_channels=[256, 512, 1024], # The out_channels is controlled by widen_factor,so the YOLOv5PAFPN's out_channels equls to out_channels * widen_factor
- num_csp_blocks=3,
- norm_cfg=dict(type='BN', momentum=0.03, eps=0.001),
- act_cfg=dict(type='SiLU', inplace=True)),
- dict(
- type='mmdet.ChannelMapper',
- in_channels=[128, 256, 512],
- out_channels=128,
- ),
- dict(
- type='mmdet.DyHead',
- in_channels=128,
- out_channels=256,
- num_blocks=2,
- # disable zero_init_offset to follow official implementation
- zero_init_offset=False)
- ]
- bbox_head=dict(head_module=dict(in_channels=[512,512,512])) # The out_channels is controlled by widen_factor,so the YOLOv5HeadModuled in_channels * widen_factor equals to the last neck's out_channels
-)
-```
-
-## Replace the backbone network
-
-```{note}
-1. When using other backbone networks, you need to ensure that the output channels of the backbone network match the input channels of the neck network.
-2. The configuration files given below only ensure that the training will work correctly, and their training performance may not be optimal. Because some backbones require specific learning rates, optimizers, and other hyperparameters. Related contents will be added in the "Training Tips" section later.
-```
-
-### Use backbone network implemented in MMYOLO
-
-Suppose you want to use `YOLOv6EfficientRep` as the backbone network of `YOLOv5`, the example config is as the following:
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-model = dict(
- backbone=dict(
- type='YOLOv6EfficientRep',
- norm_cfg=dict(type='BN', momentum=0.03, eps=0.001),
- act_cfg=dict(type='ReLU', inplace=True))
-)
-```
-
-### Use backbone network implemented in other OpenMMLab repositories
-
-The model registry in MMYOLO, MMDetection, MMClassification, and MMSegmentation all inherit from the root registry in MMEngine in the OpenMMLab 2.0 system, allowing these repositories to directly use modules already implemented by each other. Therefore, in MMYOLO, users can use backbone networks from MMDetection and MMClassification without reimplementation.
-
-#### Use backbone network implemented in MMDetection
-
-1. Suppose you want to use `ResNet-50` as the backbone network of `YOLOv5`, the example config is as the following:
-
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [512, 1024, 2048]
-
- model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmdet.ResNet', # Using ResNet from mmdet
- depth=50,
- num_stages=4,
- out_indices=(1, 2, 3),
- frozen_stages=1,
- norm_cfg=dict(type='BN', requires_grad=True),
- norm_eval=True,
- style='pytorch',
- init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
- neck=dict(
- type='YOLOv5PAFPN',
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of ResNet-50 output are [512, 1024, 2048], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
- )
- ```
-
-2. Suppose you want to use `SwinTransformer-Tiny` as the backbone network of `YOLOv5`, the example config is as the following:
-
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [192, 384, 768]
- checkpoint_file = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
-
- model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmdet.SwinTransformer', # Using SwinTransformer from mmdet
- embed_dims=96,
- depths=[2, 2, 6, 2],
- num_heads=[3, 6, 12, 24],
- window_size=7,
- mlp_ratio=4,
- qkv_bias=True,
- qk_scale=None,
- drop_rate=0.,
- attn_drop_rate=0.,
- drop_path_rate=0.2,
- patch_norm=True,
- out_indices=(1, 2, 3),
- with_cp=False,
- convert_weights=True,
- init_cfg=dict(type='Pretrained', checkpoint=checkpoint_file)),
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of SwinTransformer-Tiny output are [192, 384, 768], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
- )
- ```
-
-#### Use backbone network implemented in MMClassification
-
-1. Suppose you want to use `ConvNeXt-Tiny` as the backbone network of `YOLOv5`, the example config is as the following:
-
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
- # please run the command, mim install "mmcls>=1.0.0rc2", to install mmcls
- # import mmcls.models to trigger register_module in mmcls
- custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
- checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth' # noqa
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [192, 384, 768]
-
- model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmcls.ConvNeXt', # Using ConvNeXt from mmcls
- arch='tiny',
- out_indices=(1, 2, 3),
- drop_path_rate=0.4,
- layer_scale_init_value=1.0,
- gap_before_final_norm=False,
- init_cfg=dict(
- type='Pretrained', checkpoint=checkpoint_file,
- prefix='backbone.')), # The pre-trained weights of backbone network in MMCls have prefix='backbone.'. The prefix in the keys will be removed so that these weights can be normally loaded.
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of ConvNeXt-Tiny output are [192, 384, 768], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
- )
- ```
-
-2. Suppose you want to use `MobileNetV3-small` as the backbone network of `YOLOv5`, the example config is as the following:
-
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
- # please run the command, mim install "mmcls>=1.0.0rc2", to install mmcls
- # import mmcls.models to trigger register_module in mmcls
- custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
- checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v3/convert/mobilenet_v3_small-8427ecf0.pth' # noqa
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [24, 48, 96]
-
- model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmcls.MobileNetV3', # Using MobileNetV3 from mmcls
- arch='small',
- out_indices=(3, 8, 11), # Modify out_indices
- init_cfg=dict(
- type='Pretrained',
- checkpoint=checkpoint_file,
- prefix='backbone.')), # The pre-trained weights of backbone network in MMCls have prefix='backbone.'. The prefix in the keys will be removed so that these weights can be normally loaded.
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of MobileNetV3 output are [24, 48, 96], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
- )
- ```
-
-#### Use backbone network in `timm` through MMClassification
-
-MMClassification also provides a wrapper for the Py**T**orch **Im**age **M**odels (`timm`) backbone network, users can directly use the backbone network in `timm` through MMClassification. Suppose you want to use `EfficientNet-B1` as the backbone network of `YOLOv5`, the example config is as the following:
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-# please run the command, mim install "mmcls>=1.0.0rc2", to install mmcls
-# and the command, pip install timm, to install timm
-# import mmcls.models to trigger register_module in mmcls
-custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
-
-deepen_factor = _base_.deepen_factor
-widen_factor = 1.0
-channels = [40, 112, 320]
-
-model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmcls.TIMMBackbone', # Using timm from mmcls
- model_name='efficientnet_b1', # Using efficientnet_b1 in timm
- features_only=True,
- pretrained=True,
- out_indices=(2, 3, 4)),
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of EfficientNet-B1 output are [40, 112, 320], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
-)
-```
-
-#### Use backbone network implemented in MMSelfSup
-
-Suppose you want to use `ResNet-50` which is self-supervised trained by `MoCo v3` in MMSelfSup as the backbone network of `YOLOv5`, the example config is as the following:
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-# please run the command, mim install "mmselfsup>=1.0.0rc3", to install mmselfsup
-# import mmselfsup.models to trigger register_module in mmselfsup
-custom_imports = dict(imports=['mmselfsup.models'], allow_failed_imports=False)
-checkpoint_file = 'https://download.openmmlab.com/mmselfsup/1.x/mocov3/mocov3_resnet50_8xb512-amp-coslr-800e_in1k/mocov3_resnet50_8xb512-amp-coslr-800e_in1k_20220927-e043f51a.pth' # noqa
-deepen_factor = _base_.deepen_factor
-widen_factor = 1.0
-channels = [512, 1024, 2048]
-
-model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmselfsup.ResNet',
- depth=50,
- num_stages=4,
- out_indices=(2, 3, 4), # Note: out_indices of ResNet in MMSelfSup are 1 larger than those in MMdet and MMCls
- frozen_stages=1,
- norm_cfg=dict(type='BN', requires_grad=True),
- norm_eval=True,
- style='pytorch',
- init_cfg=dict(type='Pretrained', checkpoint=checkpoint_file)),
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of ResNet-50 output are [512, 1024, 2048], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
-)
-```
-
-#### Don't used pre-training weights
-
-When we replace the backbone network, the model initialization is trained by default loading the pre-training weight of the backbone network. Instead of using the pre-training weights of the backbone network, if you want to train the time model from scratch,
-You can set `init_cfg` in 'backbone' to 'None'. In this case, the backbone network will be initialized with the default initialization method, instead of using the trained pre-training weight.
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-deepen_factor = _base_.deepen_factor
-widen_factor = 1.0
-channels = [512, 1024, 2048]
-
-model = dict(
- backbone=dict(
- _delete_=True, # Delete the backbone field in _base_
- type='mmdet.ResNet', # Using ResNet from mmdet
- depth=50,
- num_stages=4,
- out_indices=(1, 2, 3),
- frozen_stages=1,
- norm_cfg=dict(type='BN', requires_grad=True),
- norm_eval=True,
- style='pytorch',
- init_cfg=None # If init_cfg is set to None, backbone will not be initialized with pre-trained weights
- ),
- neck=dict(
- type='YOLOv5PAFPN',
- widen_factor=widen_factor,
- in_channels=channels, # Note: The 3 channels of ResNet-50 output are [512, 1024, 2048], which do not match the original yolov5-s neck and need to be changed.
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # input channels of head need to be changed accordingly
- widen_factor=widen_factor))
-)
-```
-
-#### Freeze the weight of backbone or neck
-
-In MMYOLO, we can freeze some `stages` of the backbone network by setting `frozen_stages` parameters, so that these `stage` parameters do not participate in model updating.
-It should be noted that `frozen_stages = i` means that all parameters from the initial `stage` to the `i`th `stage` will be frozen. The following is an example of `YOLOv5`. Other algorithms are the same logic.
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-model = dict(
- backbone=dict(
- frozen_stages=1 # Indicates that the parameters in the first stage and all stages before it are frozen
- ))
-```
-
-In addition, it's able to freeze the whole `neck` with the parameter `freeze_all` in MMYOLO. The following is an example of `YOLOv5`. Other algorithms are the same logic.
-
-```python
-_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
-
-model = dict(
- neck=dict(
- freeze_all=True # If freeze_all=True, all parameters of the neck will be frozen
- ))
-```
-
-## Output prediction results
-
-If you want to save the prediction results as a specific file for offline evaluation, MMYOLO currently supports both json and pkl formats.
-
-```{note}
-The json file only save `image_id`, `bbox`, `score` and `category_id`. The json file can be read using the json library.
-The pkl file holds more content than the json file, and also holds information such as the file name and size of the predicted image; the pkl file can be read using the pickle library. The pkl file can be read using the pickle library.
-```
-
-### Output into json file
-
-If you want to output the prediction results as a json file, the command is as follows.
-
-```shell
-python tools/test.py {path_to_config} {path_to_checkpoint} --json-prefix {json_prefix}
-```
-
-The argument after `--json-prefix` should be a filename prefix (no need to enter the `.json` suffix) and can also contain a path. For a concrete example:
-
-```shell
-python tools/test.py configs\yolov5\yolov5_s-v61_syncbn_8xb16-300e_coco.py yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth --json-prefix work_dirs/demo/json_demo
-```
-
-Running the above command will output the `json_demo.bbox.json` file in the `work_dirs/demo` folder.
-
-### Output into pkl file
-
-If you want to output the prediction results as a pkl file, the command is as follows.
-
-```shell
-python tools/test.py {path_to_config} {path_to_checkpoint} --out {path_to_output_file}
-```
-
-The argument after `--out` should be a full filename (**must be** with a `.pkl` or `.pickle` suffix) and can also contain a path. For a concrete example:
-
-```shell
-python tools/test.py configs\yolov5\yolov5_s-v61_syncbn_8xb16-300e_coco.py yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth --out work_dirs/demo/pkl_demo.pkl
-```
-
-Running the above command will output the `pkl_demo.pkl` file in the `work_dirs/demo` folder.
-
-## Use mim to run scripts from other OpenMMLab repositories
-
-```{note}
-1. All script calls across libraries are currently not supported and are being fixed. More examples will be added to this document when the fix is complete. 2.
-2. mAP plotting and average training speed calculation are fixed in the MMDetection dev-3.x branch, which currently needs to be installed via the source code to be run successfully.
-```
-
-## Log Analysis
-
-#### Curve plotting
-
-`tools/analysis_tools/analyze_logs.py` plots loss/mAP curves given a training log file. Run `pip install seaborn` first to install the dependency.
-
-```shell
-mim run mmdet analyze_logs plot_curve \
- ${LOG} \ # path of train log in json format
- [--keys ${KEYS}] \ # the metric that you want to plot, default to 'bbox_mAP'
- [--start-epoch ${START_EPOCH}] # the epoch that you want to start, default to 1
- [--eval-interval ${EVALUATION_INTERVAL}] \ # the evaluation interval when training, default to 1
- [--title ${TITLE}] \ # title of figure
- [--legend ${LEGEND}] \ # legend of each plot, default to None
- [--backend ${BACKEND}] \ # backend of plt, default to None
- [--style ${STYLE}] \ # style of plt, default to 'dark'
- [--out ${OUT_FILE}] # the path of output file
-# [] stands for optional parameters, when actually entering the command line, you do not need to enter []
-```
-
-Examples:
-
-- Plot the classification loss of some run.
-
- ```shell
- mim run mmdet analyze_logs plot_curve \
- yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
- --keys loss_cls \
- --legend loss_cls
- ```
-
-
-
-- Plot the classification and regression loss of some run, and save the figure to a pdf.
-
- ```shell
- mim run mmdet analyze_logs plot_curve \
- yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
- --keys loss_cls loss_bbox \
- --legend loss_cls loss_bbox \
- --out losses_yolov5_s.pdf
- ```
-
-
-
-- Compare the bbox mAP of two runs in the same figure.
-
- ```shell
- mim run mmdet analyze_logs plot_curve \
- yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
- yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739.log.json \
- --keys bbox_mAP \
- --legend yolov5_s yolov5_n \
- --eval-interval 10 # Note that the evaluation interval must be the same as during training. Otherwise, it will raise an error.
- ```
-
-
-
-#### Compute the average training speed
-
-```shell
-mim run mmdet analyze_logs cal_train_time \
- ${LOG} \ # path of train log in json format
- [--include-outliers] # include the first value of every epoch when computing the average time
-```
-
-Examples:
-
-```shell
-mim run mmdet analyze_logs cal_train_time \
- yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json
-```
-
-The output is expected to be like the following.
-
-```text
------Analyze train time of yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json-----
-slowest epoch 278, average time is 0.1705 s/iter
-fastest epoch 300, average time is 0.1510 s/iter
-time std over epochs is 0.0026
-average iter time: 0.1556 s/iter
-```
-
-### Print the whole config
-
-`print_config.py` in MMDetection prints the whole config verbatim, expanding all its imports. The command is as following.
-
-```shell
-mim run mmdet print_config \
- ${CONFIG} \ # path of the config file
- [--save-path] \ # save path of whole config, suffixed with .py, .json or .yml
- [--cfg-options ${OPTIONS [OPTIONS...]}] # override some settings in the used config
-```
-
-Examples:
-
-```shell
-mim run mmdet print_config \
- configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- --save-path ./work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
-```
-
-Running the above command will save the `yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py` config file with the inheritance relationship expanded to \`\`yolov5_s-v61_syncbn_fast_1xb4-300e_balloon_whole.py`in the`./work_dirs\` folder.
-
-## Set the random seed
-
-If you want to set the random seed during training, you can use the following command.
-
-```shell
-python ./tools/train.py \
- ${CONFIG} \ # path of the config file
- --cfg-options randomness.seed=2023 \ # set seed to 2023
- [randomness.diff_rank_seed=True] \ # set different seeds according to global rank
- [randomness.deterministic=True] # set the deterministic option for CUDNN backend
-# [] stands for optional parameters, when actually entering the command line, you do not need to enter []
-```
-
-`randomness` has three parameters that can be set, with the following meanings.
-
-- `randomness.seed=2023`, set the random seed to 2023.
-- `randomness.diff_rank_seed=True`, set different seeds according to global rank. Defaults to False.
-- `randomness.deterministic=True`, set the deterministic option for cuDNN backend, i.e., set `torch.backends.cudnn.deterministic` to True and `torch.backends.cudnn.benchmark` to False. Defaults to False. See https://pytorch.org/docs/stable/notes/randomness.html for more details.
-
-## Specify specific GPUs during training or inference
-
-If you have multiple GPUs, such as 8 GPUs, numbered `0, 1, 2, 3, 4, 5, 6, 7`, GPU 0 will be used by default for training or inference. If you want to specify other GPUs for training or inference, you can use the following commands:
-
-```shell
-CUDA_VISIBLE_DEVICES=5 python ./tools/train.py ${CONFIG} #train
-CUDA_VISIBLE_DEVICES=5 python ./tools/test.py ${CONFIG} ${CHECKPOINT_FILE} #test
-```
-
-If you set `CUDA_VISIBLE_DEVICES` to -1 or a number greater than the maximum GPU number, such as 8, the CPU will be used for training or inference.
-
-If you want to use several of these GPUs to train in parallel, you can use the following command:
-
-```shell
-CUDA_VISIBLE_DEVICES=0,1,2,3 ./tools/dist_train.sh ${CONFIG} ${GPU_NUM}
-```
-
-Here the `GPU_NUM` is 4. In addition, if multiple tasks are trained in parallel on one machine and each task requires multiple GPUs, the PORT of each task need to be set differently to avoid communication conflict, like the following commands:
-
-```shell
-CUDA_VISIBLE_DEVICES=0,1,2,3 PORT=29500 ./tools/dist_train.sh ${CONFIG} 4
-CUDA_VISIBLE_DEVICES=4,5,6,7 PORT=29501 ./tools/dist_train.sh ${CONFIG} 4
-```
diff --git a/docs/en/advanced_guides/index.rst b/docs/en/advanced_guides/index.rst
deleted file mode 100644
index bd72cd2e..00000000
--- a/docs/en/advanced_guides/index.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-Data flow
-************************
-
-.. toctree::
- :maxdepth: 1
-
- data_flow.md
-
-
-How to
-************************
-
-.. toctree::
- :maxdepth: 1
-
- how_to.md
-
-
-Plugins
-************************
-
-.. toctree::
- :maxdepth: 1
-
- plugins.md
diff --git a/docs/en/common_usage/amp_training.md b/docs/en/common_usage/amp_training.md
new file mode 100644
index 00000000..3767114a
--- /dev/null
+++ b/docs/en/common_usage/amp_training.md
@@ -0,0 +1 @@
+# Automatic mixed precision(AMP)training
diff --git a/docs/en/common_usage/freeze_layers.md b/docs/en/common_usage/freeze_layers.md
new file mode 100644
index 00000000..4614f324
--- /dev/null
+++ b/docs/en/common_usage/freeze_layers.md
@@ -0,0 +1,28 @@
+# Freeze layers
+
+## Freeze the weight of backbone
+
+In MMYOLO, we can freeze some `stages` of the backbone network by setting `frozen_stages` parameters, so that these `stage` parameters do not participate in model updating.
+It should be noted that `frozen_stages = i` means that all parameters from the initial `stage` to the `i`th `stage` will be frozen. The following is an example of `YOLOv5`. Other algorithms are the same logic.
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+model = dict(
+ backbone=dict(
+ frozen_stages=1 # Indicates that the parameters in the first stage and all stages before it are frozen
+ ))
+```
+
+## Freeze the weight of neck
+
+In addition, it's able to freeze the whole `neck` with the parameter `freeze_all` in MMYOLO. The following is an example of `YOLOv5`. Other algorithms are the same logic.
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+model = dict(
+ neck=dict(
+ freeze_all=True # If freeze_all=True, all parameters of the neck will be frozen
+ ))
+```
diff --git a/docs/en/common_usage/mim_usage.md b/docs/en/common_usage/mim_usage.md
new file mode 100644
index 00000000..2752ea5f
--- /dev/null
+++ b/docs/en/common_usage/mim_usage.md
@@ -0,0 +1,89 @@
+# Use mim to run scripts from other OpenMMLab repositories
+
+```{note}
+1. All script calls across libraries are currently not supported and are being fixed. More examples will be added to this document when the fix is complete. 2.
+2. mAP plotting and average training speed calculation are fixed in the MMDetection dev-3.x branch, which currently needs to be installed via the source code to be run successfully.
+```
+
+## Log Analysis
+
+### Curve plotting
+
+`tools/analysis_tools/analyze_logs.py` plots loss/mAP curves given a training log file. Run `pip install seaborn` first to install the dependency.
+
+```shell
+mim run mmdet analyze_logs plot_curve \
+ ${LOG} \ # path of train log in json format
+ [--keys ${KEYS}] \ # the metric that you want to plot, default to 'bbox_mAP'
+ [--start-epoch ${START_EPOCH}] # the epoch that you want to start, default to 1
+ [--eval-interval ${EVALUATION_INTERVAL}] \ # the evaluation interval when training, default to 1
+ [--title ${TITLE}] \ # title of figure
+ [--legend ${LEGEND}] \ # legend of each plot, default to None
+ [--backend ${BACKEND}] \ # backend of plt, default to None
+ [--style ${STYLE}] \ # style of plt, default to 'dark'
+ [--out ${OUT_FILE}] # the path of output file
+# [] stands for optional parameters, when actually entering the command line, you do not need to enter []
+```
+
+Examples:
+
+- Plot the classification loss of some run.
+
+ ```shell
+ mim run mmdet analyze_logs plot_curve \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
+ --keys loss_cls \
+ --legend loss_cls
+ ```
+
+
+
+- Plot the classification and regression loss of some run, and save the figure to a pdf.
+
+ ```shell
+ mim run mmdet analyze_logs plot_curve \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
+ --keys loss_cls loss_bbox \
+ --legend loss_cls loss_bbox \
+ --out losses_yolov5_s.pdf
+ ```
+
+
+
+- Compare the bbox mAP of two runs in the same figure.
+
+ ```shell
+ mim run mmdet analyze_logs plot_curve \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
+ yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739.log.json \
+ --keys bbox_mAP \
+ --legend yolov5_s yolov5_n \
+ --eval-interval 10 # Note that the evaluation interval must be the same as during training. Otherwise, it will raise an error.
+ ```
+
+
+
+### Compute the average training speed
+
+```shell
+mim run mmdet analyze_logs cal_train_time \
+ ${LOG} \ # path of train log in json format
+ [--include-outliers] # include the first value of every epoch when computing the average time
+```
+
+Examples:
+
+```shell
+mim run mmdet analyze_logs cal_train_time \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json
+```
+
+The output is expected to be like the following.
+
+```text
+-----Analyze train time of yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json-----
+slowest epoch 278, average time is 0.1705 s/iter
+fastest epoch 300, average time is 0.1510 s/iter
+time std over epochs is 0.0026
+average iter time: 0.1556 s/iter
+```
diff --git a/docs/en/common_usage/module_combination.md b/docs/en/common_usage/module_combination.md
new file mode 100644
index 00000000..3f9ffa4c
--- /dev/null
+++ b/docs/en/common_usage/module_combination.md
@@ -0,0 +1 @@
+# Module combination
diff --git a/docs/en/common_usage/multi_necks.md b/docs/en/common_usage/multi_necks.md
new file mode 100644
index 00000000..b6f2bc25
--- /dev/null
+++ b/docs/en/common_usage/multi_necks.md
@@ -0,0 +1,37 @@
+# Apply multiple Necks
+
+If you want to stack multiple Necks, you can directly set the Neck parameters in the config. MMYOLO supports concatenating multiple Necks in the form of `List`. You need to ensure that the output channel of the previous Neck matches the input channel of the next Neck. If you need to adjust the number of channels, you can insert the `mmdet.ChannelMapper` module to align the number of channels between multiple Necks. The specific configuration is as follows:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+deepen_factor = _base_.deepen_factor
+widen_factor = _base_.widen_factor
+model = dict(
+ type='YOLODetector',
+ neck=[
+ dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=[256, 512, 1024],
+ out_channels=[256, 512, 1024], # The out_channels is controlled by widen_factor,so the YOLOv5PAFPN's out_channels equls to out_channels * widen_factor
+ num_csp_blocks=3,
+ norm_cfg=dict(type='BN', momentum=0.03, eps=0.001),
+ act_cfg=dict(type='SiLU', inplace=True)),
+ dict(
+ type='mmdet.ChannelMapper',
+ in_channels=[128, 256, 512],
+ out_channels=128,
+ ),
+ dict(
+ type='mmdet.DyHead',
+ in_channels=128,
+ out_channels=256,
+ num_blocks=2,
+ # disable zero_init_offset to follow official implementation
+ zero_init_offset=False)
+ ]
+ bbox_head=dict(head_module=dict(in_channels=[512,512,512])) # The out_channels is controlled by widen_factor,so the YOLOv5HeadModuled in_channels * widen_factor equals to the last neck's out_channels
+)
+```
diff --git a/docs/en/common_usage/output_predictions.md b/docs/en/common_usage/output_predictions.md
new file mode 100644
index 00000000..57192990
--- /dev/null
+++ b/docs/en/common_usage/output_predictions.md
@@ -0,0 +1,40 @@
+# Output prediction results
+
+If you want to save the prediction results as a specific file for offline evaluation, MMYOLO currently supports both json and pkl formats.
+
+```{note}
+The json file only save `image_id`, `bbox`, `score` and `category_id`. The json file can be read using the json library.
+The pkl file holds more content than the json file, and also holds information such as the file name and size of the predicted image; the pkl file can be read using the pickle library. The pkl file can be read using the pickle library.
+```
+
+## Output into json file
+
+If you want to output the prediction results as a json file, the command is as follows.
+
+```shell
+python tools/test.py {path_to_config} {path_to_checkpoint} --json-prefix {json_prefix}
+```
+
+The argument after `--json-prefix` should be a filename prefix (no need to enter the `.json` suffix) and can also contain a path. For a concrete example:
+
+```shell
+python tools/test.py configs\yolov5\yolov5_s-v61_syncbn_8xb16-300e_coco.py yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth --json-prefix work_dirs/demo/json_demo
+```
+
+Running the above command will output the `json_demo.bbox.json` file in the `work_dirs/demo` folder.
+
+## Output into pkl file
+
+If you want to output the prediction results as a pkl file, the command is as follows.
+
+```shell
+python tools/test.py {path_to_config} {path_to_checkpoint} --out {path_to_output_file}
+```
+
+The argument after `--out` should be a full filename (**must be** with a `.pkl` or `.pickle` suffix) and can also contain a path. For a concrete example:
+
+```shell
+python tools/test.py configs\yolov5\yolov5_s-v61_syncbn_8xb16-300e_coco.py yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth --out work_dirs/demo/pkl_demo.pkl
+```
+
+Running the above command will output the `pkl_demo.pkl` file in the `work_dirs/demo` folder.
diff --git a/docs/en/advanced_guides/plugins.md b/docs/en/common_usage/plugins.md
similarity index 100%
rename from docs/en/advanced_guides/plugins.md
rename to docs/en/common_usage/plugins.md
diff --git a/docs/en/common_usage/resume_training.md b/docs/en/common_usage/resume_training.md
new file mode 100644
index 00000000..d33f1d28
--- /dev/null
+++ b/docs/en/common_usage/resume_training.md
@@ -0,0 +1 @@
+# Resume training
diff --git a/docs/en/common_usage/set_random_seed.md b/docs/en/common_usage/set_random_seed.md
new file mode 100644
index 00000000..c45c165f
--- /dev/null
+++ b/docs/en/common_usage/set_random_seed.md
@@ -0,0 +1,18 @@
+# Set the random seed
+
+If you want to set the random seed during training, you can use the following command.
+
+```shell
+python ./tools/train.py \
+ ${CONFIG} \ # path of the config file
+ --cfg-options randomness.seed=2023 \ # set seed to 2023
+ [randomness.diff_rank_seed=True] \ # set different seeds according to global rank
+ [randomness.deterministic=True] # set the deterministic option for CUDNN backend
+# [] stands for optional parameters, when actually entering the command line, you do not need to enter []
+```
+
+`randomness` has three parameters that can be set, with the following meanings.
+
+- `randomness.seed=2023`, set the random seed to 2023.
+- `randomness.diff_rank_seed=True`, set different seeds according to global rank. Defaults to False.
+- `randomness.deterministic=True`, set the deterministic option for cuDNN backend, i.e., set `torch.backends.cudnn.deterministic` to True and `torch.backends.cudnn.benchmark` to False. Defaults to False. See https://pytorch.org/docs/stable/notes/randomness.html for more details.
diff --git a/docs/en/common_usage/set_syncbn.md b/docs/en/common_usage/set_syncbn.md
new file mode 100644
index 00000000..dba33be6
--- /dev/null
+++ b/docs/en/common_usage/set_syncbn.md
@@ -0,0 +1 @@
+# Enabling and disabling SyncBatchNorm
diff --git a/docs/en/common_usage/specify_device.md b/docs/en/common_usage/specify_device.md
new file mode 100644
index 00000000..72c8017e
--- /dev/null
+++ b/docs/en/common_usage/specify_device.md
@@ -0,0 +1,23 @@
+# Specify specific GPUs during training or inference
+
+If you have multiple GPUs, such as 8 GPUs, numbered `0, 1, 2, 3, 4, 5, 6, 7`, GPU 0 will be used by default for training or inference. If you want to specify other GPUs for training or inference, you can use the following commands:
+
+```shell
+CUDA_VISIBLE_DEVICES=5 python ./tools/train.py ${CONFIG} #train
+CUDA_VISIBLE_DEVICES=5 python ./tools/test.py ${CONFIG} ${CHECKPOINT_FILE} #test
+```
+
+If you set `CUDA_VISIBLE_DEVICES` to -1 or a number greater than the maximum GPU number, such as 8, the CPU will be used for training or inference.
+
+If you want to use several of these GPUs to train in parallel, you can use the following command:
+
+```shell
+CUDA_VISIBLE_DEVICES=0,1,2,3 ./tools/dist_train.sh ${CONFIG} ${GPU_NUM}
+```
+
+Here the `GPU_NUM` is 4. In addition, if multiple tasks are trained in parallel on one machine and each task requires multiple GPUs, the PORT of each task need to be set differently to avoid communication conflict, like the following commands:
+
+```shell
+CUDA_VISIBLE_DEVICES=0,1,2,3 PORT=29500 ./tools/dist_train.sh ${CONFIG} 4
+CUDA_VISIBLE_DEVICES=4,5,6,7 PORT=29501 ./tools/dist_train.sh ${CONFIG} 4
+```
diff --git a/docs/en/deploy/index.rst b/docs/en/deploy/index.rst
deleted file mode 100644
index 6fcfb241..00000000
--- a/docs/en/deploy/index.rst
+++ /dev/null
@@ -1,16 +0,0 @@
-Basic Deployment Guide
-************************
-
-.. toctree::
- :maxdepth: 1
-
- basic_deployment_guide.md
-
-
-Deployment tutorial
-************************
-
-.. toctree::
- :maxdepth: 1
-
- yolov5_deployment.md
diff --git a/docs/en/get_started.md b/docs/en/get_started.md
deleted file mode 100644
index 01c1a716..00000000
--- a/docs/en/get_started.md
+++ /dev/null
@@ -1,280 +0,0 @@
-# Get Started
-
-## Prerequisites
-
-Compatible MMEngine, MMCV and MMDetection versions are shown as below. Please install the correct version to avoid installation issues.
-
-| MMYOLO version | MMDetection version | MMEngine version | MMCV version |
-| :------------: | :----------------------: | :----------------------: | :---------------------: |
-| main | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-| 0.3.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-| 0.2.0 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-| 0.1.3 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-| 0.1.2 | mmdet>=3.0.0rc2, \<3.1.0 | mmengine>=0.3.0, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-| 0.1.1 | mmdet==3.0.0rc1 | mmengine>=0.1.0, \<0.2.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-| 0.1.0 | mmdet==3.0.0rc0 | mmengine>=0.1.0, \<0.2.0 | mmcv>=2.0.0rc0, \<2.1.0 |
-
-In this section, we demonstrate how to prepare an environment with PyTorch.
-
-MMDetection works on Linux, Windows, and macOS. It requires Python 3.7+, CUDA 9.2+, and PyTorch 1.7+.
-
-```{note}
-If you are experienced with PyTorch and have already installed it, just skip this part and jump to the [next section](#installation). Otherwise, you can follow these steps for the preparation.
-```
-
-**Step 0.** Download and install Miniconda from the [official website](https://docs.conda.io/en/latest/miniconda.html).
-
-**Step 1.** Create a conda environment and activate it.
-
-```shell
-conda create --name openmmlab python=3.8 -y
-conda activate openmmlab
-```
-
-**Step 2.** Install PyTorch following [official instructions](https://pytorch.org/get-started/locally/), e.g.
-
-On GPU platforms:
-
-```shell
-conda install pytorch torchvision -c pytorch
-```
-
-On CPU platforms:
-
-```shell
-conda install pytorch torchvision cpuonly -c pytorch
-```
-
-## Installation
-
-### Best Practices
-
-**Step 0.** Install [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv) using [MIM](https://github.com/open-mmlab/mim).
-
-```shell
-pip install -U openmim
-mim install "mmengine>=0.3.1"
-mim install "mmcv>=2.0.0rc1,<2.1.0"
-mim install "mmdet>=3.0.0rc5,<3.1.0"
-```
-
-**Note:**
-
-a. In MMCV-v2.x, `mmcv-full` is rename to `mmcv`, if you want to install `mmcv` without CUDA ops, you can use `mim install "mmcv-lite>=2.0.0rc1"` to install the lite version.
-
-b. If you would like to use albumentations, we suggest using pip install -r requirements/albu.txt or pip install -U albumentations --no-binary qudida,albumentations. If you simply use pip install albumentations==1.0.1, it will install opencv-python-headless simultaneously (even though you have already installed opencv-python). We recommended checking the environment after installing albumentation to ensure that opencv-python and opencv-python-headless are not installed at the same time, because it might cause unexpected issues if they both installed. Please refer to [official documentation](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies) for more details.
-
-**Step 1.** Install MMYOLO.
-
-Case a: If you develop and run mmdet directly, install it from source:
-
-```shell
-git clone https://github.com/open-mmlab/mmyolo.git
-cd mmyolo
-# Install albumentations
-pip install -r requirements/albu.txt
-# Install MMYOLO
-mim install -v -e .
-# "-v" means verbose, or more output
-# "-e" means installing a project in editable mode,
-# thus any local modifications made to the code will take effect without reinstallation.
-```
-
-Case b: If you use MMYOLO as a dependency or third-party package, install it with MIM:
-
-```shell
-mim install "mmyolo"
-```
-
-## Verify the installation
-
-To verify whether MMYOLO is installed correctly, we provide some sample codes to run an inference demo.
-
-**Step 1.** We need to download config and checkpoint files.
-
-```shell
-mim download mmyolo --config yolov5_s-v61_syncbn_fast_8xb16-300e_coco --dest .
-```
-
-The downloading will take several seconds or more, depending on your network environment. When it is done, you will find two files `yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py` and `yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth` in your current folder.
-
-**Step 2.** Verify the inference demo.
-
-Option (a). If you install MMYOLO from source, just run the following command.
-
-```shell
-python demo/image_demo.py demo/demo.jpg \
- yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py \
- yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth
-
-# Optional parameters
-# --out-dir ./output *The detection results are output to the specified directory. When args have action --show, the script do not save results. Default: ./output
-# --device cuda:0 *The computing resources used, including cuda and cpu. Default: cuda:0
-# --show *Display the results on the screen. Default: False
-# --score-thr 0.3 *Confidence threshold. Default: 0.3
-```
-
-You will see a new image on your `output` folder, where bounding boxes are plotted.
-
-Supported input types:
-
-- Single image, include `jpg`, `jpeg`, `png`, `ppm`, `bmp`, `pgm`, `tif`, `tiff`, `webp`.
-- Folder, all image files in the folder will be traversed and the corresponding results will be output.
-- URL, will automatically download from the URL and the corresponding results will be output.
-
-Option (b). If you install MMYOLO with MIM, open your python interpreter and copy&paste the following codes.
-
-```python
-from mmdet.apis import init_detector, inference_detector
-from mmyolo.utils import register_all_modules
-
-register_all_modules()
-config_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
-checkpoint_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth'
-model = init_detector(config_file, checkpoint_file, device='cpu') # or device='cuda:0'
-inference_detector(model, 'demo/demo.jpg')
-```
-
-You will see a list of `DetDataSample`, and the predictions are in the `pred_instance`, indicating the detected bounding boxes, labels, and scores.
-
-### Customize Installation
-
-#### CUDA versions
-
-When installing PyTorch, you need to specify the version of CUDA. If you are not clear on which to choose, follow our recommendations:
-
-- For Ampere-based NVIDIA GPUs, such as GeForce 30 series and NVIDIA A100, CUDA 11 is a must.
-- For older NVIDIA GPUs, CUDA 11 is backward compatible, but CUDA 10.2 offers better compatibility and is more lightweight.
-
-Please make sure the GPU driver satisfies the minimum version requirements. See [this table](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions__table-cuda-toolkit-driver-versions) for more information.
-
-```{note}
-Installing CUDA runtime libraries is enough if you follow our best practices, because no CUDA code will be compiled locally. However, if you hope to compile MMCV from source or develop other CUDA operators, you need to install the complete CUDA toolkit from NVIDIA's [website](https://developer.nvidia.com/cuda-downloads), and its version should match the CUDA version of PyTorch. i.e., the specified version of cudatoolkit in `conda install` command.
-```
-
-#### Install MMEngine without MIM
-
-To install MMEngine with pip instead of MIM, please follow \[MMEngine installation guides\](https://mmengine.readthedocs.io/en/latest/get_started/installation.html).
-
-For example, you can install MMEngine by the following command.
-
-```shell
-pip install "mmengine>=0.3.1"
-```
-
-#### Install MMCV without MIM
-
-MMCV contains C++ and CUDA extensions, thus depending on PyTorch in a complex way. MIM solves such dependencies automatically and makes the installation easier. However, it is not a must.
-
-To install MMCV with pip instead of MIM, please follow [MMCV installation guides](https://mmcv.readthedocs.io/en/2.x/get_started/installation.html). This requires manually specifying a find-url based on the PyTorch version and its CUDA version.
-
-For example, the following command installs MMCV built for PyTorch 1.12.x and CUDA 11.6.
-
-```shell
-pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
-```
-
-#### Install on CPU-only platforms
-
-MMDetection can be built for the CPU-only environment. In CPU mode you can train (requires MMCV version >= `2.0.0rc1`), test, or infer a model.
-
-However, some functionalities are gone in this mode:
-
-- Deformable Convolution
-- Modulated Deformable Convolution
-- ROI pooling
-- Deformable ROI pooling
-- CARAFE
-- SyncBatchNorm
-- CrissCrossAttention
-- MaskedConv2d
-- Temporal Interlace Shift
-- nms_cuda
-- sigmoid_focal_loss_cuda
-- bbox_overlaps
-
-If you try to train/test/infer a model containing the above ops, an error will be raised.
-The following table lists affected algorithms.
-
-| Operator | Model |
-| :-----------------------------------------------------: | :--------------------------------------------------------------------------------------: |
-| Deformable Convolution/Modulated Deformable Convolution | DCN、Guided Anchoring、RepPoints、CentripetalNet、VFNet、CascadeRPN、NAS-FCOS、DetectoRS |
-| MaskedConv2d | Guided Anchoring |
-| CARAFE | CARAFE |
-| SyncBatchNorm | ResNeSt |
-
-#### Install on Google Colab
-
-[Google Colab](https://research.google.com/) usually has PyTorch installed,
-thus we only need to install MMEngine, MMCV, MMDetection, and MMYOLO with the following commands.
-
-**Step 1.** Install [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv) using [MIM](https://github.com/open-mmlab/mim).
-
-```shell
-!pip3 install openmim
-!mim install "mmengine>=0.3.1"
-!mim install "mmcv>=2.0.0rc1,<2.1.0"
-!mim install "mmdet>=3.0.0rc5,<3.1.0"
-```
-
-**Step 2.** Install MMYOLO from the source.
-
-```shell
-!git clone https://github.com/open-mmlab/mmyolo.git
-%cd mmyolo
-!pip install -e .
-```
-
-**Step 3.** Verification.
-
-```python
-import mmyolo
-print(mmyolo.__version__)
-# Example output: 0.1.0, or an another version.
-```
-
-```{note}
-Within Jupyter, the exclamation mark `!` is used to call external executables and `%cd` is a [magic command](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd) to change the current working directory of Python.
-```
-
-#### Using MMYOLO with Docker
-
-We provide a [Dockerfile](https://github.com/open-mmlab/mmyolo/blob/main/docker/Dockerfile) to build an image. Ensure that your [docker version](https://docs.docker.com/engine/install/) >=19.03.
-
-Reminder: If you find out that your download speed is very slow, we suggest that you can canceling the comments in the last two lines of `Optional` in the [Dockerfile](https://github.com/open-mmlab/mmyolo/blob/main/docker/Dockerfile#L19-L20) to obtain a rocket like download speed:
-
-```dockerfile
-# (Optional)
-RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list && \
- pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
-```
-
-Build Command:
-
-```shell
-# build an image with PyTorch 1.9, CUDA 11.1
-# If you prefer other versions, just modified the Dockerfile
-docker build -t mmyolo docker/
-```
-
-Run it with:
-
-```shell
-export DATA_DIR=/path/to/your/dataset
-docker run --gpus all --shm-size=8g -it -v ${DATA_DIR}:/mmyolo/data mmyolo
-```
-
-### Troubleshooting
-
-If you have some issues during the installation, please first view the [FAQ](notes/faq.md) page.
-You may [open an issue](https://github.com/open-mmlab/mmyolo/issues/new/choose) on GitHub if no solution is found.
-
-### Develop using multiple MMYOLO versions
-
-The training and testing scripts have been modified in `PYTHONPATH` to ensure that the scripts use MMYOLO in the current directory.
-
-To have the default MMYOLO installed in your environment instead of what is currently in use, you can remove the code that appears in the relevant script:
-
-```shell
-PYTHONPATH="$(dirname $0)/..":$PYTHONPATH
-```
diff --git a/docs/en/get_started/15_minutes_instance_segmentation.md b/docs/en/get_started/15_minutes_instance_segmentation.md
new file mode 100644
index 00000000..c66a2f28
--- /dev/null
+++ b/docs/en/get_started/15_minutes_instance_segmentation.md
@@ -0,0 +1,3 @@
+# 15 minutes to get started with MMYOLO instance segmentation
+
+TODO
diff --git a/docs/en/get_started/15_minutes_object_detection.md b/docs/en/get_started/15_minutes_object_detection.md
new file mode 100644
index 00000000..37409e5a
--- /dev/null
+++ b/docs/en/get_started/15_minutes_object_detection.md
@@ -0,0 +1,3 @@
+# 15 minutes to get started with MMYOLO object detection
+
+TODO
diff --git a/docs/en/get_started/15_minutes_rotated_object_detection.md b/docs/en/get_started/15_minutes_rotated_object_detection.md
new file mode 100644
index 00000000..6e04c8c0
--- /dev/null
+++ b/docs/en/get_started/15_minutes_rotated_object_detection.md
@@ -0,0 +1,3 @@
+# 15 minutes to get started with MMYOLO rotated object detection
+
+TODO
diff --git a/docs/en/get_started/article.md b/docs/en/get_started/article.md
new file mode 100644
index 00000000..ea28d491
--- /dev/null
+++ b/docs/en/get_started/article.md
@@ -0,0 +1 @@
+# Resources summary
diff --git a/docs/en/get_started/dependencies.md b/docs/en/get_started/dependencies.md
new file mode 100644
index 00000000..d75275f1
--- /dev/null
+++ b/docs/en/get_started/dependencies.md
@@ -0,0 +1,44 @@
+# Prerequisites
+
+Compatible MMEngine, MMCV and MMDetection versions are shown as below. Please install the correct version to avoid installation issues.
+
+| MMYOLO version | MMDetection version | MMEngine version | MMCV version |
+| :------------: | :----------------------: | :----------------------: | :---------------------: |
+| main | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.3.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.2.0 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.1.3 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.1.2 | mmdet>=3.0.0rc2, \<3.1.0 | mmengine>=0.3.0, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.1.1 | mmdet==3.0.0rc1 | mmengine>=0.1.0, \<0.2.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.1.0 | mmdet==3.0.0rc0 | mmengine>=0.1.0, \<0.2.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+
+In this section, we demonstrate how to prepare an environment with PyTorch.
+
+MMDetection works on Linux, Windows, and macOS. It requires Python 3.7+, CUDA 9.2+, and PyTorch 1.7+.
+
+```{note}
+If you are experienced with PyTorch and have already installed it, just skip this part and jump to the [next section](#installation). Otherwise, you can follow these steps for the preparation.
+```
+
+**Step 0.** Download and install Miniconda from the [official website](https://docs.conda.io/en/latest/miniconda.html).
+
+**Step 1.** Create a conda environment and activate it.
+
+```shell
+conda create --name openmmlab python=3.8 -y
+conda activate openmmlab
+```
+
+**Step 2.** Install PyTorch following [official instructions](https://pytorch.org/get-started/locally/), e.g.
+
+On GPU platforms:
+
+```shell
+conda install pytorch torchvision -c pytorch
+```
+
+On CPU platforms:
+
+```shell
+conda install pytorch torchvision cpuonly -c pytorch
+```
diff --git a/docs/en/get_started/installation.md b/docs/en/get_started/installation.md
new file mode 100644
index 00000000..d73bede7
--- /dev/null
+++ b/docs/en/get_started/installation.md
@@ -0,0 +1,123 @@
+# Installation
+
+## Best Practices
+
+**Step 0.** Install [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv) using [MIM](https://github.com/open-mmlab/mim).
+
+```shell
+pip install -U openmim
+mim install "mmengine>=0.3.1"
+mim install "mmcv>=2.0.0rc1,<2.1.0"
+mim install "mmdet>=3.0.0rc5,<3.1.0"
+```
+
+**Note:**
+
+a. In MMCV-v2.x, `mmcv-full` is rename to `mmcv`, if you want to install `mmcv` without CUDA ops, you can use `mim install "mmcv-lite>=2.0.0rc1"` to install the lite version.
+
+b. If you would like to use albumentations, we suggest using pip install -r requirements/albu.txt or pip install -U albumentations --no-binary qudida,albumentations. If you simply use pip install albumentations==1.0.1, it will install opencv-python-headless simultaneously (even though you have already installed opencv-python). We recommended checking the environment after installing albumentation to ensure that opencv-python and opencv-python-headless are not installed at the same time, because it might cause unexpected issues if they both installed. Please refer to [official documentation](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies) for more details.
+
+**Step 1.** Install MMYOLO.
+
+Case a: If you develop and run mmdet directly, install it from source:
+
+```shell
+git clone https://github.com/open-mmlab/mmyolo.git
+cd mmyolo
+# Install albumentations
+pip install -r requirements/albu.txt
+# Install MMYOLO
+mim install -v -e .
+# "-v" means verbose, or more output
+# "-e" means installing a project in editable mode,
+# thus any local modifications made to the code will take effect without reinstallation.
+```
+
+Case b: If you use MMYOLO as a dependency or third-party package, install it with MIM:
+
+```shell
+mim install "mmyolo"
+```
+
+## Verify the installation
+
+To verify whether MMYOLO is installed correctly, we provide some sample codes to run an inference demo.
+
+**Step 1.** We need to download config and checkpoint files.
+
+```shell
+mim download mmyolo --config yolov5_s-v61_syncbn_fast_8xb16-300e_coco --dest .
+```
+
+The downloading will take several seconds or more, depending on your network environment. When it is done, you will find two files `yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py` and `yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth` in your current folder.
+
+**Step 2.** Verify the inference demo.
+
+Option (a). If you install MMYOLO from source, just run the following command.
+
+```shell
+python demo/image_demo.py demo/demo.jpg \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth
+
+# Optional parameters
+# --out-dir ./output *The detection results are output to the specified directory. When args have action --show, the script do not save results. Default: ./output
+# --device cuda:0 *The computing resources used, including cuda and cpu. Default: cuda:0
+# --show *Display the results on the screen. Default: False
+# --score-thr 0.3 *Confidence threshold. Default: 0.3
+```
+
+You will see a new image on your `output` folder, where bounding boxes are plotted.
+
+Supported input types:
+
+- Single image, include `jpg`, `jpeg`, `png`, `ppm`, `bmp`, `pgm`, `tif`, `tiff`, `webp`.
+- Folder, all image files in the folder will be traversed and the corresponding results will be output.
+- URL, will automatically download from the URL and the corresponding results will be output.
+
+Option (b). If you install MMYOLO with MIM, open your python interpreter and copy&paste the following codes.
+
+```python
+from mmdet.apis import init_detector, inference_detector
+from mmyolo.utils import register_all_modules
+
+register_all_modules()
+config_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
+checkpoint_file = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth'
+model = init_detector(config_file, checkpoint_file, device='cpu') # or device='cuda:0'
+inference_detector(model, 'demo/demo.jpg')
+```
+
+You will see a list of `DetDataSample`, and the predictions are in the `pred_instance`, indicating the detected bounding boxes, labels, and scores.
+
+## Using MMYOLO with Docker
+
+We provide a [Dockerfile](https://github.com/open-mmlab/mmyolo/blob/main/docker/Dockerfile) to build an image. Ensure that your [docker version](https://docs.docker.com/engine/install/) >=19.03.
+
+Reminder: If you find out that your download speed is very slow, we suggest that you can canceling the comments in the last two lines of `Optional` in the [Dockerfile](https://github.com/open-mmlab/mmyolo/blob/main/docker/Dockerfile#L19-L20) to obtain a rocket like download speed:
+
+```dockerfile
+# (Optional)
+RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list && \
+ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
+```
+
+Build Command:
+
+```shell
+# build an image with PyTorch 1.9, CUDA 11.1
+# If you prefer other versions, just modified the Dockerfile
+docker build -t mmyolo docker/
+```
+
+Run it with:
+
+```shell
+export DATA_DIR=/path/to/your/dataset
+docker run --gpus all --shm-size=8g -it -v ${DATA_DIR}:/mmyolo/data mmyolo
+```
+
+## Troubleshooting
+
+If you have some issues during the installation, please first view the [FAQ](../tutorials/faq.md) page.
+You may [open an issue](https://github.com/open-mmlab/mmyolo/issues/new/choose) on GitHub if no solution is found.
diff --git a/docs/en/get_started/overview.md b/docs/en/get_started/overview.md
new file mode 100644
index 00000000..07dd0c5c
--- /dev/null
+++ b/docs/en/get_started/overview.md
@@ -0,0 +1 @@
+# Overview
diff --git a/docs/en/index.rst b/docs/en/index.rst
index 123680de..5516b619 100644
--- a/docs/en/index.rst
+++ b/docs/en/index.rst
@@ -1,36 +1,83 @@
Welcome to MMYOLO's documentation!
=======================================
+You can switch between Chinese and English documents in the top-right corner of the layout.
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Get Started
+
+ get_started/overview.md
+ get_started/dependencies.md
+ get_started/installation.md
+ get_started/15_minutes_object_detection.md
+ get_started/15_minutes_rotated_object_detection.md
+ get_started/15_minutes_instance_segmentation.md
+ get_started/article.md
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Recommended Topics
+
+ recommended_topics/contributing.md
+ recommended_topics/model_design.md
+ recommended_topics/algorithm_descriptions/index.rst
+ recommended_topics/replace_backbone.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
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Common Usage
+
+ common_usage/resume_training.md
+ common_usage/syncbn.md
+ common_usage/amp_training.md
+ common_usage/plugins.md
+ common_usage/freeze_layers.md
+ common_usage/output_predictions.md
+ common_usage/set_random_seed.md
+ common_usage/module_combination.md
+ common_usage/mim_usage.md
+ common_usage/multi_necks.md
+ common_usage/specify_device.md
+
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Useful Tools
+
+ useful_tools/browse_coco_json.md
+ useful_tools/browse_dataset.md
+ useful_tools/print_config.md
+ useful_tools/dataset_analysis.md
+ useful_tools/optimize_anchors.md
+ useful_tools/extract_subcoco.md
+ useful_tools/vis_scheduler.md
+ useful_tools/dataset_converters.md
+ useful_tools/download_dataset.md
+ useful_tools/log_analysis.md
+ useful_tools/model_converters.md
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Basic Tutorials
+
+ tutorials/config.md
+ tutorials/data_flow.md
+ tutorials/custom_installation.md
+ tutorials/faq.md
+
.. toctree::
:maxdepth: 1
- :caption: Get Started
+ :caption: Advanced Tutorials
- overview.md
- get_started.md
-
-.. toctree::
- :maxdepth: 2
- :caption: User Guides
-
- user_guides/index.rst
-
-.. toctree::
- :maxdepth: 2
- :caption: Algorithm Descriptions
-
- algorithm_descriptions/index.rst
-
-.. toctree::
- :maxdepth: 2
- :caption: Advanced Guides
-
- advanced_guides/index.rst
-
-.. toctree::
- :maxdepth: 2
- :caption: Deployment Guides
-
- deploy/index.rst
+ advanced_guides/cross-library_application.md
.. toctree::
:maxdepth: 1
@@ -49,24 +96,17 @@ Welcome to MMYOLO's documentation!
:caption: Notes
notes/changelog.md
- notes/faq.md
notes/compatibility.md
notes/conventions.md
+ notes/code_style.md
+
.. toctree::
- :maxdepth: 2
- :caption: Community
-
- community/contributing.md
- community/code_style.md
-
-.. toctree::
- :caption: Switch Languag
+ :caption: Switch Language
switch_language.md
-
Indices and tables
==================
diff --git a/docs/en/community/code_style.md b/docs/en/notes/code_style.md
similarity index 89%
rename from docs/en/community/code_style.md
rename to docs/en/notes/code_style.md
index 08c534ea..3bc8291e 100644
--- a/docs/en/community/code_style.md
+++ b/docs/en/notes/code_style.md
@@ -1,3 +1,3 @@
-## Code Style
+# Code Style
Coming soon. Please refer to [chinese documentation](https://mmyolo.readthedocs.io/zh_CN/latest/community/code_style.html).
diff --git a/docs/en/overview.md b/docs/en/overview.md
deleted file mode 100644
index 339bcfa3..00000000
--- a/docs/en/overview.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Overview
-
-This chapter introduces you to the overall framework of MMYOLO and provides links to detailed tutorials.
-
-## What is MMYOLO
-
-
-

-
-
-MMYOLO is a YOLO series algorithm toolbox, which currently implements only the object detection task and will subsequently support various tasks such as instance segmentation, panoramic segmentation, and key point detection. It includes a rich set of object detection algorithms and related components and modules, and the following is its overall framework.
-
-MMYOLO file structure is identical to the MMDetection. To fully reuse the MMDetection code, MMYOLO includes only custom content, consisting of 3 main parts: `datasets`, `models`, `engine`.
-
-- **datasets** support a variety of data sets for object detection.
- - **transforms** include various data enhancement transforms.
-- **models** are the most important part of the detector, which includes different components of it.
- - **detectors** define all detection model classes.
- - **data_preprocessors** is used to preprocess the dataset of the model.
- - **backbones** include various backbone networks.
- - **necks** include various neck components.
- - **dense_heads** include various dense heads of different tasks.
- - **losses** include various loss functions.
- - **task_modules** provide components for testing tasks, such as assigners, samplers, box coders, and prior generators.
- - **layers** provide some basic network layers.
-- **engine** is a component of running.
- - **optimizers** provide optimizers and packages for optimizers.
- - **hooks** provide hooks for runner.
-
-## How to use this tutorial
-
-The detailed instruction of MMYOLO is as follows.
-
-1. Look up install instructions to [get_started.md](get_started.md).
-
-2. The basic method of how to use MMYOLO can be found here:
-
- - [Training and testing](https://mmyolo.readthedocs.io/en/latest/user_guides/index.html#train-test)
- - [From getting started to deployment tutorial](https://mmyolo.readthedocs.io/en/latest/user_guides/index.html#from-getting-started-to-deployment-tutorial)
- - [Useful Tools](https://mmyolo.readthedocs.io/en/latest/user_guides/index.html#useful-tools)
-
-3. YOLO series of tutorials on algorithm implementation and full analysis:
-
- - [Essential Basics](https://mmyolo.readthedocs.io/en/latest/algorithm_descriptions/index.html#essential-basics)
- - [A full explanation of the model and implementation](https://mmyolo.readthedocs.io/en/latest/algorithm_descriptions/index.html#algorithm-principles-and-implementation)
-
-4. YOLO series of Deploy tutorials
-
- - [Basic Deployment Guide](https://mmyolo.readthedocs.io/en/latest/deploy/index.html#basic-deployment-guide)
- - [Deployment Tutorial](https://mmyolo.readthedocs.io/en/latest/deploy/index.html#deployment-tutorial)
-
-5. Refer to the following tutorials for an in-depth look:
-
- - [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/en/algorithm_descriptions/index.rst b/docs/en/recommended_topics/algorithm_descriptions/index.rst
similarity index 67%
rename from docs/en/algorithm_descriptions/index.rst
rename to docs/en/recommended_topics/algorithm_descriptions/index.rst
index e46cac3f..e51d04cb 100644
--- a/docs/en/algorithm_descriptions/index.rst
+++ b/docs/en/recommended_topics/algorithm_descriptions/index.rst
@@ -1,12 +1,3 @@
-Essential Basics
-********************
-
-.. toctree::
- :maxdepth: 1
-
- model_design.md
-
-
Algorithm principles and implementation
******************************************
diff --git a/docs/en/algorithm_descriptions/rtmdet_description.md b/docs/en/recommended_topics/algorithm_descriptions/rtmdet_description.md
similarity index 100%
rename from docs/en/algorithm_descriptions/rtmdet_description.md
rename to docs/en/recommended_topics/algorithm_descriptions/rtmdet_description.md
diff --git a/docs/en/algorithm_descriptions/yolov5_description.md b/docs/en/recommended_topics/algorithm_descriptions/yolov5_description.md
similarity index 100%
rename from docs/en/algorithm_descriptions/yolov5_description.md
rename to docs/en/recommended_topics/algorithm_descriptions/yolov5_description.md
diff --git a/docs/en/algorithm_descriptions/yolov8_description.md b/docs/en/recommended_topics/algorithm_descriptions/yolov8_description.md
similarity index 100%
rename from docs/en/algorithm_descriptions/yolov8_description.md
rename to docs/en/recommended_topics/algorithm_descriptions/yolov8_description.md
diff --git a/docs/en/community/contributing.md b/docs/en/recommended_topics/contributing.md
similarity index 96%
rename from docs/en/community/contributing.md
rename to docs/en/recommended_topics/contributing.md
index 2c73a768..31858572 100644
--- a/docs/en/community/contributing.md
+++ b/docs/en/recommended_topics/contributing.md
@@ -1,4 +1,4 @@
-## Contributing to OpenMMLab
+# Contributing to OpenMMLab
Welcome to the MMYOLO community, we are committed to building a cutting-edge computer vision foundational library, and all kinds of contributions are welcomed, including but not limited to
@@ -21,11 +21,11 @@ The steps to fix the bug of code implementation are as follows.
You can directly post a pull request to fix documents. If you want to add a document, you should first create an issue to check if it is reasonable.
-### Pull Request Workflow
+## Pull Request Workflow
If you're not familiar with Pull Request, don't worry! The following guidance will tell you how to create a Pull Request step by step. If you want to dive into the development mode of Pull Request, you can refer to the [official documents](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
-#### 1. Fork and clone
+### 1. Fork and clone
If you are posting a pull request for the first time, you should fork the OpenMMLab repositories by clicking the **Fork** button in the top right corner of the GitHub page, and the forked repositories will appear under your GitHub profile.
@@ -57,7 +57,7 @@ upstream git@github.com:open-mmlab/mmyolo (push)
Here's a brief introduction to the origin and upstream. When we use "git clone", we create an "origin" remote by default, which points to the repository cloned from. As for "upstream", we add it ourselves to point to the target repository. Of course, if you don't like the name "upstream", you could name it as you wish. Usually, we'll push the code to "origin". If the pushed code conflicts with the latest code in official("upstream"), we should pull the latest code from upstream to resolve the conflicts, and then push to "origin" again. The posted Pull Request will be updated automatically.
```
-#### 2. Configure pre-commit
+### 2. Configure pre-commit
You should configure [pre-commit](https://pre-commit.com/#intro) in the local development environment to make sure the code style matches that of OpenMMLab. **Note**: The following code should be executed under the MMYOLO directory.
@@ -95,7 +95,7 @@ If we want to commit our code bypassing the pre-commit hook, we can use the `--n
git commit -m "xxx" --no-verify
```
-#### 3. Create a development branch
+### 3. Create a development branch
After configuring the pre-commit, we should create a branch based on the dev branch to develop the new feature or fix the bug. The proposed branch name is `username/pr_name`
@@ -109,7 +109,7 @@ In subsequent development, if the dev branch of the local repository is behind t
git pull upstream dev
```
-#### 4. Commit the code and pass the unit test
+### 4. Commit the code and pass the unit test
- MMYOLO introduces mypy to do static type checking to increase the robustness of the code. Therefore, we need to add Type Hints to our code and pass the mypy check. If you are not familiar with Type Hints, you can refer to [this tutorial](https://docs.python.org/3/library/typing.html).
@@ -127,7 +127,7 @@ git pull upstream dev
- If the documents are modified/added, we should check the rendering result referring to [guidance](#document-rendering)
-#### 5. Push the code to remote
+### 5. Push the code to remote
We could push the local commits to remote after passing through the check of unit test and pre-commit. You can associate the local branch with remote branch by adding `-u` option.
@@ -137,7 +137,7 @@ git push -u origin {branch_name}
This will allow you to use the `git push` command to push code directly next time, without having to specify a branch or the remote repository.
-#### 6. Create a Pull Request
+### 6. Create a Pull Request
(1) Create a pull request in GitHub's Pull request interface
@@ -171,7 +171,7 @@ MMYOLO will run unit test for the posted Pull Request on Linux, based on differe
-#### 7. Resolve conflicts
+### 7. Resolve conflicts
If your local branch conflicts with the latest dev branch of "upstream", you'll need to resolove them. There are two ways to do this:
@@ -189,9 +189,9 @@ git merge upstream/dev
If you are very good at handling conflicts, then you can use rebase to resolve conflicts, as this will keep your commit logs tidy. If you are unfamiliar with `rebase`, you can use `merge` to resolve conflicts.
-### Guidance
+## Guidance
-#### Unit test
+### Unit test
We should also make sure the committed code will not decrease the coverage of unit test, we could run the following command to check the coverage of unit test:
@@ -201,7 +201,7 @@ python -m coverage html
# check file in htmlcov/index.html
```
-#### Document rendering
+### Document rendering
If the documents are modified/added, we should check the rendering result. We could install the dependencies and run the following command to render the documents and check the results:
@@ -213,9 +213,9 @@ make html
# check file in ./docs/zh_cn/_build/html/index.html
```
-### Code style
+## Code style
-#### Python
+### Python
We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style.
@@ -228,17 +228,17 @@ We use the following tools for linting and formatting:
- [mdformat](https://github.com/executablebooks/mdformat): Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files.
- [docformatter](https://github.com/myint/docformatter): A formatter to format docstring.
-Style configurations of yapf and isort can be found in [setup.cfg](./setup.cfg).
+Style configurations of yapf and isort can be found in [setup.cfg](../../../setup.cfg).
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, `markdown files`,
fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirments.txt` automatically on every commit.
-The config for a pre-commit hook is stored in [.pre-commit-config](./.pre-commit-config.yaml).
+The config for a pre-commit hook is stored in [.pre-commit-config](../../../.pre-commit-config.yaml).
-#### C++ and CUDA
+### C++ and CUDA
We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
-### PR Specs
+## PR Specs
1. Use [pre-commit](https://pre-commit.com) hook to avoid issues of code style
diff --git a/docs/en/recommended_topics/dataset_preparation.md b/docs/en/recommended_topics/dataset_preparation.md
new file mode 100644
index 00000000..5c573910
--- /dev/null
+++ b/docs/en/recommended_topics/dataset_preparation.md
@@ -0,0 +1 @@
+# Dataset preparation and description
diff --git a/docs/en/recommended_topics/deploy/easydeploy_guide.md b/docs/en/recommended_topics/deploy/easydeploy_guide.md
new file mode 100644
index 00000000..46fab865
--- /dev/null
+++ b/docs/en/recommended_topics/deploy/easydeploy_guide.md
@@ -0,0 +1 @@
+# EasyDeploy Deployment
diff --git a/docs/en/recommended_topics/deploy/index.rst b/docs/en/recommended_topics/deploy/index.rst
new file mode 100644
index 00000000..f21f353c
--- /dev/null
+++ b/docs/en/recommended_topics/deploy/index.rst
@@ -0,0 +1,16 @@
+MMDeploy deployment tutorial
+********************************
+
+.. toctree::
+ :maxdepth: 1
+
+ mmdeploy_guide.md
+ mmdeploy_yolov5.md
+
+EasyDeploy deployment tutorial
+************************************
+
+.. toctree::
+ :maxdepth: 1
+
+ easydeploy_guide.md
diff --git a/docs/en/deploy/basic_deployment_guide.md b/docs/en/recommended_topics/deploy/mmdeploy_guide.md
similarity index 100%
rename from docs/en/deploy/basic_deployment_guide.md
rename to docs/en/recommended_topics/deploy/mmdeploy_guide.md
diff --git a/docs/en/deploy/yolov5_deployment.md b/docs/en/recommended_topics/deploy/mmdeploy_yolov5.md
similarity index 97%
rename from docs/en/deploy/yolov5_deployment.md
rename to docs/en/recommended_topics/deploy/mmdeploy_yolov5.md
index f0e31967..7eb85b24 100644
--- a/docs/en/deploy/yolov5_deployment.md
+++ b/docs/en/recommended_topics/deploy/mmdeploy_yolov5.md
@@ -1,10 +1,10 @@
# YOLOv5 Deployment
-Please check the [basic_deployment_guide](basic_deployment_guide.md) to get familiar with the configurations.
+Please check the [basic_deployment_guide](mmdeploy_guide.md) to get familiar with the configurations.
## Model Training and Validation
-The details of training and validation can be found at [yolov5_tutorial](../user_guides/yolov5_tutorial.md).
+TODO
## MMDeploy Environment Setup
@@ -75,7 +75,7 @@ codebase_config = dict(
backend_config = dict(type='onnxruntime')
```
-The `post_processing` in the default configuration aligns the accuracy of the current model with the trained `pytorch` model. If you need to modify the relevant parameters, you can refer to the detailed introduction of [dasic_deployment_guide](basic_deployment_guide.md).
+The `post_processing` in the default configuration aligns the accuracy of the current model with the trained `pytorch` model. If you need to modify the relevant parameters, you can refer to the detailed introduction of [dasic_deployment_guide](mmdeploy_guide.md).
To deploy the model to `TensorRT`, please refer to the [`detection_tensorrt_static-640x640.py`](https://github.com/open-mmlab/mmyolo/tree/main/configs/deploy/detection_tensorrt_static-640x640.p).
@@ -283,7 +283,7 @@ After exporting to `TensorRT`, you will get the four files as shown in Figure 2,
After successfully convert the model, you can use `${MMDEPLOY_DIR}/tools/test.py` to evaluate the converted model. The following part shows how to evaluate the static models of `ONNXRuntime` and `TensorRT`. For dynamic model evaluation, please modify the configuration of the inputs.
-#### ONNXRuntime
+### ONNXRuntime
```shell
python3 ${MMDEPLOY_DIR}/tools/test.py \
@@ -298,7 +298,7 @@ Once the process is done, you can get the output results as this:

-#### TensorRT
+### TensorRT
Note: `TensorRT` must run on `CUDA` devices!
diff --git a/docs/en/recommended_topics/industry_examples.md b/docs/en/recommended_topics/industry_examples.md
new file mode 100644
index 00000000..2380143b
--- /dev/null
+++ b/docs/en/recommended_topics/industry_examples.md
@@ -0,0 +1 @@
+# MMYOLO industry examples
diff --git a/docs/en/user_guides/custom_dataset.md b/docs/en/recommended_topics/labeling_to_deployment_tutorials.md
similarity index 100%
rename from docs/en/user_guides/custom_dataset.md
rename to docs/en/recommended_topics/labeling_to_deployment_tutorials.md
diff --git a/docs/en/recommended_topics/mm_basics.md b/docs/en/recommended_topics/mm_basics.md
new file mode 100644
index 00000000..9f23cfe6
--- /dev/null
+++ b/docs/en/recommended_topics/mm_basics.md
@@ -0,0 +1 @@
+# MM series repo essential basics
diff --git a/docs/en/algorithm_descriptions/model_design.md b/docs/en/recommended_topics/model_design.md
similarity index 100%
rename from docs/en/algorithm_descriptions/model_design.md
rename to docs/en/recommended_topics/model_design.md
diff --git a/docs/en/recommended_topics/replace_backbone.md b/docs/en/recommended_topics/replace_backbone.md
new file mode 100644
index 00000000..82d2046b
--- /dev/null
+++ b/docs/en/recommended_topics/replace_backbone.md
@@ -0,0 +1,306 @@
+# Replace the backbone network
+
+```{note}
+1. When using other backbone networks, you need to ensure that the output channels of the backbone network match the input channels of the neck network.
+2. The configuration files given below only ensure that the training will work correctly, and their training performance may not be optimal. Because some backbones require specific learning rates, optimizers, and other hyperparameters. Related contents will be added in the "Training Tips" section later.
+```
+
+## Use backbone network implemented in MMYOLO
+
+Suppose you want to use `YOLOv6EfficientRep` as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+model = dict(
+ backbone=dict(
+ type='YOLOv6EfficientRep',
+ norm_cfg=dict(type='BN', momentum=0.03, eps=0.001),
+ act_cfg=dict(type='ReLU', inplace=True))
+)
+```
+
+## Use backbone network implemented in other OpenMMLab repositories
+
+The model registry in MMYOLO, MMDetection, MMClassification, and MMSegmentation all inherit from the root registry in MMEngine in the OpenMMLab 2.0 system, allowing these repositories to directly use modules already implemented by each other. Therefore, in MMYOLO, users can use backbone networks from MMDetection and MMClassification without reimplementation.
+
+### Use backbone network implemented in MMDetection
+
+1. Suppose you want to use `ResNet-50` as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [512, 1024, 2048]
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmdet.ResNet', # Using ResNet from mmdet
+ depth=50,
+ num_stages=4,
+ out_indices=(1, 2, 3),
+ frozen_stages=1,
+ norm_cfg=dict(type='BN', requires_grad=True),
+ norm_eval=True,
+ style='pytorch',
+ init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of ResNet-50 output are [512, 1024, 2048], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
+
+2. Suppose you want to use `SwinTransformer-Tiny` as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [192, 384, 768]
+checkpoint_file = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmdet.SwinTransformer', # Using SwinTransformer from mmdet
+ embed_dims=96,
+ depths=[2, 2, 6, 2],
+ num_heads=[3, 6, 12, 24],
+ window_size=7,
+ mlp_ratio=4,
+ qkv_bias=True,
+ qk_scale=None,
+ drop_rate=0.,
+ attn_drop_rate=0.,
+ drop_path_rate=0.2,
+ patch_norm=True,
+ out_indices=(1, 2, 3),
+ with_cp=False,
+ convert_weights=True,
+ init_cfg=dict(type='Pretrained', checkpoint=checkpoint_file)),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of SwinTransformer-Tiny output are [192, 384, 768], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
+
+### Use backbone network implemented in MMClassification
+
+1. Suppose you want to use `ConvNeXt-Tiny` as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+# please run the command, mim install "mmcls>=1.0.0rc2", to install mmcls
+# import mmcls.models to trigger register_module in mmcls
+custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
+checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth' # noqa
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [192, 384, 768]
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmcls.ConvNeXt', # Using ConvNeXt from mmcls
+ arch='tiny',
+ out_indices=(1, 2, 3),
+ drop_path_rate=0.4,
+ layer_scale_init_value=1.0,
+ gap_before_final_norm=False,
+ init_cfg=dict(
+ type='Pretrained', checkpoint=checkpoint_file,
+ prefix='backbone.')), # The pre-trained weights of backbone network in MMCls have prefix='backbone.'. The prefix in the keys will be removed so that these weights can be normally loaded.
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of ConvNeXt-Tiny output are [192, 384, 768], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
+
+2. Suppose you want to use `MobileNetV3-small` as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+# please run the command, mim install "mmcls>=1.0.0rc2", to install mmcls
+# import mmcls.models to trigger register_module in mmcls
+custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
+checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v3/convert/mobilenet_v3_small-8427ecf0.pth' # noqa
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [24, 48, 96]
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmcls.MobileNetV3', # Using MobileNetV3 from mmcls
+ arch='small',
+ out_indices=(3, 8, 11), # Modify out_indices
+ init_cfg=dict(
+ type='Pretrained',
+ checkpoint=checkpoint_file,
+ prefix='backbone.')), # The pre-trained weights of backbone network in MMCls have prefix='backbone.'. The prefix in the keys will be removed so that these weights can be normally loaded.
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of MobileNetV3 output are [24, 48, 96], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
+
+### Use backbone network in `timm` through MMClassification
+
+MMClassification also provides a wrapper for the Py**T**orch **Im**age **M**odels (`timm`) backbone network, users can directly use the backbone network in `timm` through MMClassification. Suppose you want to use `EfficientNet-B1` as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+# please run the command, mim install "mmcls>=1.0.0rc2", to install mmcls
+# and the command, pip install timm, to install timm
+# import mmcls.models to trigger register_module in mmcls
+custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
+
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [40, 112, 320]
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmcls.TIMMBackbone', # Using timm from mmcls
+ model_name='efficientnet_b1', # Using efficientnet_b1 in timm
+ features_only=True,
+ pretrained=True,
+ out_indices=(2, 3, 4)),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of EfficientNet-B1 output are [40, 112, 320], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
+
+### Use backbone network implemented in MMSelfSup
+
+Suppose you want to use `ResNet-50` which is self-supervised trained by `MoCo v3` in MMSelfSup as the backbone network of `YOLOv5`, the example config is as the following:
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+# please run the command, mim install "mmselfsup>=1.0.0rc3", to install mmselfsup
+# import mmselfsup.models to trigger register_module in mmselfsup
+custom_imports = dict(imports=['mmselfsup.models'], allow_failed_imports=False)
+checkpoint_file = 'https://download.openmmlab.com/mmselfsup/1.x/mocov3/mocov3_resnet50_8xb512-amp-coslr-800e_in1k/mocov3_resnet50_8xb512-amp-coslr-800e_in1k_20220927-e043f51a.pth' # noqa
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [512, 1024, 2048]
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmselfsup.ResNet',
+ depth=50,
+ num_stages=4,
+ out_indices=(2, 3, 4), # Note: out_indices of ResNet in MMSelfSup are 1 larger than those in MMdet and MMCls
+ frozen_stages=1,
+ norm_cfg=dict(type='BN', requires_grad=True),
+ norm_eval=True,
+ style='pytorch',
+ init_cfg=dict(type='Pretrained', checkpoint=checkpoint_file)),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of ResNet-50 output are [512, 1024, 2048], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
+
+### Don't used pre-training weights
+
+When we replace the backbone network, the model initialization is trained by default loading the pre-training weight of the backbone network. Instead of using the pre-training weights of the backbone network, if you want to train the time model from scratch,
+You can set `init_cfg` in 'backbone' to 'None'. In this case, the backbone network will be initialized with the default initialization method, instead of using the trained pre-training weight.
+
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [512, 1024, 2048]
+
+model = dict(
+ backbone=dict(
+ _delete_=True, # Delete the backbone field in _base_
+ type='mmdet.ResNet', # Using ResNet from mmdet
+ depth=50,
+ num_stages=4,
+ out_indices=(1, 2, 3),
+ frozen_stages=1,
+ norm_cfg=dict(type='BN', requires_grad=True),
+ norm_eval=True,
+ style='pytorch',
+ init_cfg=None # If init_cfg is set to None, backbone will not be initialized with pre-trained weights
+ ),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ widen_factor=widen_factor,
+ in_channels=channels, # Note: The 3 channels of ResNet-50 output are [512, 1024, 2048], which do not match the original yolov5-s neck and need to be changed.
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # input channels of head need to be changed accordingly
+ widen_factor=widen_factor))
+)
+```
diff --git a/docs/en/recommended_topics/troubleshooting_steps.md b/docs/en/recommended_topics/troubleshooting_steps.md
new file mode 100644
index 00000000..60cc1143
--- /dev/null
+++ b/docs/en/recommended_topics/troubleshooting_steps.md
@@ -0,0 +1 @@
+# Troubleshooting steps for common errors
diff --git a/docs/en/user_guides/visualization.md b/docs/en/recommended_topics/visualization.md
similarity index 90%
rename from docs/en/user_guides/visualization.md
rename to docs/en/recommended_topics/visualization.md
index 7835a434..30caa9e1 100644
--- a/docs/en/user_guides/visualization.md
+++ b/docs/en/recommended_topics/visualization.md
@@ -291,3 +291,56 @@ python demo/boxam_vis_demo.py \
+
+## Perform inference on large images
+
+First install [`sahi`](https://github.com/obss/sahi) with:
+
+```shell
+pip install -U sahi>=0.11.4
+```
+
+Perform MMYOLO inference on large images (as satellite imagery) as:
+
+```shell
+wget -P checkpoint https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth
+
+python demo/large_image_demo.py \
+ demo/large_image.jpg \
+ configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py \
+ checkpoint/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth \
+```
+
+Arrange slicing parameters as:
+
+```shell
+python demo/large_image_demo.py \
+ demo/large_image.jpg \
+ configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py \
+ checkpoint/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth \
+ --patch-size 512
+ --patch-overlap-ratio 0.25
+```
+
+Export debug visuals while performing inference on large images as:
+
+```shell
+python demo/large_image_demo.py \
+ demo/large_image.jpg \
+ configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py \
+ checkpoint/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth \
+ --debug
+```
+
+[`sahi`](https://github.com/obss/sahi) citation:
+
+```
+@article{akyon2022sahi,
+ title={Slicing Aided Hyper Inference and Fine-tuning for Small Object Detection},
+ author={Akyon, Fatih Cagatay and Altinuc, Sinan Onur and Temizel, Alptekin},
+ journal={2022 IEEE International Conference on Image Processing (ICIP)},
+ doi={10.1109/ICIP46576.2022.9897990},
+ pages={966-970},
+ year={2022}
+}
+```
diff --git a/docs/en/user_guides/config.md b/docs/en/tutorials/config.md
similarity index 99%
rename from docs/en/user_guides/config.md
rename to docs/en/tutorials/config.md
index 0e0aac44..01937f30 100644
--- a/docs/en/user_guides/config.md
+++ b/docs/en/tutorials/config.md
@@ -427,8 +427,6 @@ model = dict(
Some intermediate variables are used in the configs files, like `train_pipeline` and `test_pipeline` in datasets. It's worth noting that when modifying intermediate variables in the children configs, users need to pass the intermediate variables into corresponding fields again.
For example, we would like to change the `image_scale` during training and add `YOLOv5MixUp` data augmentation, `img_scale/train_pipeline/test_pipeline` are intermediate variables we would like to modify.
-**Notice**: `YOLOv5MixUp` requires adding the `pre_transform` and `mosaic_affine_pipeline` to its `train_pipeline` field. Please refer to [The description of YOLOv5 algorithm and its implementation](../algorithm_descriptions/yolov5_description.md) for detailed processes and diagrams.
-
```python
_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
diff --git a/docs/en/tutorials/custom_installation.md b/docs/en/tutorials/custom_installation.md
new file mode 100644
index 00000000..4aafe6a3
--- /dev/null
+++ b/docs/en/tutorials/custom_installation.md
@@ -0,0 +1,109 @@
+# Customize Installation
+
+## CUDA versions
+
+When installing PyTorch, you need to specify the version of CUDA. If you are not clear on which to choose, follow our recommendations:
+
+- For Ampere-based NVIDIA GPUs, such as GeForce 30 series and NVIDIA A100, CUDA 11 is a must.
+- For older NVIDIA GPUs, CUDA 11 is backward compatible, but CUDA 10.2 offers better compatibility and is more lightweight.
+
+Please make sure the GPU driver satisfies the minimum version requirements. See [this table](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions__table-cuda-toolkit-driver-versions) for more information.
+
+```{note}
+Installing CUDA runtime libraries is enough if you follow our best practices, because no CUDA code will be compiled locally. However, if you hope to compile MMCV from source or develop other CUDA operators, you need to install the complete CUDA toolkit from NVIDIA's [website](https://developer.nvidia.com/cuda-downloads), and its version should match the CUDA version of PyTorch. i.e., the specified version of cudatoolkit in `conda install` command.
+```
+
+## Install MMEngine without MIM
+
+To install MMEngine with pip instead of MIM, please follow \[MMEngine installation guides\](https://mmengine.readthedocs.io/en/latest/get_started/installation.html).
+
+For example, you can install MMEngine by the following command.
+
+```shell
+pip install "mmengine>=0.3.1"
+```
+
+## Install MMCV without MIM
+
+MMCV contains C++ and CUDA extensions, thus depending on PyTorch in a complex way. MIM solves such dependencies automatically and makes the installation easier. However, it is not a must.
+
+To install MMCV with pip instead of MIM, please follow [MMCV installation guides](https://mmcv.readthedocs.io/en/2.x/get_started/installation.html). This requires manually specifying a find-url based on the PyTorch version and its CUDA version.
+
+For example, the following command installs MMCV built for PyTorch 1.12.x and CUDA 11.6.
+
+```shell
+pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
+```
+
+## Install on CPU-only platforms
+
+MMDetection can be built for the CPU-only environment. In CPU mode you can train (requires MMCV version >= `2.0.0rc1`), test, or infer a model.
+
+However, some functionalities are gone in this mode:
+
+- Deformable Convolution
+- Modulated Deformable Convolution
+- ROI pooling
+- Deformable ROI pooling
+- CARAFE
+- SyncBatchNorm
+- CrissCrossAttention
+- MaskedConv2d
+- Temporal Interlace Shift
+- nms_cuda
+- sigmoid_focal_loss_cuda
+- bbox_overlaps
+
+If you try to train/test/infer a model containing the above ops, an error will be raised.
+The following table lists affected algorithms.
+
+| Operator | Model |
+| :-----------------------------------------------------: | :--------------------------------------------------------------------------------------: |
+| Deformable Convolution/Modulated Deformable Convolution | DCN、Guided Anchoring、RepPoints、CentripetalNet、VFNet、CascadeRPN、NAS-FCOS、DetectoRS |
+| MaskedConv2d | Guided Anchoring |
+| CARAFE | CARAFE |
+| SyncBatchNorm | ResNeSt |
+
+## Install on Google Colab
+
+[Google Colab](https://research.google.com/) usually has PyTorch installed,
+thus we only need to install MMEngine, MMCV, MMDetection, and MMYOLO with the following commands.
+
+**Step 1.** Install [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv) using [MIM](https://github.com/open-mmlab/mim).
+
+```shell
+!pip3 install openmim
+!mim install "mmengine>=0.3.1"
+!mim install "mmcv>=2.0.0rc1,<2.1.0"
+!mim install "mmdet>=3.0.0rc5,<3.1.0"
+```
+
+**Step 2.** Install MMYOLO from the source.
+
+```shell
+!git clone https://github.com/open-mmlab/mmyolo.git
+%cd mmyolo
+!pip install -e .
+```
+
+**Step 3.** Verification.
+
+```python
+import mmyolo
+print(mmyolo.__version__)
+# Example output: 0.1.0, or an another version.
+```
+
+```{note}
+Within Jupyter, the exclamation mark `!` is used to call external executables and `%cd` is a [magic command](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd) to change the current working directory of Python.
+```
+
+## Develop using multiple MMYOLO versions
+
+The training and testing scripts have been modified in `PYTHONPATH` to ensure that the scripts use MMYOLO in the current directory.
+
+To have the default MMYOLO installed in your environment instead of what is currently in use, you can remove the code that appears in the relevant script:
+
+```shell
+PYTHONPATH="$(dirname $0)/..":$PYTHONPATH
+```
diff --git a/docs/en/advanced_guides/data_flow.md b/docs/en/tutorials/data_flow.md
similarity index 99%
rename from docs/en/advanced_guides/data_flow.md
rename to docs/en/tutorials/data_flow.md
index 161e6179..ab0e2e64 100644
--- a/docs/en/advanced_guides/data_flow.md
+++ b/docs/en/tutorials/data_flow.md
@@ -1,4 +1,4 @@
-## Mixed image data augmentation update
+# Mixed image data augmentation update
Mixed image data augmentation is similar to Mosaic and MixUp, in which the annotation information of multiple images needs to be obtained for fusion during the running process. In the OpenMMLab data augmentation pipeline, other indexes of the dataset are generally not available. In order to achieve the above function, in the YOLOX reproduced in MMDetection, the concept of [MultiImageMixDataset](https://github.com/open-mmlab/mmdetection/blob/master/mmdet/datasets/dataset_wrappers.py#L338) dataset wrapper is proposed.
diff --git a/docs/en/notes/faq.md b/docs/en/tutorials/faq.md
similarity index 81%
rename from docs/en/notes/faq.md
rename to docs/en/tutorials/faq.md
index 2e91bc81..b79f2720 100644
--- a/docs/en/notes/faq.md
+++ b/docs/en/tutorials/faq.md
@@ -2,9 +2,9 @@
We list some common problems many users face and their corresponding solutions here. Feel free to enrich the list if you find any frequent issues and have ways to help others to solve them. If the contents here do not cover your issue, please create an [issue](https://github.com/open-mmlab/mmyolo/issues/new/choose) and make sure you fill in all the required information in the template.
-## Why do we need to launch MMYOLO? Why do we need to open a separate repository instead of putting it directly into MMDetection?
+## Why do we need to launch MMYOLO?
-Since the open source, we have been receiving similar questions from our community partners, and the answers can be summarized in the following three points.
+Why do we need to launch MMYOLO? Why do we need to open a separate repository instead of putting it directly into MMDetection? Since the open source, we have been receiving similar questions from our community partners, and the answers can be summarized in the following three points.
**(1) Unified operation and inference platform**
diff --git a/docs/en/useful_tools/browse_coco_json.md b/docs/en/useful_tools/browse_coco_json.md
new file mode 100644
index 00000000..772b8a56
--- /dev/null
+++ b/docs/en/useful_tools/browse_coco_json.md
@@ -0,0 +1,62 @@
+# Visualize COCO labels
+
+`tools/analysis_tools/browse_coco_json.py` is a script that can visualization to display the COCO label in the picture.
+
+```shell
+python tools/analysis_tools/browse_coco_json.py [--data-root ${DATA_ROOT}] \
+ [--img-dir ${IMG_DIR}] \
+ [--ann-file ${ANN_FILE}] \
+ [--wait-time ${WAIT_TIME}] \
+ [--disp-all] [--category-names CATEGORY_NAMES [CATEGORY_NAMES ...]] \
+ [--shuffle]
+```
+
+If images and labels are in the same folder, you can specify `--data-root` to the folder, and then `--img-dir` and `--ann-file` to specify the relative path of the folder. The code will be automatically spliced.
+If the image and label files are not in the same folder, you do not need to specify `--data-root`, but directly specify `--img-dir` and `--ann-file` of the absolute path.
+
+E.g:
+
+1. Visualize all categories of `COCO` and display all types of annotations such as `bbox` and `mask`:
+
+```shell
+python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
+ --img-dir 'train2017' \
+ --ann-file 'annotations/instances_train2017.json' \
+ --disp-all
+```
+
+If images and labels are not in the same folder, you can use a absolutely path:
+
+```shell
+python tools/analysis_tools/browse_coco_json.py --img-dir '/dataset/image/coco/train2017' \
+ --ann-file '/label/instances_train2017.json' \
+ --disp-all
+```
+
+2. Visualize all categories of `COCO`, and display only the `bbox` type labels, and shuffle the image to show:
+
+```shell
+python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
+ --img-dir 'train2017' \
+ --ann-file 'annotations/instances_train2017.json' \
+ --shuffle
+```
+
+3. Only visualize the `bicycle` and `person` categories of `COCO` and only the `bbox` type labels are displayed:
+
+```shell
+python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
+ --img-dir 'train2017' \
+ --ann-file 'annotations/instances_train2017.json' \
+ --category-names 'bicycle' 'person'
+```
+
+4. Visualize all categories of `COCO`, and display all types of label such as `bbox`, `mask`, and shuffle the image to show:
+
+```shell
+python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
+ --img-dir 'train2017' \
+ --ann-file 'annotations/instances_train2017.json' \
+ --disp-all \
+ --shuffle
+```
diff --git a/docs/en/useful_tools/browse_dataset.md b/docs/en/useful_tools/browse_dataset.md
new file mode 100644
index 00000000..f066d225
--- /dev/null
+++ b/docs/en/useful_tools/browse_dataset.md
@@ -0,0 +1,42 @@
+# Visualize Datasets
+
+`tools/analysis_tools/browse_dataset.py` helps the user to browse a detection dataset (both images and bounding box annotations) visually, or save the image to a designated directory.
+
+```shell
+python tools/analysis_tools/browse_dataset.py ${CONFIG} \
+ [--out-dir ${OUT_DIR}] \
+ [--not-show] \
+ [--show-interval ${SHOW_INTERVAL}]
+```
+
+E,g:
+
+1. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will pop up directly and be saved to the directory `work_dirs/browse_ dataset` at the same time:
+
+```shell
+python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
+ --out-dir 'work_dirs/browse_dataset'
+```
+
+2. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will pop up and display directly. Each picture lasts for `10` seconds. At the same time, it will be saved to the directory `work_dirs/browse_ dataset`:
+
+```shell
+python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
+ --out-dir 'work_dirs/browse_dataset' \
+ --show-interval 10
+```
+
+3. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will pop up and display directly. Each picture lasts for `10` seconds and the picture will not be saved:
+
+```shell
+python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
+ --show-interval 10
+```
+
+4. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will not pop up directly, but only saved to the directory `work_dirs/browse_ dataset`:
+
+```shell
+python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
+ --out-dir 'work_dirs/browse_dataset' \
+ --not-show
+```
diff --git a/docs/en/useful_tools/dataset_analysis.md b/docs/en/useful_tools/dataset_analysis.md
new file mode 100644
index 00000000..c6149e94
--- /dev/null
+++ b/docs/en/useful_tools/dataset_analysis.md
@@ -0,0 +1,79 @@
+# Visualize dataset analysis
+
+`tools/analysis_tools/dataset_analysis.py` help users get the renderings of the four functions, and save the pictures to the `dataset_analysis` folder under the current running directory.
+
+Description of the script's functions:
+
+The data required by each sub function is obtained through the data preparation of `main()`.
+
+Function 1: Generated by the sub function `show_bbox_num` to display the distribution of categories and bbox instances.
+
+
+
+Function 2: Generated by the sub function `show_bbox_wh` to display the width and height distribution of categories and bbox instances.
+
+
+
+Function 3: Generated by the sub function `show_bbox_wh_ratio` to display the width to height ratio distribution of categories and bbox instances.
+
+
+
+Function 3: Generated by the sub function `show_bbox_area` to display the distribution map of category and bbox instance area based on area rules.
+
+
+
+Print List: Generated by the sub function `show_class_list` and `show_data_list`.
+
+
+
+```shell
+python tools/analysis_tools/dataset_analysis.py ${CONFIG} \
+ [--type ${TYPE}] \
+ [--class-name ${CLASS_NAME}] \
+ [--area-rule ${AREA_RULE}] \
+ [--func ${FUNC}] \
+ [--out-dir ${OUT_DIR}]
+```
+
+E,g:
+
+1.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, By default,the data loading type is `train_dataset`, the area rule is `[0,32,96,1e5]`, generate a result graph containing all functions and save the graph to the current running directory `./dataset_analysis` folder:
+
+```shell
+python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py
+```
+
+2.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, change the data loading type from the default `train_dataset` to `val_dataset` through the `--val-dataset` setting:
+
+```shell
+python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
+ --val-dataset
+```
+
+3.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, change the display of all generated classes to specific classes. Take the display of `person` classes as an example:
+
+```shell
+python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
+ --class-name person
+```
+
+4.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, redefine the area rule through `--area-rule` . Take `30 70 125` as an example, the area rule becomes `[0,30,70,125,1e5]`:
+
+```shell
+python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
+ --area-rule 30 70 125
+```
+
+5.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, change the display of four function renderings to only display `Function 1` as an example:
+
+```shell
+python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
+ --func show_bbox_num
+```
+
+6.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, modify the picture saving address to `work_dirs/dataset_analysis`:
+
+```shell
+python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
+ --out-dir work_dirs/dataset_analysis
+```
diff --git a/docs/en/useful_tools/dataset_converters.md b/docs/en/useful_tools/dataset_converters.md
new file mode 100644
index 00000000..72ad968c
--- /dev/null
+++ b/docs/en/useful_tools/dataset_converters.md
@@ -0,0 +1,55 @@
+# Dataset Conversion
+
+The folder `tools/data_converters` currently contains `ballon2coco.py`, `yolo2coco.py`, and `labelme2coco.py` - three dataset conversion tools.
+
+- `ballon2coco.py` converts the `balloon` dataset (this small dataset is for starters only) to COCO format.
+
+```shell
+python tools/dataset_converters/balloon2coco.py
+```
+
+- `yolo2coco.py` converts a dataset from `yolo-style` **.txt** format to COCO format, please use it as follows:
+
+```shell
+python tools/dataset_converters/yolo2coco.py /path/to/the/root/dir/of/your_dataset
+```
+
+Instructions:
+
+1. `image_dir` is the root directory of the yolo-style dataset you need to pass to the script, which should contain `images`, `labels`, and `classes.txt`. `classes.txt` is the class declaration corresponding to the current dataset. One class a line. The structure of the root directory should be formatted as this example shows:
+
+```bash
+.
+└── $ROOT_PATH
+ ├── classes.txt
+ ├── labels
+ │ ├── a.txt
+ │ ├── b.txt
+ │ └── ...
+ ├── images
+ │ ├── a.jpg
+ │ ├── b.png
+ │ └── ...
+ └── ...
+```
+
+2. The script will automatically check if `train.txt`, `val.txt`, and `test.txt` have already existed under `image_dir`. If these files are located, the script will organize the dataset accordingly. Otherwise, the script will convert the dataset into one file. The image paths in these files must be **ABSOLUTE** paths.
+3. By default, the script will create a folder called `annotations` in the `image_dir` directory which stores the converted JSON file. If `train.txt`, `val.txt`, and `test.txt` are not found, the output file is `result.json`. Otherwise, the corresponding JSON file will be generated, named as `train.json`, `val.json`, and `test.json`. The `annotations` folder may look similar to this:
+
+```bash
+.
+└── $ROOT_PATH
+ ├── annotations
+ │ ├── result.json
+ │ └── ...
+ ├── classes.txt
+ ├── labels
+ │ ├── a.txt
+ │ ├── b.txt
+ │ └── ...
+ ├── images
+ │ ├── a.jpg
+ │ ├── b.png
+ │ └── ...
+ └── ...
+```
diff --git a/docs/en/useful_tools/download_dataset.md b/docs/en/useful_tools/download_dataset.md
new file mode 100644
index 00000000..8a3e57ec
--- /dev/null
+++ b/docs/en/useful_tools/download_dataset.md
@@ -0,0 +1,11 @@
+# Download Dataset
+
+`tools/misc/download_dataset.py` supports downloading datasets such as `COCO`, `VOC`, `LVIS` and `Balloon`.
+
+```shell
+python tools/misc/download_dataset.py --dataset-name coco2017
+python tools/misc/download_dataset.py --dataset-name voc2007
+python tools/misc/download_dataset.py --dataset-name voc2012
+python tools/misc/download_dataset.py --dataset-name lvis
+python tools/misc/download_dataset.py --dataset-name balloon [--save-dir ${SAVE_DIR}] [--unzip]
+```
diff --git a/docs/en/useful_tools/extract_subcoco.md b/docs/en/useful_tools/extract_subcoco.md
new file mode 100644
index 00000000..b2c7e06c
--- /dev/null
+++ b/docs/en/useful_tools/extract_subcoco.md
@@ -0,0 +1,60 @@
+# Extracts a subset of COCO
+
+The training dataset of the COCO2017 dataset includes 118K images, and the validation set includes 5K images, which is a relatively large dataset. Loading JSON in debugging or quick verification scenarios will consume more resources and bring slower startup speed.
+
+The `extract_subcoco.py` script provides the ability to extract a specified number/classes/area-size of images. The user can use the `--num-img`, `--classes`, `--area-size` parameter to get a COCO subset of the specified condition of images.
+
+For example, extract images use scripts as follows:
+
+```shell
+python tools/misc/extract_subcoco.py \
+ ${ROOT} \
+ ${OUT_DIR} \
+ --num-img 20 \
+ --classes cat dog person \
+ --area-size small
+```
+
+It gone be extract 20 images, and only includes annotations which belongs to cat(or dog/person) and bbox area size is small, after filter by class and area size, the empty annotation images won't be chosen, guarantee the images be extracted definitely has annotation info.
+
+Currently, only support COCO2017. In the future will support user-defined datasets of standard coco JSON format.
+
+The root path folder format is as follows:
+
+```text
+├── root
+│ ├── annotations
+│ ├── train2017
+│ ├── val2017
+│ ├── test2017
+```
+
+1. Extract 10 training images and 10 validation images using only 5K validation sets.
+
+```shell
+python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --num-img 10
+```
+
+2. Extract 20 training images using the training set and 20 validation images using the validation set.
+
+```shell
+python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --num-img 20 --use-training-set
+```
+
+3. Set the global seed to 1. The default is no setting.
+
+```shell
+python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --num-img 20 --use-training-set --seed 1
+```
+
+4. Extract images by specify classes
+
+```shell
+python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --classes cat dog person
+```
+
+5. Extract images by specify anchor size
+
+```shell
+python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --area-size small
+```
diff --git a/docs/en/useful_tools/log_analysis.md b/docs/en/useful_tools/log_analysis.md
new file mode 100644
index 00000000..6b3e6040
--- /dev/null
+++ b/docs/en/useful_tools/log_analysis.md
@@ -0,0 +1,82 @@
+# Log Analysis
+
+## Curve plotting
+
+`tools/analysis_tools/analyze_logs.py` plots loss/mAP curves given a training log file. Run `pip install seaborn` first to install the dependency.
+
+```shell
+mim run mmdet analyze_logs plot_curve \
+ ${LOG} \ # path of train log in json format
+ [--keys ${KEYS}] \ # the metric that you want to plot, default to 'bbox_mAP'
+ [--start-epoch ${START_EPOCH}] # the epoch that you want to start, default to 1
+ [--eval-interval ${EVALUATION_INTERVAL}] \ # the evaluation interval when training, default to 1
+ [--title ${TITLE}] \ # title of figure
+ [--legend ${LEGEND}] \ # legend of each plot, default to None
+ [--backend ${BACKEND}] \ # backend of plt, default to None
+ [--style ${STYLE}] \ # style of plt, default to 'dark'
+ [--out ${OUT_FILE}] # the path of output file
+# [] stands for optional parameters, when actually entering the command line, you do not need to enter []
+```
+
+Examples:
+
+- Plot the classification loss of some run.
+
+ ```shell
+ mim run mmdet analyze_logs plot_curve \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
+ --keys loss_cls \
+ --legend loss_cls
+ ```
+
+
+
+- Plot the classification and regression loss of some run, and save the figure to a pdf.
+
+ ```shell
+ mim run mmdet analyze_logs plot_curve \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
+ --keys loss_cls loss_bbox \
+ --legend loss_cls loss_bbox \
+ --out losses_yolov5_s.pdf
+ ```
+
+
+
+- Compare the bbox mAP of two runs in the same figure.
+
+ ```shell
+ mim run mmdet analyze_logs plot_curve \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json \
+ yolov5_n-v61_syncbn_fast_8xb16-300e_coco_20220919_090739.log.json \
+ --keys bbox_mAP \
+ --legend yolov5_s yolov5_n \
+ --eval-interval 10 # Note that the evaluation interval must be the same as during training. Otherwise, it will raise an error.
+ ```
+
+
+
+## Compute the average training speed
+
+```shell
+mim run mmdet analyze_logs cal_train_time \
+ ${LOG} \ # path of train log in json format
+ [--include-outliers] # include the first value of every epoch when computing the average time
+```
+
+Examples:
+
+```shell
+mim run mmdet analyze_logs cal_train_time \
+ yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json
+```
+
+The output is expected to be like the following.
+
+```text
+-----Analyze train time of yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700.log.json-----
+slowest epoch 278, average time is 0.1705 s/iter
+fastest epoch 300, average time is 0.1510 s/iter
+time std over epochs is 0.0026
+average iter time: 0.1556 s/iter
+```
diff --git a/docs/en/useful_tools/model_converters.md b/docs/en/useful_tools/model_converters.md
new file mode 100644
index 00000000..09fb52df
--- /dev/null
+++ b/docs/en/useful_tools/model_converters.md
@@ -0,0 +1,54 @@
+# Convert Model
+
+The six scripts under the `tools/model_converters` directory can help users convert the keys in the official pre-trained model of YOLO to the format of MMYOLO, and use MMYOLO to fine-tune the model.
+
+## YOLOv5
+
+Take conversion `yolov5s.pt` as an example:
+
+1. Clone the official YOLOv5 code to the local (currently the maximum supported version is `v6.1`):
+
+```shell
+git clone -b v6.1 https://github.com/ultralytics/yolov5.git
+cd yolov5
+```
+
+2. Download official weight file:
+
+```shell
+wget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5s.pt
+```
+
+3. Copy file `tools/model_converters/yolov5_to_mmyolo.py` to the path of YOLOv5 official code clone:
+
+```shell
+cp ${MMDET_YOLO_PATH}/tools/model_converters/yolov5_to_mmyolo.py yolov5_to_mmyolo.py
+```
+
+4. Conversion
+
+```shell
+python yolov5_to_mmyolo.py --src ${WEIGHT_FILE_PATH} --dst mmyolov5.pt
+```
+
+The converted `mmyolov5.pt` can be used by MMYOLO. The official weight conversion of YOLOv6 is also used in the same way.
+
+## YOLOX
+
+The conversion of YOLOX model **does not need** to download the official YOLOX code, just download the weight.
+
+Take conversion `yolox_s.pth` as an example:
+
+1. Download official weight file:
+
+```shell
+wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth
+```
+
+2. Conversion
+
+```shell
+python tools/model_converters/yolox_to_mmyolo.py --src yolox_s.pth --dst mmyolox.pt
+```
+
+The converted `mmyolox.pt` can be used by MMYOLO.
diff --git a/docs/en/useful_tools/optimize_anchors.md b/docs/en/useful_tools/optimize_anchors.md
new file mode 100644
index 00000000..460bc6e2
--- /dev/null
+++ b/docs/en/useful_tools/optimize_anchors.md
@@ -0,0 +1,38 @@
+# Optimize anchors size
+
+Script `tools/analysis_tools/optimize_anchors.py` supports three methods to optimize YOLO anchors including `k-means`
+anchor cluster, `Differential Evolution` and `v5-k-means`.
+
+## k-means
+
+In k-means method, the distance criteria is based IoU, python shell as follow:
+
+```shell
+python tools/analysis_tools/optimize_anchors.py ${CONFIG} \
+ --algorithm k-means \
+ --input-shape ${INPUT_SHAPE [WIDTH HEIGHT]} \
+ --out-dir ${OUT_DIR}
+```
+
+## Differential Evolution
+
+In differential_evolution method, based differential evolution algorithm, use `avg_iou_cost` as minimum target function, python shell as follow:
+
+```shell
+python tools/analysis_tools/optimize_anchors.py ${CONFIG} \
+ --algorithm DE \
+ --input-shape ${INPUT_SHAPE [WIDTH HEIGHT]} \
+ --out-dir ${OUT_DIR}
+```
+
+## v5-k-means
+
+In v5-k-means method, clustering standard as same with YOLOv5 which use shape-match, python shell as follow:
+
+```shell
+python tools/analysis_tools/optimize_anchors.py ${CONFIG} \
+ --algorithm v5-k-means \
+ --input-shape ${INPUT_SHAPE [WIDTH HEIGHT]} \
+ --prior_match_thr ${PRIOR_MATCH_THR} \
+ --out-dir ${OUT_DIR}
+```
diff --git a/docs/en/useful_tools/print_config.md b/docs/en/useful_tools/print_config.md
new file mode 100644
index 00000000..2a6ee79f
--- /dev/null
+++ b/docs/en/useful_tools/print_config.md
@@ -0,0 +1,20 @@
+# Print the whole config
+
+`print_config.py` in MMDetection prints the whole config verbatim, expanding all its imports. The command is as following.
+
+```shell
+mim run mmdet print_config \
+ ${CONFIG} \ # path of the config file
+ [--save-path] \ # save path of whole config, suffixed with .py, .json or .yml
+ [--cfg-options ${OPTIONS [OPTIONS...]}] # override some settings in the used config
+```
+
+Examples:
+
+```shell
+mim run mmdet print_config \
+ configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
+ --save-path ./work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
+```
+
+Running the above command will save the `yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py` config file with the inheritance relationship expanded to \`\`yolov5_s-v61_syncbn_fast_1xb4-300e_balloon_whole.py`in the`./work_dirs\` folder.
diff --git a/docs/en/useful_tools/vis_scheduler.md b/docs/en/useful_tools/vis_scheduler.md
new file mode 100644
index 00000000..f1526342
--- /dev/null
+++ b/docs/en/useful_tools/vis_scheduler.md
@@ -0,0 +1,44 @@
+# Hyper-parameter Scheduler Visualization
+
+`tools/analysis_tools/vis_scheduler` aims to help the user to check the hyper-parameter scheduler of the optimizer(without training), which support the "learning rate", "momentum", and "weight_decay".
+
+```bash
+python tools/analysis_tools/vis_scheduler.py \
+ ${CONFIG_FILE} \
+ [-p, --parameter ${PARAMETER_NAME}] \
+ [-d, --dataset-size ${DATASET_SIZE}] \
+ [-n, --ngpus ${NUM_GPUs}] \
+ [-o, --out-dir ${OUT_DIR}] \
+ [--title ${TITLE}] \
+ [--style ${STYLE}] \
+ [--window-size ${WINDOW_SIZE}] \
+ [--cfg-options]
+```
+
+**Description of all arguments**:
+
+- `config`: The path of a model config file.
+- **`-p, --parameter`**: The param to visualize its change curve, choose from "lr", "momentum" or "wd". Default to use "lr".
+- **`-d, --dataset-size`**: The size of the datasets. If set,`DATASETS.build` will be skipped and `${DATASET_SIZE}` will be used as the size. Default to use the function `DATASETS.build`.
+- **`-n, --ngpus`**: The number of GPUs used in training, default to be 1.
+- **`-o, --out-dir`**: The output path of the curve plot, default not to output.
+- `--title`: Title of figure. If not set, default to be config file name.
+- `--style`: Style of plt. If not set, default to be `whitegrid`.
+- `--window-size`: The shape of the display window. If not specified, it will be set to `12*7`. If used, it must be in the format `'W*H'`.
+- `--cfg-options`: Modifications to the configuration file, refer to [Learn about Configs](../tutorials/config.md).
+
+```{note}
+Loading annotations maybe consume much time, you can directly specify the size of the dataset with `-d, dataset-size` to save time.
+```
+
+You can use the following command to plot the step learning rate schedule used in the config `configs/rtmdet/rtmdet_s_syncbn_fast_8xb32-300e_coco.py`:
+
+```shell
+python tools/analysis_tools/vis_scheduler.py \
+ configs/rtmdet/rtmdet_s_syncbn_fast_8xb32-300e_coco.py \
+ --dataset-size 118287 \
+ --ngpus 8 \
+ --out-dir ./output
+```
+
+
diff --git a/docs/en/user_guides/index.rst b/docs/en/user_guides/index.rst
deleted file mode 100644
index 50649c96..00000000
--- a/docs/en/user_guides/index.rst
+++ /dev/null
@@ -1,28 +0,0 @@
-Train & Test
-**************
-
-MMYOLO provides a lot of detection models in `Model Zoo `_. This note will show how to perform common tasks on these existing models and standard datasets:
-
-
-.. toctree::
- :maxdepth: 1
-
- config.md
-
-From Getting Started to Deployment tutorial
-***********************************************
-
-.. toctree::
- :maxdepth: 1
-
- custom_dataset.md
- yolov5_tutorial.md
-
-Useful Tools
-************
-
-.. toctree::
- :maxdepth: 1
-
- visualization.md
- useful_tools.md
diff --git a/docs/en/user_guides/useful_tools.md b/docs/en/user_guides/useful_tools.md
deleted file mode 100644
index e38217ff..00000000
--- a/docs/en/user_guides/useful_tools.md
+++ /dev/null
@@ -1,520 +0,0 @@
-# Useful tools
-
-We provide lots of useful tools under the `tools/` directory. In addition, you can also quickly run other open source libraries of OpenMMLab through MIM.
-
-Take MMDetection as an example. If you want to use [print_config.py](https://github.com/open-mmlab/mmdetection/blob/3.x/tools/misc/print_config.py), you can directly use the following commands without copying the source code to the MMYOLO library.
-
-```shell
-mim run mmdet print_config ${CONFIG}
-```
-
-## Visualization
-
-### Visualize COCO labels
-
-`tools/analysis_tools/browse_coco_json.py` is a script that can visualization to display the COCO label in the picture.
-
-```shell
-python tools/analysis_tools/browse_coco_json.py [--data-root ${DATA_ROOT}] \
- [--img-dir ${IMG_DIR}] \
- [--ann-file ${ANN_FILE}] \
- [--wait-time ${WAIT_TIME}] \
- [--disp-all] [--category-names CATEGORY_NAMES [CATEGORY_NAMES ...]] \
- [--shuffle]
-```
-
-If images and labels are in the same folder, you can specify `--data-root` to the folder, and then `--img-dir` and `--ann-file` to specify the relative path of the folder. The code will be automatically spliced.
-If the image and label files are not in the same folder, you do not need to specify `--data-root`, but directly specify `--img-dir` and `--ann-file` of the absolute path.
-
-E.g:
-
-1. Visualize all categories of `COCO` and display all types of annotations such as `bbox` and `mask`:
-
-```shell
-python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
- --img-dir 'train2017' \
- --ann-file 'annotations/instances_train2017.json' \
- --disp-all
-```
-
-If images and labels are not in the same folder, you can use a absolutely path:
-
-```shell
-python tools/analysis_tools/browse_coco_json.py --img-dir '/dataset/image/coco/train2017' \
- --ann-file '/label/instances_train2017.json' \
- --disp-all
-```
-
-2. Visualize all categories of `COCO`, and display only the `bbox` type labels, and shuffle the image to show:
-
-```shell
-python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
- --img-dir 'train2017' \
- --ann-file 'annotations/instances_train2017.json' \
- --shuffle
-```
-
-3. Only visualize the `bicycle` and `person` categories of `COCO` and only the `bbox` type labels are displayed:
-
-```shell
-python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
- --img-dir 'train2017' \
- --ann-file 'annotations/instances_train2017.json' \
- --category-names 'bicycle' 'person'
-```
-
-4. Visualize all categories of `COCO`, and display all types of label such as `bbox`, `mask`, and shuffle the image to show:
-
-```shell
-python tools/analysis_tools/browse_coco_json.py --data-root './data/coco' \
- --img-dir 'train2017' \
- --ann-file 'annotations/instances_train2017.json' \
- --disp-all \
- --shuffle
-```
-
-### Visualize Datasets
-
-`tools/analysis_tools/browse_dataset.py` helps the user to browse a detection dataset (both images and bounding box annotations) visually, or save the image to a designated directory.
-
-```shell
-python tools/analysis_tools/browse_dataset.py ${CONFIG} \
- [--out-dir ${OUT_DIR}] \
- [--not-show] \
- [--show-interval ${SHOW_INTERVAL}]
-```
-
-E,g:
-
-1. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will pop up directly and be saved to the directory `work_dirs/browse_ dataset` at the same time:
-
-```shell
-python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
- --out-dir 'work_dirs/browse_dataset'
-```
-
-2. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will pop up and display directly. Each picture lasts for `10` seconds. At the same time, it will be saved to the directory `work_dirs/browse_ dataset`:
-
-```shell
-python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
- --out-dir 'work_dirs/browse_dataset' \
- --show-interval 10
-```
-
-3. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will pop up and display directly. Each picture lasts for `10` seconds and the picture will not be saved:
-
-```shell
-python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
- --show-interval 10
-```
-
-4. Use `config` file `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` to visualize the picture. The picture will not pop up directly, but only saved to the directory `work_dirs/browse_ dataset`:
-
-```shell
-python tools/analysis_tools/browse_dataset.py 'configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py' \
- --out-dir 'work_dirs/browse_dataset' \
- --not-show
-```
-
-### Visualize dataset analysis
-
-`tools/analysis_tools/dataset_analysis.py` help users get the renderings of the four functions, and save the pictures to the `dataset_analysis` folder under the current running directory.
-
-Description of the script's functions:
-
-The data required by each sub function is obtained through the data preparation of `main()`.
-
-Function 1: Generated by the sub function `show_bbox_num` to display the distribution of categories and bbox instances.
-
-
-
-Function 2: Generated by the sub function `show_bbox_wh` to display the width and height distribution of categories and bbox instances.
-
-
-
-Function 3: Generated by the sub function `show_bbox_wh_ratio` to display the width to height ratio distribution of categories and bbox instances.
-
-
-
-Function 3: Generated by the sub function `show_bbox_area` to display the distribution map of category and bbox instance area based on area rules.
-
-
-
-Print List: Generated by the sub function `show_class_list` and `show_data_list`.
-
-
-
-```shell
-python tools/analysis_tools/dataset_analysis.py ${CONFIG} \
- [--type ${TYPE}] \
- [--class-name ${CLASS_NAME}] \
- [--area-rule ${AREA_RULE}] \
- [--func ${FUNC}] \
- [--out-dir ${OUT_DIR}]
-```
-
-E,g:
-
-1.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, By default,the data loading type is `train_dataset`, the area rule is `[0,32,96,1e5]`, generate a result graph containing all functions and save the graph to the current running directory `./dataset_analysis` folder:
-
-```shell
-python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py
-```
-
-2.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, change the data loading type from the default `train_dataset` to `val_dataset` through the `--val-dataset` setting:
-
-```shell
-python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
- --val-dataset
-```
-
-3.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, change the display of all generated classes to specific classes. Take the display of `person` classes as an example:
-
-```shell
-python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
- --class-name person
-```
-
-4.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, redefine the area rule through `--area-rule` . Take `30 70 125` as an example, the area rule becomes `[0,30,70,125,1e5]`:
-
-```shell
-python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
- --area-rule 30 70 125
-```
-
-5.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, change the display of four function renderings to only display `Function 1` as an example:
-
-```shell
-python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
- --func show_bbox_num
-```
-
-6.Use `config` file `configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py` analyze the dataset, modify the picture saving address to `work_dirs/dataset_analysis`:
-
-```shell
-python tools/analysis_tools/dataset_analysis.py configs/yolov5/voc/yolov5_s-v61_fast_1xb64-50e_voc.py \
- --out-dir work_dirs/dataset_analysis
-```
-
-### Hyper-parameter Scheduler Visualization
-
-`tools/analysis_tools/vis_scheduler` aims to help the user to check the hyper-parameter scheduler of the optimizer(without training), which support the "learning rate", "momentum", and "weight_decay".
-
-```bash
-python tools/analysis_tools/vis_scheduler.py \
- ${CONFIG_FILE} \
- [-p, --parameter ${PARAMETER_NAME}] \
- [-d, --dataset-size ${DATASET_SIZE}] \
- [-n, --ngpus ${NUM_GPUs}] \
- [-o, --out-dir ${OUT_DIR}] \
- [--title ${TITLE}] \
- [--style ${STYLE}] \
- [--window-size ${WINDOW_SIZE}] \
- [--cfg-options]
-```
-
-**Description of all arguments**:
-
-- `config`: The path of a model config file.
-- **`-p, --parameter`**: The param to visualize its change curve, choose from "lr", "momentum" or "wd". Default to use "lr".
-- **`-d, --dataset-size`**: The size of the datasets. If set,`DATASETS.build` will be skipped and `${DATASET_SIZE}` will be used as the size. Default to use the function `DATASETS.build`.
-- **`-n, --ngpus`**: The number of GPUs used in training, default to be 1.
-- **`-o, --out-dir`**: The output path of the curve plot, default not to output.
-- `--title`: Title of figure. If not set, default to be config file name.
-- `--style`: Style of plt. If not set, default to be `whitegrid`.
-- `--window-size`: The shape of the display window. If not specified, it will be set to `12*7`. If used, it must be in the format `'W*H'`.
-- `--cfg-options`: Modifications to the configuration file, refer to [Learn about Configs](../user_guides/config.md).
-
-```{note}
-Loading annotations maybe consume much time, you can directly specify the size of the dataset with `-d, dataset-size` to save time.
-```
-
-You can use the following command to plot the step learning rate schedule used in the config `configs/rtmdet/rtmdet_s_syncbn_fast_8xb32-300e_coco.py`:
-
-```shell
-python tools/analysis_tools/vis_scheduler.py \
- configs/rtmdet/rtmdet_s_syncbn_fast_8xb32-300e_coco.py \
- --dataset-size 118287 \
- --ngpus 8 \
- --out-dir ./output
-```
-
-
-
-## Dataset Conversion
-
-The folder `tools/data_converters` currently contains `ballon2coco.py`, `yolo2coco.py`, and `labelme2coco.py` - three dataset conversion tools.
-
-- `ballon2coco.py` converts the `balloon` dataset (this small dataset is for starters only) to COCO format.
-
-For a detailed description of this script, please see the `Dataset Preparation` section in [From getting started to deployment with YOLOv5](./yolov5_tutorial.md).
-
-```shell
-python tools/dataset_converters/balloon2coco.py
-```
-
-- `yolo2coco.py` converts a dataset from `yolo-style` **.txt** format to COCO format, please use it as follows:
-
-```shell
-python tools/dataset_converters/yolo2coco.py /path/to/the/root/dir/of/your_dataset
-```
-
-Instructions:
-
-1. `image_dir` is the root directory of the yolo-style dataset you need to pass to the script, which should contain `images`, `labels`, and `classes.txt`. `classes.txt` is the class declaration corresponding to the current dataset. One class a line. The structure of the root directory should be formatted as this example shows:
-
-```bash
-.
-└── $ROOT_PATH
- ├── classes.txt
- ├── labels
- │ ├── a.txt
- │ ├── b.txt
- │ └── ...
- ├── images
- │ ├── a.jpg
- │ ├── b.png
- │ └── ...
- └── ...
-```
-
-2. The script will automatically check if `train.txt`, `val.txt`, and `test.txt` have already existed under `image_dir`. If these files are located, the script will organize the dataset accordingly. Otherwise, the script will convert the dataset into one file. The image paths in these files must be **ABSOLUTE** paths.
-3. By default, the script will create a folder called `annotations` in the `image_dir` directory which stores the converted JSON file. If `train.txt`, `val.txt`, and `test.txt` are not found, the output file is `result.json`. Otherwise, the corresponding JSON file will be generated, named as `train.json`, `val.json`, and `test.json`. The `annotations` folder may look similar to this:
-
-```bash
-.
-└── $ROOT_PATH
- ├── annotations
- │ ├── result.json
- │ └── ...
- ├── classes.txt
- ├── labels
- │ ├── a.txt
- │ ├── b.txt
- │ └── ...
- ├── images
- │ ├── a.jpg
- │ ├── b.png
- │ └── ...
- └── ...
-```
-
-## Download Dataset
-
-`tools/misc/download_dataset.py` supports downloading datasets such as `COCO`, `VOC`, `LVIS` and `Balloon`.
-
-```shell
-python tools/misc/download_dataset.py --dataset-name coco2017
-python tools/misc/download_dataset.py --dataset-name voc2007
-python tools/misc/download_dataset.py --dataset-name voc2012
-python tools/misc/download_dataset.py --dataset-name lvis
-python tools/misc/download_dataset.py --dataset-name balloon [--save-dir ${SAVE_DIR}] [--unzip]
-```
-
-## Convert Model
-
-The six scripts under the `tools/model_converters` directory can help users convert the keys in the official pre-trained model of YOLO to the format of MMYOLO, and use MMYOLO to fine-tune the model.
-
-### YOLOv5
-
-Take conversion `yolov5s.pt` as an example:
-
-1. Clone the official YOLOv5 code to the local (currently the maximum supported version is `v6.1`):
-
-```shell
-git clone -b v6.1 https://github.com/ultralytics/yolov5.git
-cd yolov5
-```
-
-2. Download official weight file:
-
-```shell
-wget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5s.pt
-```
-
-3. Copy file `tools/model_converters/yolov5_to_mmyolo.py` to the path of YOLOv5 official code clone:
-
-```shell
-cp ${MMDET_YOLO_PATH}/tools/model_converters/yolov5_to_mmyolo.py yolov5_to_mmyolo.py
-```
-
-4. Conversion
-
-```shell
-python yolov5_to_mmyolo.py --src ${WEIGHT_FILE_PATH} --dst mmyolov5.pt
-```
-
-The converted `mmyolov5.pt` can be used by MMYOLO. The official weight conversion of YOLOv6 is also used in the same way.
-
-### YOLOX
-
-The conversion of YOLOX model **does not need** to download the official YOLOX code, just download the weight.
-
-Take conversion `yolox_s.pth` as an example:
-
-1. Download official weight file:
-
-```shell
-wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth
-```
-
-2. Conversion
-
-```shell
-python tools/model_converters/yolox_to_mmyolo.py --src yolox_s.pth --dst mmyolox.pt
-```
-
-The converted `mmyolox.pt` can be used by MMYOLO.
-
-## Optimize anchors size
-
-Script `tools/analysis_tools/optimize_anchors.py` supports three methods to optimize YOLO anchors including `k-means`
-anchor cluster, `Differential Evolution` and `v5-k-means`.
-
-### k-means
-
-In k-means method, the distance criteria is based IoU, python shell as follow:
-
-```shell
-python tools/analysis_tools/optimize_anchors.py ${CONFIG} \
- --algorithm k-means \
- --input-shape ${INPUT_SHAPE [WIDTH HEIGHT]} \
- --out-dir ${OUT_DIR}
-```
-
-### Differential Evolution
-
-In differential_evolution method, based differential evolution algorithm, use `avg_iou_cost` as minimum target function, python shell as follow:
-
-```shell
-python tools/analysis_tools/optimize_anchors.py ${CONFIG} \
- --algorithm DE \
- --input-shape ${INPUT_SHAPE [WIDTH HEIGHT]} \
- --out-dir ${OUT_DIR}
-```
-
-### v5-k-means
-
-In v5-k-means method, clustering standard as same with YOLOv5 which use shape-match, python shell as follow:
-
-```shell
-python tools/analysis_tools/optimize_anchors.py ${CONFIG} \
- --algorithm v5-k-means \
- --input-shape ${INPUT_SHAPE [WIDTH HEIGHT]} \
- --prior_match_thr ${PRIOR_MATCH_THR} \
- --out-dir ${OUT_DIR}
-```
-
-## Perform inference on large images
-
-First install [`sahi`](https://github.com/obss/sahi) with:
-
-```shell
-pip install -U sahi>=0.11.4
-```
-
-Perform MMYOLO inference on large images (as satellite imagery) as:
-
-```shell
-wget -P checkpoint https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth
-
-python demo/large_image_demo.py \
- demo/large_image.jpg \
- configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py \
- checkpoint/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth \
-```
-
-Arrange slicing parameters as:
-
-```shell
-python demo/large_image_demo.py \
- demo/large_image.jpg \
- configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py \
- checkpoint/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth \
- --patch-size 512
- --patch-overlap-ratio 0.25
-```
-
-Export debug visuals while performing inference on large images as:
-
-```shell
-python demo/large_image_demo.py \
- demo/large_image.jpg \
- configs/yolov5/yolov5_m-v61_syncbn_fast_8xb16-300e_coco.py \
- checkpoint/yolov5_m-v61_syncbn_fast_8xb16-300e_coco_20220917_204944-516a710f.pth \
- --debug
-```
-
-[`sahi`](https://github.com/obss/sahi) citation:
-
-```
-@article{akyon2022sahi,
- title={Slicing Aided Hyper Inference and Fine-tuning for Small Object Detection},
- author={Akyon, Fatih Cagatay and Altinuc, Sinan Onur and Temizel, Alptekin},
- journal={2022 IEEE International Conference on Image Processing (ICIP)},
- doi={10.1109/ICIP46576.2022.9897990},
- pages={966-970},
- year={2022}
-}
-```
-
-## Extracts a subset of COCO
-
-The training dataset of the COCO2017 dataset includes 118K images, and the validation set includes 5K images, which is a relatively large dataset. Loading JSON in debugging or quick verification scenarios will consume more resources and bring slower startup speed.
-
-The `extract_subcoco.py` script provides the ability to extract a specified number/classes/area-size of images. The user can use the `--num-img`, `--classes`, `--area-size` parameter to get a COCO subset of the specified condition of images.
-
-For example, extract images use scripts as follows:
-
-```shell
-python tools/misc/extract_subcoco.py \
- ${ROOT} \
- ${OUT_DIR} \
- --num-img 20 \
- --classes cat dog person \
- --area-size small
-```
-
-It gone be extract 20 images, and only includes annotations which belongs to cat(or dog/person) and bbox area size is small, after filter by class and area size, the empty annotation images won't be chosen, guarantee the images be extracted definitely has annotation info.
-
-Currently, only support COCO2017. In the future will support user-defined datasets of standard coco JSON format.
-
-The root path folder format is as follows:
-
-```text
-├── root
-│ ├── annotations
-│ ├── train2017
-│ ├── val2017
-│ ├── test2017
-```
-
-1. Extract 10 training images and 10 validation images using only 5K validation sets.
-
-```shell
-python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --num-img 10
-```
-
-2. Extract 20 training images using the training set and 20 validation images using the validation set.
-
-```shell
-python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --num-img 20 --use-training-set
-```
-
-3. Set the global seed to 1. The default is no setting.
-
-```shell
-python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --num-img 20 --use-training-set --seed 1
-```
-
-4. Extract images by specify classes
-
-```shell
-python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --classes cat dog person
-```
-
-5. Extract images by specify anchor size
-
-```shell
-python tools/misc/extract_subcoco.py ${ROOT} ${OUT_DIR} --area-size small
-```
diff --git a/docs/en/user_guides/yolov5_tutorial.md b/docs/en/user_guides/yolov5_tutorial.md
deleted file mode 100644
index ff9d703a..00000000
--- a/docs/en/user_guides/yolov5_tutorial.md
+++ /dev/null
@@ -1,235 +0,0 @@
-# From getting started to deployment with YOLOv5
-
-## Environment Setup
-
-Note: Since this repository uses OpenMMLab 2.0, please create a new conda virtual environment to prevent conflicts with your existing repositories and projects of OpenMMLab 1.0.
-
-```shell
-conda create -n open-mmlab python=3.8 -y
-conda activate open-mmlab
-conda install pytorch torchvision -c pytorch
-# conda install pytorch torchvision cpuonly -c pytorch
-pip install -U openmim
-mim install "mmengine>=0.3.1"
-mim install "mmcv>=2.0.0rc1,<2.1.0"
-mim install "mmdet>=3.0.0rc5,<3.1.0"
-git clone https://github.com/open-mmlab/mmyolo.git
-cd mmyolo
-# Install albumentations
-pip install -r requirements/albu.txt
-# Install MMYOLO
-mim install -v -e .
-# "-v" means verbose, or more output
-# "-e" means install the project in editable mode, so any local modifications made to the code will take effect, eliminating the need to reinstall.
-```
-
-For more detailed information about environment configuration, please refer to [get_started](../get_started.md).
-
-## Dataset Preparation
-
-In this tutorial, we provide the ballon dataset, which is less than 40MB, as the training dataset for MMYOLO.
-
-```shell
-python tools/misc/download_dataset.py --dataset-name balloon --save-dir data --unzip
-python tools/dataset_converters/balloon2coco.py
-```
-
-After executing the above command, the balloon dataset will be downloaded in the `data` folder with the converted format we need. The `train.json` and `val.json` are the annotation files in the COCO format.
-
-
-

-
-
-## Config File Preparation
-
-Create a new file called the `yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py` configuration file in the `configs/yolov5` folder, and copy the following content into it.
-
-```python
-_base_ = './yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
-
-data_root = 'data/balloon/'
-
-train_batch_size_per_gpu = 4
-train_num_workers = 2
-
-metainfo = {
- 'classes': ('balloon', ),
- 'palette': [
- (220, 20, 60),
- ]
-}
-
-train_dataloader = dict(
- batch_size=train_batch_size_per_gpu,
- num_workers=train_num_workers,
- dataset=dict(
- data_root=data_root,
- metainfo=metainfo,
- data_prefix=dict(img='train/'),
- ann_file='train.json'))
-
-val_dataloader = dict(
- dataset=dict(
- data_root=data_root,
- metainfo=metainfo,
- data_prefix=dict(img='val/'),
- ann_file='val.json'))
-
-test_dataloader = val_dataloader
-
-val_evaluator = dict(ann_file=data_root + 'val.json')
-
-test_evaluator = val_evaluator
-
-model = dict(bbox_head=dict(head_module=dict(num_classes=1)))
-
-default_hooks = dict(logger=dict(interval=1))
-```
-
-The above configuration is inherited from `./yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py`, and `data_root`, `metainfo`, `train_dataloader`, `val_dataloader`, `num_classes` and other configurations are updated according to the balloon data we are using.
-The reason why we set the `interval` of the logger to 1 is that the balloon data set we choose is relatively small, and if the `interval` is too large, we will not see the output of the loss-related log. Therefore, by setting the `interval` of the logger to 1 will ensure that each interval iteration will output a loss-related log.
-
-## Training
-
-```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
-```
-
-After executing the above training command, the `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon` folder will be automatically generated. Both the weight and the training configuration files will be saved in this folder.
-
-
-

-
-
-### Resume training after interruptions
-
-If training stops midway, add `--resume` at the end of the training command, and the program will automatically load the latest weight file from `work_dirs` to resume training.
-
-```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py --resume
-```
-
-### Fine-tune with loaded pretrained weights
-
-NOTICE: It is highly recommended that finetuning from large datasets, such as COCO, can significantly boost the performance of overall network.
-In this example, compared with training from scratch, finetuning the pretrained model outperforms with a significant margin. (Over 30+ mAP boost than training from scratch).
-
-1. Download the COCO dataset pre-trained weights
-
-```shell
-cd mmyolo
-wget https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth
-```
-
-2. Load the pretrained model to train
-
-```shell
-cd mmyolo
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- --cfg-options load_from='yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth'
-```
-
-3. Freeze backbone to train
-
-Freeze the four backbone stages by setting `model.backbone.frozen_stages=4` in the config file or from the command line.
-
-```shell
-# Set model.backbone.frozen_stages=4 from the command line
-cd mmyolo
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- --cfg-options load_from='yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' model.backbone.frozen_stages=4
-```
-
-### Visualization
-
-For `visualization` of `default_hooks` in `configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py`, we set `draw` to `True` and `interval` to `2`.
-
-```python
-default_hooks = dict(
- logger=dict(interval=1),
- visualization=dict(draw=True, interval=2),
-)
-```
-
-Re-run the following training command. During the validation, each `interval` image will save a puzzle of the annotation and prediction results to `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/{timestamp}/vis_data/vis_image` folder.
-
-```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
-```
-
-
-

-
-
-#### Visualization Backend Support
-
-MMEngine supports various backends such as local, TensorBoard, and wandb.
-
-- wandb
-
-Register and get your wandb API key from the [official website](https://wandb.ai/settings).
-
-
-

-
-
-```shell
-pip install wandb
-
-wandb login
-# enter your API key, then you can see if you login successfully
-```
-
-Add wandb configuration in `configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py`.
-
-```python
-visualizer = dict(vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')])
-```
-
-Re-run the training command to check data visualization results such as loss, learning rate, and coco/bbox_mAP in the web link prompted on the command line.
-
-```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
-```
-
-
-

-
-
-- Tensorboard
-
-Install Tensorboard
-
-```shell
-pip install tensorboard
-```
-
-Similar to wandb, we need to add Tensorboard configuration in `configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py`.
-
-```python
-visualizer = dict(vis_backends=[dict(type='LocalVisBackend'),dict(type='TensorboardVisBackend')])
-```
-
-Re-run the training command, a Tensorboard folder will be created in `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/{timestamp}/vis_data`, You can get data visualization results such as loss, learning rate, and coco/bbox_mAP in the web link prompted on the command line with the following command:
-
-```shell
-tensorboard --logdir=work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon
-```
-
-## Model Testing
-
-```shell
-python tools/test.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/epoch_300.pth \
- --show-dir show_results
-```
-
-Run the above command, the inference result picture will be automatically saved to the `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/{timestamp}/show_results` folder. The following is one of the result pictures. The left one is the actual annotation, and the right is the model inference result.
-
-
-

-
-
-## Model Deployment
-
-Please refer to [this](../deploy/yolov5_deployment.md)
diff --git a/docs/zh_cn/common_usage/output_predictions.md b/docs/zh_cn/common_usage/output_predictions.md
index 6c123e96..b11f856d 100644
--- a/docs/zh_cn/common_usage/output_predictions.md
+++ b/docs/zh_cn/common_usage/output_predictions.md
@@ -7,7 +7,7 @@ json 文件仅保存 `image_id`、`bbox`、`score` 和 `category_id`; json 文
pkl 保存内容比 json 文件更多,还会保存预测图片的文件名和尺寸等一系列信息; pkl 文件可以使用 pickle 库读取。
```
-### 输出为 json 文件
+## 输出为 json 文件
如果想将预测结果输出为 json 文件,则命令如下:
@@ -23,7 +23,7 @@ python tools/test.py configs\yolov5\yolov5_s-v61_syncbn_8xb16-300e_coco.py yolov
运行以上命令会在 `work_dirs/demo` 文件夹下,输出 `json_demo.bbox.json` 文件。
-### 输出为 pkl 文件
+## 输出为 pkl 文件
如果想将预测结果输出为 pkl 文件,则命令如下:
diff --git a/docs/zh_cn/get_started/15_minutes_object_detection.md b/docs/zh_cn/get_started/15_minutes_object_detection.md
index fc7dc295..6523dd51 100644
--- a/docs/zh_cn/get_started/15_minutes_object_detection.md
+++ b/docs/zh_cn/get_started/15_minutes_object_detection.md
@@ -1,63 +1,123 @@
# 15 分钟上手 MMYOLO 目标检测
+目标检测任务是指给定一张图片,网络预测出图片中所包括的所有物体类别和对应的边界框
+
+
+

+
+
+以我们提供的猫 cat 小数据集为例,带大家 15 分钟轻松上手 MMYOLO 目标检测。整个流程包含如下步骤:
+
+- [环境安装](#环境安装)
+- [数据集准备](#数据集准备)
+- [配置准备](#配置准备)
+- [模型训练](#模型训练)
+- [模型测试](#模型测试)
+- [EasyDeploy 模型部署](#easydeploy-模型部署)
+
## 环境安装
-温馨提醒:由于本仓库采用的是 OpenMMLab 2.0,请最好新建一个 conda 虚拟环境,防止和 OpenMMLab 1.0 已经安装的仓库冲突。
+假设你已经提前安装好了 Conda,接下来安装 PyTorch
```shell
-conda create -n open-mmlab python=3.8 -y
-conda activate open-mmlab
+conda create -n mmyolo python=3.8 -y
+conda activate mmyolo
+# 如果你有 GPU
conda install pytorch torchvision -c pytorch
+# 如果你是 CPU
# conda install pytorch torchvision cpuonly -c pytorch
-pip install -U openmim
-mim install "mmengine>=0.3.1"
-mim install "mmcv>=2.0.0rc1,<2.1.0"
-mim install "mmdet>=3.0.0rc5,<3.1.0"
+```
+
+安装 MMYOLO 和依赖库
+
+```shell
git clone https://github.com/open-mmlab/mmyolo.git
cd mmyolo
+pip install -U openmim
+mim install -r requirements/mminstall.txt
# Install albumentations
-pip install -r requirements/albu.txt
+mim install -r requirements/albu.txt
# Install MMYOLO
mim install -v -e .
# "-v" 指详细说明,或更多的输出
# "-e" 表示在可编辑模式下安装项目,因此对代码所做的任何本地修改都会生效,从而无需重新安装。
```
-详细环境配置操作请查看 [get_started](../get_started/installation.md)
+```{note}
+温馨提醒:由于本仓库采用的是 OpenMMLab 2.0,请最好新建一个 conda 虚拟环境,防止和 OpenMMLab 1.0 已经安装的仓库冲突。
+```
+
+详细环境配置操作请查看 [安装和验证](./installation.md)
## 数据集准备
-本文选取不到 40MB 大小的 balloon 气球数据集作为 MMYOLO 的学习数据集。
-
-```shell
-python tools/misc/download_dataset.py --dataset-name balloon --save-dir data --unzip
-python tools/dataset_converters/balloon2coco.py
-```
-
-执行以上命令,下载数据集并转化格式后,balloon 数据集在 `data` 文件夹中准备好了,`train.json` 和 `val.json` 便是 coco 格式的标注文件了。
+Cat 数据集是一个包括 144 张图片的单类别数据集(本 cat 数据集由 @RangeKing 提供原始图片,由 @PeterH0323 进行数据清洗), 包括了训练所需的标注信息。 样例图片如下所示:
-

+
-## config 文件准备
+你只需执行如下命令即可下载并且直接用起来
-在 `configs/yolov5` 文件夹下新建 `yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py` 配置文件,并把以下内容复制配置文件中。
+```shell
+python tools/misc/download_dataset.py --dataset-name cat --save-dir ./data/cat --unzip --delete
+```
+
+数据集组织格式如下所示:
+
+
+

+
+
+data 位于 mmyolo 工程目录下, `data/cat/annotations` 中存放的是 COCO 格式的标注,`data/cat/images` 中存放的是所有图片
+
+## 配置准备
+
+以 YOLOv5 算法为例,考虑到用户显存和内存有限,我们需要修改一些默认训练参数来让大家愉快的跑起来,核心需要修改的参数如下
+
+- YOLOv5 是 Anchor-Based 类算法,不同的数据集需要自适应计算合适的 Anchor
+- 默认配置是 8 卡,每张卡 batch size 为 16,现将其改成单卡,每张卡 batch size 为 12
+- 默认训练 epoch 是 300,将其改成 40 epoch
+- 由于数据集太小,我们选择固定 backbone 网络权重
+- 原则上 batch size 改变后,学习率也需要进行线性缩放,但是实测发现不需要
+
+具体操作为在 `configs/yolov5` 文件夹下新建 `yolov5_s-v61_fast_1xb12-40e_cat.py` 配置文件(为了方便大家直接使用,我们已经提供了该配置),并把以下内容复制配置文件中。
```python
-_base_ = './yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
+# 基于该配置进行继承并重写部分配置
+_base_ = 'yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py'
-data_root = 'data/balloon/'
+data_root = './data/cat/' # 数据集根路径
+class_name = ('cat', ) # 数据集类别名称
+num_classes = len(class_name) # 数据集类别数
+# metainfo 必须要传给后面的 dataloader 配置,否则无效
+# palette 是可视化时候对应类别的显示颜色
+# palette 长度必须大于等于和 classes 长度
+metainfo = dict(classes=class_name, palette=[(20, 220, 60)])
-train_batch_size_per_gpu = 4
-train_num_workers = 2
+# 基于 tools/analysis_tools/optimize_anchors.py 自适应计算的 anchor
+anchors = [
+ [(68, 69), (154, 91), (143, 162)], # P3/8
+ [(242, 160), (189, 287), (391, 207)], # P4/16
+ [(353, 337), (539, 341), (443, 432)] # P5/32
+]
+# 最大训练 40 epoch
+max_epochs = 40
+# bs 为 12
+train_batch_size_per_gpu = 12
+# dataloader 加载进程数
+train_num_workers = 4
-metainfo = {
- 'classes': ('balloon', ),
- 'palette': [
- (220, 20, 60),
- ]
-}
+# 加载 COCO 预训练权重
+load_from = 'https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' # noqa
+
+model = dict(
+ # 固定整个 backbone 权重,不进行训练
+ backbone=dict(frozen_stages=4),
+ bbox_head=dict(
+ head_module=dict(num_classes=num_classes),
+ prior_generator=dict(base_sizes=anchors)
+ ))
train_dataloader = dict(
batch_size=train_batch_size_per_gpu,
@@ -65,110 +125,100 @@ train_dataloader = dict(
dataset=dict(
data_root=data_root,
metainfo=metainfo,
- data_prefix=dict(img='train/'),
- ann_file='train.json'))
+ # 数据集标注文件 json 路径
+ ann_file='annotations/trainval.json',
+ # 数据集前缀
+ data_prefix=dict(img='images/')))
val_dataloader = dict(
dataset=dict(
- data_root=data_root,
metainfo=metainfo,
- data_prefix=dict(img='val/'),
- ann_file='val.json'))
+ data_root=data_root,
+ ann_file='annotations/trainval.json',
+ data_prefix=dict(img='images/')))
test_dataloader = val_dataloader
-val_evaluator = dict(ann_file=data_root + 'val.json')
-
+val_evaluator = dict(ann_file=data_root + 'annotations/trainval.json')
test_evaluator = val_evaluator
-model = dict(bbox_head=dict(head_module=dict(num_classes=1)))
-
-default_hooks = dict(logger=dict(interval=1))
+default_hooks = dict(
+ # 每隔 10 个 epoch 保存一次权重,并且最多保存 2 个权重
+ # 模型评估时候自动保存最佳模型
+ checkpoint=dict(interval=10, max_keep_ckpts=2, save_best='auto'),
+ param_scheduler=dict(max_epochs=max_epochs),
+ # 日志打印间隔为 5
+ logger=dict(type='LoggerHook', interval=5))
+# 评估间隔为 10
+train_cfg = dict(max_epochs=max_epochs, val_interval=10)
```
-以上配置从 `./yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py` 中继承,并根据 balloon 数据的特点更新了 `data_root`、`metainfo`、`train_dataloader`、`val_dataloader`、`num_classes` 等配置。
-我们将 logger 的 `interval` 设置为 1 的原因是,每进行 `interval` 次 iteration 会输出一次 loss 相关的日志,而我们选取气球数据集比较小,`interval` 太大我们将看不到 loss 相关日志的输出。
+以上配置从 `yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py` 中继承,并根据 cat 数据的特点更新了 `data_root`、`metainfo`、`train_dataloader`、`val_dataloader`、`num_classes` 等配置。
-## 训练
+## 模型训练
```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
+python tools/train.py configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py
```
-运行以上训练命令,`work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon` 文件夹会被自动生成,权重文件以及此次的训练配置文件将会保存在此文件夹中。
+运行以上训练命令 `work_dirs/yolov5_s-v61_fast_1xb12-40e_cat` 文件夹会被自动生成,权重文件以及此次的训练配置文件将会保存在此文件夹中。 在 1660 低端显卡上,整个训练过程大概需要 8 分钟。
-

+
+在 `trainval.json` 上性能如下所示:
+
+```text
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.685
+ Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.953
+ Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.852
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
+ Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.685
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.664
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.749
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.761
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
+ Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.761
+```
+
+上述性能是通过 COCO API 打印,其中 -1 表示不存在对于尺度的物体。根据 COCO 定义的规则,Cat 数据集里面全部是大物体,不存在小和中等规模物体。
+
+### 一些注意事项
+
+在训练过程中会打印如下两个关键警告:
+
+- You are using `YOLOv5Head` with num_classes == 1. The loss_cls will be 0. This is a normal phenomenon.
+- The model and loaded state dict do not match exactly
+
+这两个警告都不会对性能有任何影响。第一个警告是说明由于当前训练的类别数是 1,根据 YOLOv5 算法的社区, 分类分支的 loss 始终是 0,这是正常现象。第二个警告是因为目前是采用微调模式进行训练,我们加载了 COCO 80 个类的预训练权重,
+这会导致最后的 Head 模块卷积通道数不对应,从而导致这部分权重无法加载,这也是正常现象。
+
### 中断后恢复训练
-如果训练中途停止,在训练命令最后加上 `--resume` ,程序会自动从 `work_dirs` 中加载最新的权重文件恢复训练。
+如果训练中途停止,可以在训练命令最后加上 `--resume` ,程序会自动从 `work_dirs` 中加载最新的权重文件恢复训练。
```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py --resume
+python tools/train.py configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py --resume
```
-### 加载预训练权重微调
+### 节省显存策略
-经过测试,相比不加载预训练模型,加载 YOLOv5-s 预训练模型在气球数据集上训练和验证 coco/bbox_mAP 能涨 30 多个百分点。
-
-1. 下载 COCO 数据集预训练权重
+上述配置大概需要 3.0G 显存,如果你的显存不够,可以考虑开启混合精度训练
```shell
-cd mmyolo
-wget https://download.openmmlab.com/mmyolo/v0/yolov5/yolov5_s-v61_syncbn_fast_8xb16-300e_coco/yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth
+python tools/train.py configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py --amp
```
-2. 加载预训练模型进行训练
+### 训练可视化
-```shell
-cd mmyolo
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- --cfg-options load_from='yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth'
-```
+MMYOLO 目前支持本地、TensorBoard 以及 WandB 等多种后端可视化,默认是采用本地可视化方式,你可以切换为 WandB 等实时可视化训练过程中各类指标。
-3. 冻结 backbone 进行训练
+#### 1 WandB 可视化使用
-通过 config 文件或者命令行中设置 model.backbone.frozen_stages=4 冻结 backbone 的 4 个 stages。
-
-```shell
-# 命令行中设置 model.backbone.frozen_stages=4
-cd mmyolo
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- --cfg-options load_from='yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth' model.backbone.frozen_stages=4
-```
-
-### 训练验证中可视化相关
-
-#### 验证阶段可视化
-
-我们将 `configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py` 中的 `default_hooks` 的 `visualization` 进行修改,设置 `draw` 为 `True`,`interval` 为 `2`。
-
-```shell
-default_hooks = dict(
- logger=dict(interval=1),
- visualization=dict(draw=True, interval=2),
-)
-```
-
-重新运行以下训练命令,在验证评估的过程中,每 `interval` 张图片就会保存一张标注结果和预测结果的拼图到 `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/{timestamp}/vis_data/vis_image` 文件夹中了。
-
-```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
-```
-
-
-

-
-
-#### 可视化后端使用
-
-MMEngine 支持本地、TensorBoard 以及 wandb 等多种后端。
-
-##### wandb 可视化使用
-
-wandb 官网注册并在 https://wandb.ai/settings 获取到 wandb 的 API Keys。
+WandB 官网注册并在 https://wandb.ai/settings 获取到 WandB 的 API Keys。

@@ -180,7 +230,7 @@ pip install wandb
wandb login
```
-在 `configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py` 添加 wandb 配置
+在 `configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py` 配置文件最后添加 WandB 配置
```python
visualizer = dict(vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')])
@@ -189,14 +239,17 @@ visualizer = dict(vis_backends = [dict(type='LocalVisBackend'), dict(type='Wandb
重新运行训练命令便可以在命令行中提示的网页链接中看到 loss、学习率和 coco/bbox_mAP 等数据可视化了。
```shell
-python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py
+python tools/train.py configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py
```
-

+

+
+
+
-##### Tensorboard 可视化使用
+#### 2 Tensorboard 可视化使用
安装 Tensorboard 环境
@@ -204,33 +257,155 @@ python tools/train.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.
pip install tensorboard
```
-同上述在配置文件 `configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py`中添加 `tensorboard` 配置
+同上述在配置文件 `configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py`配置的最后添加 `tensorboard` 配置
```python
visualizer = dict(vis_backends=[dict(type='LocalVisBackend'),dict(type='TensorboardVisBackend')])
```
-重新运行训练命令后,Tensorboard 文件会生成在可视化文件夹 `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/{timestamp}/vis_data` 下,
+重新运行训练命令后,Tensorboard 文件会生成在可视化文件夹 `work_dirs/yolov5_s-v61_fast_1xb12-40e_cat.py/{timestamp}/vis_data` 下,
运行下面的命令便可以在网页链接使用 Tensorboard 查看 loss、学习率和 coco/bbox_mAP 等可视化数据了:
```shell
-tensorboard --logdir=work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon
+tensorboard --logdir=work_dirs/yolov5_s-v61_fast_1xb12-40e_cat.py
```
## 模型测试
```shell
-python tools/test.py configs/yolov5/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon.py \
- work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/epoch_300.pth \
+python tools/test.py configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py \
+ work_dirs/yolov5_s-v61_fast_1xb12-40e_cat/epoch_40.pth \
--show-dir show_results
```
-运行以上测试命令,推理结果图片会自动保存至 `work_dirs/yolov5_s-v61_syncbn_fast_1xb4-300e_balloon/{timestamp}/show_results` 文件夹中。下面为其中一张结果图片,左图为实际标注,右图为模型推理结果。
+运行以上测试命令, 你不不仅可以得到**模型训练**部分所打印的 AP 性能,还可以将推理结果图片自动保存至 `work_dirs/yolov5_s-v61_fast_1xb12-40e_cat/{timestamp}/show_results` 文件夹中。下面为其中一张结果图片,左图为实际标注,右图为模型推理结果。
-

+
-## 模型部署
+如果你使用了 `WandbVisBackend` 或者 `TensorboardVisBackend`,则还可以在浏览器窗口可视化模型推理结果。
-请参考[这里](../deploy/yolov5_deployment.md)
+## 特征图相关可视化
+
+MMYOLO 中提供了特征图相关可视化脚本,用于分析当前模型训练效果。 详细使用流程请参考 [特征图可视化](../recommended_topics/visualization.md)
+
+由于 `test_pipeline` 直接可视化会存在偏差,故将需要 `configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py` 中 `test_pipeline`
+
+```python
+test_pipeline = [
+ dict(
+ type='LoadImageFromFile',
+ file_client_args=_base_.file_client_args),
+ dict(type='YOLOv5KeepRatioResize', scale=img_scale),
+ dict(
+ type='LetterResize',
+ scale=img_scale,
+ allow_scale_up=False,
+ pad_val=dict(img=114)),
+ dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
+ dict(
+ type='mmdet.PackDetInputs',
+ meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
+ 'scale_factor', 'pad_param'))
+]
+```
+
+修改为如下配置:
+
+```python
+test_pipeline = [
+ dict(
+ type='LoadImageFromFile',
+ file_client_args=_base_.file_client_args),
+ dict(type='mmdet.Resize', scale=img_scale, keep_ratio=False), # 这里将 LetterResize 修改成 mmdet.Resize
+ dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
+ dict(
+ type='mmdet.PackDetInputs',
+ meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
+ 'scale_factor'))
+]
+```
+
+我们选择 `data/cat/images/IMG_20221020_112705.jpg` 图片作为例子,可视化 YOLOv5 backbone 和 neck 层的输出特征图。
+
+**1. 可视化 YOLOv5 backbone 输出的 3 个通道**
+
+```shell
+python demo/featmap_vis_demo.py data/cat/images/IMG_20221020_112705.jpg \
+ configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py \
+ work_dirs/yolov5_s-v61_fast_1xb8-40e_cat/epoch_40.pth \
+ --target-layers backbone \
+ --channel-reduction squeeze_mean
+```
+
+
+

+
+
+结果会保存到当前路径的 output 文件夹下。上图中绘制的 3 个输出特征图对应大中小输出特征图。由于本次训练的 backbone 实际上没有参与训练,从上图可以看到,大物体 cat 是在小特征图进行预测,这符合目标检测分层检测思想。
+
+**2. 可视化 YOLOv5 neck 输出的 3 个通道**
+
+```shell
+python demo/featmap_vis_demo.py data/cat/images/IMG_20221020_112705.jpg \
+ configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py \
+ work_dirs/yolov5_s-v61_fast_1xb8-40e_cat/epoch_40.pth \
+ --target-layers neck \
+ --channel-reduction squeeze_mean
+```
+
+
+

+
+
+从上图可以看出,由于 neck 是参与训练的,并且由于我们重新设置了 anchor, 强行让 3 个输出特征图都拟合同一个尺度的物体,导致 neck 输出的 3 个图类似,破坏了 backbone 原先的预训练分布。同时也可以看出 40 epoch 训练上述数据集是不够的,特征图效果不佳。
+
+**3. Grad-Based CAM 可视化**
+
+基于上述特征图可视化效果,我们可以分析特征层 bbox 级别的 Grad CAM。
+
+(a) 查看 neck 输出的最小输出特征图的 Grad CAM
+
+```shell
+python demo/boxam_vis_demo.py data/cat/images/IMG_20221020_112705.jpg \
+ configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py \
+ work_dirs/yolov5_s-v61_fast_1xb8-40e_cat/epoch_40.pth \
+ --target-layer neck.out_layers[2]
+```
+
+
+

+
+
+(b) 查看 neck 输出的中等输出特征图的 Grad CAM
+
+```shell
+python demo/boxam_vis_demo.py data/cat/images/IMG_20221020_112705.jpg \
+ configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py \
+ work_dirs/yolov5_s-v61_fast_1xb8-40e_cat/epoch_40.pth \
+ --target-layer neck.out_layers[1]
+```
+
+
+

+
+
+(c) 查看 neck 输出的最大输出特征图的 Grad CAM
+
+```shell
+python demo/boxam_vis_demo.py data/cat/images/IMG_20221020_112705.jpg \
+ configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py \
+ work_dirs/yolov5_s-v61_fast_1xb8-40e_cat/epoch_40.pth \
+ --target-layer neck.out_layers[0]
+```
+
+
+

+
+
+## EasyDeploy 模型部署
+
+TODO
+
+以上完整内容可以查看 [15_minutes_object_detection.ipynb](<>)
diff --git a/docs/zh_cn/get_started/article.md b/docs/zh_cn/get_started/article.md
index e9e9bfc3..43cd0f8e 100644
--- a/docs/zh_cn/get_started/article.md
+++ b/docs/zh_cn/get_started/article.md
@@ -16,14 +16,14 @@
- [社区协作,简洁易用,快来开箱新一代 YOLO 系列开源库](https://zhuanlan.zhihu.com/p/575615805)
- [MMYOLO 社区倾情贡献,RTMDet 原理社区开发者解读来啦!](https://zhuanlan.zhihu.com/p/569777684)
+- [MMYOLO 自定义数据集从标注到部署保姆级教程](https://zhuanlan.zhihu.com/p/595497726)
+- [满足一切需求的 MMYOLO 可视化:测试过程可视化](https://zhuanlan.zhihu.com/p/593179372)
- [YOLOv8 深度详解!一文看懂,快速上手](https://zhuanlan.zhihu.com/p/598566644)
- [玩转 MMYOLO 基础类第一期: 配置文件太复杂?继承用法看不懂?配置全解读来了](https://zhuanlan.zhihu.com/p/577715188)
- [玩转 MMYOLO 工具类第一期: 特征图可视化](https://zhuanlan.zhihu.com/p/578141381?)
-- [玩转 MMYOLO 实用类第二期:源码阅读和调试「必备」技巧文档](https://zhuanlan.zhihu.com/p/580885852)
+- [玩转 MMYOLO 实用类第一期:源码阅读和调试「必备」技巧文档](https://zhuanlan.zhihu.com/p/580885852)
- [玩转 MMYOLO 基础类第二期:工程文件结构简析](https://zhuanlan.zhihu.com/p/584807195)
- [玩转 MMYOLO 实用类第二期:10分钟换遍主干网络文档](https://zhuanlan.zhihu.com/p/585641598)
-- [MMYOLO 自定义数据集从标注到部署保姆级教程](https://zhuanlan.zhihu.com/p/595497726)
-- [满足一切需求的 MMYOLO 可视化:测试过程可视化](https://zhuanlan.zhihu.com/p/593179372)
### 视频
diff --git a/docs/zh_cn/get_started/dependencies.md b/docs/zh_cn/get_started/dependencies.md
index 8b736098..fcd3f661 100644
--- a/docs/zh_cn/get_started/dependencies.md
+++ b/docs/zh_cn/get_started/dependencies.md
@@ -5,6 +5,7 @@
| MMYOLO version | MMDetection version | MMEngine version | MMCV version |
| :------------: | :----------------------: | :----------------------: | :---------------------: |
| main | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
+| 0.4.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
| 0.3.0 | mmdet>=3.0.0rc5, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
| 0.2.0 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
| 0.1.3 | mmdet>=3.0.0rc3, \<3.1.0 | mmengine>=0.3.1, \<1.0.0 | mmcv>=2.0.0rc0, \<2.1.0 |
@@ -14,10 +15,15 @@
本节中,我们将演示如何用 PyTorch 准备一个环境。
-MMYOLO 支持在 Linux,Windows 和 macOS 上运行。它需要 Python 3.7 以上,CUDA 9.2 以上和 PyTorch 1.7 以上。
+MMYOLO 支持在 Linux,Windows 和 macOS 上运行。它的基本环境依赖为:
+
+- Python 3.7+
+- PyTorch 1.7+
+- CUDA 9.2+
+- GCC 5.4+
```{note}
-如果你对 PyTorch 有经验并且已经安装了它,你可以直接跳转到[下一小节](#安装流程)。否则,你可以按照下述步骤进行准备
+如果你对 PyTorch 有经验并且已经安装了它,你可以直接跳转到下一小节。否则,你可以按照下述步骤进行准备
```
**步骤 0.** 从 [官方网站](https://docs.conda.io/en/latest/miniconda.html) 下载并安装 Miniconda。
@@ -25,8 +31,8 @@ MMYOLO 支持在 Linux,Windows 和 macOS 上运行。它需要 Python 3.7 以
**步骤 1.** 创建并激活一个 conda 环境。
```shell
-conda create -n open-mmlab python=3.8 -y
-conda activate open-mmlab
+conda create -n mmyolo python=3.8 -y
+conda activate mmyolo
```
**步骤 2.** 基于 [PyTorch 官方说明](https://pytorch.org/get-started/locally/) 安装 PyTorch。
@@ -42,3 +48,11 @@ conda install pytorch torchvision -c pytorch
```shell
conda install pytorch torchvision cpuonly -c pytorch
```
+
+**步骤 3.** 验证 PyTorch 安装
+
+```shell
+python -c "import torch; print(torch.__version__); print(torch.cuda.is_available())"
+```
+
+如果是在 GPU 平台上,那么会打印版本信息和 True 字符,否则打印版本信息和 False 字符。
diff --git a/docs/zh_cn/get_started/installation.md b/docs/zh_cn/get_started/installation.md
index 0dcc0da0..147d204f 100644
--- a/docs/zh_cn/get_started/installation.md
+++ b/docs/zh_cn/get_started/installation.md
@@ -11,11 +11,19 @@ mim install "mmcv>=2.0.0rc1,<2.1.0"
mim install "mmdet>=3.0.0rc5,<3.1.0"
```
+如果你当前已经处于 mmyolo 工程目录下,则可以采用如下简化写法
+
+```shell
+cd mmyolo
+pip install -U openmim
+mim install -r requirements/mminstall.txt
+```
+
**注意:**
a. 在 MMCV-v2.x 中,`mmcv-full` 改名为 `mmcv`,如果你想安装不包含 CUDA 算子精简版,可以通过 `mim install mmcv-lite>=2.0.0rc1` 来安装。
-b. 如果使用 albumentations,我们建议使用 pip install -r requirements/albu.txt 或者 pip install -U albumentations --no-binary qudida,albumentations 进行安装。 如果简单地使用 pip install albumentations==1.0.1 进行安装,则会同时安装 opencv-python-headless(即便已经安装了 opencv-python 也会再次安装)。我们建议在安装 albumentations 后检查环境,以确保没有同时安装 opencv-python 和 opencv-python-headless,因为同时安装可能会导致一些问题。更多细节请参考 [官方文档](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies) 。
+b. 如果使用 `albumentations`,我们建议使用 `pip install -r requirements/albu.txt` 或者 `pip install -U albumentations --no-binary qudida,albumentations` 进行安装。 如果简单地使用 `pip install albumentations==1.0.1` 进行安装,则会同时安装 `opencv-python-headless`(即便已经安装了 `opencv-python` 也会再次安装)。我们建议在安装 albumentations 后检查环境,以确保没有同时安装 `opencv-python` 和 `opencv-python-headless`,因为同时安装可能会导致一些问题。更多细节请参考 [官方文档](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies) 。
**步骤 1.** 安装 MMYOLO
@@ -25,7 +33,7 @@ b. 如果使用 albumentations,我们建议使用 pip install -r requirements/
git clone https://github.com/open-mmlab/mmyolo.git
cd mmyolo
# Install albumentations
-pip install -r requirements/albu.txt
+mim install -r requirements/albu.txt
# Install MMYOLO
mim install -v -e .
# "-v" 指详细说明,或更多的输出
@@ -48,7 +56,7 @@ mim install "mmyolo"
mim download mmyolo --config yolov5_s-v61_syncbn_fast_8xb16-300e_coco --dest .
```
-下载将需要几秒钟或更长时间,这取决于你的网络环境。完成后,你会在当前文件夹中发现两个文件 `yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py` and `yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth`。
+下载将需要几秒钟或更长时间,这取决于你的网络环境。完成后,你会在当前文件夹中发现两个文件 `yolov5_s-v61_syncbn_fast_8xb16-300e_coco.py` 和 `yolov5_s-v61_syncbn_fast_8xb16-300e_coco_20220918_084700-86e02187.pth`。
**步骤 2.** 推理验证
@@ -89,109 +97,7 @@ inference_detector(model, 'demo/demo.jpg')
你将会看到一个包含 `DetDataSample` 的列表,预测结果在 `pred_instance` 里,包含有预测框、预测分数 和 预测类别。
-## 自定义安装
-
-### CUDA 版本
-
-在安装 PyTorch 时,你需要指定 CUDA 的版本。如果你不清楚应该选择哪一个,请遵循我们的建议。
-
-- 对于 Ampere 架构的 NVIDIA GPU,例如 GeForce 30 系列 以及 NVIDIA A100,CUDA 11 是必需的。
-- 对于更早的 NVIDIA GPU,CUDA 11 是向后兼容 (backward compatible) 的,但 CUDA 10.2 能够提供更好的兼容性,也更加轻量。
-
-请确保你的 GPU 驱动版本满足最低的版本需求,参阅 NVIDIA 官方的 [CUDA 工具箱和相应的驱动版本关系表](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions__table-cuda-toolkit-driver-versions)。
-
-```{note}
-如果按照我们的最佳实践进行安装,CUDA 运行时库就足够了,因为我们提供相关 CUDA 代码的预编译,不需要进行本地编译。
-但如果你希望从源码进行 MMCV 的编译,或是进行其他 CUDA 算子的开发,那么就必须安装完整的 CUDA 工具链,参见
-[NVIDIA 官网](https://developer.nvidia.com/cuda-downloads) ,另外还需要确保该 CUDA 工具链的版本与 PyTorch 安装时
-的配置相匹配(如用 `conda install` 安装 PyTorch 时指定的 cudatoolkit 版本)。
-```
-
-### 不使用 MIM 安装 MMEngine
-
-要使用 pip 而不是 MIM 来安装 MMEngine,请遵照 [MMEngine 安装指南](https://mmengine.readthedocs.io/en/latest/get_started/installation.html)。
-
-例如,你可以通过以下命令安装 MMEngine:
-
-```shell
-pip install "mmengine>=0.3.1"
-```
-
-### 不使用 MIM 安装 MMCV
-
-MMCV 包含 C++ 和 CUDA 扩展,因此其对 PyTorch 的依赖比较复杂。MIM 会自动解析这些 依赖,选择合适的 MMCV 预编译包,使安装更简单,但它并不是必需的。
-
-要使用 pip 而不是 MIM 来安装 MMCV,请遵照 [MMCV 安装指南](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/installation.html)。
-它需要您用指定 URL 的形式手动指定对应的 PyTorch 和 CUDA 版本。
-
-例如,下述命令将会安装基于 PyTorch 1.12.x 和 CUDA 11.6 编译的 mmcv:
-
-```shell
-pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
-```
-
-### 在 CPU 环境中安装
-
-我们的代码能够建立在只使用 CPU 的环境(CUDA 不可用)。
-
-在 CPU 模式下,可以进行模型训练(需要 MMCV 版本 >= `2.0.0rc1`)、测试或者推理,然而以下功能将在 CPU 模式下不能使用:
-
-- Deformable Convolution
-- Modulated Deformable Convolution
-- ROI pooling
-- Deformable ROI pooling
-- CARAFE: Content-Aware ReAssembly of FEatures
-- SyncBatchNorm
-- CrissCrossAttention: Criss-Cross Attention
-- MaskedConv2d
-- Temporal Interlace Shift
-- nms_cuda
-- sigmoid_focal_loss_cuda
-- bbox_overlaps
-
-因此,如果尝试使用包含上述操作的模型进行训练/测试/推理,将会报错。下表列出了由于依赖上述算子而无法在 CPU 上运行的相关模型:
-
-| 操作 | 模型 |
-| :-----------------------------------------------------: | :--------------------------------------------------------------------------------------: |
-| Deformable Convolution/Modulated Deformable Convolution | DCN、Guided Anchoring、RepPoints、CentripetalNet、VFNet、CascadeRPN、NAS-FCOS、DetectoRS |
-| MaskedConv2d | Guided Anchoring |
-| CARAFE | CARAFE |
-| SyncBatchNorm | ResNeSt |
-
-### 在 Google Colab 中安装
-
-[Google Colab](https://colab.research.google.com/) 通常已经包含了 PyTorch 环境,因此我们只需要安装 MMEngine、MMCV、MMDetection 和 MMYOLO 即可,命令如下:
-
-**步骤 1.** 使用 [MIM](https://github.com/open-mmlab/mim) 安装 [MMEngine](https://github.com/open-mmlab/mmengine) 、 [MMCV](https://github.com/open-mmlab/mmcv) 和 [MMDetection](https://github.com/open-mmlab/mmdetection) 。
-
-```shell
-!pip3 install openmim
-!mim install "mmengine>=0.3.1"
-!mim install "mmcv>=2.0.0rc1,<2.1.0"
-!mim install "mmdet>=3.0.0rc5,<3.1.0"
-```
-
-**步骤 2.** 使用源码安装 MMYOLO:
-
-```shell
-!git clone https://github.com/open-mmlab/mmyolo.git
-%cd mmyolo
-!pip install -e .
-```
-
-**步骤 3.** 验证安装是否成功:
-
-```python
-import mmyolo
-print(mmyolo.__version__)
-# 预期输出: 0.1.0 或其他版本号
-```
-
-```{note}
-在 Jupyter 中,感叹号 `!` 用于执行外部命令,而 `%cd` 是一个[魔术命令](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd),用于切换 Python 的工作路径。
-```
-
-### 通过 Docker 使用 MMYOLO
+## 通过 Docker 使用 MMYOLO
我们提供了一个 [Dockerfile](https://github.com/open-mmlab/mmyolo/blob/main/docker/Dockerfile) 来构建一个镜像。请确保你的 [docker 版本](https://docs.docker.com/engine/install/) >=`19.03`。
@@ -218,18 +124,8 @@ export DATA_DIR=/path/to/your/dataset
docker run --gpus all --shm-size=8g -it -v ${DATA_DIR}:/mmyolo/data mmyolo
```
+其余自定义安装流程请查看 [自定义安装](../tutorials/custom_installation.md)
+
## 排除故障
-如果你在安装过程中遇到一些问题,请先查看 [FAQ](notes/faq.md) 页面。
-
-如果没有找到解决方案,你也可以在 GitHub 上 [打开一个问题](https://github.com/open-mmlab/mmyolo/issues/new/choose)。
-
-## 使用多个 MMYOLO 版本进行开发
-
-训练和测试的脚本已经在 `PYTHONPATH` 中进行了修改,以确保脚本使用当前目录中的 MMYOLO。
-
-要使环境中安装默认的 MMYOLO 而不是当前正在在使用的,可以删除出现在相关脚本中的代码:
-
-```shell
-PYTHONPATH="$(dirname $0)/..":$PYTHONPATH
-```
+如果你在安装过程中遇到一些问题,你可以在 GitHub 上 [打开一个问题](https://github.com/open-mmlab/mmyolo/issues/new/choose)。
diff --git a/docs/zh_cn/get_started/overview.md b/docs/zh_cn/get_started/overview.md
index 58dc66ea..c87454ba 100644
--- a/docs/zh_cn/get_started/overview.md
+++ b/docs/zh_cn/get_started/overview.md
@@ -1,33 +1,60 @@
# 概述
-本章向您介绍 MMYOLO 的整体框架,并提供详细的教程链接。
-
## MMYOLO 介绍
-MMYOLO 是一个 YOLO 系列的算法工具箱,目前仅实现了目标检测任务,后续会支持实例分割、全景分割和关键点检测等多种任务。其包括丰富的目标检测算法以及相关的组件和模块,下面是它的整体框架:
+MMYOLO 是一个基于 PyTorch 和 MMDetection 的 YOLO 系列算法开源工具箱,它是 [OpenMMLab](https://openmmlab.com/) 项目的一部分。 MMYOLO 定位为 YOLO 系列热门开源库以及工业应用核心库,其愿景图如下所示:
-MMYOLO 文件结构和 MMDetection 完全一致。为了能够充分复用 MMDetection 代码,MMYOLO 仅包括定制内容,其由 3 个主要部分组成:`datasets`、`models`、`engine`。
+
+

+
-- **datasets** 支持用于目标检测的各种数据集。
- - **transforms** 包含各种数据增强变换。
-- **models** 是检测器最重要的部分,包含检测器的不同组件。
- - **detectors** 定义所有检测模型类。
- - **data_preprocessors** 用于预处理模型的输入数据。
- - **backbones** 包含各种骨干网络
- - **necks** 包含各种模型颈部组件
- - **dense_heads** 包含执行密集预测的各种检测头。
- - **losses** 包含各种损失函数
- - **task_modules** 为检测任务提供模块。例如 assigners、samplers、box coders 和 prior generators。
- - **layers** 提供了一些基本的神经网络层
-- **engine** 是运行时组件的一部分。
- - **optimizers** 提供优化器和优化器封装。
- - **hooks** 提供 runner 的各种钩子。
+目前支持的 YOLO 系列算法如下:
-## 文档使用指南
+
+支持的算法
+
+- YOLOv5
+- YOLOX
+- RTMDet
+- YOLOv6
+- YOLOv7
+- PPYOLOE
+- YOLOv8
+
+
+
+目前支持的任务如下:
+
+
+支持的任务
+
+- 目标检测
+- 旋转框目标检测
+
+
+
+MMYOLO 支持在 Linux、Windows、macOS 上运行, 支持 PyTorch 1.7 及其以上版本运行。它具有如下三个特性:
+
+- 🕹️ **统一便捷的算法评测**
+
+ MMYOLO 统一了各类 YOLO 算法模块的实现,并提供了统一的评测流程,用户可以公平便捷地进行对比分析。
+
+- 📚 **丰富的入门和进阶文档**
+
+ MMYOLO 提供了从入门到部署到进阶和算法解析等一系列文档,方便不同用户快速上手和扩展。
+
+- 🧩 **模块化设计**
+
+ MMYOLO 将框架解耦成不同的模块组件,通过组合不同的模块和训练测试策略,用户可以便捷地构建自定义模型。
+
+

+ 图为 RangeKing@GitHub 提供,非常感谢!
+
+## 本文档使用指南
MMYOLO 中将文档结构分成 6 个部分,对应不同需求的用户。
@@ -35,7 +62,7 @@ MMYOLO 中将文档结构分成 6 个部分,对应不同需求的用户。
- **推荐专题**。本部分是 MMYOLO 中提供的以主题形式的精华文档,包括了 MMYOLO 中大量的特性等。强烈推荐使用 MMYOLO 的所有用户阅读
- **常用功能**。本部分提供了训练测试过程中用户经常会用到的各类常用功能,用户可以在用到时候再次查阅
- **实用工具**。本部分是 tools 下使用工具的汇总文档,便于大家能够快速的愉快使用 MMYOLO 中提供的各类脚本
-- **基础和进阶教程**。本部分设计到 MMYOLO 中的一些基本概念和进阶教程等,适合想详细了解 MMYOLO 设计思想和结构设计的用户
-- **其他**。其余部分包括 模型仓库、说明和接口文档等等
+- **基础和进阶教程**。本部分涉及到 MMYOLO 中的一些基本概念和进阶教程等,适合想详细了解 MMYOLO 设计思想和结构设计的用户
+- **其他**。其余部分包括模型仓库、说明和接口文档等等
-不同需求的用户可以按需选择你心怡的内容阅读。如果你对本文档有不同异议或者更好的优化办法,欢迎给 MMYOLO 提 PR ~
+不同需求的用户可以按需选择你心怡的内容阅读。如果你对本文档有异议或者更好的优化办法,欢迎给 MMYOLO 提 PR ~, 请参考 [如何给 MMYOLO 贡献代码](../recommended_topics/contributing.md)
diff --git a/docs/zh_cn/index.rst b/docs/zh_cn/index.rst
index d3473e70..1138e9c3 100644
--- a/docs/zh_cn/index.rst
+++ b/docs/zh_cn/index.rst
@@ -1,6 +1,6 @@
欢迎来到 MMYOLO 中文文档!
=======================================
-您可以在页面左下角切换中英文文档。
+您可以在页面右上角切换中英文文档。
.. toctree::
:maxdepth: 2
@@ -18,16 +18,17 @@
:maxdepth: 2
:caption: 推荐专题
- featured_topics/contributing.md
- featured_topics/model_design.md
- featured_topics/industry_examples.md
- featured_topics/dataset_preparation.md
- featured_topics/algorithm_descriptions/index.rst
- featured_topics/replace_backbone.md
- featured_topics/labeling_to_deployment_tutorials.md
- featured_topics/visualization.md
- featured_topics/deploy/index.rst
- featured_topics/troubleshooting_steps.md
+ recommended_topics/contributing.md
+ recommended_topics/model_design.md
+ recommended_topics/algorithm_descriptions/index.rst
+ recommended_topics/replace_backbone.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
.. toctree::
:maxdepth: 2
@@ -40,10 +41,11 @@
common_usage/freeze_layers.md
common_usage/output_predictions.md
common_usage/set_random_seed.md
+ common_usage/module_combination.md
common_usage/mim_usage.md
common_usage/multi_necks.md
common_usage/specify_device.md
- common_usage/module_combination.md
+
.. toctree::
:maxdepth: 2
@@ -51,15 +53,15 @@
useful_tools/browse_coco_json.md
useful_tools/browse_dataset.md
+ useful_tools/print_config.md
useful_tools/dataset_analysis.md
+ useful_tools/optimize_anchors.md
+ useful_tools/extract_subcoco.md
+ useful_tools/vis_scheduler.md
useful_tools/dataset_converters.md
useful_tools/download_dataset.md
- useful_tools/extract_subcoco.md
useful_tools/log_analysis.md
useful_tools/model_converters.md
- useful_tools/optimize_anchors.md
- useful_tools/print_config.md
- useful_tools/vis_scheduler.md
.. toctree::
:maxdepth: 2
@@ -67,8 +69,10 @@
tutorials/config.md
tutorials/data_flow.md
+ tutorials/custom_installation.md
tutorials/faq.md
+
.. toctree::
:maxdepth: 1
:caption: 进阶教程
diff --git a/docs/zh_cn/notes/code_style.md b/docs/zh_cn/notes/code_style.md
index 4634016d..fc6120cc 100644
--- a/docs/zh_cn/notes/code_style.md
+++ b/docs/zh_cn/notes/code_style.md
@@ -1,8 +1,8 @@
-## 代码规范
+# 代码规范
-### 代码规范标准
+## 代码规范标准
-#### PEP 8 —— Python 官方代码规范
+### PEP 8 —— Python 官方代码规范
[Python 官方的代码风格指南](https://www.python.org/dev/peps/pep-0008/),包含了以下几个方面的内容:
@@ -46,7 +46,7 @@ hypot2 = x * x + y * y
这一规范是为了指示不同优先级,但 OpenMMLab 的设置中通常没有启用 yapf 的 `ARITHMETIC_PRECEDENCE_INDICATION` 选项,因而格式规范工具不会按照推荐样式格式化,以设置为准。
:::
-#### Google 开源项目风格指南
+### Google 开源项目风格指南
[Google 使用的编程风格指南](https://google.github.io/styleguide/pyguide.html),包括了 Python 相关的章节。相较于 PEP 8,该指南提供了更为详尽的代码指南。该指南包括了语言规范和风格规范两个部分。
@@ -70,15 +70,15 @@ from mmcv.cnn.bricks import Conv2d, build_norm_layer, DropPath, MaxPool2d, \
from ...utils import is_str # 最多向上回溯一层,过多的回溯容易导致结构混乱
```
-OpenMMLab 项目使用 pre-commit 工具自动格式化代码,详情见[贡献代码](../featured_topics/contributing.md#代码风格)。
+OpenMMLab 项目使用 pre-commit 工具自动格式化代码,详情见[贡献代码](../recommended_topics/contributing.md#代码风格)。
-### 命名规范
+## 命名规范
-#### 命名规范的重要性
+### 命名规范的重要性
优秀的命名是良好代码可读的基础。基础的命名规范对各类变量的命名做了要求,使读者可以方便地根据代码名了解变量是一个类 / 局部变量 / 全局变量等。而优秀的命名则需要代码作者对于变量的功能有清晰的认识,以及良好的表达能力,从而使读者根据名称就能了解其含义,甚至帮助了解该段代码的功能。
-#### 基础命名规范
+### 基础命名规范
| 类型 | 公有 | 私有 |
| --------------- | ---------------- | ------------------ |
@@ -99,7 +99,7 @@ OpenMMLab 项目使用 pre-commit 工具自动格式化代码,详情见[贡献
- 尽量不要使用过于简单的命名,除了约定俗成的循环变量 i,文件变量 f,错误变量 e 等。
- 不会被用到的变量可以命名为 \_,逻辑检查器会将其忽略。
-#### 命名技巧
+### 命名技巧
良好的变量命名需要保证三点:
@@ -136,13 +136,13 @@ def __init__(self, in_channels, out_channels):
注意避免非常规或统一约定的缩写,如 nb -> num_blocks,in_nc -> in_channels
-### docstring 规范
+## docstring 规范
-#### 为什么要写 docstring
+### 为什么要写 docstring
docstring 是对一个类、一个函数功能与 API 接口的详细描述,有两个功能,一是帮助其他开发者了解代码功能,方便 debug 和复用代码;二是在 Readthedocs 文档中自动生成相关的 API reference 文档,帮助不了解源代码的社区用户使用相关功能。
-#### 如何写 docstring
+### 如何写 docstring
与注释不同,一份规范的 docstring 有着严格的格式要求,以便于 Python 解释器以及 sphinx 进行文档解析,详细的 docstring 约定参见 [PEP 257](https://www.python.org/dev/peps/pep-0257/)。此处以例子的形式介绍各种文档的标准格式,参考格式为 [Google 风格](https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_style_rules/#comments)。
@@ -372,13 +372,13 @@ docstring 是对一个类、一个函数功能与 API 接口的详细描述,
- [Example Google Style Python Docstrings ‒ napoleon 0.7 documentation](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html#example-google)
```
-### 注释规范
+## 注释规范
-#### 为什么要写注释
+### 为什么要写注释
对于一个开源项目,团队合作以及社区之间的合作是必不可少的,因而尤其要重视合理的注释。不写注释的代码,很有可能过几个月自己也难以理解,造成额外的阅读和修改成本。
-#### 如何写注释
+### 如何写注释
最需要写注释的是代码中那些技巧性的部分。如果你在下次代码审查的时候必须解释一下,那么你应该现在就给它写注释。对于复杂的操作,应该在其操作开始前写上若干行注释。对于不是一目了然的代码,应在其行尾添加注释。
—— Google 开源项目风格指南
@@ -414,7 +414,7 @@ if i & (i-1) == 0: # True if i bitwise and i-1 is 0.
self._reversed_padding_repeated_twice = _reverse_repeat_tuple(self.padding, 2)
```
-#### 注释示例
+### 注释示例
1. 出自 `mmcv/utils/registry.py`,对于较为复杂的逻辑结构,通过注释,明确了优先级关系。
@@ -447,9 +447,9 @@ self._reversed_padding_repeated_twice = _reverse_repeat_tuple(self.padding, 2)
torch.save(checkpoint, file)
```
-### 类型注解
+## 类型注解
-#### 为什么要写类型注解
+### 为什么要写类型注解
类型注解是对函数中变量的类型做限定或提示,为代码的安全性提供保障、增强代码的可读性、避免出现类型相关的错误。
Python 没有对类型做强制限制,类型注解只起到一个提示作用,通常你的 IDE 会解析这些类型注解,然后在你调用相关代码时对类型做提示。另外也有类型注解检查工具,这些工具会根据类型注解,对代码中可能出现的问题进行检查,减少 bug 的出现。
@@ -461,7 +461,7 @@ Python 没有对类型做强制限制,类型注解只起到一个提示作用
4. 难以理解的代码请进行注释
5. 若代码中的类型已经稳定,可以进行注释. 对于一份成熟的代码,多数情况下,即使注释了所有的函数,也不会丧失太多的灵活性.
-#### 如何写类型注解
+### 如何写类型注解
1. 函数 / 方法类型注解,通常不对 self 和 cls 注释。
@@ -586,7 +586,7 @@ Python 没有对类型做强制限制,类型注解只起到一个提示作用
更多关于类型注解的写法请参考 [typing](https://docs.python.org/3/library/typing.html)。
-#### 类型注解检查工具
+### 类型注解检查工具
[mypy](https://mypy.readthedocs.io/en/stable/) 是一个 Python 静态类型检查工具。根据你的类型注解,mypy 会检查传参、赋值等操作是否符合类型注解,从而避免可能出现的 bug。
diff --git a/docs/zh_cn/featured_topics/algorithm_descriptions/index.rst b/docs/zh_cn/recommended_topics/algorithm_descriptions/index.rst
similarity index 100%
rename from docs/zh_cn/featured_topics/algorithm_descriptions/index.rst
rename to docs/zh_cn/recommended_topics/algorithm_descriptions/index.rst
diff --git a/docs/zh_cn/featured_topics/algorithm_descriptions/rtmdet_description.md b/docs/zh_cn/recommended_topics/algorithm_descriptions/rtmdet_description.md
similarity index 100%
rename from docs/zh_cn/featured_topics/algorithm_descriptions/rtmdet_description.md
rename to docs/zh_cn/recommended_topics/algorithm_descriptions/rtmdet_description.md
diff --git a/docs/zh_cn/featured_topics/algorithm_descriptions/yolov5_description.md b/docs/zh_cn/recommended_topics/algorithm_descriptions/yolov5_description.md
similarity index 100%
rename from docs/zh_cn/featured_topics/algorithm_descriptions/yolov5_description.md
rename to docs/zh_cn/recommended_topics/algorithm_descriptions/yolov5_description.md
diff --git a/docs/zh_cn/featured_topics/algorithm_descriptions/yolov6_description.md b/docs/zh_cn/recommended_topics/algorithm_descriptions/yolov6_description.md
similarity index 100%
rename from docs/zh_cn/featured_topics/algorithm_descriptions/yolov6_description.md
rename to docs/zh_cn/recommended_topics/algorithm_descriptions/yolov6_description.md
diff --git a/docs/zh_cn/featured_topics/algorithm_descriptions/yolov8_description.md b/docs/zh_cn/recommended_topics/algorithm_descriptions/yolov8_description.md
similarity index 100%
rename from docs/zh_cn/featured_topics/algorithm_descriptions/yolov8_description.md
rename to docs/zh_cn/recommended_topics/algorithm_descriptions/yolov8_description.md
diff --git a/docs/zh_cn/featured_topics/contributing.md b/docs/zh_cn/recommended_topics/contributing.md
similarity index 95%
rename from docs/zh_cn/featured_topics/contributing.md
rename to docs/zh_cn/recommended_topics/contributing.md
index 16c76b0a..ff3b2ca3 100644
--- a/docs/zh_cn/featured_topics/contributing.md
+++ b/docs/zh_cn/recommended_topics/contributing.md
@@ -1,4 +1,4 @@
-## 如何给 MMYOLO 贡献代码
+# 如何给 MMYOLO 贡献代码
欢迎加入 MMYOLO 社区,我们致力于打造最前沿的计算机视觉基础库,我们欢迎任何类型的贡献,包括但不限于
@@ -23,11 +23,11 @@
1. 提交 issue,确认添加文档的必要性。
2. 添加文档,提交拉取请求。
-### 拉取请求工作流
+## 拉取请求工作流
如果你对拉取请求不了解,没关系,接下来的内容将会从零开始,一步一步地指引你如何创建一个拉取请求。如果你想深入了解拉取请求的开发模式,可以参考 github [官方文档](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
-#### 1. 复刻仓库
+### 1. 复刻仓库
当你第一次提交拉取请求时,先复刻 OpenMMLab 原代码库,点击 GitHub 页面右上角的 **Fork** 按钮,复刻后的代码库将会出现在你的 GitHub 个人主页下。
@@ -59,7 +59,7 @@ upstream git@github.com:open-mmlab/mmyolo (push)
这里对 origin 和 upstream 进行一个简单的介绍,当我们使用 git clone 来克隆代码时,会默认创建一个 origin 的 remote,它指向我们克隆的代码库地址,而 upstream 则是我们自己添加的,用来指向原始代码库地址。当然如果你不喜欢他叫 upstream,也可以自己修改,比如叫 open-mmlab。我们通常向 origin 提交代码(即 fork 下来的远程仓库),然后向 upstream 提交一个 pull request。如果提交的代码和最新的代码发生冲突,再从 upstream 拉取最新的代码,和本地分支解决冲突,再提交到 origin。
```
-#### 2. 配置 pre-commit
+### 2. 配置 pre-commit
在本地开发环境中,我们使用 [pre-commit](https://pre-commit.com/#intro) 来检查代码风格,以确保代码风格的统一。在提交代码,需要先安装 pre-commit(需要在 MMYOLO 目录下执行):
@@ -98,7 +98,7 @@ pre-commit run --all-files -c .pre-commit-config-zh-cn.yaml
git commit -m "xxx" --no-verify
```
-#### 3. 创建开发分支
+### 3. 创建开发分支
安装完 pre-commit 之后,我们需要基于 dev 创建开发分支,建议的分支命名规则为 `username/pr_name`。
@@ -112,7 +112,7 @@ git checkout -b yhc/refactor_contributing_doc
git pull upstream dev
```
-#### 4. 提交代码并在本地通过单元测试
+### 4. 提交代码并在本地通过单元测试
- MMYOLO 引入了 mypy 来做静态类型检查,以增加代码的鲁棒性。因此我们在提交代码时,需要补充 Type Hints。具体规则可以参考[教程](https://zhuanlan.zhihu.com/p/519335398)。
@@ -130,7 +130,7 @@ git pull upstream dev
- 如果修改/添加了文档,参考[指引](#文档渲染)确认文档渲染正常。
-#### 5. 推送代码到远程
+### 5. 推送代码到远程
代码通过单元测试和 pre-commit 检查后,将代码推送到远程仓库,如果是第一次推送,可以在 `git push` 后加上 `-u` 参数以关联远程分支
@@ -140,7 +140,7 @@ git push -u origin {branch_name}
这样下次就可以直接使用 `git push` 命令推送代码了,而无需指定分支和远程仓库。
-#### 6. 提交拉取请求(PR)
+### 6. 提交拉取请求(PR)
(1) 在 GitHub 的 Pull request 界面创建拉取请求

@@ -177,7 +177,7 @@ MMYOLO 会在 Linux 上,基于不同版本的 Python、PyTorch 对提交的代
所有 reviewer 同意合入 PR 后,我们会尽快将 PR 合并到 dev 分支。
-#### 7. 解决冲突
+### 7. 解决冲突
随着时间的推移,我们的代码库会不断更新,这时候,如果你的 PR 与 dev 分支存在冲突,你需要解决冲突,解决冲突的方式有两种:
@@ -195,9 +195,9 @@ git merge upstream/dev
如果你非常善于处理冲突,那么可以使用 rebase 的方式来解决冲突,因为这能够保证你的 commit log 的整洁。如果你不太熟悉 `rebase` 的使用,那么可以使用 `merge` 的方式来解决冲突。
-### 指引
+## 指引
-#### 单元测试
+### 单元测试
在提交修复代码错误或新增特性的拉取请求时,我们应该尽可能的让单元测试覆盖所有提交的代码,计算单元测试覆盖率的方法如下
@@ -207,7 +207,7 @@ python -m coverage html
# check file in htmlcov/index.html
```
-#### 文档渲染
+### 文档渲染
在提交修复代码错误或新增特性的拉取请求时,可能会需要修改/新增模块的 docstring。我们需要确认渲染后的文档样式是正确的。
本地生成渲染后的文档的方法如下
@@ -220,9 +220,9 @@ make html
# check file in ./docs/zh_cn/_build/html/index.html
```
-### 代码风格
+## 代码风格
-#### Python
+### Python
[PEP8](https://www.python.org/dev/peps/pep-0008/) 作为 OpenMMLab 算法库首选的代码规范,我们使用以下工具检查和格式化代码
@@ -233,21 +233,21 @@ make html
- [mdformat](https://github.com/executablebooks/mdformat):检查 markdown 文件的工具
- [docformatter](https://github.com/myint/docformatter):格式化 docstring 的工具
-yapf 和 isort 的配置可以在 [setup.cfg](./setup.cfg) 找到
+yapf 和 isort 的配置可以在 [setup.cfg](../../../setup.cfg) 找到
通过配置 [pre-commit hook](https://pre-commit.com/) ,我们可以在提交代码时自动检查和格式化 `flake8`、`yapf`、`isort`、`trailing whitespaces`、`markdown files`,
修复 `end-of-files`、`double-quoted-strings`、`python-encoding-pragma`、`mixed-line-ending`,调整 `requirments.txt` 的包顺序。
-pre-commit 钩子的配置可以在 [.pre-commit-config](./.pre-commit-config.yaml) 找到。
+pre-commit 钩子的配置可以在 [.pre-commit-config](../../../.pre-commit-config.yaml) 找到。
pre-commit 具体的安装使用方式见[拉取请求](#2-配置-pre-commit)。
更具体的规范请参考 [OpenMMLab 代码规范](../notes/code_style.md)。
-#### C++ and CUDA
+### C++ and CUDA
C++ 和 CUDA 的代码规范遵从 [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
-### 拉取请求规范
+## 拉取请求规范
1. 使用 [pre-commit hook](https://pre-commit.com),尽量减少代码风格相关问题
diff --git a/docs/zh_cn/featured_topics/dataset_preparation.md b/docs/zh_cn/recommended_topics/dataset_preparation.md
similarity index 100%
rename from docs/zh_cn/featured_topics/dataset_preparation.md
rename to docs/zh_cn/recommended_topics/dataset_preparation.md
diff --git a/docs/zh_cn/featured_topics/deploy/easydeploy_guide.md b/docs/zh_cn/recommended_topics/deploy/easydeploy_guide.md
similarity index 90%
rename from docs/zh_cn/featured_topics/deploy/easydeploy_guide.md
rename to docs/zh_cn/recommended_topics/deploy/easydeploy_guide.md
index 80a69d25..8f337e6c 100644
--- a/docs/zh_cn/featured_topics/deploy/easydeploy_guide.md
+++ b/docs/zh_cn/recommended_topics/deploy/easydeploy_guide.md
@@ -1,4 +1,4 @@
-# EasyDeploy 部署必备教程
+# EasyDeploy 部署
本项目作为 MMYOLO 的部署 project 单独存在,意图剥离 MMDeploy 当前的体系,独自支持用户完成模型训练后的转换和部署功能,使用户的学习和工程成本下降。
diff --git a/docs/zh_cn/featured_topics/deploy/index.rst b/docs/zh_cn/recommended_topics/deploy/index.rst
similarity index 70%
rename from docs/zh_cn/featured_topics/deploy/index.rst
rename to docs/zh_cn/recommended_topics/deploy/index.rst
index 3c545466..3d5f08bc 100644
--- a/docs/zh_cn/featured_topics/deploy/index.rst
+++ b/docs/zh_cn/recommended_topics/deploy/index.rst
@@ -5,17 +5,8 @@ MMDeploy 部署必备教程
:maxdepth: 1
mmdeploy_guide.md
-
-
-MMDeploy 部署 YOLOv5 全流程说明
-************************
-
-.. toctree::
- :maxdepth: 1
-
mmdeploy_yolov5.md
-
EasyDeploy 部署必备教程
************************
diff --git a/docs/zh_cn/featured_topics/deploy/mmdeploy_guide.md b/docs/zh_cn/recommended_topics/deploy/mmdeploy_guide.md
similarity index 98%
rename from docs/zh_cn/featured_topics/deploy/mmdeploy_guide.md
rename to docs/zh_cn/recommended_topics/deploy/mmdeploy_guide.md
index e0181d54..a6a98d3d 100644
--- a/docs/zh_cn/featured_topics/deploy/mmdeploy_guide.md
+++ b/docs/zh_cn/recommended_topics/deploy/mmdeploy_guide.md
@@ -1,4 +1,4 @@
-# 部署必备教程
+# MMDeploy 部署
## MMDeploy 介绍
@@ -83,7 +83,7 @@ test_dataloader = dict(
`test_pipeline` 为部署时对输入图像进行处理的流程,`LetterResize` 控制了输入图像的尺寸,同时限制了导出模型所能接受的输入尺寸。
-`test_dataloader` 为部署时构建数据加载器配置,`batch_shapes_cfg` 控制了是否启用 `batch_shapes` 策略,详细内容可以参考 [yolov5 配置文件说明](https://github.com/open-mmlab/mmyolo/blob/main/docs/zh_cn/user_guides/config.md) 。
+`test_dataloader` 为部署时构建数据加载器配置,`batch_shapes_cfg` 控制了是否启用 `batch_shapes` 策略,详细内容可以参考 [yolov5 配置文件说明](../../tutorials/config.md) 。
#### (2) 部署配置文件介绍
diff --git a/docs/zh_cn/featured_topics/deploy/mmdeploy_yolov5.md b/docs/zh_cn/recommended_topics/deploy/mmdeploy_yolov5.md
similarity index 99%
rename from docs/zh_cn/featured_topics/deploy/mmdeploy_yolov5.md
rename to docs/zh_cn/recommended_topics/deploy/mmdeploy_yolov5.md
index 99c0895d..c48a6406 100644
--- a/docs/zh_cn/featured_topics/deploy/mmdeploy_yolov5.md
+++ b/docs/zh_cn/recommended_topics/deploy/mmdeploy_yolov5.md
@@ -4,7 +4,7 @@
## 模型训练和测试
-模型训练和测试请参考 [YOLOv5 从入门到部署全流程](../get_started/15_minutes.md) 。
+模型训练和测试请参考 [YOLOv5 从入门到部署全流程](./mmdeploy_yolov5.md) 。
## 准备 MMDeploy 运行环境
diff --git a/docs/zh_cn/featured_topics/industry_examples.md b/docs/zh_cn/recommended_topics/industry_examples.md
similarity index 100%
rename from docs/zh_cn/featured_topics/industry_examples.md
rename to docs/zh_cn/recommended_topics/industry_examples.md
diff --git a/docs/zh_cn/featured_topics/labeling_to_deployment_tutorials.md b/docs/zh_cn/recommended_topics/labeling_to_deployment_tutorials.md
similarity index 100%
rename from docs/zh_cn/featured_topics/labeling_to_deployment_tutorials.md
rename to docs/zh_cn/recommended_topics/labeling_to_deployment_tutorials.md
diff --git a/docs/zh_cn/recommended_topics/mm_basics.md b/docs/zh_cn/recommended_topics/mm_basics.md
new file mode 100644
index 00000000..2d8098b1
--- /dev/null
+++ b/docs/zh_cn/recommended_topics/mm_basics.md
@@ -0,0 +1 @@
+# MM 系列仓库必备基础
diff --git a/docs/zh_cn/featured_topics/model_design.md b/docs/zh_cn/recommended_topics/model_design.md
similarity index 100%
rename from docs/zh_cn/featured_topics/model_design.md
rename to docs/zh_cn/recommended_topics/model_design.md
diff --git a/docs/zh_cn/featured_topics/replace_backbone.md b/docs/zh_cn/recommended_topics/replace_backbone.md
similarity index 52%
rename from docs/zh_cn/featured_topics/replace_backbone.md
rename to docs/zh_cn/recommended_topics/replace_backbone.md
index 4514fefe..d78a2520 100644
--- a/docs/zh_cn/featured_topics/replace_backbone.md
+++ b/docs/zh_cn/recommended_topics/replace_backbone.md
@@ -28,162 +28,162 @@ OpenMMLab 2.0 体系中 MMYOLO、MMDetection、MMClassification、MMSelfsup 中
1. 假设想将 `ResNet-50` 作为 `YOLOv5` 的主干网络,则配置文件如下:
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [512, 1024, 2048]
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [512, 1024, 2048]
- model = dict(
- backbone=dict(
- _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
- type='mmdet.ResNet', # 使用 mmdet 中的 ResNet
- depth=50,
- num_stages=4,
- out_indices=(1, 2, 3),
- frozen_stages=1,
- norm_cfg=dict(type='BN', requires_grad=True),
- norm_eval=True,
- style='pytorch',
- init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
- neck=dict(
- type='YOLOv5PAFPN',
- widen_factor=widen_factor,
- in_channels=channels, # 注意:ResNet-50 输出的3个通道是 [512, 1024, 2048],和原先的 yolov5-s neck 不匹配,需要更改
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # head 部分输入通道也要做相应更改
- widen_factor=widen_factor))
- )
- ```
+model = dict(
+ backbone=dict(
+ _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
+ type='mmdet.ResNet', # 使用 mmdet 中的 ResNet
+ depth=50,
+ num_stages=4,
+ out_indices=(1, 2, 3),
+ frozen_stages=1,
+ norm_cfg=dict(type='BN', requires_grad=True),
+ norm_eval=True,
+ style='pytorch',
+ init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ widen_factor=widen_factor,
+ in_channels=channels, # 注意:ResNet-50 输出的3个通道是 [512, 1024, 2048],和原先的 yolov5-s neck 不匹配,需要更改
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # head 部分输入通道也要做相应更改
+ widen_factor=widen_factor))
+)
+```
2. 假设想将 `SwinTransformer-Tiny` 作为 `YOLOv5` 的主干网络,则配置文件如下:
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [192, 384, 768]
- checkpoint_file = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [192, 384, 768]
+checkpoint_file = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
- model = dict(
- backbone=dict(
- _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
- type='mmdet.SwinTransformer', # 使用 mmdet 中的 SwinTransformer
- embed_dims=96,
- depths=[2, 2, 6, 2],
- num_heads=[3, 6, 12, 24],
- window_size=7,
- mlp_ratio=4,
- qkv_bias=True,
- qk_scale=None,
- drop_rate=0.,
- attn_drop_rate=0.,
- drop_path_rate=0.2,
- patch_norm=True,
- out_indices=(1, 2, 3),
- with_cp=False,
- convert_weights=True,
- init_cfg=dict(type='Pretrained', checkpoint=checkpoint_file)),
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # 注意:SwinTransformer-Tiny 输出的3个通道是 [192, 384, 768],和原先的 yolov5-s neck 不匹配,需要更改
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # head 部分输入通道也要做相应更改
- widen_factor=widen_factor))
- )
- ```
+model = dict(
+ backbone=dict(
+ _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
+ type='mmdet.SwinTransformer', # 使用 mmdet 中的 SwinTransformer
+ embed_dims=96,
+ depths=[2, 2, 6, 2],
+ num_heads=[3, 6, 12, 24],
+ window_size=7,
+ mlp_ratio=4,
+ qkv_bias=True,
+ qk_scale=None,
+ drop_rate=0.,
+ attn_drop_rate=0.,
+ drop_path_rate=0.2,
+ patch_norm=True,
+ out_indices=(1, 2, 3),
+ with_cp=False,
+ convert_weights=True,
+ init_cfg=dict(type='Pretrained', checkpoint=checkpoint_file)),
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # 注意:SwinTransformer-Tiny 输出的3个通道是 [192, 384, 768],和原先的 yolov5-s neck 不匹配,需要更改
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # head 部分输入通道也要做相应更改
+ widen_factor=widen_factor))
+)
+```
### 使用在 MMClassification 中实现的主干网络
1. 假设想将 `ConvNeXt-Tiny` 作为 `YOLOv5` 的主干网络,则配置文件如下:
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
- # 请先使用命令: mim install "mmcls>=1.0.0rc2",安装 mmcls
- # 导入 mmcls.models 使得可以调用 mmcls 中注册的模块
- custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
- checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth' # noqa
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [192, 384, 768]
+# 请先使用命令: mim install "mmcls>=1.0.0rc2",安装 mmcls
+# 导入 mmcls.models 使得可以调用 mmcls 中注册的模块
+custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
+checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/convnext/downstream/convnext-tiny_3rdparty_32xb128-noema_in1k_20220301-795e9634.pth' # noqa
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [192, 384, 768]
- model = dict(
- backbone=dict(
- _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
- type='mmcls.ConvNeXt', # 使用 mmcls 中的 ConvNeXt
- arch='tiny',
- out_indices=(1, 2, 3),
- drop_path_rate=0.4,
- layer_scale_init_value=1.0,
- gap_before_final_norm=False,
- init_cfg=dict(
- type='Pretrained', checkpoint=checkpoint_file,
- prefix='backbone.')), # MMCls 中主干网络的预训练权重含义 prefix='backbone.',为了正常加载权重,需要把这个 prefix 去掉。
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # 注意:ConvNeXt-Tiny 输出的3个通道是 [192, 384, 768],和原先的 yolov5-s neck 不匹配,需要更改
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # head 部分输入通道也要做相应更改
- widen_factor=widen_factor))
- )
- ```
+model = dict(
+ backbone=dict(
+ _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
+ type='mmcls.ConvNeXt', # 使用 mmcls 中的 ConvNeXt
+ arch='tiny',
+ out_indices=(1, 2, 3),
+ drop_path_rate=0.4,
+ layer_scale_init_value=1.0,
+ gap_before_final_norm=False,
+ init_cfg=dict(
+ type='Pretrained', checkpoint=checkpoint_file,
+ prefix='backbone.')), # MMCls 中主干网络的预训练权重含义 prefix='backbone.',为了正常加载权重,需要把这个 prefix 去掉。
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # 注意:ConvNeXt-Tiny 输出的3个通道是 [192, 384, 768],和原先的 yolov5-s neck 不匹配,需要更改
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # head 部分输入通道也要做相应更改
+ widen_factor=widen_factor))
+)
+```
2. 假设想将 `MobileNetV3-small` 作为 `YOLOv5` 的主干网络,则配置文件如下:
- ```python
- _base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
+```python
+_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
- # 请先使用命令: mim install "mmcls>=1.0.0rc2",安装 mmcls
- # 导入 mmcls.models 使得可以调用 mmcls 中注册的模块
- custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
- checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v3/convert/mobilenet_v3_small-8427ecf0.pth' # noqa
- deepen_factor = _base_.deepen_factor
- widen_factor = 1.0
- channels = [24, 48, 96]
+# 请先使用命令: mim install "mmcls>=1.0.0rc2",安装 mmcls
+# 导入 mmcls.models 使得可以调用 mmcls 中注册的模块
+custom_imports = dict(imports=['mmcls.models'], allow_failed_imports=False)
+checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v3/convert/mobilenet_v3_small-8427ecf0.pth' # noqa
+deepen_factor = _base_.deepen_factor
+widen_factor = 1.0
+channels = [24, 48, 96]
- model = dict(
- backbone=dict(
- _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
- type='mmcls.MobileNetV3', # 使用 mmcls 中的 MobileNetV3
- arch='small',
- out_indices=(3, 8, 11), # 修改 out_indices
- init_cfg=dict(
- type='Pretrained',
- checkpoint=checkpoint_file,
- prefix='backbone.')), # MMCls 中主干网络的预训练权重含义 prefix='backbone.',为了正常加载权重,需要把这个 prefix 去掉。
- neck=dict(
- type='YOLOv5PAFPN',
- deepen_factor=deepen_factor,
- widen_factor=widen_factor,
- in_channels=channels, # 注意:MobileNetV3-small 输出的3个通道是 [24, 48, 96],和原先的 yolov5-s neck 不匹配,需要更改
- out_channels=channels),
- bbox_head=dict(
- type='YOLOv5Head',
- head_module=dict(
- type='YOLOv5HeadModule',
- in_channels=channels, # head 部分输入通道也要做相应更改
- widen_factor=widen_factor))
- )
- ```
+model = dict(
+ backbone=dict(
+ _delete_=True, # 将 _base_ 中关于 backbone 的字段删除
+ type='mmcls.MobileNetV3', # 使用 mmcls 中的 MobileNetV3
+ arch='small',
+ out_indices=(3, 8, 11), # 修改 out_indices
+ init_cfg=dict(
+ type='Pretrained',
+ checkpoint=checkpoint_file,
+ prefix='backbone.')), # MMCls 中主干网络的预训练权重含义 prefix='backbone.',为了正常加载权重,需要把这个 prefix 去掉。
+ neck=dict(
+ type='YOLOv5PAFPN',
+ deepen_factor=deepen_factor,
+ widen_factor=widen_factor,
+ in_channels=channels, # 注意:MobileNetV3-small 输出的3个通道是 [24, 48, 96],和原先的 yolov5-s neck 不匹配,需要更改
+ out_channels=channels),
+ bbox_head=dict(
+ type='YOLOv5Head',
+ head_module=dict(
+ type='YOLOv5HeadModule',
+ in_channels=channels, # head 部分输入通道也要做相应更改
+ widen_factor=widen_factor))
+)
+```
### 通过 MMClassification 使用 `timm` 中实现的主干网络
diff --git a/docs/zh_cn/featured_topics/troubleshooting_steps.md b/docs/zh_cn/recommended_topics/troubleshooting_steps.md
similarity index 100%
rename from docs/zh_cn/featured_topics/troubleshooting_steps.md
rename to docs/zh_cn/recommended_topics/troubleshooting_steps.md
diff --git a/docs/zh_cn/featured_topics/visualization.md b/docs/zh_cn/recommended_topics/visualization.md
similarity index 99%
rename from docs/zh_cn/featured_topics/visualization.md
rename to docs/zh_cn/recommended_topics/visualization.md
index 52e8c579..8a1b8c6f 100644
--- a/docs/zh_cn/featured_topics/visualization.md
+++ b/docs/zh_cn/recommended_topics/visualization.md
@@ -376,7 +376,7 @@ python tools/analysis_tools/browse_dataset.py \
- **`-p, --phase`**: 可视化数据集的阶段,只能为 `['train', 'val', 'test']` 之一,默认为 `'train'`。
- **`-n, --show-number`**: 可视化样本数量。如果没有指定,默认展示数据集的所有图片。
- **`-m, --mode`**: 可视化的模式,只能为 `['original', 'transformed', 'pipeline']` 之一。 默认为 `'transformed'`。
-- `--cfg-options` : 对配置文件的修改,参考[学习配置文件](./config.md)。
+- `--cfg-options` : 对配置文件的修改,参考[学习配置文件](../../tutorials/config.md)。
```shell
`-m, --mode` 用于设置可视化的模式,默认设置为 'transformed'。
@@ -539,3 +539,5 @@ python tools/analysis_tools/vis_scheduler.py \
```

+
+## 大图推理 (TODO)
diff --git a/docs/zh_cn/tutorials/config.md b/docs/zh_cn/tutorials/config.md
index 738931a3..12c7aafe 100644
--- a/docs/zh_cn/tutorials/config.md
+++ b/docs/zh_cn/tutorials/config.md
@@ -425,7 +425,7 @@ model = dict(
配置文件里会使用一些中间变量,例如数据集里的 `train_pipeline`/`test_pipeline`。我们在定义新的 `train_pipeline`/`test_pipeline` 之后,需要将它们传递到 `data` 里。例如,我们想在训练或测试时,改变 YOLOv5 网络的 `img_scale` 训练尺度并在训练时添加 `YOLOv5MixUp` 数据增强,`img_scale/train_pipeline/test_pipeline` 是我们想要修改的中间变量。
-**注**:使用 `YOLOv5MixUp` 数据增强时,需要将 `YOLOv5MixUp` 之前的训练数据处理流程定义在其 `pre_transform` 中。详细过程和图解可参见 [YOLOv5 原理和实现全解析](../algorithm_descriptions/yolov5_description.md)。
+**注**:使用 `YOLOv5MixUp` 数据增强时,需要将 `YOLOv5MixUp` 之前的训练数据处理流程定义在其 `pre_transform` 中。详细过程和图解可参见 [YOLOv5 原理和实现全解析](../recommended_topics/algorithm_descriptions/yolov5_description.md)。
```python
_base_ = './yolov5_s-v61_syncbn_8xb16-300e_coco.py'
diff --git a/docs/zh_cn/tutorials/custom_installation.md b/docs/zh_cn/tutorials/custom_installation.md
new file mode 100644
index 00000000..df9bf0cf
--- /dev/null
+++ b/docs/zh_cn/tutorials/custom_installation.md
@@ -0,0 +1,111 @@
+# 自定义安装
+
+## CUDA 版本
+
+在安装 PyTorch 时,你需要指定 CUDA 的版本。如果你不清楚应该选择哪一个,请遵循我们的建议。
+
+- 对于 Ampere 架构的 NVIDIA GPU,例如 GeForce 30 系列 以及 NVIDIA A100,CUDA 11 是必需的。
+- 对于更早的 NVIDIA GPU,CUDA 11 是向后兼容 (backward compatible) 的,但 CUDA 10.2 能够提供更好的兼容性,也更加轻量。
+
+请确保你的 GPU 驱动版本满足最低的版本需求,参阅 NVIDIA 官方的 [CUDA 工具箱和相应的驱动版本关系表](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions__table-cuda-toolkit-driver-versions)。
+
+```{note}
+如果按照我们的最佳实践进行安装,CUDA 运行时库就足够了,因为我们提供相关 CUDA 代码的预编译,不需要进行本地编译。
+但如果你希望从源码进行 MMCV 的编译,或是进行其他 CUDA 算子的开发,那么就必须安装完整的 CUDA 工具链,参见
+[NVIDIA 官网](https://developer.nvidia.com/cuda-downloads) ,另外还需要确保该 CUDA 工具链的版本与 PyTorch 安装时
+的配置相匹配(如用 `conda install` 安装 PyTorch 时指定的 cudatoolkit 版本)。
+```
+
+## 不使用 MIM 安装 MMEngine
+
+要使用 pip 而不是 MIM 来安装 MMEngine,请遵照 [MMEngine 安装指南](https://mmengine.readthedocs.io/en/latest/get_started/installation.html)。
+
+例如,你可以通过以下命令安装 MMEngine:
+
+```shell
+pip install "mmengine>=0.3.1"
+```
+
+## 不使用 MIM 安装 MMCV
+
+MMCV 包含 C++ 和 CUDA 扩展,因此其对 PyTorch 的依赖比较复杂。MIM 会自动解析这些 依赖,选择合适的 MMCV 预编译包,使安装更简单,但它并不是必需的。
+
+要使用 pip 而不是 MIM 来安装 MMCV,请遵照 [MMCV 安装指南](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/installation.html)。
+它需要您用指定 URL 的形式手动指定对应的 PyTorch 和 CUDA 版本。
+
+例如,下述命令将会安装基于 PyTorch 1.12.x 和 CUDA 11.6 编译的 mmcv:
+
+```shell
+pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html
+```
+
+## 在 CPU 环境中安装
+
+我们的代码能够建立在只使用 CPU 的环境(CUDA 不可用)。
+
+在 CPU 模式下,可以进行模型训练(需要 MMCV 版本 >= `2.0.0rc1`)、测试或者推理,然而以下功能将在 CPU 模式下不能使用:
+
+- Deformable Convolution
+- Modulated Deformable Convolution
+- ROI pooling
+- Deformable ROI pooling
+- CARAFE: Content-Aware ReAssembly of FEatures
+- SyncBatchNorm
+- CrissCrossAttention: Criss-Cross Attention
+- MaskedConv2d
+- Temporal Interlace Shift
+- nms_cuda
+- sigmoid_focal_loss_cuda
+- bbox_overlaps
+
+因此,如果尝试使用包含上述操作的模型进行训练/测试/推理,将会报错。下表列出了由于依赖上述算子而无法在 CPU 上运行的相关模型:
+
+| 操作 | 模型 |
+| :-----------------------------------------------------: | :--------------------------------------------------------------------------------------: |
+| Deformable Convolution/Modulated Deformable Convolution | DCN、Guided Anchoring、RepPoints、CentripetalNet、VFNet、CascadeRPN、NAS-FCOS、DetectoRS |
+| MaskedConv2d | Guided Anchoring |
+| CARAFE | CARAFE |
+| SyncBatchNorm | ResNeSt |
+
+## 在 Google Colab 中安装
+
+[Google Colab](https://colab.research.google.com/) 通常已经包含了 PyTorch 环境,因此我们只需要安装 MMEngine、MMCV、MMDetection 和 MMYOLO 即可,命令如下:
+
+**步骤 1.** 使用 [MIM](https://github.com/open-mmlab/mim) 安装 [MMEngine](https://github.com/open-mmlab/mmengine) 、 [MMCV](https://github.com/open-mmlab/mmcv) 和 [MMDetection](https://github.com/open-mmlab/mmdetection) 。
+
+```shell
+!pip3 install openmim
+!mim install "mmengine>=0.3.1"
+!mim install "mmcv>=2.0.0rc1,<2.1.0"
+!mim install "mmdet>=3.0.0rc5,<3.1.0"
+```
+
+**步骤 2.** 使用源码安装 MMYOLO:
+
+```shell
+!git clone https://github.com/open-mmlab/mmyolo.git
+%cd mmyolo
+!pip install -e .
+```
+
+**步骤 3.** 验证安装是否成功:
+
+```python
+import mmyolo
+print(mmyolo.__version__)
+# 预期输出: 0.1.0 或其他版本号
+```
+
+```{note}
+在 Jupyter 中,感叹号 `!` 用于执行外部命令,而 `%cd` 是一个[魔术命令](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd),用于切换 Python 的工作路径。
+```
+
+## 使用多个 MMYOLO 版本进行开发
+
+训练和测试的脚本已经在 `PYTHONPATH` 中进行了修改,以确保脚本使用当前目录中的 MMYOLO。
+
+要使环境中安装默认的 MMYOLO 而不是当前正在在使用的,可以删除出现在相关脚本中的如下代码:
+
+```shell
+PYTHONPATH="$(dirname $0)/..":$PYTHONPATH
+```
diff --git a/docs/zh_cn/tutorials/data_flow.md b/docs/zh_cn/tutorials/data_flow.md
index 9e4e52b5..804004de 100644
--- a/docs/zh_cn/tutorials/data_flow.md
+++ b/docs/zh_cn/tutorials/data_flow.md
@@ -1,4 +1,4 @@
-## 混合类图片数据增强更新
+# 混合类图片数据增强更新
混合类图片数据增强是指类似 Mosaic 和 MixUp 一样,在运行过程中需要获取多张图片的标注信息进行融合。 在 OpenMMLab 数据增强 pipeline 中一般是获取不到数据集其他索引的。 为了实现上述功能,在 MMDetection 复现的 YOLOX 中提出了 [MultiImageMixDataset](https://github.com/open-mmlab/mmdetection/blob/master/mmdet/datasets/dataset_wrappers.py#L338) 数据集包装器的概念。
diff --git a/docs/zh_cn/useful_tools/browse_dataset.md b/docs/zh_cn/useful_tools/browse_dataset.md
index a0d4a7c6..ab991daa 100644
--- a/docs/zh_cn/useful_tools/browse_dataset.md
+++ b/docs/zh_cn/useful_tools/browse_dataset.md
@@ -18,7 +18,7 @@ python tools/analysis_tools/browse_dataset.py \
- **`-p, --phase`**: 可视化数据集的阶段,只能为 `['train', 'val', 'test']` 之一,默认为 `'train'`。
- **`-n, --show-number`**: 可视化样本数量。如果没有指定,默认展示数据集的所有图片。
- **`-m, --mode`**: 可视化的模式,只能为 `['original', 'transformed', 'pipeline']` 之一。 默认为 `'transformed'`。
-- `--cfg-options` : 对配置文件的修改,参考[学习配置文件](./config.md)。
+- `--cfg-options` : 对配置文件的修改,参考[学习配置文件](../tutorials/config.md)。
```shell
`-m, --mode` 用于设置可视化的模式,默认设置为 'transformed'。
diff --git a/docs/zh_cn/useful_tools/dataset_converters.md b/docs/zh_cn/useful_tools/dataset_converters.md
index 71e49472..38da7fc7 100644
--- a/docs/zh_cn/useful_tools/dataset_converters.md
+++ b/docs/zh_cn/useful_tools/dataset_converters.md
@@ -4,8 +4,6 @@
- `ballon2coco.py` 将 `balloon` 数据集(该小型数据集仅作为入门使用)转换成 COCO 的格式。
-关于该脚本的详细说明,请看 [YOLOv5 从入门到部署全流程](../get_started/15_minutes.md) 中 `数据集准备` 小节。
-
```shell
python tools/dataset_converters/balloon2coco.py
```
diff --git a/docs/zh_cn/useful_tools/vis_scheduler.md b/docs/zh_cn/useful_tools/vis_scheduler.md
index e6848b17..f0d772ae 100644
--- a/docs/zh_cn/useful_tools/vis_scheduler.md
+++ b/docs/zh_cn/useful_tools/vis_scheduler.md
@@ -25,7 +25,7 @@ python tools/analysis_tools/vis_scheduler.py \
- `--title`: 可视化图片的标题,默认为配置文件名。
- `--style`: 可视化图片的风格,默认为 `whitegrid`。
- `--window-size`: 可视化窗口大小,如果没有指定,默认为 `12*7`。如果需要指定,按照格式 `'W*H'`。
-- `--cfg-options`: 对配置文件的修改,参考[学习配置文件](../user_guides/config.md)。
+- `--cfg-options`: 对配置文件的修改,参考[学习配置文件](../tutorials/config.md)。
```{note}
部分数据集在解析标注阶段比较耗时,推荐直接将 `-d, dataset-size` 指定数据集的大小,以节约时间。