[Docs] Make API of docs clearer (#469)

* [Docs] Make API of docs clearer

* minor fix

* fix md format
pull/416/head^2
Zaida Zhou 2022-08-30 16:27:20 +08:00 committed by GitHub
parent 9728b6aaef
commit 3f5e08fa4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 1663 additions and 136 deletions

2
.gitignore vendored
View File

@ -64,7 +64,9 @@ instance/
# Sphinx documentation
docs/en/_build/
docs/en/api/generated/
docs/zh_cn/_build/
docs/zh_cn/api/generated/
src/
# PyBuilder

View File

@ -0,0 +1,3 @@
table.colwidths-auto td {
width: 50%
}

View File

@ -0,0 +1,14 @@
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}
{{ name | underline}}
.. autoclass:: {{ name }}
:members:
..
autogenerated from source/_templates/classtemplate.rst
note it does not have :inherited-members:

View File

@ -1,59 +0,0 @@
Registry
--------
.. automodule:: mmengine.registry
:members:
Config
--------
.. automodule:: mmengine.config
:members:
Runner
--------
.. automodule:: mmengine.runner
:members:
Hook
--------
.. automodule:: mmengine.hooks
:members:
Optimizer
----------
.. automodule:: mmengine.optim
:members:
Data Structures
----------------
.. automodule:: mmengine.structures
:members:
Dataset
------------
.. automodule:: mmengine.dataset
:members:
Distributed
-----------
.. automodule:: mmengine.dist
:members:
Logging
--------
.. automodule:: mmengine.logging
:members:
Model
--------
.. automodule:: mmengine.model
:members:
Visualization
--------
.. automodule:: mmengine.visualization
:members:
Utils
--------
.. automodule:: mmengine.utils
:members:

View File

@ -0,0 +1,16 @@
.. role:: hidden
:class: hidden-section
mmengine.config
===================================
.. currentmodule:: mmengine.config
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Config
ConfigDict
DictAction

View File

@ -0,0 +1,59 @@
.. role:: hidden
:class: hidden-section
mmengine.dataset
===================================
.. contents:: mmengine.dataset
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.dataset
Dataset
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseDataset
Compose
force_full_init
Dataset Wrapper
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
ClassBalancedDataset
ConcatDataset
RepeatDataset
Sampler
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
DefaultSampler
InfiniteSampler
Utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
default_collate
pseudo_collate
worker_init_fn

View File

@ -0,0 +1,18 @@
.. role:: hidden
:class: hidden-section
mmengine.device
===================================
.. currentmodule:: mmengine.device
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_device
get_max_cuda_memory
is_cuda_available
is_mlu_available
is_mps_available

View File

@ -0,0 +1,60 @@
.. role:: hidden
:class: hidden-section
mmengine.dist
===================================
.. contents:: mmengine.dist
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.dist
dist
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
gather
gather_object
all_gather
all_gather_object
all_reduce
all_reduce_dict
all_reduce_params
broadcast
sync_random_seed
broadcast_object_list
collect_results
collect_results_cpu
collect_results_gpu
utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_dist_info
init_dist
init_local_group
get_backend
get_world_size
get_rank
get_local_size
get_local_rank
is_main_process
master_only
barrier
is_distributed
get_local_group
get_default_group
get_data_device
get_comm_device
cast_data_device

View File

@ -0,0 +1,44 @@
.. role:: hidden
:class: hidden-section
mmengine.evaluator
===================================
.. contents:: mmengine.evaluator
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.evaluator
Evaluator
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Evaluator
Metric
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseMetric
DumpResults
Utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_metric_value

View File

@ -0,0 +1,64 @@
.. role:: hidden
:class: hidden-section
mmengine.fileio
===================================
.. contents:: mmengine.fileio
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.fileio
File Client
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseStorageBackend
FileClient
HardDiskBackend
HTTPBackend
LmdbBackend
MemcachedBackend
PetrelBackend
File Handler
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseFileHandler
JsonHandler
PickleHandler
YamlHandler
File IO
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
dump
load
register_handler
Parse File
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
dict_from_file
list_from_file

