From 3da4e04656d572b6065af1e6aa6a310549a4e1d1 Mon Sep 17 00:00:00 2001 From: Zhengfei-0311 <78833899+Zhengfei-0311@users.noreply.github.com> Date: Sat, 8 Oct 2022 11:20:52 +0800 Subject: [PATCH] [Doc]: Update config.md (#562) * Update config.md * Update config.md --- docs/zh_cn/tutorials/config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh_cn/tutorials/config.md b/docs/zh_cn/tutorials/config.md index 35ec44094c..486dba2b89 100644 --- a/docs/zh_cn/tutorials/config.md +++ b/docs/zh_cn/tutorials/config.md @@ -113,7 +113,7 @@ optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) 然后在算法库中可以通过如下代码构造优化器对象。 ```python -from mmengine import Config +from mmengine import Config, optim from mmengine.registry import OPTIMIZERS import torch.nn as nn @@ -573,7 +573,7 @@ MMEngine 还提供了 `get_config` 和 `get_model` 两个接口,支持对符 用户可以通过指定 `pretrained=True` 获得已经加载预训练权重的模型以进行训练或者推理。 ```python -from mmengine import get_model +from mmengine.hub import get_model model = get_model( 'mmdet::faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py', pretrained=True) @@ -590,7 +590,7 @@ http loads checkpoint from path: https://download.openmmlab.com/mmdetection/v2.0 同时,如果用户指定 `pretrained=True` ,得到的配置文件中会新增 `model_path` 字段,指定了对应模型预训练权重的路径。 ```python -from mmengine import get_config +from mmengine.hub import get_config cfg = get_config( 'mmdet::faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py', pretrained=True)