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 track(detection: pytb.output.detection.Detection) pytb.output.detection.Detection [source]
Performs a tracking method to match the IDs between frames.
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
- 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).
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
- 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.
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.
Tracker |
Parameters |
---|---|
Centroid |
|
IOU |
|
KIOU |
|
SORT |
|
DeepSORT |
|
Parameter |
Default value |
Description |
---|---|---|
|
10 |
An object that is not tracked for max_age frame is removed from the memory. |
|
3 |
Minimum of hits to start tracking the objects. |
|
0.3 / 0.7* |
The minimum IOU threshold to keep the association of a previously detected object. |
|
1.0 |
Above a value of 1.0, it enables a fading memory which gives less importance to the older tracks in the memory. |
|
/ |
DeepSORT requires a model weight trained to track object features. |
|
0.3 |
See underlying implementation. |
|
null |
See underlying implementation. |
|
false |
Whether the average detection confidence should be evaluated to filter out detection. |
|
0 |
If avg_det_conf is used, the thresholds defines the average confidence under which a detection will be filtered out. |
|
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