View File

@ -0,0 +1,24 @@
.. role:: hidden
:class: hidden-section
mmengine.hooks
===================================
.. currentmodule:: mmengine.hooks
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Hook
CheckpointHook
EMAHook
LoggerHook
NaiveVisualizationHook
ParamSchedulerHook
RuntimeInfoHook
DistSamplerSeedHook
IterTimerHook
SyncBuffersHook
EmptyCacheHook

View File

@ -0,0 +1,15 @@
.. role:: hidden
:class: hidden-section
mmengine.hub
===================================
.. currentmodule:: mmengine.hub
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_config
get_config

View File

@ -0,0 +1,17 @@
.. role:: hidden
:class: hidden-section
mmengine.logging
===================================
.. currentmodule:: mmengine.logging
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
MMLogger
MessageHub
HistoryBuffer
print_log

View File

@ -0,0 +1,104 @@
.. role:: hidden
:class: hidden-section
mmengine.model
===================================
.. contents:: mmengine.model
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.model
Module
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseModule
ModuleDict
ModuleList
Sequential
Model
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseModel
BaseDataPreprocessor
ImgDataPreprocessor
EMA
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseAveragedModel
ExponentialMovingAverage
MomentumAnnealingEMA
StochasticWeightAverage
Model Wrapper
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
MMDistributedDataParallel
MMSeparateDistributedDataParallel
MMFullyShardedDataParallel
is_model_wrapper
Weight Initialization
----------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseInit
Caffe2XavierInit
ConstantInit
KaimingInit
NormalInit
PretrainedInit
TruncNormalInit
UniformInit
XavierInit
bias_init_with_prob
caffe2_xavier_init
constant_init
initialize
kaiming_init
normal_init
trunc_normal_init
uniform_init
update_init_info
xavier_init
Utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
detect_anomalous_params
merge_dict
stack_batch
revert_sync_batchnorm

View File

@ -0,0 +1,59 @@
.. role:: hidden
:class: hidden-section
mmengine.optim
===================================
.. contents:: mmengine.optim
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.optim
Optimizer
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
AmpOptimWrapper
OptimWrapper
OptimWrapperDict
DefaultOptimWrapperConstructor
build_optim_wrapper
Scheduler
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
_ParamScheduler
ConstantLR
ConstantMomentum
ConstantParamScheduler
CosineAnnealingLR
CosineAnnealingMomentum
CosineAnnealingParamScheduler
ExponentialLR
ExponentialMomentum
ExponentialParamScheduler
LinearLR
LinearMomentum
LinearParamScheduler
MultiStepLR
MultiStepMomentum
MultiStepParamScheduler
OneCycleLR
OneCycleParamScheduler
PolyLR
PolyMomentum
PolyParamScheduler
StepLR
StepMomentum
StepParamScheduler

View File

@ -0,0 +1,21 @@
.. role:: hidden
:class: hidden-section
mmengine.registry
===================================
.. currentmodule:: mmengine.registry
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Registry
DefaultScope
build_from_cfg
build_model_from_cfg
build_runner_from_cfg
build_scheduler_from_cfg
count_registered_modules
traverse_registry_tree

View File

@ -0,0 +1,78 @@
.. role:: hidden
:class: hidden-section
mmengine.runner
===================================
.. contents:: mmengine.runner
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.runner
Runner
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Runner
Loop
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseLoop
EpochBasedTrainLoop
IterBasedTrainLoop
ValLoop
TestLoop
Checkpoints
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
CheckpointLoader
find_latest_checkpoint
get_deprecated_model_names
get_external_models
get_mmcls_models
get_state_dict
get_torchvision_models
load_checkpoint
load_state_dict
save_checkpoint
weights_to_cpu
AMP
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
autocast
Miscellaneous
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
LogProcessor
Priority
get_priority

View File

@ -0,0 +1,22 @@
.. role:: hidden
:class: hidden-section
mmengine.structures
===================================
.. contents:: mmengine.structures
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.structures
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseDataElement
InstanceData
LabelData
PixelData

