tracklab.wrappers.detect_single package

Submodules

tracklab.wrappers.detect_single.topdown_mmpose_api module

class tracklab.wrappers.detect_single.topdown_mmpose_api.TopDownMMPose(device, batch_size, config_name, path_to_checkpoint, vis_kp_threshold=0.4, min_num_vis_kp=3, **kwargs)[source]

Bases: DetectionLevelModule

collate_fn() Any

Convert list of data sampled from dataset into a batch of data, of which type consistent with the type of each data_itement in data_batch.

Different from pseudo_collate(), default_collate will stack tensor contained in data_batch into a batched tensor with the first dimension batch size, and then move input tensor to the target device.

Different from default_collate in pytorch, default_collate will not process BaseDataElement.

This code is referenced from: Pytorch default_collate.

Note

default_collate only accept input tensor with the same shape.

Parameters:

data_batch (Sequence) – Data sampled from dataset.

Returns:

Data in the same format as the data_itement of data_batch, of which tensors have been stacked, and ndarray, int, float have been converted to tensors.

Return type:

Any

input_columns = ['bbox_ltwh', 'bbox_conf']
output_columns = ['keypoints_xyc', 'keypoints_conf']
preprocess(image, detection: Series, metadata: Series)[source]

Adapts the default input to your specific case.

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

  • detection – a Series 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.

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