mindpose.callbacks

class mindpose.callbacks.EvalCallback(inferencer=None, evaluator=None, dataset=None, interval=1, max_epoch=1, save_best=False, save_last=False, best_ckpt_path='./best.ckpt', last_ckpt_path='./last.ckpt', target_metric_name='AP', summary_dir='.', rank_id=None, device_num=None)[source]

Bases: Callback

Running evaluation during training. The training, evaluation result will be saved in summary record format for visualization. The best and last checkpoint can be saved after each training epoch.

Parameters:
  • inferencer (Optional[Inferencer]) – Inferencer for running inference on the dataset. Default: None

  • evaluator (Optional[Evaluator]) – Evaluator for running evaluation. Default: None

  • dataset (Optional[Dataset]) – The dataset used for running inference. Default: None

  • interval (int) – The interval of running evaluation, in epoch. Default: 1

  • max_epoch (int) – Total number of epochs for training. Default: 1

  • save_best (bool) – Saving the best model based on the result of the target metric performance. Default: False

  • save_last (bool) – Saving the last model. Default: False

  • best_ckpt_path (str) – Path of the best checkpoint file. Default: “./best.ckpt”

  • last_ckpt_path (str) – Path of the last checkpoint file. Default: “./last.ckpt”

  • target_metric_name (str) – The metric name deciding the best model to save. Default: “AP”

  • summary_dir (str) – The directory storing the summary record. Default: “.”

  • rank_id (Optional[int]) – Rank id. Default: None

  • device_num (Optional[int]) – Number of devices. Default: None