View File

@ -0,0 +1,24 @@
.. role:: hidden
:class: hidden-section
mmengine.utils.dl_utils
===================================
.. currentmodule:: mmengine.utils.dl_utils
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
collect_env
load_url
has_batch_norm
is_norm
mmcv_full_available
tensor2imgs
TORCH_VERSION
set_multi_processing
TimeCounter
torch_meshgrid
is_jit_tracing

View File

@ -0,0 +1,110 @@
.. role:: hidden
:class: hidden-section
mmengine.utils
===================================
.. contents:: mmengine.utils
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.utils
Manager
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
ManagerMeta
ManagerMixin
Path
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
check_file_exist
fopen
is_abs
is_filepath
mkdir_or_exist
scandir
symlink
Package
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
call_command
check_install_package
get_installed_path
is_installed
Version
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
digit_version
get_git_hash
Progress Bar
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
ProgressBar
track_iter_progress
track_parallel_progress
track_progress
Miscellaneous
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
is_list_of
is_tuple_of
is_seq_of
is_str
iter_cast
list_cast
tuple_cast
concat_list
slice_list
to_1tuple
to_2tuple
to_3tuple
to_4tuple
to_ntuple
check_prerequisites
deprecated_api_warning
has_method
is_method_overridden
import_modules_from_strings
requires_executable
requires_package
Timer
TimerError
check_time

View File

@ -0,0 +1,35 @@
.. role:: hidden
:class: hidden-section
mmengine.visualization
===================================
.. contents:: mmengine.visualization
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.visualization
Visualizer
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Visualizer
visualization Backend
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseVisBackend
LocalVisBackend
TensorboardVisBackend
WandbVisBackend

View File

@ -40,6 +40,8 @@ release = __version__
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.autosectionlabel',
@ -50,6 +52,14 @@ extensions = [
] # yapf: disable
autodoc_typehints = 'description'
# Configuration for intersphinx
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable', None),
'torch': ('https://pytorch.org/docs/stable/', None),
'mmcv': ('https://mmcv.readthedocs.io/en/dev-2.x/', None),
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -81,6 +91,7 @@ html_theme_options = {
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']
# -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code

View File

@ -0,0 +1,2 @@
[html writers]
table_style: colwidths-auto

View File

@ -9,10 +9,26 @@ You can switch between Chinese and English documents in the lower-left corner of
tutorials/registry.md
.. toctree::
:maxdepth: 2
:maxdepth: 1
:caption: API Reference
api.rst
mmengine.registry <api/registry>
mmengine.config <api/config>
mmengine.runner <api/runner>
mmengine.hooks <api/hooks>
mmengine.model <api/model>
mmengine.optim <api/optim>
mmengine.evaluator <api/evaluator>
mmengine.structures <api/structures>
mmengine.dataset <api/dataset>
mmengine.device <api/device>
mmengine.hub <api/hub>
mmengine.logging <api/logging>
mmengine.visualization <api/visualization>
mmengine.fileio <api/fileio>
mmengine.dist <api/dist>
mmengine.utils <api/utils>
mmengine.utils.dl_utils <api/utils.dl_utils>
.. toctree::
:caption: Switch Language

View File

@ -0,0 +1,3 @@
table.colwidths-auto td {
width: 50%
}

View File

@ -0,0 +1,14 @@
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}
{{ name | underline}}
.. autoclass:: {{ name }}
:members:
..
autogenerated from source/_templates/classtemplate.rst
note it does not have :inherited-members:

View File

@ -1,59 +0,0 @@
Registry
--------
.. automodule:: mmengine.registry
:members:
Config
--------
.. automodule:: mmengine.config
:members:
Runner
--------
.. automodule:: mmengine.runner
:members:
Hook
--------
.. automodule:: mmengine.hooks
:members:
Optimizer
----------
.. automodule:: mmengine.optim
:members:
Data Structures
----------------
.. automodule:: mmengine.structures
:members:
Dataset
------------
.. automodule:: mmengine.dataset
:members:
Distributed
-----------
.. automodule:: mmengine.dist
:members:
Logging
--------
.. automodule:: mmengine.logging
:members:
Model
--------
.. automodule:: mmengine.model
:members:
Visualization
--------
.. automodule:: mmengine.visualization
:members:
Utils
--------
.. automodule:: mmengine.utils
:members:

