parse_label_csv

lightning_pose.utils.io.parse_label_csv(csv_file: str, header_rows: list[int] | None = None) LabeledData[source]

Parse a label CSV file into a LabeledData object in a single read.

Reads the file exactly once and returns keypoint names, image names, coordinates, and per-keypoint visibility flags. When the file contains a visible column per keypoint, visibility flags are returned as an int64 tensor; otherwise visibility is None.

This function is the single entry point for reading label files. A future parse_label_json function for COCO .json format should return the same LabeledData type, allowing callers to remain format-agnostic.

Parameters:
  • csv_file – path to the label CSV file

  • header_rows – row indices that form the MultiIndex header; defaults to [0, 1, 2]

Returns:

LabeledData containing all label information

Raises:
  • FileNotFoundError – if csv_file does not exist

  • ValueError – if any visibility value is outside {0, 1, 2}