docstr: Perform inference for learner.
  
  Parameters
  ----------
  data
      The data for inference.
  realtime
      Whether use realtime inference.
  requires_label
      Whether uses label during inference.
  barebones
      Whether to run in “barebones mode”, where all lightning's features that may impact raw speed are disabled.
  
  Returns
  -------
  A list of output dicts.
docstr_tok: ["Perform","inference","for","learner",".","Parameters","--","--","--","--","--","data","The","data","for","inference",".","realtime","Whether","use","realtime","inference",".","requires_label","Whether","uses","label","during","inference",".","barebones","Whether","to","run","in","\u201c","barebones","mode","\u201d",",","where","all","lightning","'s","features","that","may","impact","raw","speed","are","disabled",".","Returns","--","--","--","-","A","list","of","output","dicts","."]
code: def predict_per_run(
      self,
      data: Union[pd.DataFrame, dict, list],
      realtime: Optional[bool],
      requires_label: bool,
      barebones: Optional[bool] = False,
  ) -> List[Dict]:
      """
      Perform inference for learner.
  
      Parameters
      ----------
      data
          The data for inference.
      realtime
          Whether use realtime inference.
      requires_label
          Whether uses label during inference.
      barebones
          Whether to run in “barebones mode”, where all lightning's features that may impact raw speed are disabled.
  
      Returns
      -------
      A list of output dicts.
      """
      data = self.on_predict_per_run_start(data=data)
      column_types = self.infer_column_types(
          column_types=self._column_types,
          data=data,
          is_train=False,
      )
      column_types = infer_rois_column_type(
          column_types=column_types,
          data=data,
      )
      df_preprocessor = self.get_df_preprocessor_per_run(
          df_preprocessor=self._df_preprocessor,
          data=data,
          column_types=column_types,
          is_train=False,
      )
      if self._fit_called:
          df_preprocessor._column_types = (
              self.update_image_column_types(data=data)
          )
      data_processors = self.get_data_processors_per_run(
          data_processors=self._data_processors,
          requires_label=requires_label,
          is_train=False,
      )
      num_gpus, strategy = self.get_num_gpus_and_strategy_per_run(
          predict_data=data,
          is_train=False,
      )
      precision = self.get_precision_per_run(
          num_gpus=num_gpus,
          precision=self._config.env.precision,
          cpu_only_warning=False,
      )
      batch_size = self.get_predict_batch_size_per_run(
          num_gpus=num_gpus, strategy=strategy
      )
      (
          realtime,
          num_gpus,
          barebones,
      ) = self.update_realtime_for_interactive_env(
          realtime=realtime,
          num_gpus=num_gpus,
          barebones=barebones,
          strategy=strategy,
      )
      datamodule = self.get_datamodule_per_run(
          df_preprocessor=df_preprocessor,
          data_processors=data_processors,
          per_gpu_batch_size=batch_size,
          num_workers=self._config.env.num_workers_evaluation,
          predict_data=data,
          is_train=False,
      )
      pred_writer = self.get_pred_writer(strategy=strategy)
      callbacks = self.get_callbacks_per_run(
          pred_writer=pred_writer, is_train=False
      )
      litmodule = self.get_litmodule_per_run(is_train=False)
      trainer = self.init_trainer_per_run(
          num_gpus=num_gpus,
          precision=precision,
          strategy=strategy,
          callbacks=callbacks,
          barebones=barebones,
          is_train=False,
      )
      outputs = self.run_trainer(
          trainer=trainer,
          litmodule=litmodule,
          datamodule=datamodule,
          pred_writer=pred_writer,
          is_train=False,
      )
      outputs = self.collect_predictions(
          outputs=outputs,
          trainer=trainer,
          pred_writer=pred_writer,
          num_gpus=num_gpus,
      )
      self.on_predict_per_run_end(trainer=trainer)
  
      # TODO: remove this by adjusting the return format of mmdet_image or lit_mmdet.
      if pred_writer is None and self._problem_type == OBJECT_DETECTION:
          outputs = [
              output
              for batch_outputs in outputs
              for output in batch_outputs
          ]
  
      return outputs
  
imports: import json
  import logging
  import os
  from datetime import timedelta
  from typing import Dict, List, Optional, Union
  import pandas
  from omegaconf import DictConfig, OmegaConf
  from torch import nn
  from ..constants import BBOX, DDP, MAP, MULTI_IMAGE_MIX_DATASET, OBJECT_DETECTION, OPEN_VOCABULARY_OBJECT_DETECTION, OVD_RET, XYWH
  from ..data import BaseDataModule, MultiImageMixDataset, MultiModalFeaturePreprocessor, infer_rois_column_type
  from ..optimization import LitModule, MMDetLitModule
  from ..utils import check_if_packages_installed, cocoeval, convert_pred_to_xywh, create_fusion_model, extract_from_output, from_coco_or_voc, get_detection_classes, object_detection_data_to_df, save_ovd_result_df, save_result_df, setup_save_path, split_train_tuning_data
  from .base import BaseLearner
label_desc: Use image node_id 15 for calling the ObjectDetectionLearner obj's underlying member method code with example usage: obj.predict_per_run(data, realtime, requires_label, barebones) and returns: outputs