class_docstr: Object Detection Inferencer.
  
  Args:
      model (str, optional): Path to the config file or the model name
          defined in metafile. For example, it could be
          "rtmdet-s" or 'rtmdet_s_8xb32-300e_coco' or
          "configs/rtmdet/rtmdet_s_8xb32-300e_coco.py".
          If model is not specified, user must provide the
          `weights` saved by MMEngine which contains the config string.
          Defaults to None.
      weights (str, optional): Path to the checkpoint. If it is not specified
          and model is a model name of metafile, the weights will be loaded
          from metafile. Defaults to None.
      device (str, optional): Device to run inference. If None, the available
          device will be automatically used. Defaults to None.
      scope (str, optional): The scope of the model. Defaults to mmdet.
      palette (str): Color palette used for visualization. The order of
          priority is palette -> config -> checkpoint. Defaults to 'none'.
      show_progress (bool): Control whether to display the progress
          bar during the inference process. Defaults to True.
docstr: Process the inputs into a model-feedable format.
  
  Customize your preprocess by overriding this method. Preprocess should
  return an iterable object, of which each item will be used as the
  input of ``model.test_step``.
  
  ``BaseInferencer.preprocess`` will return an iterable chunked data,
  which will be used in __call__ like this:
  
  .. code-block:: python
  
      def __call__(self, inputs, batch_size=1, **kwargs):
          chunked_data = self.preprocess(inputs, batch_size, **kwargs)
          for batch in chunked_data:
              preds = self.forward(batch, **kwargs)
  
  Args:
      inputs (InputsType): Inputs given by user.
      batch_size (int): batch size. Defaults to 1.
  
  Yields:
      Any: Data processed by the ``pipeline`` and ``collate_fn``.
docstr_tok: ["Process","the","inputs","into","a","model-feedable","format",".","Customize","your","preprocess","by","overriding","this","method",".","Preprocess","should","return","an","iterable","object",",","of","which","each","item","will","be","used","as","the","input","of","``","model.test_step","``",".","``","BaseInferencer.preprocess","``","will","return","an","iterable","chunked","data",",","which","will","be","used","in","__call__","like","this",":","..","code-block",":",":","python","def","__call__","(","self",",","inputs",",","batch_size=1",",","*","*","kwargs",")",":","chunked_data","=","self.preprocess","(","inputs",",","batch_size",",","*","*","kwargs",")","for","batch","in","chunked_data",":","preds","=","self.forward","(","batch",",","*","*","kwargs",")","Args",":","inputs","(","InputsType",")",":","Inputs","given","by","user",".","batch_size","(","int",")",":","batch","size",".","Defaults","to","1",".","Yields",":","Any",":","Data","processed","by","the","``","pipeline","``","and","``","collate_fn","``","."]
code: def preprocess(
      self, inputs: InputsType, batch_size: int = 1, **kwargs
  ):
      """Process the inputs into a model-feedable format.
  
      Customize your preprocess by overriding this method. Preprocess should
      return an iterable object, of which each item will be used as the
      input of ``model.test_step``.
  
      ``BaseInferencer.preprocess`` will return an iterable chunked data,
      which will be used in __call__ like this:
  
      .. code-block:: python
  
          def __call__(self, inputs, batch_size=1, **kwargs):
              chunked_data = self.preprocess(inputs, batch_size, **kwargs)
              for batch in chunked_data:
                  preds = self.forward(batch, **kwargs)
  
      Args:
          inputs (InputsType): Inputs given by user.
          batch_size (int): batch size. Defaults to 1.
  
      Yields:
          Any: Data processed by the ``pipeline`` and ``collate_fn``.
      """
      chunked_data = self._get_chunk_data(inputs, batch_size)
      yield from map(self.collate_fn, chunked_data)
  
imports: import copy
  import os.path
  import warnings
  from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union
  import mmcv
  import mmengine
  import numpy
  import torch.nn
  from mmcv.transforms import LoadImageFromFile
  from mmengine.dataset import Compose
  from mmengine.fileio import get_file_backend, isdir, join_path, list_dir_or_file
  from mmengine.infer.infer import BaseInferencer, ModelType
  from mmengine.model.utils import revert_sync_batchnorm
  from mmengine.registry import init_default_scope
  from mmengine.runner.checkpoint import _load_checkpoint_to_model
  from mmengine.visualization import Visualizer
  from rich.progress import track
  from mmdet.evaluation import INSTANCE_OFFSET
  from mmdet.registry import DATASETS
  from mmdet.structures import DetDataSample
  from mmdet.structures.mask import encode_mask_results, mask2bbox
  from mmdet.utils import ConfigType
  from ..evaluation import get_classes
label_desc: Use image node_id 7 for calling the DetInferencer obj's underlying member method code with example usage: obj.preprocess(inputs, batch_size) without return types