poseinterface.io.predictions_to_poseinterface#

poseinterface.io.predictions_to_poseinterface(input_path, video_path, output_dir, *, sub_id, ses_id, cam_id)[source]#

Convert a prediction file to poseinterface COCO JSON format.

This function reads predictions for a given video and writes the corresponding “video-level” COCO JSON labels in the poseinterface format, (i.e. a sub-<sub_id>_ses-<ses_id>_cam-<cam_id>_videolabels.json file).

The output JSON file is meant to facilitate the extraction of “clip-level” labels, (i.e. files of the format sub-<sub_id>_ses-<ses_id>_cam-<cam_id>_start-<frame_id>_dur-<n_frames>_cliplabels.json).

Parameters:
  • input_path (Path | str) – Path to the predictions file. It should be one of the formats supported by movement (see movement supported formats)

  • video_path (Path | str) – Path to the corresponding video file. Used to attach video metadata (resolution) to the COCO output.

  • output_dir (Path | str) – Path to the directory where to save the output JSON file.

  • sub_id (str) – Subject ID to include in the generated filenames.

  • ses_id (str) – Session ID to include in the generated filenames.

  • cam_id (str) – Camera ID to include in the generated filenames.

Returns:

Path to the saved COCO JSON file.

Return type:

Path

Notes

For the full list of supported formats for the input file, see movement supported formats.