class_docstr: Image pre-processor for tracking tasks.
  
      Accepts the data sampled by the dataloader, and preprocesses
      it into the format of the model input. ``TrackDataPreprocessor``
      provides the tracking data pre-processing as follows:
  
      - Collate and move data to the target device.
      - Pad inputs to the maximum size of current batch with defined
        ``pad_value``. The padding size can be divisible by a defined
        ``pad_size_divisor``
      - Stack inputs to inputs.
      - Convert inputs from bgr to rgb if the shape of input is (1, 3, H, W).
      - Normalize image with defined std and mean.
      - Do batch augmentations during training.
      - Record the information of ``batch_input_shape`` and ``pad_shape``.
  
      Args:
          mean (Sequence[Number], optional): The pixel mean of R, G, B
              channels. Defaults to None.
          std (Sequence[Number], optional): The pixel standard deviation of
              R, G, B channels. Defaults to None.
          pad_size_divisor (int): The size of padded image should be
              divisible by ``pad_size_divisor``. Defaults to 1.
          pad_value (Number): The padded pixel value. Defaults to 0.
          pad_mask (bool): Whether to pad instance masks. Defaults to False.
          mask_pad_value (int): The padded pixel value for instance masks.
              Defaults to 0.
          bgr_to_rgb (bool): whether to convert image from BGR to RGB.
              Defaults to False.
          rgb_to_bgr (bool): whether to convert image from RGB to RGB.
              Defaults to False.
          use_det_processor: (bool): whether to use DetDataPreprocessor
              in training phrase. This is mainly for some tracking models
              fed into one image rather than a group of image in training.
              Defaults to False.
  .       boxtype2tensor (bool): Whether to convert the ``BaseBoxes`` type of
              bboxes data to ``Tensor`` type. Defaults to True.
          batch_augments (list[dict], optional): Batch-level augmentations
class_docstr_tok: ["Image","pre-processor","for","tracking","tasks",".","Accepts","the","data","sampled","by","the","dataloader",",","and","preprocesses","it","into","the","format","of","the","model","input",".","``","TrackDataPreprocessor","``","provides","the","tracking","data","pre-processing","as","follows",":","-","Collate","and","move","data","to","the","target","device",".","-","Pad","inputs","to","the","maximum","size","of","current","batch","with","defined","``","pad_value","``",".","The","padding","size","can","be","divisible","by","a","defined","``","pad_size_divisor","``","-","Stack","inputs","to","inputs",".","-","Convert","inputs","from","bgr","to","rgb","if","the","shape","of","input","is","(","1",",","3",",","H",",","W",")",".","-","Normalize","image","with","defined","std","and","mean",".","-","Do","batch","augmentations","during","training",".","-","Record","the","information","of","``","batch_input_shape","``","and","``","pad_shape","``",".","Args",":","mean","(","Sequence","[","Number","]",",","optional",")",":","The","pixel","mean","of","R",",","G",",","B","channels",".","Defaults","to","None",".","std","(","Sequence","[","Number","]",",","optional",")",":","The","pixel","standard","deviation","of","R",",","G",",","B","channels",".","Defaults","to","None",".","pad_size_divisor","(","int",")",":","The","size","of","padded","image","should","be","divisible","by","``","pad_size_divisor","``",".","Defaults","to","1.","pad_value","(","Number",")",":","The","padded","pixel","value",".","Defaults","to","0.","pad_mask","(","bool",")",":","Whether","to","pad","instance","masks",".","Defaults","to","False",".","mask_pad_value","(","int",")",":","The","padded","pixel","value","for","instance","masks",".","Defaults","to","0.","bgr_to_rgb","(","bool",")",":","whether","to","convert","image","from","BGR","to","RGB",".","Defaults","to","False",".","rgb_to_bgr","(","bool",")",":","whether","to","convert","image","from","RGB","to","RGB",".","Defaults","to","False",".","use_det_processor",":","(","bool",")",":","whether","to","use","DetDataPreprocessor","in","training","phrase",".","This","is","mainly","for","some","tracking","models","fed","into","one","image","rather","than","a","group","of","image","in","training",".","Defaults","to","False",".",".","boxtype2tensor","(","bool",")",":","Whether","to","convert","the","``","BaseBoxes","``","type","of","bboxes","data","to","``","Tensor","``","type",".","Defaults","to","True",".","batch_augments","(","list","[","dict","]",",","optional",")",":","Batch-level","augmentations"]
docstr: Get the pad_shape of each image based on data and pad_size_divisor.
  
  Args:
      data (dict): Data sampled from dataloader.
  
  Returns:
      Dict[str, List]: The shape of padding.
docstr_tok: ["Get","the","pad_shape","of","each","image","based","on","data","and","pad_size_divisor",".","Args",":","data","(","dict",")",":","Data","sampled","from","dataloader",".","Returns",":","Dict","[","str",",","List","]",":","The","shape","of","padding","."]
code: def _get_track_pad_shape(self, data: dict) -> Dict[str, List]:
      """Get the pad_shape of each image based on data and pad_size_divisor.
  
      Args:
          data (dict): Data sampled from dataloader.
  
      Returns:
          Dict[str, List]: The shape of padding.
      """
      batch_pad_shape = dict()
      batch_pad_shape = []
      for imgs in data["inputs"]:
          # The sequence images in one sample among a batch have the same
          # original shape
          pad_h = (
              int(np.ceil(imgs.shape[-2] / self.pad_size_divisor))
              * self.pad_size_divisor
          )
          pad_w = (
              int(np.ceil(imgs.shape[-1] / self.pad_size_divisor))
              * self.pad_size_divisor
          )
          pad_shapes = [(pad_h, pad_w)] * imgs.size(0)
          batch_pad_shape.append(pad_shapes)
      return batch_pad_shape
  
file_path: mmdetection/mmdet/models/data_preprocessors/track_data_preprocessor.py
imports: from typing import Dict, List, Optional, Sequence, Union
  import numpy
  import torch
  import torch.nn.functional
  from mmengine.model.utils import stack_batch
  from mmdet.models.utils.misc import samplelist_boxtype2tensor
  from mmdet.registry import MODELS
  from mmdet.structures import TrackDataSample
  from mmdet.structures.mask import BitmapMasks
  from .data_preprocessor import DetDataPreprocessor
label_desc: Use image node_id 3 for calling the TrackDataPreprocessor obj's underlying member method code with example usage: obj._get_track_pad_shape(data) and returns: batch_pad_shape