Skip to content

Commit ffc2bb3

Browse files
[Docs] Replace the models used in the tutorial document with RTMDet (#9834)
1 parent 13aa724 commit ffc2bb3

File tree

12 files changed

+292
-474
lines changed

12 files changed

+292
-474
lines changed

Diff for: demo/inference_demo.ipynb

+95-281
Large diffs are not rendered by default.

Diff for: docs/en/get_started.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ To verify whether MMDetection is installed correctly, we provide some sample cod
7676
**Step 1.** We need to download config and checkpoint files.
7777

7878
```shell
79-
mim download mmdet --config yolov3_mobilenetv2_8xb24-320-300e_coco --dest .
79+
mim download mmdet --config rtmdet_tiny_8xb32-300e_coco --dest .
8080
```
8181

82-
The downloading will take several seconds or more, depending on your network environment. When it is done, you will find two files `yolov3_mobilenetv2_8xb24-320-300e_coco.py` and `yolov3_mobilenetv2_320_300e_coco_20210719_215349-d18dff72.pth` in your current folder.
82+
The downloading will take several seconds or more, depending on your network environment. When it is done, you will find two files `rtmdet_tiny_8xb32-300e_coco.py` and `rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth` in your current folder.
8383

8484
**Step 2.** Verify the inference demo.
8585

8686
Case a: If you install MMDetection from source, just run the following command.
8787

8888
```shell
89-
python demo/image_demo.py demo/demo.jpg yolov3_mobilenetv2_8xb24-320-300e_coco.py --weights yolov3_mobilenetv2_320_300e_coco_20210719_215349-d18dff72.pth --device cpu
89+
python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu
9090
```
9191

9292
You will see a new image `demo.jpg` on your `./outputs/vis` folder, where bounding boxes are plotted on cars, benches, etc.
@@ -96,8 +96,8 @@ Case b: If you install MMDetection with MIM, open your python interpreter and co
9696
```python
9797
from mmdet.apis import init_detector, inference_detector
9898

99-
config_file = 'yolov3_mobilenetv2_8xb24-320-300e_coco.py'
100-
checkpoint_file = 'yolov3_mobilenetv2_320_300e_coco_20210719_215349-d18dff72.pth'
99+
config_file = 'rtmdet_tiny_8xb32-300e_coco.py'
100+
checkpoint_file = 'rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth'
101101
model = init_detector(config_file, checkpoint_file, device='cpu') # or device='cuda:0'
102102
inference_detector(model, 'demo/demo.jpg')
103103
```

Diff for: docs/en/user_guides/config.md

+34-32
Large diffs are not rendered by default.

Diff for: docs/en/user_guides/inference.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
MMDetection provides hundreds of pre-trained detection models in [Model Zoo](https://mmdetection.readthedocs.io/en/latest/model_zoo.html).
44
This note will show how to inference, which means using trained models to detect objects on images.
55

6-
In MMDetection, a model is defined by a [configuration file](config.md) and existing model parameters are saved in a checkpoint file.
6+
In MMDetection, a model is defined by a [configuration file](https://mmdetection.readthedocs.io/en/3.x/user_guides/config.html) and existing model parameters are saved in a checkpoint file.
77

8-
To start with, we recommend [Faster RCNN](https://github.com/open-mmlab/mmdetection/blob/3.x/configs/faster_rcnn) with this [configuration file](https://github.com/open-mmlab/mmdetection/blob/3.x/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py) and this [checkpoint file](https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth). It is recommended to download the checkpoint file to `checkpoints` directory.
8+
To start with, we recommend [RTMDet](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet) with this [configuration file](https://github.com/open-mmlab/mmdetection/blob/3.x/configs/rtmdet/rtmdet_l_8xb32-300e_coco.py) and this [checkpoint file](https://download.openmmlab.com/mmdetection/v3.0/rtmdet/rtmdet_l_8xb32-300e_coco/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth). It is recommended to download the checkpoint file to `checkpoints` directory.
99

1010
## High-level APIs for inference
1111

@@ -21,8 +21,8 @@ from mmdet.apis import init_detector, inference_detector
2121

2222

2323
# Specify the path to model config and checkpoint file
24-
config_file = 'configs/faster_rcnn/faster-rcnn_r50-fpn_1x_coco.py'
25-
checkpoint_file = 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
24+
config_file = 'configs/rtmdet/rtmdet_l_8xb32-300e_coco.py'
25+
checkpoint_file = 'checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth'
2626

2727
# Build the model from a config file and a checkpoint file
2828
model = init_detector(config_file, checkpoint_file, device='cuda:0')
@@ -110,8 +110,8 @@ Examples:
110110

111111
```shell
112112
python demo/image_demo.py demo/demo.jpg \
113-
configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
114-
--weights checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
113+
configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \
114+
--weights checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \
115115
--device cpu
116116
```
117117

@@ -132,8 +132,8 @@ Examples:
132132

133133
```shell
134134
python demo/webcam_demo.py \
135-
configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
136-
checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
135+
configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \
136+
checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth
137137
```
138138

139139
### Video demo
@@ -156,8 +156,8 @@ Examples:
156156

157157
```shell
158158
python demo/video_demo.py demo/demo.mp4 \
159-
configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
160-
checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
159+
configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \
160+
checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \
161161
--out result.mp4
162162
```
163163

@@ -182,7 +182,7 @@ Examples:
182182

183183
```shell
184184
python demo/video_gpuaccel_demo.py demo/demo.mp4 \
185-
configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
186-
checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
185+
configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \
186+
checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \
187187
--nvdecode --out result.mp4
188188
```

Diff for: docs/en/user_guides/test.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ Optional arguments:
5454

5555
Assuming that you have already downloaded the checkpoints to the directory `checkpoints/`.
5656

57-
1. Test Faster R-CNN and visualize the results. Press any key for the next image.
58-
Config and checkpoint files are available [here](../../../configs/faster_rcnn).
57+
1. Test RTMDet and visualize the results. Press any key for the next image.
58+
Config and checkpoint files are available [here](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet).
5959

6060
```shell
6161
python tools/test.py \
62-
configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
63-
checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
62+
configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \
63+
checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \
6464
--show
6565
```
6666

67-
2. Test Faster R-CNN and save the painted images for future visualization.
68-
Config and checkpoint files are available [here](../../../configs/faster_rcnn).
67+
2. Test RTMDet and save the painted images for future visualization.
68+
Config and checkpoint files are available [here](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet).
6969

7070
```shell
7171
python tools/test.py \
72-
configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \
73-
checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
72+
configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \
73+
checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \
7474
--show-dir faster_rcnn_r50_fpn_1x_results
7575
```
7676

Diff for: docs/en/user_guides/train.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You could download the existing models in advance if the network connection is u
1313

1414
## Learning rate auto scaling
1515

16-
**Important**: The default learning rate in config files is for 8 GPUs and 2 sample per GPU (batch size = 8 * 2 = 16). And it had been set to `auto_scale_lr.base_batch_size` in `config/_base_/default_runtime.py`. Learning rate will be automatically scaled base on this value when the batch size is `16`. Meanwhile, in order not to affect other codebase which based on mmdet, the flag `auto_scale_lr.enable` is set to `False` by default.
16+
**Important**: The default learning rate in config files is for 8 GPUs and 2 sample per GPU (batch size = 8 * 2 = 16). And it had been set to `auto_scale_lr.base_batch_size` in `config/_base_/schedules/schedule_1x.py`. Learning rate will be automatically scaled base on this value when the batch size is `16`. Meanwhile, in order not to affect other codebase which based on mmdet, the flag `auto_scale_lr.enable` is set to `False` by default.
1717

1818
If you want to enable this feature, you need to add argument `--auto-scale-lr`. And you need to check the config name which you want to use before you process the command, because the config name indicates the default batch size.
1919
By default, it is `8 x 2 = 16 batch size`, like `faster_rcnn_r50_caffe_fpn_90k_coco.py` or `pisa_faster_rcnn_x101_32x4d_fpn_1x_coco.py`. In other cases, you will see the config file name have `_NxM_` in dictating, like `cornernet_hourglass104_mstest_32x3_210e_coco.py` which batch size is `32 x 3 = 96`, or `scnet_x101_64x4d_fpn_8x1_20e_coco.py` which batch size is `8 x 1 = 8`.
@@ -436,7 +436,7 @@ To train a model with the new config, you can simply run
436436
python tools/train.py configs/balloon/mask-rcnn_r50-caffe_fpn_ms-poly-1x_balloon.py
437437
```
438438

439-
For more detailed usages, please refer to the [training guide](train.md).
439+
For more detailed usages, please refer to the [training guide](https://mmdetection.readthedocs.io/en/3.x/user_guides/train.html#train-predefined-models-on-standard-datasets).
440440

441441
## Test and inference
442442

@@ -446,4 +446,4 @@ To test the trained model, you can simply run
446446
python tools/test.py configs/balloon/mask-rcnn_r50-caffe_fpn_ms-poly-1x_balloon.py work_dirs/mask-rcnn_r50-caffe_fpn_ms-poly-1x_balloon/epoch_12.pth
447447
```
448448

449-
For more detailed usages, please refer to the [testing guide](test.md).
449+
For more detailed usages, please refer to the [testing guide](https://mmdetection.readthedocs.io/en/3.x/user_guides/test.html).

Diff for: docs/zh_cn/get_started.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ mim install "mmdet>=3.0.0rc0"
7575
**步骤 1.** 我们需要下载配置文件和模型权重文件。
7676

7777
```shell
78-
mim download mmdet --config yolov3_mobilenetv2_8xb24-320-300e_coco --dest .
78+
mim download mmdet --config rtmdet_tiny_8xb32-300e_coco --dest .
7979
```
8080

81-
下载将需要几秒钟或更长时间,这取决于你的网络环境。完成后,你会在当前文件夹中发现两个文件 `yolov3_mobilenetv2_8xb24-320-300e_coco.py``yolov3_mobilenetv2_320_300e_coco_20210719_215349-d18dff72.pth`
81+
下载将需要几秒钟或更长时间,这取决于你的网络环境。完成后,你会在当前文件夹中发现两个文件 `rtmdet_tiny_8xb32-300e_coco.py``rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth`
8282

8383
**步骤 2.** 推理验证。
8484

8585
方案 a:如果你通过源码安装的 MMDetection,那么直接运行以下命令进行验证:
8686

8787
```shell
88-
python demo/image_demo.py demo/demo.jpg yolov3_mobilenetv2_8xb24-320-300e_coco.py --weights yolov3_mobilenetv2_320_300e_coco_20210719_215349-d18dff72.pth --device cpu
88+
python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu
8989
```
9090

9191
你会在当前文件夹中的 `outputs/vis` 文件夹中看到一个新的图像 `demo.jpg`,图像中包含有网络预测的检测框。
@@ -95,8 +95,8 @@ python demo/image_demo.py demo/demo.jpg yolov3_mobilenetv2_8xb24-320-300e_coco.p
9595
```python
9696
from mmdet.apis import init_detector, inference_detector
9797

98-
config_file = 'yolov3_mobilenetv2_8xb24-320-300e_coco.py'
99-
checkpoint_file = 'yolov3_mobilenetv2_320_300e_coco_20210719_215349-d18dff72.pth'
98+
config_file = 'rtmdet_tiny_8xb32-300e_coco.py'
99+
checkpoint_file = 'rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth'
100100
model = init_detector(config_file, checkpoint_file, device='cpu') # or device='cuda:0'
101101
inference_detector(model, 'demo/demo.jpg')
102102
```

0 commit comments

Comments
 (0)