Shortcuts

RuntimeInfoHook

class mmengine.hooks.RuntimeInfoHook[源代码]

A hook that updates runtime information into message hub.

E.g. epoch, iter, max_epochs, and max_iters for the training state. Components that cannot access the runner can get runtime information through the message hub.

after_test(runner)[源代码]

All subclasses should override this method, if they need any operations after testing.

参数:

runner (Runner) – The runner of the testing process.

返回类型:

None

after_test_epoch(runner, metrics=None)[源代码]

All subclasses should override this method, if they need any operations after each test epoch.

参数:
  • runner (Runner) – The runner of the testing process.

  • metrics (Dict[str, float], optional) – Evaluation results of all metrics on test dataset. The keys are the names of the metrics, and the values are corresponding results.

返回类型:

None

after_train(runner)[源代码]

All subclasses should override this method, if they need any operations after train.

参数:

runner (Runner) – The runner of the training process.

返回类型:

None

after_train_iter(runner, batch_idx, data_batch=None, outputs=None)[源代码]

Update log_vars in model outputs every iteration.

参数:
  • runner (Runner) – The runner of the training process.

  • batch_idx (int) – The index of the current batch in the train loop.

  • data_batch (Sequence[dict], optional) – Data from dataloader. Defaults to None.

  • outputs (dict, optional) – Outputs from model. Defaults to None.

返回类型:

None

after_val(runner)[源代码]

All subclasses should override this method, if they need any operations after validation.

参数:

runner (Runner) – The runner of the validation process.

返回类型:

None

after_val_epoch(runner, metrics=None)[源代码]

All subclasses should override this method, if they need any operations after each validation epoch.

参数:
  • runner (Runner) – The runner of the validation process.

  • metrics (Dict[str, float], optional) – Evaluation results of all metrics on validation dataset. The keys are the names of the metrics, and the values are corresponding results.

返回类型:

None

before_run(runner)[源代码]

Update metainfo.

参数:

runner (Runner) – The runner of the training process.

返回类型:

None

before_test(runner)[源代码]

All subclasses should override this method, if they need any operations before testing.

参数:

runner (Runner) – The runner of the testing process.

返回类型:

None

before_train(runner)[源代码]

Update resumed training state.

参数:

runner (Runner) – The runner of the training process.

返回类型:

None

before_train_epoch(runner)[源代码]

Update current epoch information before every epoch.

参数:

runner (Runner) – The runner of the training process.

返回类型:

None

before_train_iter(runner, batch_idx, data_batch=None)[源代码]

Update current iter and learning rate information before every iteration.

参数:
  • runner (Runner) – The runner of the training process.

  • batch_idx (int) – The index of the current batch in the train loop.

  • data_batch (Sequence[dict], optional) – Data from dataloader. Defaults to None.

返回类型:

None

before_val(runner)[源代码]

All subclasses should override this method, if they need any operations before validation.

参数:

runner (Runner) – The runner of the validation process.

返回类型:

None