class_docstr: Base inferencer.
  
  Args:
      model (str, optional): Path to the config file or the model name
          defined in metafile. For example, it could be
          "dbnet_resnet18_fpnc_1200e_icdar2015" or
          "configs/textdet/dbnet/dbnet_resnet18_fpnc_1200e_icdar2015.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 "mmocr".
docstr: Call the inferencer.
  
  Args:
      inputs (InputsType): Inputs for the inferencer. It can be a path
          to image / image directory, or an array, or a list of these.
          Note: If it's an numpy array, it should be in BGR order.
      return_datasamples (bool): Whether to return results as
          :obj:`BaseDataElement`. Defaults to False.
      batch_size (int): Inference batch size. Defaults to 1.
      progress_bar (bool): Whether to show a progress bar. Defaults to
          True.
      return_vis (bool): Whether to return the visualization result.
          Defaults to False.
      show (bool): Whether to display the visualization results in a
          popup window. Defaults to False.
      wait_time (float): The interval of show (s). Defaults to 0.
      draw_pred (bool): Whether to draw predicted bounding boxes.
          Defaults to True.
      pred_score_thr (float): Minimum score of bboxes to draw.
          Defaults to 0.3.
      out_dir (str): Output directory of results. Defaults to 'results/'.
      save_vis (bool): Whether to save the visualization results to
          "out_dir". Defaults to False.
      save_pred (bool): Whether to save the inference results to
          "out_dir". Defaults to False.
      print_result (bool): Whether to print the inference result w/o
          visualization to the console. Defaults to False.
  
      **kwargs: Other keyword arguments passed to :meth:`preprocess`,
          :meth:`forward`, :meth:`visualize` and :meth:`postprocess`.
          Each key in kwargs should be in the corresponding set of
          ``preprocess_kwargs``, ``forward_kwargs``, ``visualize_kwargs``
          and ``postprocess_kwargs``.
  
  Returns:
      dict: Inference and visualization results, mapped from
          "predictions" and "visualization".
