class_docstr: The class in charge of performing the tracking of the detections produced by a detector.
  
  Parameters
  ----------
  distance_function : Union[str, Callable[[Detection, TrackedObject], float]]
      Function used by the tracker to determine the distance between newly detected objects and the objects that are currently being tracked.
      This function should take 2 input arguments, the first being a [Detection][norfair.tracker.Detection], and the second a [TrackedObject][norfair.tracker.TrackedObject].
      It has to return a `float` with the distance it calculates.
      Some common distances are implemented in [distances][], as a shortcut the tracker accepts the name of these [predefined distances][norfair.distances.get_distance_by_name].
      Scipy's predefined distances are also accepted. A `str` with one of the available metrics in
      [`scipy.spatial.distance.cdist`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html).
  distance_threshold : float
      Defines what is the maximum distance that can constitute a match.
      Detections and tracked objects whose distances are above this threshold won't be matched by the tracker.
  hit_counter_max : int, optional
      Each tracked objects keeps an internal hit counter which tracks how often it's getting matched to a detection,
      each time it gets a match this counter goes up, and each time it doesn't it goes down.
  
      If it goes below 0 the object gets destroyed. This argument defines how large this inertia can grow,
      and therefore defines how long an object can live without getting matched to any detections, before it is displaced as a dead object, if no ReID distance function is implemented it will be destroyed.
  initialization_delay : Optional[int], optional
       Determines how large the object's hit counter must be in order to be considered as initialized, and get returned to the user as a real object.
       It must be smaller than `hit_counter_max` or otherwise the object would never be initialized.
  
       If set to 0, objects will get returned to the user as soon as they are detected for the first time,
       which can be problematic as this can result in objects appearing and immediately dissapearing.
  
       Defaults to `hit_counter_max / 2`
  pointwise_hit_counter_max : int, optional
      Each tracked object keeps track of how often the points it's tracking have been getting matched.
      Points that are getting matched (`pointwise_hit_counter > 0`) are said to be live, and points which aren't (`pointwise_hit_counter = 0`)
      are said to not be live.
  
      This is used to determine things like which individual points in a tracked object get drawn by [`draw_tracked_objects`][norfair.drawing.draw_tracked_objects] and which don't.
      This argument defines how large the inertia for each point of a tracker can grow.
  detection_threshold : float, optional
      Sets the threshold at which the scores of the points in a detection being fed into the tracker must dip below to be ignored by the tracker.
  filter_factory : FilterFactory, optional
      This parameter can be used to change what filter the [`TrackedObject`][norfair.tracker.TrackedObject] instances created by the tracker will use.
      Defaults to [`OptimizedKalmanFilterFactory()`][norfair.filter.OptimizedKalmanFilterFactory]
  past_detections_length : int, optional
      How many past detections to save for each tracked object.
      Norfair tries to distribute these past detections uniformly through the object's lifetime so they're more representative.
      Very useful if you want to add metric learning to your model, as you can associate an embedding to each detection and access them in your distance function.
  reid_distance_function: Optional[Callable[["TrackedObject", "TrackedObject"], float]]
      Function used by the tracker to determine the ReID distance between newly detected trackers and unmatched trackers by the distance function.
  
      This function should take 2 input arguments, the first being tracked objects in the initialization phase of type [`TrackedObject`][norfair.tracker.TrackedObject],
      and the second being tracked objects that have been unmatched of type [`TrackedObject`][norfair.tracker.TrackedObject]. It returns a `float` with the distance it
      calculates.
  reid_distance_threshold: float
      Defines what is the maximum ReID distance that can constitute a match.
  
      Tracked objects whose distance is above this threshold won't be merged, if they are the oldest tracked object will be maintained
      with the position of the new tracked object.
  reid_hit_counter_max: Optional[int]
      Each tracked object keeps an internal ReID hit counter which tracks how often it's getting recognized by another tracker,
      each time it gets a match this counter goes up, and each time it doesn't it goes down. If it goes below 0 the object gets destroyed.
      If used, this argument (`reid_hit_counter_max`) defines how long an object can live without getting matched to any detections, before it is destroyed.
docstr: Process detections found in each frame.
  
  The detections can be matched to previous tracked objects or new ones will be created
  according to the configuration of the Tracker.
  The currently alive and initialized tracked objects are returned
  
  Parameters
  ----------
  detections : Optional[List[Detection]], optional
      A list of [`Detection`][norfair.tracker.Detection] which represent the detections found in the current frame being processed.
  
      If no detections have been found in the current frame, or the user is purposely skipping frames to improve video processing time,
      this argument should be set to None or ignored, as the update function is needed to advance the state of the Kalman Filters inside the tracker.
  period : int, optional
      The user can chose not to run their detector on all frames, so as to process video faster.
      This parameter sets every how many frames the detector is getting ran,
      so that the tracker is aware of this situation and can handle it properly.
  
      This argument can be reset on each frame processed,
      which is useful if the user is dynamically changing how many frames the detector is skipping on a video when working in real-time.
  coord_transformations: Optional[CoordinatesTransformation]
      The coordinate transformation calculated by the [MotionEstimator][norfair.camera_motion.MotionEstimator].
  
  Returns
  -------
  List[TrackedObject]
      The list of active tracked objects.
