pixano_inference.schemas.tracking
Tracking I/O types.
A tracking model follows objects through the frames of a video. It is either prompted (the
request names the objects with points, boxes or masks, as SAM2 expects) or prompt-free (tracking
by detection, as in ByteTrack: the model detects the objects and creates the tracks itself). Both
return the same :class:TrackingOutput: for each frame, the objects tracked in it.
TrackedFrame(**data)
Bases: _BaseModel
The objects tracked in one frame.
Attributes:
| Name | Type | Description |
|---|---|---|
frame_index |
int
|
Index of the frame, 0-based and relative to the submitted video frames. |
objects |
list[TrackedObject]
|
Objects tracked in the frame, each track at most once. |
Source code in pydantic/main.py
TrackedObject(**data)
Bases: _BaseModel
One tracked object in one frame.
A mask-based tracker (SAM2) fills mask; a detection-based tracker (ByteTrack) fills box
and score. At least one of box and mask is present.
Attributes:
| Name | Type | Description |
|---|---|---|
track_id |
int
|
Identity of the object across frames. A prompted model returns the object ID of the request; a prompt-free model assigns it. |
box |
list[float] | None
|
Bounding box |
score |
float | None
|
Confidence of the object in this frame, or |
class_name |
str | None
|
Class name of the object, or |
mask |
CompressedRLE | None
|
Mask of the object in compressed-RLE format, or |
Source code in pydantic/main.py
TrackingBoxPrompt(**data)
Bases: _BaseModel
Box prompt for a tracking keyframe.
Source code in pydantic/main.py
TrackingInput(**data)
Bases: _BaseModel
Input for video tracking.
A prompted request names the objects to track: objects_ids with one keyframe (or one legacy
point/box prompt) per object. A prompt-free request gives only the video, and optionally
classes and box_threshold: the model detects the objects and assigns the track ids.
Attributes:
| Name | Type | Description |
|---|---|---|
video |
list[str | Path | bytes] | str | Path | bytes
|
Path to the video, list of frame paths, or base64 encoded video/frames. |
points |
list[list[list[int]]] | None
|
Legacy point prompts [num_objects, num_points, 2]. |
labels |
list[list[int]] | None
|
Legacy labels for points [num_objects, num_points]. |
boxes |
list[list[int]] | None
|
Legacy box prompts [num_objects, 4]. |
propagate |
bool | None
|
Whether to propagate masks beyond the prompted frames. |
interval |
TrackingInterval | None
|
Optional propagation interval relative to the provided frame window. |
keyframes |
list[TrackingKeyframe] | None
|
Optional structured prompt payloads for each object. |
objects_ids |
list[int]
|
IDs of the prompted objects. Empty for a prompt-free request. |
frame_indexes |
list[int]
|
Indexes of the prompted frames. Empty for a prompt-free request. |
classes |
list[str] | str | None
|
Class names to detect and track (prompt-free tracking). |
box_threshold |
float | None
|
Minimum detection confidence for an object to be tracked (prompt-free
tracking). |
Source code in pydantic/main.py
TrackingInterval(**data)
Bases: _BaseModel
Optional propagation window relative to the provided video frames.
Source code in pydantic/main.py
TrackingKeyframe(**data)
Bases: _BaseModel
Prompt payload for a single tracking keyframe.
Source code in pydantic/main.py
TrackingOutput(**data)
Bases: _BaseModel
Output for video tracking: for each frame, the objects tracked in it.
This is the shape a tracker produces, one frame at a time: append one :class:TrackedFrame per
frame, holding one :class:TrackedObject per object alive in that frame. Use :meth:tracks to
read the same result as trajectories.
Attributes:
| Name | Type | Description |
|---|---|---|
frames |
list[TrackedFrame]
|
Tracked frames, in the order the model processed them. A frame appears at most once; a frame where nothing is tracked may be omitted or have no objects. |
Source code in pydantic/main.py
tracks()
Group the result by track.
Returns:
| Type | Description |
|---|---|
dict[int, list[tuple[int, TrackedObject]]]
|
For each track ID, its |
Source code in pixano_inference/schemas/tracking.py
TrackingPointPrompt(**data)
Bases: _BaseModel
Point prompt for a tracking keyframe.