poseinterface.io.split_lp_collected_data#

poseinterface.io.split_lp_collected_data(input_path, output_dir)[source]#

Split a Lightning Pose project-level CollectedData.csv into per-session CSVs.

Lightning Pose stores labels for all sessions in a single project-level CollectedData.csv, with full image paths (e.g. labeled-data/<session>/<image>.png) as the row index. This function splits that file into one CSV per session, each formatted as a DLC-style CollectedData_<scorer>.csv with a three-level row MultiIndex (top_dir, session, image). The resulting per-session files can be passed directly to poseinterface.io.annotations_to_poseinterface().

Parameters:
  • input_path (Path) – Path to the Lightning Pose project-level CollectedData.csv.

  • output_dir (Path) – Parent directory for the per-session output CSVs. Each session is written to <output_dir>/<session>/CollectedData_<scorer>.csv, mirroring the DLC labeled-data/ layout.

Returns:

Mapping from session name to the path of the per-session CSV.

Return type:

dict[str, Path]

Raises:

ValueError – If any row index entry cannot be parsed into exactly three path components (top_dir, session, image).

Examples

>>> from pathlib import Path
>>> from poseinterface.io import split_lp_collected_data
>>> session_csvs = split_lp_collected_data(
...     input_path=Path("path/to/CollectedData.csv"),
...     output_dir=Path("path/to/labeled-data"),
... )