tracklab.wrappers.track package

Submodules

tracklab.wrappers.track.bot_sort_api module

class tracklab.wrappers.track.bot_sort_api.BotSORT(cfg, device, **kwargs)[source]

Bases: ImageLevelModule

input_columns = ['bbox_ltwh', 'bbox_conf', 'category_id']
output_columns = ['track_id', 'track_bbox_ltwh', 'track_bbox_conf']
preprocess(image, detections: DataFrame, metadata: Series)[source]

Adapts the default input to your specific case.

Parameters:
  • image – a numpy array of the current image

  • detections – a DataFrame containing all the detections pertaining to a single image

  • metadata – additional information about the image

Returns:

input for the process function

Return type:

preprocessed_sample

process(batch, detections: DataFrame, metadatas: DataFrame)[source]

The main processing function. Runs on GPU.

Parameters:
  • batch – The batched outputs of preprocess

  • detections – The previous detections.

  • metadatas – The previous image metadatas

Returns:

Either a DataFrame containing the new/updated detections

or a tuple containing detections and metadatas (in that order) The DataFrames can be either a list of Series, a list of DataFrames or a single DataFrame. The returned objects will be aggregated automatically according to the name of the Series/index of the DataFrame. It is thus mandatory here to name correctly your series or index your dataframes. The output will override the previous detections with the same name/index.

Return type:

output

reset()[source]

Reset the tracker state to start tracking in a new video.

tracklab.wrappers.track.bpbreid_strong_sort_api module

class tracklab.wrappers.track.bpbreid_strong_sort_api.BPBReIDStrongSORT(cfg, device, batch_size=None, **kwargs)[source]

Bases: ImageLevelModule

input_columns = ['bbox_ltwh', 'embeddings', 'visibility_scores']
output_columns = ['track_id', 'track_bbox_kf_ltwh', 'track_bbox_pred_kf_ltwh', 'matched_with', 'costs', 'hits', 'age', 'time_since_update', 'state']
prepare_next_frame(next_frame: ndarray)[source]
preprocess(image, detections: DataFrame, metadata: Series)[source]

Adapts the default input to your specific case.

Parameters:
  • image – a numpy array of the current image

  • detections – a DataFrame containing all the detections pertaining to a single image

  • metadata – additional information about the image

Returns:

input for the process function

Return type:

preprocessed_sample

process(batch, detections: DataFrame, metadatas: DataFrame)[source]

The main processing function. Runs on GPU.

Parameters:
  • batch – The batched outputs of preprocess

  • detections – The previous detections.

  • metadatas – The previous image metadatas

Returns:

Either a DataFrame containing the new/updated detections

or a tuple containing detections and metadatas (in that order) The DataFrames can be either a list of Series, a list of DataFrames or a single DataFrame. The returned objects will be aggregated automatically according to the name of the Series/index of the DataFrame. It is thus mandatory here to name correctly your series or index your dataframes. The output will override the previous detections with the same name/index.

Return type:

output

reset()[source]

Reset the tracker state to start tracking in a new video.

tracklab.wrappers.track.byte_track_api module

class tracklab.wrappers.track.byte_track_api.ByteTrack(cfg, device, **kwargs)[source]

Bases: ImageLevelModule

input_columns = ['bbox_ltwh', 'bbox_conf', 'category_id']
output_columns = ['track_id', 'track_bbox_ltwh', 'track_bbox_conf']
preprocess(image, detections: DataFrame, metadata: Series)[source]

Adapts the default input to your specific case.

Parameters:
  • image – a numpy array of the current image

  • detections – a DataFrame containing all the detections pertaining to a single image

  • metadata – additional information about the image

Returns:

input for the process function

Return type:

preprocessed_sample

process(batch, detections: DataFrame, metadatas: DataFrame)[source]

The main processing function. Runs on GPU.

Parameters:
  • batch – The batched outputs of preprocess

  • detections – The previous detections.

  • metadatas – The previous image metadatas

Returns:

Either a DataFrame containing the new/updated detections

or a tuple containing detections and metadatas (in that order) The DataFrames can be either a list of Series, a list of DataFrames or a single DataFrame. The returned objects will be aggregated automatically according to the name of the Series/index of the DataFrame. It is thus mandatory here to name correctly your series or index your dataframes. The output will override the previous detections with the same name/index.

