docstr: Parameters
  ----------
  num_classes
      Number of classes. Used in classification.
      If this is specified and is different from the pretrained model's output,
      the model's head will be changed to have <num_classes> output.
  classes
      All classes in this dataset.
  sample_data_path
      This is used for automatically inference num_classes, classes, or label.
docstr_tok: ["Parameters","--","--","--","--","--","num_classes","Number","of","classes",".","Used","in","classification",".","If","this","is","specified","and","is","different","from","the","pretrained","model","'s","output",",","the","model","'s","head","will","be","changed","to","have","<","num_classes",">","output",".","classes","All","classes","in","this","dataset",".","sample_data_path","This","is","used","for","automatically","inference","num_classes",",","classes",",","or","label","."]
code: def __init__(
      self,
      label: Optional[
          str
      ] = None,  # TODO: can we let users customize label?
      problem_type: Optional[str] = OBJECT_DETECTION,
      presets: Optional[str] = None,
      eval_metric: Optional[str] = None,
      hyperparameters: Optional[dict] = None,
      path: Optional[str] = None,
      verbosity: Optional[int] = 2,
      num_classes: Optional[
          int
      ] = None,  # TODO: can we infer this from train/predict data?
      classes: Optional[
          list
      ] = None,  # TODO: can we infer this from train/predict data?
      warn_if_exist: Optional[bool] = True,
      enable_progress_bar: Optional[bool] = None,
      pretrained: Optional[bool] = True,
      validation_metric: Optional[str] = None,
      sample_data_path: Optional[
          str
      ] = None,  # TODO: can we use train/predict data instead?
      **kwargs,
  ):
      """
      Parameters
      ----------
      num_classes
          Number of classes. Used in classification.
          If this is specified and is different from the pretrained model's output,
          the model's head will be changed to have <num_classes> output.
      classes
          All classes in this dataset.
      sample_data_path
          This is used for automatically inference num_classes, classes, or label.
      """
      super().__init__(
          problem_type=problem_type,
          presets=presets,
          eval_metric=eval_metric,
          hyperparameters=hyperparameters,
          path=path,
          verbosity=verbosity,
          warn_if_exist=warn_if_exist,
          enable_progress_bar=enable_progress_bar,
          pretrained=pretrained,
          validation_metric=validation_metric,
      )
      check_if_packages_installed(problem_type=self._problem_type)
  
      self._output_shape = num_classes
      self._classes = classes
      self._sample_data_path = sample_data_path
  
      # TODO: merge object detection and open vocabulary object detection
      if self._problem_type == OBJECT_DETECTION:
          self._label_column = "label"
          if self._sample_data_path is not None:
              self._classes = get_detection_classes(
                  self._sample_data_path
              )
              self._output_shape = len(self._classes)
  
      # TODO: merge _detection_anno_train and detection_anno_train?
      self._detection_anno_train = None
      self.detection_anno_train = None
  
      self._log_filters += [
          ".*Creating a tensor from a list of numpy.ndarrays is extremely slow..*",
      ]
  
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 1 to create a new ObjectDetectionLearner object from inherited base classes: BaseLearner with example: obj = ObjectDetectionLearner(label, problem_type, presets, eval_metric, hyperparameters, path, verbosity, num_classes, classes, warn_if_exist, enable_progress_bar, pretrained, validation_metric, sample_data_path)