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, pipeline, 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, pipeline, batch_size)
      yield from map(self.collate_fn, chunked_data)
  
file_path: mmdetection/projects/XDecoder/xdecoder/inference/texttoimage_regionretrieval_inferencer.py
imports: import copy
  from typing import Iterable, Optional, Union
  import torch
  from mmengine.dataset import Compose
  from rich.progress import track
  from mmdet.apis.det_inferencer import DetInferencer, InputsType
  from mmdet.utils import ConfigType
label_desc: Use image node_id 3 for calling the TextToImageRegionRetrievalInferencer obj's underlying member method code with example usage: obj.preprocess(inputs, pipeline, batch_size) without return types