备注
您正在阅读 MMClassification 0.x 版本的文档。MMClassification 0.x 会在 2022 年末被切换为次要分支。建议您升级到 MMClassification 1.0 版本,体验更多新特性和新功能。请查阅 MMClassification 1.0 的安装教程、迁移教程以及更新日志。
mmcls.apis.train_model¶
- mmcls.apis.train_model(model, dataset, cfg, distributed=False, validate=False, timestamp=None, device=None, meta=None)[源代码]¶
Train a model.
This method will build dataloaders, wrap the model and build a runner according to the provided config.
- 参数
model (
torch.nn.Module
) – The model to be run.dataset (
mmcls.datasets.BaseDataset
| List[BaseDataset]) – The dataset used to train the model. It can be a single dataset, or a list of dataset with the same length as workflow.cfg (
mmcv.utils.Config
) – The configs of the experiment.distributed (bool) – Whether to train the model in a distributed environment. Defaults to False.
validate (bool) – Whether to do validation with
mmcv.runner.EvalHook
. Defaults to False.timestamp (str, optional) – The timestamp string to auto generate the name of log files. Defaults to None.
device (str, optional) – TODO
meta (dict, optional) – A dict records some import information such as environment info and seed, which will be logged in logger hook. Defaults to None.