Shortcuts

EarlyStoppingHook

class mmengine.hooks.EarlyStoppingHook(monitor, rule=None, min_delta=0.1, strict=False, check_finite=True, patience=5, stopping_threshold=None)[源代码]

Early stop the training when the monitored metric reached a plateau.

参数:
  • monitor (str) – The monitored metric key to decide early stopping.

  • rule (str, optional) – Comparison rule. Options are ‘greater’, ‘less’. Defaults to None.

  • min_delta (float, optional) – Minimum difference to continue the training. Defaults to 0.01.

  • strict (bool, optional) – Whether to crash the training when monitor is not found in the metrics. Defaults to False.

  • check_finite (bool) – Whether to stop training when the monitor becomes NaN or infinite. Defaults to True.

  • patience (int, optional) – The times of validation with no improvement after which training will be stopped. Defaults to 5.

  • stopping_threshold (float, optional) – Stop training immediately once the monitored quantity reaches this threshold. Defaults to None.

备注

New in version 0.7.0.

after_val_epoch(runner, metrics)[源代码]

Decide whether to stop the training process.

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

  • metrics (dict) – Evaluation results of all metrics

before_run(runner)[源代码]

Check stop_training variable in runner.train_loop.

参数:

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

返回类型:

None