annie.parsers.track

Parser for .track / __track{N}.csv files (one tracked face per file).

A track file is derived from a .vdet by a tracking heuristic and follows a single face across frames — exactly one row per frame it appears in. The track index is encoded in the filename after a double underscore, e.g. {video_id}__track0.csv.

Functions

track_id_from_name(→ int)

Extract the track index N from a ...__track{N} filename.

load_track(→ tuple[int, ...)

Load a track file into its track id and per-frame annotations.

Module Contents

annie.parsers.track.track_id_from_name(path: str | pathlib.Path) → int[source]

Extract the track index N from a ...__track{N} filename.

Parameters:

path – The track file path or name.

Returns:

The parsed track index.

Raises:

ValueError – If the name does not contain a __track{N} segment.

annie.parsers.track.load_track(path: str | pathlib.Path) → tuple[int, list[annie.core.models.FrameAnnotation]][source]

Load a track file into its track id and per-frame annotations.

Every box is stamped with the track id parsed from the filename. A well-formed track has exactly one box per frame, but the loader does not enforce that — it groups defensively like the vdet loader.

Parameters:

path – Path to the __track{N}.csv file.

Returns:

A (track_id, frames) tuple where frames is ordered by ascending frame index.