View File

@ -0,0 +1,16 @@
.. role:: hidden
:class: hidden-section
mmengine.config
===================================
.. currentmodule:: mmengine.config
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Config
ConfigDict
DictAction

View File

@ -0,0 +1,59 @@
.. role:: hidden
:class: hidden-section
mmengine.dataset
===================================
.. contents:: mmengine.dataset
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.dataset
Dataset
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseDataset
Compose
force_full_init
Dataset Wrapper
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
ClassBalancedDataset
ConcatDataset
RepeatDataset
Sampler
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
DefaultSampler
InfiniteSampler
Utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
default_collate
pseudo_collate
worker_init_fn

View File

@ -0,0 +1,18 @@
.. role:: hidden
:class: hidden-section
mmengine.device
===================================
.. currentmodule:: mmengine.device
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_device
get_max_cuda_memory
is_cuda_available
is_mlu_available
is_mps_available

View File

@ -0,0 +1,60 @@
.. role:: hidden
:class: hidden-section
mmengine.dist
===================================
.. contents:: mmengine.dist
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.dist
dist
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
gather
gather_object
all_gather
all_gather_object
all_reduce
all_reduce_dict
all_reduce_params
broadcast
sync_random_seed
broadcast_object_list
collect_results
collect_results_cpu
collect_results_gpu
utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_dist_info
init_dist
init_local_group
get_backend
get_world_size
get_rank
get_local_size
get_local_rank
is_main_process
master_only
barrier
is_distributed
get_local_group
get_default_group
get_data_device
get_comm_device
cast_data_device

View File

@ -0,0 +1,44 @@
.. role:: hidden
:class: hidden-section
mmengine.evaluator
===================================
.. contents:: mmengine.evaluator
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.evaluator
Evaluator
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Evaluator
Metric
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseMetric
DumpResults
Utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_metric_value

View File

@ -0,0 +1,64 @@
.. role:: hidden
:class: hidden-section
mmengine.fileio
===================================
.. contents:: mmengine.fileio
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.fileio
File Client
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseStorageBackend
FileClient
HardDiskBackend
HTTPBackend
LmdbBackend
MemcachedBackend
PetrelBackend
File Handler
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseFileHandler
JsonHandler
PickleHandler
YamlHandler
File IO
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
dump
load
register_handler
Parse File
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
dict_from_file
list_from_file

View File

@ -0,0 +1,24 @@
.. role:: hidden
:class: hidden-section
mmengine.hooks
===================================
.. currentmodule:: mmengine.hooks
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Hook
CheckpointHook
EMAHook
LoggerHook
NaiveVisualizationHook
ParamSchedulerHook
RuntimeInfoHook
DistSamplerSeedHook
IterTimerHook
SyncBuffersHook
EmptyCacheHook

View File

@ -0,0 +1,15 @@
.. role:: hidden
:class: hidden-section
mmengine.hub
===================================
.. currentmodule:: mmengine.hub
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
get_config
get_config

View File

@ -0,0 +1,17 @@
.. role:: hidden
:class: hidden-section
mmengine.logging
===================================
.. currentmodule:: mmengine.logging
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
MMLogger
MessageHub
HistoryBuffer
print_log

View File

@ -0,0 +1,104 @@
.. role:: hidden
:class: hidden-section
mmengine.model
===================================
.. contents:: mmengine.model
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.model
Module
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseModule
ModuleDict
ModuleList
Sequential
Model
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseModel
BaseDataPreprocessor
ImgDataPreprocessor
EMA
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseAveragedModel
ExponentialMovingAverage
MomentumAnnealingEMA
StochasticWeightAverage
Model Wrapper
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
MMDistributedDataParallel
MMSeparateDistributedDataParallel
MMFullyShardedDataParallel
is_model_wrapper
Weight Initialization
----------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseInit
Caffe2XavierInit
ConstantInit
KaimingInit
NormalInit
PretrainedInit
TruncNormalInit
UniformInit
XavierInit
bias_init_with_prob
caffe2_xavier_init
constant_init
initialize
kaiming_init
normal_init
trunc_normal_init
uniform_init
update_init_info
xavier_init
Utils
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
detect_anomalous_params
merge_dict
stack_batch
revert_sync_batchnorm

