class_docstr: Quasi-Dense Similarity Learning for Multiple Object Tracking.
  
  This multi object tracker is the implementation of `QDTrack
  <https://arxiv.org/abs/2006.06664>`_.
  
  Args:
      detector (dict): Configuration of detector. Defaults to None.
      track_head (dict): Configuration of track head. Defaults to None.
      tracker (dict): Configuration of tracker. Defaults to None.
      freeze_detector (bool): If True, freeze the detector weights.
          Defaults to False.
      data_preprocessor (dict or ConfigDict, optional): The pre-process
         config of :class:`TrackDataPreprocessor`.  it usually includes,
          ``pad_size_divisor``, ``pad_value``, ``mean`` and ``std``.
      init_cfg (dict or list[dict]): Configuration of initialization.
          Defaults to None.
class_docstr_tok: ["Quasi-Dense","Similarity","Learning","for","Multiple","Object","Tracking",".","This","multi","object","tracker","is","the","implementation","of","`","QDTrack","<","https",":","\/\/arxiv.org\/abs\/2006.06664",">","`","_",".","Args",":","detector","(","dict",")",":","Configuration","of","detector",".","Defaults","to","None",".","track_head","(","dict",")",":","Configuration","of","track","head",".","Defaults","to","None",".","tracker","(","dict",")",":","Configuration","of","tracker",".","Defaults","to","None",".","freeze_detector","(","bool",")",":","If","True",",","freeze","the","detector","weights",".","Defaults","to","False",".","data_preprocessor","(","dict","or","ConfigDict",",","optional",")",":","The","pre-process","config","of",":","class",":","`","TrackDataPreprocessor","`",".","it","usually","includes",",","``","pad_size_divisor","``",",","``","pad_value","``",",","``","mean","``","and","``","std","``",".","init_cfg","(","dict","or","list","[","dict","]",")",":","Configuration","of","initialization",".","Defaults","to","None","."]
docstr: Predict results from a video and data samples with post- processing.
  
  Args:
      inputs (Tensor): of shape (N, T, C, H, W) encoding
          input images. The N denotes batch size.
          The T denotes the number of frames in a video.
      data_samples (list[:obj:`TrackDataSample`]): The batch
          data samples. It usually includes information such
          as `video_data_samples`.
      rescale (bool, Optional): If False, then returned bboxes and masks
          will fit the scale of img, otherwise, returned bboxes and masks
          will fit the scale of original image shape. Defaults to True.
  
  Returns:
      TrackSampleList: Tracking results of the inputs.
docstr_tok: ["Predict","results","from","a","video","and","data","samples","with","post-","processing",".","Args",":","inputs","(","Tensor",")",":","of","shape","(","N",",","T",",","C",",","H",",","W",")","encoding","input","images",".","The","N","denotes","batch","size",".","The","T","denotes","the","number","of","frames","in","a","video",".","data_samples","(","list","[",":","obj",":","`","TrackDataSample","`","]",")",":","The","batch","data","samples",".","It","usually","includes","information","such","as","`","video_data_samples","`",".","rescale","(","bool",",","Optional",")",":","If","False",",","then","returned","bboxes","and","masks","will","fit","the","scale","of","img",",","otherwise",",","returned","bboxes","and","masks","will","fit","the","scale","of","original","image","shape",".","Defaults","to","True",".","Returns",":","TrackSampleList",":","Tracking","results","of","the","inputs","."]
code: def predict(
      self,
      inputs: Tensor,
      data_samples: TrackSampleList,
      rescale: bool = True,
      **kwargs,
  ) -> TrackSampleList:
      """Predict results from a video and data samples with post- processing.
  
      Args:
          inputs (Tensor): of shape (N, T, C, H, W) encoding
              input images. The N denotes batch size.
              The T denotes the number of frames in a video.
          data_samples (list[:obj:`TrackDataSample`]): The batch
              data samples. It usually includes information such
              as `video_data_samples`.
          rescale (bool, Optional): If False, then returned bboxes and masks
              will fit the scale of img, otherwise, returned bboxes and masks
              will fit the scale of original image shape. Defaults to True.
  
      Returns:
          TrackSampleList: Tracking results of the inputs.
      """
      assert (
          inputs.dim() == 5
      ), "The img must be 5D Tensor (N, T, C, H, W)."
      assert (
          inputs.size(0) == 1
      ), "QDTrack inference only support 1 batch size per gpu for now."
  
      assert (
          len(data_samples) == 1
      ), "QDTrack only support 1 batch size per gpu for now."
  
      track_data_sample = data_samples[0]
      video_len = len(track_data_sample)
      if track_data_sample[0].frame_id == 0:
          self.tracker.reset()
  
      for frame_id in range(video_len):
          img_data_sample = track_data_sample[frame_id]
          single_img = inputs[:, frame_id].contiguous()
          x = self.detector.extract_feat(single_img)
          rpn_results_list = self.detector.rpn_head.predict(
              x, [img_data_sample]
          )
          # det_results List[InstanceData]
          det_results = self.detector.roi_head.predict(
              x, rpn_results_list, [img_data_sample], rescale=rescale
          )
          assert (
              len(det_results) == 1
          ), "Batch inference is not supported."
          img_data_sample.pred_instances = det_results[0]
          frame_pred_track_instances = self.tracker.track(
              model=self,
              img=single_img,
              feats=x,
              data_sample=img_data_sample,
              **kwargs,
          )
          img_data_sample.pred_track_instances = (
              frame_pred_track_instances
          )
  
      return [track_data_sample]
  
file_path: mmdetection/mmdet/models/mot/qdtrack.py
imports: from typing import Optional, Union
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import TrackSampleList
  from mmdet.utils import OptConfigType, OptMultiConfig
  from .base import BaseMOTModel
label_desc: Use image node_id 2 for calling the QDTrack obj's underlying member method code with example usage: obj.predict(inputs, data_samples, rescale) and returns: list