class_docstr: Interpolate tracks to make tracks more complete.
  
  Args:
      min_num_frames (int, optional): The minimum length of a track that will
          be interpolated. Defaults to 5.
      max_num_frames (int, optional): The maximum disconnected length in
          a track. Defaults to 20.
      use_gsi (bool, optional): Whether to use the GSI (Gaussian-smoothed
          interpolation) method. Defaults to False.
      smooth_tau (int, optional): smoothing parameter in GSI. Defaults to 10.
class_docstr_tok: ["Interpolate","tracks","to","make","tracks","more","complete",".","Args",":","min_num_frames","(","int",",","optional",")",":","The","minimum","length","of","a","track","that","will","be","interpolated",".","Defaults","to","5.","max_num_frames","(","int",",","optional",")",":","The","maximum","disconnected","length","in","a","track",".","Defaults","to","20.","use_gsi","(","bool",",","optional",")",":","Whether","to","use","the","GSI","(","Gaussian-smoothed","interpolation",")","method",".","Defaults","to","False",".","smooth_tau","(","int",",","optional",")",":","smoothing","parameter","in","GSI",".","Defaults","to","10","."]
docstr: Interpolate a track linearly to make the track more complete.
  
  This function is proposed in
  "ByteTrack: Multi-Object Tracking by Associating Every Detection Box."
  `ByteTrack<https://arxiv.org/abs/2110.06864>`_.
  
  Args:
      track (ndarray): With shape (N, 7). Each row denotes
          (frame_id, track_id, x1, y1, x2, y2, score).
      max_num_frames (int, optional): The maximum disconnected length in
          the track. Defaults to 20.
  
  Returns:
      ndarray: The interpolated track with shape (N, 7). Each row denotes
          (frame_id, track_id, x1, y1, x2, y2, score)
docstr_tok: ["Interpolate","a","track","linearly","to","make","the","track","more","complete",".","This","function","is","proposed","in","''","ByteTrack",":","Multi-Object","Tracking","by","Associating","Every","Detection","Box",".","''","`","ByteTrack","<","https",":","\/\/arxiv.org\/abs\/2110.06864",">","`","_",".","Args",":","track","(","ndarray",")",":","With","shape","(","N",",","7",")",".","Each","row","denotes","(","frame_id",",","track_id",",","x1",",","y1",",","x2",",","y2",",","score",")",".","max_num_frames","(","int",",","optional",")",":","The","maximum","disconnected","length","in","the","track",".","Defaults","to","20",".","Returns",":","ndarray",":","The","interpolated","track","with","shape","(","N",",","7",")",".","Each","row","denotes","(","frame_id",",","track_id",",","x1",",","y1",",","x2",",","y2",",","score",")"]
code: def _interpolate_track(
      self, track: np.ndarray, track_id: int, max_num_frames: int = 20
  ) -> np.ndarray:
      """Interpolate a track linearly to make the track more complete.
  
      This function is proposed in
      "ByteTrack: Multi-Object Tracking by Associating Every Detection Box."
      `ByteTrack<https://arxiv.org/abs/2110.06864>`_.
  
      Args:
          track (ndarray): With shape (N, 7). Each row denotes
              (frame_id, track_id, x1, y1, x2, y2, score).
          max_num_frames (int, optional): The maximum disconnected length in
              the track. Defaults to 20.
  
      Returns:
          ndarray: The interpolated track with shape (N, 7). Each row denotes
              (frame_id, track_id, x1, y1, x2, y2, score)
      """
      assert (
          track[:, 1] == track_id
      ).all(), (
          "The track id should not changed when interpolate a track."
      )
  
      frame_ids = track[:, 0]
      interpolated_track = np.zeros((0, 7))
      # perform interpolation for the disconnected frames in the track.
      for i in np.where(np.diff(frame_ids) > 1)[0]:
          left_frame_id = frame_ids[i]
          right_frame_id = frame_ids[i + 1]
          num_disconnected_frames = int(right_frame_id - left_frame_id)
  
          if 1 < num_disconnected_frames < max_num_frames:
              left_bbox = track[i, 2:6]
              right_bbox = track[i + 1, 2:6]
  
              # perform interpolation for two adjacent tracklets.
              for j in range(1, num_disconnected_frames):
                  cur_bbox = (
                      j
                      / (num_disconnected_frames)
                      * (right_bbox - left_bbox)
                      + left_bbox
                  )
                  cur_result = np.ones((7,))
                  cur_result[0] = j + left_frame_id
                  cur_result[1] = track_id
                  cur_result[2:6] = cur_bbox
  
                  interpolated_track = np.concatenate(
                      (interpolated_track, cur_result[None]), axis=0
                  )
  
      interpolated_track = np.concatenate(
          (track, interpolated_track), axis=0
      )
      return interpolated_track
  
imports: import numpy
  from mmdet.registry import TASK_UTILS
label_desc: Use image node_id 2 for calling the InterpolateTracklets obj's underlying member method code with example usage: obj._interpolate_track(track, track_id, max_num_frames) and returns: interpolated_track