View File

@ -0,0 +1,59 @@
.. role:: hidden
:class: hidden-section
mmengine.optim
===================================
.. contents:: mmengine.optim
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.optim
Optimizer
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
AmpOptimWrapper
OptimWrapper
OptimWrapperDict
DefaultOptimWrapperConstructor
build_optim_wrapper
Scheduler
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
_ParamScheduler
ConstantLR
ConstantMomentum
ConstantParamScheduler
CosineAnnealingLR
CosineAnnealingMomentum
CosineAnnealingParamScheduler
ExponentialLR
ExponentialMomentum
ExponentialParamScheduler
LinearLR
LinearMomentum
LinearParamScheduler
MultiStepLR
MultiStepMomentum
MultiStepParamScheduler
OneCycleLR
OneCycleParamScheduler
PolyLR
PolyMomentum
PolyParamScheduler
StepLR
StepMomentum
StepParamScheduler

View File

@ -0,0 +1,21 @@
.. role:: hidden
:class: hidden-section
mmengine.registry
===================================
.. currentmodule:: mmengine.registry
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Registry
DefaultScope
build_from_cfg
build_model_from_cfg
build_runner_from_cfg
build_scheduler_from_cfg
count_registered_modules
traverse_registry_tree

View File

@ -0,0 +1,78 @@
.. role:: hidden
:class: hidden-section
mmengine.runner
===================================
.. contents:: mmengine.runner
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.runner
Runner
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Runner
Loop
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseLoop
EpochBasedTrainLoop
IterBasedTrainLoop
ValLoop
TestLoop
Checkpoints
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
CheckpointLoader
find_latest_checkpoint
get_deprecated_model_names
get_external_models
get_mmcls_models
get_state_dict
get_torchvision_models
load_checkpoint
load_state_dict
save_checkpoint
weights_to_cpu
AMP
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
autocast
Miscellaneous
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
LogProcessor
Priority
get_priority

View File

@ -0,0 +1,22 @@
.. role:: hidden
:class: hidden-section
mmengine.structures
===================================
.. contents:: mmengine.structures
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.structures
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseDataElement
InstanceData
LabelData
PixelData

View File

@ -0,0 +1,24 @@
.. role:: hidden
:class: hidden-section
mmengine.utils.dl_utils
===================================
.. currentmodule:: mmengine.utils.dl_utils
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
collect_env
load_url
has_batch_norm
is_norm
mmcv_full_available
tensor2imgs
TORCH_VERSION
set_multi_processing
TimeCounter
torch_meshgrid
is_jit_tracing

View File

@ -0,0 +1,110 @@
.. role:: hidden
:class: hidden-section
mmengine.utils
===================================
.. contents:: mmengine.utils
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.utils
Manager
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
ManagerMeta
ManagerMixin
Path
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
check_file_exist
fopen
is_abs
is_filepath
mkdir_or_exist
scandir
symlink
Package
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
call_command
check_install_package
get_installed_path
is_installed
Version
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
digit_version
get_git_hash
Progress Bar
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
ProgressBar
track_iter_progress
track_parallel_progress
track_progress
Miscellaneous
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
is_list_of
is_tuple_of
is_seq_of
is_str
iter_cast
list_cast
tuple_cast
concat_list
slice_list
to_1tuple
to_2tuple
to_3tuple
to_4tuple
to_ntuple
check_prerequisites
deprecated_api_warning
has_method
is_method_overridden
import_modules_from_strings
requires_executable
requires_package
Timer
TimerError
check_time

View File

