class_docstr: Tracker for Quasi-Dense Tracking.
  
  Args:
      init_score_thr (float): The cls_score threshold to
          initialize a new tracklet. Defaults to 0.8.
      obj_score_thr (float): The cls_score threshold to
          update a tracked tracklet. Defaults to 0.5.
      match_score_thr (float): The match threshold. Defaults to 0.5.
      memo_tracklet_frames (int): The most frames in a tracklet memory.
          Defaults to 10.
      memo_backdrop_frames (int): The most frames in the backdrops.
          Defaults to 1.
      memo_momentum (float): The momentum value for embeds updating.
          Defaults to 0.8.
      nms_conf_thr (float): The nms threshold for confidence.
          Defaults to 0.5.
      nms_backdrop_iou_thr (float): The nms threshold for backdrop IoU.
          Defaults to 0.3.
      nms_class_iou_thr (float): The nms threshold for class IoU.
          Defaults to 0.7.
      with_cats (bool): Whether to track with the same category.
          Defaults to True.
      match_metric (str): The match metric. Defaults to 'bisoftmax'.
docstr: Tracking forward function.
  
  Args:
      ids (Tensor): of shape(N, ).
      bboxes (Tensor): of shape (N, 5).
      embeds (Tensor): of shape (N, 256).
      labels (Tensor): of shape (N, ).
      scores (Tensor): of shape (N, ).
      frame_id (int): The id of current frame, 0-index.
docstr_tok: ["Tracking","forward","function",".","Args",":","ids","(","Tensor",")",":","of","shape","(","N",",",")",".","bboxes","(","Tensor",")",":","of","shape","(","N",",","5",")",".","embeds","(","Tensor",")",":","of","shape","(","N",",","256",")",".","labels","(","Tensor",")",":","of","shape","(","N",",",")",".","scores","(","Tensor",")",":","of","shape","(","N",",",")",".","frame_id","(","int",")",":","The","id","of","current","frame",",","0-index","."]
code: def update(
      self,
      ids: Tensor,
      bboxes: Tensor,
      embeds: Tensor,
      labels: Tensor,
      scores: Tensor,
      frame_id: int,
  ) -> None:
      """Tracking forward function.
  
      Args:
          ids (Tensor): of shape(N, ).
          bboxes (Tensor): of shape (N, 5).
          embeds (Tensor): of shape (N, 256).
          labels (Tensor): of shape (N, ).
          scores (Tensor): of shape (N, ).
          frame_id (int): The id of current frame, 0-index.
      """
      tracklet_inds = ids > -1
  
      for id, bbox, embed, label, score in zip(
          ids[tracklet_inds],
          bboxes[tracklet_inds],
          embeds[tracklet_inds],
          labels[tracklet_inds],
          scores[tracklet_inds],
      ):
          id = int(id)
          # update the tracked ones and initialize new tracks
          if id in self.tracks.keys():
              velocity = (bbox - self.tracks[id]["bbox"]) / (
                  frame_id - self.tracks[id]["last_frame"]
              )
              self.tracks[id]["bbox"] = bbox
              self.tracks[id]["embed"] = (
                  1 - self.memo_momentum
              ) * self.tracks[id]["embed"] + self.memo_momentum * embed
              self.tracks[id]["last_frame"] = frame_id
              self.tracks[id]["label"] = label
              self.tracks[id]["score"] = score
              self.tracks[id]["velocity"] = (
                  self.tracks[id]["velocity"]
                  * self.tracks[id]["acc_frame"]
                  + velocity
              ) / (self.tracks[id]["acc_frame"] + 1)
              self.tracks[id]["acc_frame"] += 1
          else:
              self.tracks[id] = dict(
                  bbox=bbox,
                  embed=embed,
                  label=label,
                  score=score,
                  last_frame=frame_id,
                  velocity=torch.zeros_like(bbox),
                  acc_frame=0,
              )
      # backdrop update according to IoU
      backdrop_inds = torch.nonzero(ids == -1, as_tuple=False).squeeze(
          1
      )
      ious = bbox_overlaps(bboxes[backdrop_inds], bboxes)
      for i, ind in enumerate(backdrop_inds):
          if (ious[i, :ind] > self.nms_backdrop_iou_thr).any():
              backdrop_inds[i] = -1
      backdrop_inds = backdrop_inds[backdrop_inds > -1]
      # old backdrops would be removed at first
      self.backdrops.insert(
          0,
          dict(
              bboxes=bboxes[backdrop_inds],
              embeds=embeds[backdrop_inds],
              labels=labels[backdrop_inds],
          ),
      )
  
      # pop memo
      invalid_ids = []
      for k, v in self.tracks.items():
          if frame_id - v["last_frame"] >= self.memo_tracklet_frames:
              invalid_ids.append(k)
      for invalid_id in invalid_ids:
          self.tracks.pop(invalid_id)
  
      if len(self.backdrops) > self.memo_backdrop_frames:
          self.backdrops.pop()
  
file_path: mmdetection/mmdet/models/trackers/quasi_dense_tracker.py
imports: from typing import List, Tuple
  import torch
  import torch.nn.functional
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import TrackDataSample
  from mmdet.structures.bbox import bbox_overlaps
  from .base_tracker import BaseTracker
label_desc: Use image node_id 3 for calling the QuasiDenseTracker obj's underlying member method code with example usage: obj.update(ids, bboxes, embeds, labels, scores, frame_id) without return types