Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICV-mmengine_basecode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Schiffel
ICV-mmengine_basecode
Commits
5a9ac09f
Unverified
Commit
5a9ac09f
authored
2 years ago
by
Mashiro
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Doc]: Fix docs and docstring of config (#497)
parent
5349908e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/zh_cn/tutorials/config.md
+16
-16
16 additions, 16 deletions
docs/zh_cn/tutorials/config.md
mmengine/hub/hub.py
+8
-4
8 additions, 4 deletions
mmengine/hub/hub.py
with
24 additions
and
20 deletions
docs/zh_cn/tutorials/config.md
+
16
−
16
View file @
5a9ac09f
...
@@ -5,22 +5,22 @@ MMEngine 实现了抽象的配置类(Config),为用户提供统一的配
...
@@ -5,22 +5,22 @@ MMEngine 实现了抽象的配置类(Config),为用户提供统一的配
在开始教程之前,我们先将教程中需要用到的配置文件下载到本地(建议在临时目录下执行,方便后续删除示例配置文件):
在开始教程之前,我们先将教程中需要用到的配置文件下载到本地(建议在临时目录下执行,方便后续删除示例配置文件):
```
bash
```
bash
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/config_sgd.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/config_sgd.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/cross_repo.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/cross_repo.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/custom_imports.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/custom_imports.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/demo_train.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/demo_train.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/example.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/example.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/learn_read_config.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/learn_read_config.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/my_module.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/my_module.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/optimizer_cfg.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/optimizer_cfg.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/predefined_var.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/predefined_var.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/refer_base_var.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/refer_base_var.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/resnet50_delete_key.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/resnet50_delete_key.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/resnet50_lr0.01.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/resnet50_lr0.01.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/resnet50_runtime.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/resnet50_runtime.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/resnet50.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/resnet50.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/runtime_cfg.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/runtime_cfg.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
HAOCHENY/config_docs
/docs/resources/config/modify_base_var.py
wget https://raw.githubusercontent.com/open-mmlab/mmengine/
main
/docs/resources/config/modify_base_var.py
```
```
## 配置文件读取
## 配置文件读取
...
...
This diff is collapsed.
Click to expand it.
mmengine/hub/hub.py
+
8
−
4
View file @
5a9ac09f
...
@@ -21,10 +21,9 @@ def get_config(cfg_path: str, pretrained: bool = False) -> Config:
...
@@ -21,10 +21,9 @@ def get_config(cfg_path: str, pretrained: bool = False) -> Config:
by ``cfg.model_path``. Defaults to False.
by ``cfg.model_path``. Defaults to False.
Examples:
Examples:
>>>
cfg
=
get_config
(
'
mmdet::faster_rcnn/faster_rcnn_r50_fpn_1x_coco
'
,
>>>
cfg
=
get_config
(
'
mmdet::faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py
'
,
pretrained
=
True
)
>>>
pretrained
=
True
)
>>>
# Equivalent to
>>>
# Equivalent to
>>>
Config
.
fromfile
(
'
/path/to/faster_rcnn_r50_fpn_1x_coco.py
'
)
>>>
# cfg =
Config.fromfile('/path/to/faster_rcnn_r50_fpn_1x_coco.py')
>>>
cfg
.
model_path
>>>
cfg
.
model_path
https
:
//
download
.
openmmlab
.
com
/
mmdetection
/
v2
.
0
/
faster_rcnn
/
faster_rcnn_r50_fpn_1x_coco
/
faster_rcnn_r50_fpn_1x_coco_20200130
-
047
c8118
.
pth
https
:
//
download
.
openmmlab
.
com
/
mmdetection
/
v2
.
0
/
faster_rcnn
/
faster_rcnn_r50_fpn_1x_coco
/
faster_rcnn_r50_fpn_1x_coco_20200130
-
047
c8118
.
pth
...
@@ -65,9 +64,14 @@ def get_model(cfg_path: str, pretrained: bool = False, **kwargs):
...
@@ -65,9 +64,14 @@ def get_model(cfg_path: str, pretrained: bool = False, **kwargs):
pretrained (bool): Whether to load pretrained model. Defaults to False.
pretrained (bool): Whether to load pretrained model. Defaults to False.
kwargs (dict): Default arguments to build model.
kwargs (dict): Default arguments to build model.
Examples:
>>>
model
=
get_model
(
'
mmdet::faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py
'
,
pretrained
=
True
)
>>>
type
(
model
)
<
class
'
mmdet
.
models
.
detectors
.
faster_rcnn
.
FasterRCNN
'
>
Returns:
Returns:
nn.Module: Built model.
nn.Module: Built model.
"""
"""
# noqa E301
package = cfg_path.split(
'
::
'
)[0]
package = cfg_path.split(
'
::
'
)[0]
with DefaultScope.overwrite_default_scope(package): # type: ignore
with DefaultScope.overwrite_default_scope(package): # type: ignore
cfg = get_config(cfg_path, pretrained)
cfg = get_config(cfg_path, pretrained)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment