docstr: Evaluate model on a test dataset.
  
  Parameters
  ----------
  data
      A dataframe, containing the same columns as the training data.
      Or a str, that is a path of the annotation file for detection.
  metrics
      A list of metric names to report.
      If None, we only return the score for the stored `_eval_metric_name`.
  return_pred
      Whether to return the prediction result of each row.
  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.
  eval_tool
      The eval_tool for object detection. Could be "pycocotools" or "torchmetrics".
  
  Returns
  -------
  A dictionary with the metric names and their corresponding scores.
  Optionally return a dataframe of prediction results.
docstr_tok: ["Evaluate","model","on","a","test","dataset",".","Parameters","--","--","--","--","--","data","A","dataframe",",","containing","the","same","columns","as","the","training","data",".","Or","a","str",",","that","is","a","path","of","the","annotation","file","for","detection",".","metrics","A","list","of","metric","names","to","report",".","If","None",",","we","only","return","the","score","for","the","stored","`","_eval_metric_name","`",".","return_pred","Whether","to","return","the","prediction","result","of","each","row",".","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",".","eval_tool","The","eval_tool","for","object","detection",".","Could","be","``","pycocotools","''","or","``","torchmetrics","''",".","Returns","--","--","--","-","A","dictionary","with","the","metric","names","and","their","corresponding","scores",".","Optionally","return","a","dataframe","of","prediction","results","."]
code: def evaluate(
      self,
      data: Union[pd.DataFrame, dict, list, str],
      metrics: Optional[Union[str, List[str]]] = None,
      return_pred: Optional[bool] = False,
      realtime: Optional[bool] = False,
      eval_tool: Optional[str] = None,
      **kwargs,
  ):
      """
      Evaluate model on a test dataset.
  
      Parameters
      ----------
      data
          A dataframe, containing the same columns as the training data.
          Or a str, that is a path of the annotation file for detection.
      metrics
          A list of metric names to report.
          If None, we only return the score for the stored `_eval_metric_name`.
      return_pred
          Whether to return the prediction result of each row.
      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.
      eval_tool
          The eval_tool for object detection. Could be "pycocotools" or "torchmetrics".
  
      Returns
      -------
      A dictionary with the metric names and their corresponding scores.
      Optionally return a dataframe of prediction results.
      """
      self.ensure_predict_ready()
      if self._problem_type == OPEN_VOCABULARY_OBJECT_DETECTION:
          raise NotImplementedError(
              "Open vocabulary object detection doesn't support calling `evaluate` yet."
          )
  
      if realtime:
          return NotImplementedError(
              f"Current problem type {self._problem_type} does not support realtime predict."
          )
      if isinstance(data, str):
          return self.evaluate_coco(
              anno_file_or_df=data,
              metrics=metrics,
              return_pred=return_pred,
              eval_tool=eval_tool,
          )
      else:
          data = object_detection_data_to_df(data)
          return self.evaluate_coco(
              anno_file_or_df=data,
              metrics=metrics,
              return_pred=return_pred,
              eval_tool="torchmetrics",
          )
  
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 17 for calling the ObjectDetectionLearner obj's underlying member method code with example usage: obj.evaluate(data, metrics, return_pred, realtime, eval_tool) and returns: NotImplementedError, self, self