class_docstr: Implementation of `Masked-attention Mask
  Transformer for Universal Image Segmentation
  <https://arxiv.org/pdf/2112.01527>`_.
  
  Args:
      backbone (dict): Configuration of backbone. Defaults to None.
      track_head (dict): Configuration of track head. Defaults to None.
      data_preprocessor (dict or ConfigDict, optional): The pre-process
         config of :class:`TrackDataPreprocessor`.  it usually includes,
          ``pad_size_divisor``, ``pad_value``, ``mean`` and ``std``.
          Defaults to None.
      init_cfg (dict or list[dict]): Configuration of initialization.
          Defaults to None.
class_docstr_tok: ["Implementation","of","`","Masked-attention","Mask","Transformer","for","Universal","Image","Segmentation","<","https",":","\/\/arxiv.org\/pdf\/2112.01527",">","`","_",".","Args",":","backbone","(","dict",")",":","Configuration","of","backbone",".","Defaults","to","None",".","track_head","(","dict",")",":","Configuration","of","track","head",".","Defaults","to","None",".","data_preprocessor","(","dict","or","ConfigDict",",","optional",")",":","The","pre-process","config","of",":","class",":","`","TrackDataPreprocessor","`",".","it","usually","includes",",","``","pad_size_divisor","``",",","``","pad_value","``",",","``","mean","``","and","``","std","``",".","Defaults","to","None",".","init_cfg","(","dict","or","list","[","dict","]",")",":","Configuration","of","initialization",".","Defaults","to","None","."]
docstr: Predict results from a batch of inputs and data samples with
  postprocessing.
  
  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","batch","of","inputs","and","data","samples","with","postprocessing",".","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,
  ) -> TrackSampleList:
      """Predict results from a batch of inputs and data samples with
      postprocessing.
  
      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 (
          len(data_samples) == 1
      ), "Mask2former only support 1 batch size per gpu for now."
  
      # [T, C, H, W]
      img = inputs[0]
      track_data_sample = data_samples[0]
      feats = self.backbone(img)
      pred_track_ins_list = self.track_head.predict(
          feats, track_data_sample, rescale
      )
  
      det_data_samples_list = []
      for idx, pred_track_ins in enumerate(pred_track_ins_list):
          img_data_sample = track_data_sample[idx]
          img_data_sample.pred_track_instances = pred_track_ins
          det_data_samples_list.append(img_data_sample)
  
      results = TrackDataSample()
      results.video_data_samples = det_data_samples_list
      return [results]
  
file_path: mmdetection/mmdet/models/vis/mask2former_vis.py
imports: from typing import Optional, Union
  from torch import Tensor
  from mmdet.models.mot import BaseMOTModel
  from mmdet.registry import MODELS
  from mmdet.structures import TrackDataSample, TrackSampleList
  from mmdet.utils import OptConfigType, OptMultiConfig
label_desc: Use image node_id 4 for calling the Mask2FormerVideo obj's underlying member method code with example usage: obj.predict(inputs, data_samples, rescale) and returns: list