docstr: Predict values for the label column of new data.
  
  Parameters
  ----------
  data
      The data to make predictions for. Should contain same column names as training data and
      follow same format (except for the `label` column).
  as_pandas
      Whether to return the output as a pandas DataFrame(Series) (True) or numpy array (False).
  realtime
      Whether to do realtime inference, which is efficient for small data (default False).
      If provided None, we would infer it on based on the data modalities
      and sample number.
  save_results
      Whether to save the prediction results (only works for detection now)
  
  Returns
  -------
  Array of predictions, one corresponding to each row in given dataset.
docstr_tok: ["Predict","values","for","the","label","column","of","new","data",".","Parameters","--","--","--","--","--","data","The","data","to","make","predictions","for",".","Should","contain","same","column","names","as","training","data","and","follow","same","format","(","except","for","the","`","label","`","column",")",".","as_pandas","Whether","to","return","the","output","as","a","pandas","DataFrame","(","Series",")","(","True",")","or","numpy","array","(","False",")",".","realtime","Whether","to","do","realtime","inference",",","which","is","efficient","for","small","data","(","default","False",")",".","If","provided","None",",","we","would","infer","it","on","based","on","the","data","modalities","and","sample","number",".","save_results","Whether","to","save","the","prediction","results","(","only","works","for","detection","now",")","Returns","--","--","--","-","Array","of","predictions",",","one","corresponding","to","each","row","in","given","dataset","."]
code: def predict(
      self,
      data: Union[pd.DataFrame, dict, list, str],
      as_pandas: Optional[bool] = None,
      realtime: Optional[bool] = False,
      save_results: Optional[bool] = None,
      **kwargs,
  ):
      """
      Predict values for the label column of new data.
  
      Parameters
      ----------
      data
          The data to make predictions for. Should contain same column names as training data and
          follow same format (except for the `label` column).
      as_pandas
          Whether to return the output as a pandas DataFrame(Series) (True) or numpy array (False).
      realtime
          Whether to do realtime inference, which is efficient for small data (default False).
          If provided None, we would infer it on based on the data modalities
          and sample number.
      save_results
          Whether to save the prediction results (only works for detection now)
  
      Returns
      -------
      Array of predictions, one corresponding to each row in given dataset.
      """
      self.ensure_predict_ready()
      ret_type = BBOX
      if self._problem_type == OBJECT_DETECTION:
          data = object_detection_data_to_df(data)
          if self._label_column not in data:
              self._label_column = None
      elif self._problem_type == OPEN_VOCABULARY_OBJECT_DETECTION:
          ret_type = OVD_RET
  
      outputs = self.predict_per_run(
          data=data,
          realtime=realtime,
          requires_label=False,
      )
      pred = extract_from_output(outputs=outputs, ret_type=ret_type)
      if self._problem_type == OBJECT_DETECTION:
          if self._model.output_bbox_format == XYWH:
              pred = convert_pred_to_xywh(pred)
  
      if save_results and self._problem_type == OBJECT_DETECTION:
          self._save_path = setup_save_path(
              old_save_path=self._save_path,
              warn_if_exist=False,
          )
          save_result_df(
              pred=pred,
              data=data,
              detection_classes=self._model.model.CLASSES,
              result_path=os.path.join(self._save_path, "result.txt"),
          )
  
      if (
          as_pandas is None and isinstance(data, pd.DataFrame)
      ) or as_pandas is True:
          if (
              self._problem_type == OBJECT_DETECTION
          ):  # TODO: add prediction output in COCO format if as_pandas is False
              # TODO: calling save_result_df to convert data to dataframe is not a good logic
              # TODO: consider combining this with the above saving logic or using a different function.
              pred = save_result_df(
                  pred=pred,
                  data=data,
                  detection_classes=self._model.model.CLASSES,
                  result_path=None,
              )
          elif (
              self._problem_type == OPEN_VOCABULARY_OBJECT_DETECTION
          ):  # TODO: refactor and merge with OBJECT DETECTION
              pred = save_ovd_result_df(
                  pred=pred,
                  data=data,
                  result_path=None,
              )
  
      return pred
  
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 18 for calling the ObjectDetectionLearner obj's underlying member method code with example usage: obj.predict(data, as_pandas, realtime, save_results) and returns: pred