docstr_tok: ["Call","the","inferencer",".","Args",":","inputs","(","InputsType",")",":","Inputs","for","the","inferencer",".","It","can","be","a","path","to","image","\/","image","directory",",","or","an","array",",","or","a","list","of","these",".","Note",":","If","it","'s","an","numpy","array",",","it","should","be","in","BGR","order",".","return_datasamples","(","bool",")",":","Whether","to","return","results","as",":","obj",":","`","BaseDataElement","`",".","Defaults","to","False",".","batch_size","(","int",")",":","Inference","batch","size",".","Defaults","to","1.","progress_bar","(","bool",")",":","Whether","to","show","a","progress","bar",".","Defaults","to","True",".","return_vis","(","bool",")",":","Whether","to","return","the","visualization","result",".","Defaults","to","False",".","show","(","bool",")",":","Whether","to","display","the","visualization","results","in","a","popup","window",".","Defaults","to","False",".","wait_time","(","float",")",":","The","interval","of","show","(","s",")",".","Defaults","to","0.","draw_pred","(","bool",")",":","Whether","to","draw","predicted","bounding","boxes",".","Defaults","to","True",".","pred_score_thr","(","float",")",":","Minimum","score","of","bboxes","to","draw",".","Defaults","to","0.3.","out_dir","(","str",")",":","Output","directory","of","results",".","Defaults","to","'results\/","'",".","save_vis","(","bool",")",":","Whether","to","save","the","visualization","results","to","``","out_dir","''",".","Defaults","to","False",".","save_pred","(","bool",")",":","Whether","to","save","the","inference","results","to","``","out_dir","''",".","Defaults","to","False",".","print_result","(","bool",")",":","Whether","to","print","the","inference","result","w\/o","visualization","to","the","console",".","Defaults","to","False",".","*","*","kwargs",":","Other","keyword","arguments","passed","to",":","meth",":","`","preprocess","`",",",":","meth",":","`","forward","`",",",":","meth",":","`","visualize","`","and",":","meth",":","`","postprocess","`",".","Each","key","in","kwargs","should","be","in","the","corresponding","set","of","``","preprocess_kwargs","``",",","``","forward_kwargs","``",",","``","visualize_kwargs","``","and","``","postprocess_kwargs","``",".","Returns",":","dict",":","Inference","and","visualization","results",",","mapped","from","``","predictions","''","and","``","visualization","''","."]
code: def __call__(
      self,
      inputs: InputsType,
      return_datasamples: bool = False,
      batch_size: int = 1,
      progress_bar: bool = True,
      return_vis: bool = False,
      show: bool = False,
      wait_time: int = 0,
      draw_pred: bool = True,
      pred_score_thr: float = 0.3,
      out_dir: str = "results/",
      save_vis: bool = False,
      save_pred: bool = False,
      print_result: bool = False,
      **kwargs,
  ) -> dict:
      """Call the inferencer.
  
      Args:
          inputs (InputsType): Inputs for the inferencer. It can be a path
              to image / image directory, or an array, or a list of these.
              Note: If it's an numpy array, it should be in BGR order.
          return_datasamples (bool): Whether to return results as
              :obj:`BaseDataElement`. Defaults to False.
          batch_size (int): Inference batch size. Defaults to 1.
          progress_bar (bool): Whether to show a progress bar. Defaults to
              True.
          return_vis (bool): Whether to return the visualization result.
              Defaults to False.
          show (bool): Whether to display the visualization results in a
              popup window. Defaults to False.
          wait_time (float): The interval of show (s). Defaults to 0.
          draw_pred (bool): Whether to draw predicted bounding boxes.
              Defaults to True.
          pred_score_thr (float): Minimum score of bboxes to draw.
              Defaults to 0.3.
          out_dir (str): Output directory of results. Defaults to 'results/'.
          save_vis (bool): Whether to save the visualization results to
              "out_dir". Defaults to False.
          save_pred (bool): Whether to save the inference results to
              "out_dir". Defaults to False.
          print_result (bool): Whether to print the inference result w/o
              visualization to the console. Defaults to False.
  
          **kwargs: Other keyword arguments passed to :meth:`preprocess`,
              :meth:`forward`, :meth:`visualize` and :meth:`postprocess`.
              Each key in kwargs should be in the corresponding set of
              ``preprocess_kwargs``, ``forward_kwargs``, ``visualize_kwargs``
              and ``postprocess_kwargs``.
  
      Returns:
          dict: Inference and visualization results, mapped from
              "predictions" and "visualization".
      """
      if (save_vis or save_pred) and not out_dir:
          raise ValueError(
              "out_dir must be specified when save_vis or "
              "save_pred is True!"
          )
      if out_dir:
          img_out_dir = osp.join(out_dir, "vis")
          pred_out_dir = osp.join(out_dir, "preds")
      else:
          img_out_dir, pred_out_dir = "", ""
      (
          preprocess_kwargs,
          forward_kwargs,
          visualize_kwargs,
          postprocess_kwargs,
      ) = self._dispatch_kwargs(
          return_vis=return_vis,
          show=show,
          wait_time=wait_time,
          draw_pred=draw_pred,
          pred_score_thr=pred_score_thr,
          save_vis=save_vis,
          save_pred=save_pred,
          print_result=print_result,
          **kwargs,
      )
  
      ori_inputs = self._inputs_to_list(inputs)
      inputs = self.preprocess(
          ori_inputs, batch_size=batch_size, **preprocess_kwargs
      )
      results = {"predictions": [], "visualization": []}
      for ori_inputs, data in track(
          inputs, description="Inference", disable=not progress_bar
      ):
          preds = self.forward(data, **forward_kwargs)
          visualization = self.visualize(
              ori_inputs,
              preds,
              img_out_dir=img_out_dir,
              **visualize_kwargs,
          )
          batch_res = self.postprocess(
              preds,
              visualization,
              return_datasamples,
              pred_out_dir=pred_out_dir,
              **postprocess_kwargs,
          )
          results["predictions"].extend(batch_res["predictions"])
          if return_vis and batch_res["visualization"] is not None:
              results["visualization"].extend(
                  batch_res["visualization"]
              )
      return results
  
imports: import os.path
  from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union
  import mmcv
  import mmengine
  import numpy
  from mmengine.dataset import Compose
  from mmengine.infer.infer import BaseInferencer, ModelType
  from mmengine.model.utils import revert_sync_batchnorm
  from mmengine.registry import init_default_scope
  from mmengine.structures import InstanceData
  from rich.progress import track
  from torch import Tensor
  from mmocr.utils import ConfigType
label_desc: Use image node_id 4 for calling the BaseMMOCRInferencer obj's underlying member method code with example usage: obj.__call__(inputs, return_datasamples, batch_size, progress_bar, return_vis, show, wait_time, draw_pred, pred_score_thr, out_dir, save_vis, save_pred, print_result) and returns: results