MMEngine

0.10.7 · active · verified Mon Apr 13

MMEngine is the foundational training engine for OpenMMLab projects, providing a comprehensive and flexible framework for deep learning training, evaluation, and deployment. It offers utilities for configuration management, logging, hooks, runners, and visualization. The current stable version is 0.10.7, with frequent patch and minor releases and active development towards 0.11.0.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define and use a configuration object in MMEngine. The `Config` class is central to managing experiment settings, model architectures, and training parameters, often loaded from Python files.

from mmengine.config import Config

# Define configuration using a dictionary
cfg_dict = dict(
    model=dict(type='MyCustomModel', num_classes=10, init_cfg=None),
    dataloader=dict(batch_size=32, num_workers=4),
    optimizer=dict(type='Adam', lr=0.001)
)

# Create a Config object
cfg = Config(cfg_dict)

# Access configuration parameters
print(f"Model type: {cfg.model.type}")
print(f"Optimizer learning rate: {cfg.optimizer.lr}")

# You can also load from a file:
# cfg = Config.fromfile('path/to/your_config.py')

view raw JSON →