code: def update(
      self,
      detections: Optional[List["Detection"]] = None,
      period: int = 1,
      coord_transformations: Optional[CoordinatesTransformation] = None,
  ) -> List["TrackedObject"]:
      """
      Process detections found in each frame.
  
      The detections can be matched to previous tracked objects or new ones will be created
      according to the configuration of the Tracker.
      The currently alive and initialized tracked objects are returned
  
      Parameters
      ----------
      detections : Optional[List[Detection]], optional
          A list of [`Detection`][norfair.tracker.Detection] which represent the detections found in the current frame being processed.
  
          If no detections have been found in the current frame, or the user is purposely skipping frames to improve video processing time,
          this argument should be set to None or ignored, as the update function is needed to advance the state of the Kalman Filters inside the tracker.
      period : int, optional
          The user can chose not to run their detector on all frames, so as to process video faster.
          This parameter sets every how many frames the detector is getting ran,
          so that the tracker is aware of this situation and can handle it properly.
  
          This argument can be reset on each frame processed,
          which is useful if the user is dynamically changing how many frames the detector is skipping on a video when working in real-time.
      coord_transformations: Optional[CoordinatesTransformation]
          The coordinate transformation calculated by the [MotionEstimator][norfair.camera_motion.MotionEstimator].
  
      Returns
      -------
      List[TrackedObject]
          The list of active tracked objects.
      """
      if coord_transformations is not None:
          for det in detections:
              det.update_coordinate_transformation(
                  coord_transformations
              )
  
      # Remove stale trackers and make candidate object real if the hit counter is positive
      alive_objects = []
      dead_objects = []
      if self.reid_hit_counter_max is None:
          self.tracked_objects = [
              o
              for o in self.tracked_objects
              if o.hit_counter_is_positive
          ]
          alive_objects = self.tracked_objects
      else:
          tracked_objects = []
          for o in self.tracked_objects:
              if o.reid_hit_counter_is_positive:
                  tracked_objects.append(o)
                  if o.hit_counter_is_positive:
                      alive_objects.append(o)
                  else:
                      dead_objects.append(o)
          self.tracked_objects = tracked_objects
  
      # Update tracker
      for obj in self.tracked_objects:
          obj.tracker_step()
          obj.update_coordinate_transformation(coord_transformations)
  
      # Update initialized tracked objects with detections
      (
          unmatched_detections,
          _,
          unmatched_init_trackers,
      ) = self._update_objects_in_place(
          self.distance_function,
          self.distance_threshold,
          [o for o in alive_objects if not o.is_initializing],
          detections,
          period,
      )
  
      # Update not yet initialized tracked objects with yet unmatched detections
      (
          unmatched_detections,
          matched_not_init_trackers,
          _,
      ) = self._update_objects_in_place(
          self.distance_function,
          self.distance_threshold,
          [o for o in alive_objects if o.is_initializing],
          unmatched_detections,
          period,
      )
  
      if self.reid_distance_function is not None:
          # Match unmatched initialized tracked objects with not yet initialized tracked objects
          _, _, _ = self._update_objects_in_place(
              self.reid_distance_function,
              self.reid_distance_threshold,
              unmatched_init_trackers + dead_objects,
              matched_not_init_trackers,
              period,
          )
  
      # Create new tracked objects from remaining unmatched detections
      for detection in unmatched_detections:
          self.tracked_objects.append(
              self._obj_factory.create(
                  initial_detection=detection,
                  hit_counter_max=self.hit_counter_max,
                  initialization_delay=self.initialization_delay,
                  pointwise_hit_counter_max=self.pointwise_hit_counter_max,
                  detection_threshold=self.detection_threshold,
                  period=period,
                  filter_factory=self.filter_factory,
                  past_detections_length=self.past_detections_length,
                  reid_hit_counter_max=self.reid_hit_counter_max,
                  coord_transformations=coord_transformations,
              )
          )
  
      return self.get_active_objects()
  
imports: from logging import warning
  from typing import Any, Callable, Hashable, List, Optional, Sequence, Tuple, Union
  import numpy
  from rich import print
  from norfair.camera_motion import CoordinatesTransformation
  from .distances import AVAILABLE_VECTORIZED_DISTANCES, ScalarDistance, get_distance_by_name
  from .filter import FilterFactory, OptimizedKalmanFilterFactory
  from .utils import validate_points
label_desc: Use image node_id 2 for calling the Tracker obj's underlying member method code with example usage: obj.update(detections, period, coord_transformations) and returns: self