Skip to content

pixano.features.schemas.annotations.tracklet

Tracklet(created_at=None, updated_at=None, **data)

Bases: Annotation

A Tracklet is a temporal segment of a video sequence.

Attributes:

Name Type Description
start_timestep int

The start timestep of the tracklet.

end_timestep int

The end timestep of the tracklet.

start_timestamp float

The start timestamp of the tracklet.

end_timestamp float

The end timestamp of the tracklet.

Source code in pixano/features/schemas/base_schema.py
def __init__(self, /, created_at: datetime | None = None, updated_at: datetime | None = None, **data: Any):
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.

    Args:
        created_at: The creation date of the object.
        updated_at: The last modification date of the object.
        data: The data of the object validated by Pydantic.
    """
    created_at, updated_at = validate_and_init_create_at_and_update_at(created_at, updated_at)
    data.update({"created_at": created_at, "updated_at": updated_at})
    super().__init__(**data)

create_tracklet(id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none(), start_timestep=-1, end_timestep=-1, start_timestamp=-1.0, end_timestamp=-1.0)

Create a Tracklet instance.

Parameters:

Name Type Description Default
id str

The tracklet id.

''
item_ref ItemRef

The item reference.

none()
view_ref ViewRef

The view reference.

none()
entity_ref EntityRef

The parent track reference.

none()
source_ref SourceRef

The source reference.

none()
start_timestep int

The start timestep of the tracklet.

-1
end_timestep int

The end timestep of the tracklet.

-1
start_timestamp float

The start timestamp of the tracklet.

-1.0
end_timestamp float

The end timestamp of the tracklet.

-1.0

Returns:

Type Description
Tracklet

The created Tracklet instance.

Source code in pixano/features/schemas/annotations/tracklet.py
def create_tracklet(
    id: str = "",
    item_ref: ItemRef = ItemRef.none(),
    view_ref: ViewRef = ViewRef.none(),
    entity_ref: EntityRef = EntityRef.none(),
    source_ref: SourceRef = SourceRef.none(),
    start_timestep: int = -1,
    end_timestep: int = -1,
    start_timestamp: float = -1.0,
    end_timestamp: float = -1.0,
) -> Tracklet:
    """Create a `Tracklet` instance.

    Args:
        id: The tracklet id.
        item_ref: The item reference.
        view_ref: The view reference.
        entity_ref: The parent track reference.
        source_ref: The source reference.
        start_timestep: The start timestep of the tracklet.
        end_timestep: The end timestep of the tracklet.
        start_timestamp: The start timestamp of the tracklet.
        end_timestamp: The end timestamp of the tracklet.

    Returns:
        The created `Tracklet` instance.
    """
    return Tracklet(
        id=id,
        item_ref=item_ref,
        view_ref=view_ref,
        entity_ref=entity_ref,
        source_ref=source_ref,
        start_timestep=start_timestep,
        end_timestep=end_timestep,
        start_timestamp=start_timestamp,
        end_timestamp=end_timestamp,
    )

is_tracklet(cls, strict=False)

Check if the given class is a subclass of Tracklet.

Source code in pixano/features/schemas/annotations/tracklet.py
def is_tracklet(cls: type, strict: bool = False) -> bool:
    """Check if the given class is a subclass of `Tracklet`."""
    return issubclass_strict(cls, Tracklet, strict)