@ -0,0 +1,35 @@
.. role:: hidden
:class: hidden-section
mmengine.visualization
===================================
.. contents:: mmengine.visualization
:depth: 2
:local:
:backlinks: top
.. currentmodule:: mmengine.visualization
Visualizer
----------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
Visualizer
visualization Backend
---------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: classtemplate.rst
BaseVisBackend
LocalVisBackend
TensorboardVisBackend
WandbVisBackend

View File

@ -44,6 +44,8 @@ language = 'zh_CN'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.autosectionlabel',
@ -54,6 +56,14 @@ extensions = [
] # yapf: disable
autodoc_typehints = 'description'
# Configuration for intersphinx
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable', None),
'torch': ('https://pytorch.org/docs/stable/', None),
'mmcv': ('https://mmcv.readthedocs.io/en/dev-2.x/', None),
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -85,6 +95,7 @@ html_theme_options = {
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']
# -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code

View File

@ -0,0 +1,2 @@
[html writers]
table_style: colwidths-auto

View File

@ -3,18 +3,22 @@
MMEngine 是一个用于深度学习模型训练的基础库,基于 PyTorch支持在 Linux、Windows、MacOS 上运行。它具有如下三个亮点:
1. 通用MMEngine 实现了一个高级的通用训练器,它能够:
- 支持用少量代码训练不同的任务,例如仅使用 80 行代码就可以训练 imagenetpytorch example 400 行)
- 轻松兼容流行的算法库如 TIMM、TorchVision 和 Detectron2 中的模型
- 支持用少量代码训练不同的任务,例如仅使用 80 行代码就可以训练 imagenetpytorch example 400 行)
- 轻松兼容流行的算法库如 TIMM、TorchVision 和 Detectron2 中的模型
2. 统一MMEngine 设计了一个接口统一的开放架构,使得
- 用户可以仅依赖一份代码实现所有任务的轻量化,例如 MMRazor 1.x 相比 MMRazor 0.x 优化了 40% 的代码量
- 上下游的对接更加统一便捷,在为上层算法库提供统一抽象的同时,支持多种后端设备。目前 MMEngine 支持 Nvidia CUDA、Mac MPS、AMD、MLU 等设备进行模型训练。
- 用户可以仅依赖一份代码实现所有任务的轻量化,例如 MMRazor 1.x 相比 MMRazor 0.x 优化了 40% 的代码量
- 上下游的对接更加统一便捷,在为上层算法库提供统一抽象的同时,支持多种后端设备。目前 MMEngine 支持 Nvidia CUDA、Mac MPS、AMD、MLU 等设备进行模型训练。
3. 灵活MMEngine 实现了“乐高”式的训练流程,支持了
- 根据迭代数、 loss 和评测结果等动态调整的训练流程、优化策略和数据增强策略例如早停early stopping机制等
- 任意形式的模型权重平均,如 Exponential Momentum Average (EMA) 和 Stochastic Weight Averaging (SWA)
- 训练过程中针对任意数据和任意节点的灵活可视化和日志控制
- 对神经网络模型中各个层的优化配置进行细粒度调整
- 混合精度训练的灵活控制
- 根据迭代数、 loss 和评测结果等动态调整的训练流程、优化策略和数据增强策略例如早停early stopping机制等
- 任意形式的模型权重平均,如 Exponential Momentum Average (EMA) 和 Stochastic Weight Averaging (SWA)
- 训练过程中针对任意数据和任意节点的灵活可视化和日志控制
- 对神经网络模型中各个层的优化配置进行细粒度调整
- 混合精度训练的灵活控制
### 架构
@ -53,4 +57,4 @@ MMEngine 中还实现了各种算法模型执行过程中需要用到的公共
- [分布式通信原语Distributed Communication Primitives](../tutorials/distributed.md):负责在程序分布式运行过程中不同进程间的通信。这套接口屏蔽了分布式和非分布式环境的区别,同时也自动处理了数据的设备和通信后端。
- [其他工具Utils](../tutorials/utils.md):还有一些工具性的模块,如 ManagerMixin它实现了一种全局变量的创建和获取方式执行器内很多全局可见对象的基类就是 ManagerMixin。
用户可以进一步阅读[教程]()来了解这些模块的高级用法,也可以参考[设计文档]() 了解它们的设计思路与细节。
用户可以进一步阅读[教程](<>)来了解这些模块的高级用法,也可以参考[设计文档](<>) 了解它们的设计思路与细节。