Return type:

output

reset()[source]

Reset the tracker state to start tracking in a new video.

tracklab.wrappers.track.deep_oc_sort_api module

class tracklab.wrappers.track.deep_oc_sort_api.DeepOCSORT(cfg, device, **kwargs)[source]

Bases: ImageLevelModule

input_columns = ['bbox_ltwh', 'bbox_conf', 'category_id']
output_columns = ['track_id', 'track_bbox_ltwh', 'track_bbox_conf']
preprocess(image, detections: DataFrame, metadata: Series)[source]

Adapts the default input to your specific case.

Parameters:
  • image – a numpy array of the current image

  • detections – a DataFrame containing all the detections pertaining to a single image

  • metadata – additional information about the image

Returns:

input for the process function

Return type:

preprocessed_sample

process(batch, detections: DataFrame, metadatas: DataFrame)[source]

The main processing function. Runs on GPU.

Parameters:
  • batch – The batched outputs of preprocess

  • detections – The previous detections.

  • metadatas – The previous image metadatas

Returns:

Either a DataFrame containing the new/updated detections

or a tuple containing detections and metadatas (in that order) The DataFrames can be either a list of Series, a list of DataFrames or a single DataFrame. The returned objects will be aggregated automatically according to the name of the Series/index of the DataFrame. It is thus mandatory here to name correctly your series or index your dataframes. The output will override the previous detections with the same name/index.

Return type:

output

reset()[source]

Reset the tracker state to start tracking in a new video.

tracklab.wrappers.track.oc_sort_api module

class tracklab.wrappers.track.oc_sort_api.OCSORT(cfg, device, **kwargs)[source]

Bases: ImageLevelModule

input_columns = ['bbox_ltwh', 'bbox_conf', 'category_id']
output_columns = ['track_id', 'track_bbox_ltwh', 'track_bbox_conf']
preprocess(image, detections: DataFrame, metadata: Series)[source]

Adapts the default input to your specific case.

Parameters:
  • image – a numpy array of the current image

  • detections – a DataFrame containing all the detections pertaining to a single image

  • metadata – additional information about the image

Returns:

input for the process function

Return type:

preprocessed_sample

process(batch, detections: DataFrame, metadatas: DataFrame)[source]

The main processing function. Runs on GPU.

Parameters:
  • batch – The batched outputs of preprocess

  • detections – The previous detections.

  • metadatas – The previous image metadatas

Returns:

Either a DataFrame containing the new/updated detections

or a tuple containing detections and metadatas (in that order) The DataFrames can be either a list of Series, a list of DataFrames or a single DataFrame. The returned objects will be aggregated automatically according to the name of the Series/index of the DataFrame. It is thus mandatory here to name correctly your series or index your dataframes. The output will override the previous detections with the same name/index.

Return type:

output

reset()[source]

Reset the tracker state to start tracking in a new video.

tracklab.wrappers.track.strong_sort_api module

class tracklab.wrappers.track.strong_sort_api.StrongSORT(cfg, device, **kwargs)[source]

Bases: ImageLevelModule

input_columns = ['bbox_ltwh', 'bbox_conf', 'category_id']
output_columns = ['track_id', 'track_bbox_ltwh', 'track_bbox_conf']
preprocess(image, detections: DataFrame, metadata: Series)[source]

Adapts the default input to your specific case.

Parameters:
  • image – a numpy array of the current image

  • detections – a DataFrame containing all the detections pertaining to a single image

  • metadata – additional information about the image

Returns:

input for the process function

Return type:

preprocessed_sample

process(batch, detections: DataFrame, metadatas: DataFrame)[source]

The main processing function. Runs on GPU.

Parameters:
  • batch – The batched outputs of preprocess

  • detections – The previous detections.

  • metadatas – The previous image metadatas

Returns:

Either a DataFrame containing the new/updated detections

or a tuple containing detections and metadatas (in that order) The DataFrames can be either a list of Series, a list of DataFrames or a single DataFrame. The returned objects will be aggregated automatically according to the name of the Series/index of the DataFrame. It is thus mandatory here to name correctly your series or index your dataframes. The output will override the previous detections with the same name/index.

Return type:

output

reset()[source]

Reset the tracker state to start tracking in a new video.