Tracking

Welcome to the documentation about the trackers.

tracker

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson (2021-2022)

class Tracker[source]

Bases: abc.ABC

abstract __init__()[source]

Initializes the tracker with the given parameters.

abstract track(detection: pytb.output.detection.Detection) pytb.output.detection.Detection[source]

Performs a tracking method to match the IDs between frames.

Parameters

detection (Detection) – The detection used to infer IDs.

Returns

A set of detections with the tracking information added.

Return type

Detection

abstract reset_state()[source]

Reset the current state of the tracker.

tracker_factory

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson (2021-2022)

class TrackerFactory[source]

Bases: object

static create_tracker(proc_parameters: dict) pytb.tracking.tracker.Tracker[source]

Creates a tracker given a dictionary of parameters provided that the defined parameters are valid. Otherwise, an error message is given indicating the invalid parameters. Based on a model type and an implementation, it initializes the appropriate tracker with the given parameters.

Parameters

proc_parameters (dict) – A dictionary describing the tracker to initialize.

Returns

A concrete implementation of a Tracker (e.g YOLO).

Return type

Detection

static _bboxes_2d_tracker(proc_parameters: dict) pytb.tracking.bboxes.bboxes_2d_tracker.bboxes_2d_tracker.BBoxes2DTracker[source]

Creates a BBoxes2DTracker given a dictionary of parameters. It then branches on the model type to initialize a concrete detector implementation (e.g SORT).

static _pose_tracker(proc_parameters: dict) None[source]

TODO. No implementation of pose tracker yet. Creates a PoseTracker given a dictionary of parameters. It then branches on the model type to initialize a concrete tracker implementation (e.g XXX).

tracking_manager

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson (2021-2022)

class TrackingManager(tracker: pytb.tracking.tracker.Tracker, preprocess_parameters: dict, postprocess_parameters: dict)[source]

Bases: object

__init__(tracker: pytb.tracking.tracker.Tracker, preprocess_parameters: dict, postprocess_parameters: dict)[source]

This class is used to handle all the steps of the tracking in one single track method. Specifically, it applies the preprocess parameters, infer the object IDs based on the detected objects and filters out the results using the postprocess parameters. This constructor initialize a TrackingManager provided that the preprocess and post process parameters are valid. Otherwise, an error message is given indicating the invalid parameter(s).

Parameters
  • tracker (Tracker) – A concrete implementation of a Tracker initialized using the tracker_factory.

  • preprocess_parameters (dict) – A dictionary containing the image transformation before proceeding to the tracking.

  • postprocess_parameters (dict) – A dictionary containing the thresholds to filter out the results of the tracking.

Returns

An initalized DetectionManager that can be called on each frame using detect method.

Return type

Detection

track(detection: pytb.output.detection.Detection, frame: Optional[numpy.ndarray] = None) pytb.output.detection.Detection[source]

Proceeds to the tracking on the given frame. It first transforms the image using the preprocess parameters of this instance of TrackingManager. Then, it infers the results of the detection (see the concrete implementation of the provided tracker). Finally, it filters out the result using the postprocess parameters of this instance of TrackingManager.

reset_state()[source]

Resets the state of the tracker as if it was just initialized.

bboxes_2d_tracker

Hereby, you find two tables that (1) list the parameters in relation with the JSON config file that can be used for each tracker and (2) give details on their usage.

List of trackers and their parameters

Tracker

Parameters

Centroid

max_age

IOU

min_hits, iou_thresh

KIOU

min_hits, iou_thresh, max_age

SORT

min_hits, iou_thresh, max_age, memory_fade

DeepSORT

model_path, min_hits, iou_thresh, max_age, memory_fade, max_cosine_dist, nn_budget, avg_det_conf, avg_det_conf_thresh, most_common_class

List of parameters and their usage

Parameter

Default value

Description

max_age

10

An object that is not tracked for max_age frame is removed from the memory.

min_hits

3

Minimum of hits to start tracking the objects.

iou_thresh

0.3 / 0.7*

The minimum IOU threshold to keep the association of a previously detected object.

memory_fade

1.0

Above a value of 1.0, it enables a fading memory which gives less importance to the older tracks in the memory.

model_path

/

DeepSORT requires a model weight trained to track object features.

max_cosine_dist

0.3

See underlying implementation.

nn_budget

null

See underlying implementation.

avg_det_conf

false

Whether the average detection confidence should be evaluated to filter out detection.

avg_det_conf_thresh

0

If avg_det_conf is used, the thresholds defines the average confidence under which a detection will be filtered out.

most_common_class

false

If true, the object class will be the most common class detected over time.

* In the case of DeepSORT, the default value of iou_thresh is 0.7, it showed better performance experimentally.

Copyright (c) 2021-2022 UCLouvain, ICTEAM Licensed under GPL-3.0 [see LICENSE for details] Written by Jonathan Samelson (2021-2022)

class BBoxes2DTracker(proc_parameters: dict)[source]

Bases: pytb.tracking.tracker.Tracker

__init__(proc_parameters: dict)[source]

This class encompasses the attributes that are common to most trackers of 2D bounding boxes. Initializes the BBoxes2D tracker with the given parameters.

Parameters

proc_parameters (dict) – A dictionary containing the parameters of the desired tracker.

abstract track(detection: pytb.output.bboxes_2d.BBoxes2D) pytb.output.bboxes_2d_track.BBoxes2DTrack[source]

Performs an inference on the given frame.

Parameters

detection (BBoxes2D) – The detection used to infer IDs.

Returns

A set of 2D bounding boxes identifying detected objects with the tracking information added.

Return type

BBoxes2DTrack

abstract reset_state()[source]

Reset the current state of the tracker.