View File

@ -6,7 +6,9 @@
:maxdepth: 1
:caption: 开始你的第一步
get_started/introduction.md
get_started/installation.md
get_started/15_minutes.md
.. toctree::
:maxdepth: 1
@ -16,14 +18,16 @@
tutorials/config.md
tutorials/runner.md
tutorials/hook.md
tutorials/optimizer.md
tutorials/optim_wrapper.md
tutorials/param_scheduler.md
tutorials/evaluation.md
tutorials/data_element.md
tutorials/basedataset.md
tutorials/evaluator.md
tutorials/distributed.md
tutorials/logging.md
tutorials/visualizer.md
tutorials/visualization.md
tutorials/fileio.md
tutorials/utils.md
.. toctree::
:maxdepth: 1
@ -32,12 +36,14 @@
examples/resume_training.md
examples/speed_up_training.md
examples/save_gpu_memory.md
examples/cross_library.md
.. toctree::
:maxdepth: 1
:caption: 迁移指南
migration/migrate_hook_from_mmcv.md
migration/migrate_transform.md
migration/migrate_param_scheduler_from_mmcv.md
.. toctree::
@ -46,6 +52,7 @@
design/hook.md
design/runner.md
design/metric_and_evaluator.md
design/visualization.md
design/logging.md
@ -53,7 +60,23 @@
:maxdepth: 2
:caption: API 文档
api.rst
mmengine.registry <api/registry>
mmengine.config <api/config>
mmengine.runner <api/runner>
mmengine.hooks <api/hooks>
mmengine.model <api/model>
mmengine.optim <api/optim>
mmengine.evaluator <api/evaluator>
mmengine.structures <api/structures>
mmengine.dataset <api/dataset>
mmengine.device <api/device>
mmengine.hub <api/hub>
mmengine.logging <api/logging>
mmengine.visualization <api/visualization>
mmengine.fileio <api/fileio>
mmengine.dist <api/dist>
mmengine.utils <api/utils>
mmengine.utils.dl_utils <api/utils.dl_utils>
.. toctree::
:caption: 语言切换

View File

@ -4,7 +4,7 @@
- 评测指标: 用于根据测试数据和模型预测结果,完成模型特定精度指标的计算。在 OpenMMLab 各算法库中提供了对应任务的常用评测指标,如 [MMClassification](https://github.com/open-mmlab/mmclassification) 中提供了[分类正确率指标Accuracy](https://mmclassification.readthedocs.io/zh_CN/dev-1.x/generated/mmcls.evaluation.Accuracy.html) 用于计算分类模型的 Top-k 分类正确率。
- 评测器: 是评测指标的上层模块,用于在数据输入评测指标前完成必要的格式转换,并提供分布式支持。在模型训练和测试中,评测器由[执行器Runner](https://mmengine.readthedocs.io/zh_CN/latest/api/runner.html)自动构建。用户亦可根据需求手动创建评测器,进行离线评测。
- 评测器: 是评测指标的上层模块,用于在数据输入评测指标前完成必要的格式转换,并提供分布式支持。在模型训练和测试中,评测器由[执行器Runner](runner.md)自动构建。用户亦可根据需求手动创建评测器,进行离线评测。
## 在模型训练或测试中进行评测
@ -37,7 +37,7 @@ test_evaluator = [
### 自定义评测指标
如果算法库中提供的常用评测指标无法满足需求,用户也可以增加自定义的评测指标。具体的方法可以参考[评测指标和评测器设计](/docs/zh_cn/design/metric_and_evaluator.md)。
如果算法库中提供的常用评测指标无法满足需求,用户也可以增加自定义的评测指标。具体的方法可以参考[评测指标和评测器设计](../design/evaluation.md)。
## 使用离线结果进行评测