Skip to content

boxmot.trackers.ocsort.track

This script is adopted from the SORT script by Alex Bewley alex@bewley.ai

KalmanBoxTracker

KalmanBoxTracker(
    bbox,
    cls,
    det_ind,
    delta_t=3,
    max_obs=50,
    is_obb=False,
    id_allocator: TrackIdAllocator | None = None,
    *,
    noise_config: KalmanNoiseConfig | None = None,
    kalman_type: str | None = None,
)

Bases: SortBoxTrack

One OC-SORT identity with its filter, observations, and motion direction.

cls instance-attribute

cls = cls

NOTE: [-1,-1,-1,-1,-1] is a compromising placeholder for non-observation status, the same for the return of function k_previous_obs. It is ugly and I do not like it. But to support generate observation array in a fast and unified way, which you would see below k_observations = np.array([k_previous_obs(...]]), let's bear it for now.

conf instance-attribute

conf = bbox[-1]

delta_t instance-attribute

delta_t = delta_t

det_ind instance-attribute

det_ind = det_ind

history instance-attribute

history = deque([], maxlen=max_obs)

history_observations instance-attribute

history_observations = deque([], maxlen=max_obs)

is_obb instance-attribute

is_obb = is_obb

kf instance-attribute

kf = create_filter(noise_config=noise_config)

last_observation instance-attribute

last_observation = (
    array([-1, -1, -1, -1, -1, -1])
    if is_obb
    else array([-1, -1, -1, -1, -1])
)

motion_model instance-attribute

motion_model = create_motion_model(
    kalman_type or XYSR,
    is_obb=is_obb,
    max_obs=max_obs,
    cls_id=int(cls),
)

observation_centric class-attribute instance-attribute

observation_centric = True

observations instance-attribute

observations = dict()

velocity instance-attribute

velocity = None

camera_update

camera_update(transform: ndarray) -> None

Transform this track and its recovery histories to the current frame.

get_state

get_state()

Returns the current bounding box estimate.

multi_camera_update classmethod

multi_camera_update(tracks, transform: ndarray) -> None

Transform complete AABB/OBB motion and association state in batches.

predict

predict(*, dt: float | None = None) -> ndarray

Advances the state vector and returns the predicted bounding box estimate.

update

update(bbox, cls, det_ind)

Updates the state vector with observed bbox.

speed_direction_obb

speed_direction_obb(bbox1, bbox2)