class_docstr: A nearest neighbor distance metric that, for each target, returns
  the closest distance to any sample that has been observed so far.
  
  Args:
      metric (str): Either "euclidean" or "cosine".
      matching_threshold (float): The matching threshold. Samples with larger
          distance are considered an invalid match.
      budget (Optional[int]): If not None, fix samples per class to at most
          this number. Removes the oldest samples when the budget is reached.
  
  Attributes:
      samples (Dict[int -> List[ndarray]]): A dictionary that maps from target
          identities to the list of samples that have been observed so far.
code: def __init__(self, metric, matching_threshold, budget=None):
      if metric == "euclidean":
          self._metric = _nn_euclidean_distance
      elif metric == "cosine":
          self._metric = _nn_cosine_distance
      else:
          raise ValueError(
              "Invalid metric; must be either 'euclidean' or 'cosine'"
          )
      self.matching_threshold = matching_threshold
      self.budget = budget
      self.samples = {}
  
file_path: PaddleHub/modules/video/multiple_object_tracking/fairmot_dla34/modeling/mot/matching/deepsort_matching.py
imports: import numpy
  from scipy.optimize import linear_sum_assignment
  from ..motion import kalman_filter
label_desc: Use image node_id 1 to create a new NearestNeighborDistanceMetric object from inherited base classes: object with example: obj = NearestNeighborDistanceMetric(metric, matching_threshold, budget)