Skip to main content

ObjectTracking

Applies object-tracking algorithm to all the detections.

This module provides a pipeline element to track objects throughout the frams. This module takes a bounding box and tracks it by assigning unique id.

Examples:

REST API:

WIP

Configuration File:

short-from : object-tracking:<i-max_age>:<i-hist_len>:<i-sampling_frequency>

pipeline:
- person-detection-nano:a:0.3:0.3
- object-tracking:3:50:25
sources:
- address: videos/demo-tracking-28s.mp4
- type: file

ObjectTracking Objects

class ObjectTracking(Element)

Applies object-tracking algorithm to all the detections.

Attributes:

  • name str - The name of the element.
  • max_age int - The number of consecutive iterations for which the tracker needs to be maintained for any object after it has stopped being detected.
  • hist_len int - The max length (in number of points) for which the tracking history can be retained. The larger this value the longer the trace for any detected box.
  • sampling_frequency int - The frequency at which the centroid coordinates of the tracker are appended to the history list

Examples:

ele = ObjectTracking("3", "50", "25")

extract_params

@staticmethod
def extract_params(model_params)

Extract the parameters for this element.

Arguments:

  • model_params List[str] - The parameters for this element.

Returns:

  • max_age int - The number of consecutive iterations for which the tracker needs to be maintained for any object after it has stopped being detected.
  • hist_len int - The max length (in number of points) for which the tracking history can be retained. The larger this value the longer the trace for any detected box.
  • sampling_frequency int - The frequency at which the centroid coordinates of the tracker are appended to the history list

Raises:

  • ExtractParameterException - If the parameters are not valid.

Examples:

params = ObjectTracking.extract_params(["3","50","25"])
ele = ObjectTracking(*params)

process

def process(meta)

Process the bounding boxes.

This is the main function for this element. It will take the bounding boxes, assigns unique id to each bounding box and trackes it through the following frames.

Arguments:

  • meta dict - The metadata to process.

Returns:

  • meta dict - The processed metadata.

Examples:

ele = ObjectTracking("3", "50", "25")
meta = ele.process(meta)