vis4d.state.track3d.cc_3dt

Memory for CC-3DT inference.

Classes

CC3DTrackGraph([track, memory_size, ...])

CC-3DT tracking graph.

Track

CC-3DT Track state.

class CC3DTrackGraph(track=None, memory_size=10, memory_momentum=0.8, backdrop_memory_size=1, nms_backdrop_iou_thr=0.3, motion_model='KF3D', lstm_model=None, motion_dims=7, num_frames=5, fps=2, update_3d_score=True, add_backdrops=True)[source]

CC-3DT tracking graph.

Creates an instance of the class.

__call__(boxes_2d, scores_2d, camera_ids, boxes_3d, scores_3d, class_ids, embeddings, frame_id)[source]

Update the tracker with new detections.

Return type:

Track3DOut

build_motion_model(obs_3d)[source]

Build motion model.

Return type:

BaseMotionModel

create_track(track_id, box_2d, score_2d, box_3d, score_3d, class_id, embed, obs_box_3d, frame_id)[source]

Create a new track.

Return type:

None

get_tracks(device, frame_id=None, add_backdrops=False)[source]

Get tracklests.

If the frame_id is not provided, will return the latest state of all tracklets. Otherwise, will return the state of all tracklets at the given frame_id. If add_backdrops is True, will also return the backdrops.

Parameters:
  • device (torch.device) – Device to put the tensors on.

  • frame_id (int, optional) – Frame id to query. Defaults to None.

  • add_backdrops (bool, optional) – Whether to add backdrops to the output. Defaults to False.

Returns:

2D boxes in shape (N, 4). scores_2d (Tensor): 2D scores in shape (N,). boxes_3d (Tensor): 3D boxes in shape (N, 12). scores_3d (Tensor): 3D scores in shape (N,). class_ids (Tensor): Class ids in shape (N,). track_ids (Tensor): Track ids in shape (N,). embeds (Tensor): Embeddings in shape (N, E). motion_models (list[BaseMotionModel]): Motion models. velocities (Tensor): Velocities in shape (N, 3).

Return type:

boxes_2d (Tensor)

is_empty()[source]

Check if the memory is empty.

Return type:

bool

reset()[source]

Empty the memory.

Return type:

None

update(frame_id, track_ids, boxes_2d, scores_2d, camera_ids, boxes_3d, scores_3d, class_ids, embeddings, obs_boxes_3d)[source]

Update the track memory with a new state.

Return type:

None

update_track(track_id, box_2d, score_2d, box_3d, score_3d, class_id, embed, obs_box_3d, frame_id)[source]

Update a track.

Return type:

None

class Track[source]

CC-3DT Track state.

box_2d

In shape (4,) and contains x1, y1, x2, y2.

Type:

Tensor

score_2d

In shape (1,).

Type:

Tensor

box_3d

In shape (12,) contains x,y,z,h,w,l,rx,ry,rz,vx,vy,vz.

Type:

Tensor

score_3d

In shape (1,).

Type:

Tensor

class_id

In shape (1,).

Type:

Tensor

embed

In shape (E,). E is the embedding dimension.

Type:

Tensor

motion_model

The motion model.

Type:

BaseMotionModel

velocity

In shape (motion_dims,).

Type:

Tensor

last_frame

The last frame the track was updated.

Type:

int

acc_frame

The number of frames the track was updated.

Type:

int