predict_single_video

lightning_pose.utils.predictions.predict_single_video(cfg_file: str | DictConfig, video_file: str, preds_file: str, data_module: BaseDataModule | UnlabeledDataModule | None = None, ckpt_file: str | None = None, trainer: Trainer | None = None, model: HeatmapTracker | SemiSupervisedHeatmapTracker | HeatmapTrackerMHCRNN | SemiSupervisedHeatmapTrackerMHCRNN | RegressionTracker | SemiSupervisedRegressionTracker | None = None, save_heatmaps: bool | None = False) DataFrame[source]

Make predictions for a single video, loading frame sequences using DALI.

This function initializes a DALI pipeline, prepares a dataloader, and passes it on to _make_predictions().

Parameters:
  • cfg_file – either a hydra config or a path pointing to one, with all the model specs. needed for loading the model.

  • video_file – absolute path to a single video you want to get predictions for, .mp4 file.

  • preds_file – absolute filename for the predictions .csv file

  • data_module – contains keypoint names for prediction file

  • ckpt_file – absolute path to the checkpoint of your trained model; requires .ckpt suffix

  • trainer – pl.Trainer object

  • model – Lightning Module

  • save_heatmaps – export heatmaps as numpy array

Returns:

pandas dataframe with predictions