class_docstr: Support MMDET object detection models.
  Refer to https://github.com/open-mmlab/mmdetection
code: def _load_checkpoint(self, checkpoint_file):
      # build model and load pretrained weights
      from mmdet.utils import register_all_modules
  
      register_all_modules()  # https://github.com/open-mmlab/mmdetection/issues/9719
  
      self.model = MODELS.build(self.config.model)
      # yolox use self.config.model.data_preprocessor, yolov3 use self.config.data_preprocessor
      self.data_preprocessor = MODELS.build(
          self.config.data_preprocessor
          if "data_preprocessor" in self.config
          else self.config.model.data_preprocessor
      )
  
      if (
          self.pretrained and checkpoint_file is not None
      ):  # TODO: enable training from scratch
          self.checkpoint = load_checkpoint(
              self.model, checkpoint_file, map_location="cpu"
          )
  
      # save the config and classes in the model for convenience
      self.model.cfg = self.config
      if self.classes:
          self.model.CLASSES = self.classes
      else:
          if self.checkpoint and "CLASSES" in self.checkpoint.get(
              "meta", {}
          ):
              warnings.simplefilter("once")
              warnings.warn(
                  f"Using classes provided in checkpoints: {self.checkpoint['meta']['CLASSES']}. Provide data while init MultiModalPredictor if this is not expected."
              )
              self.model.CLASSES = self.checkpoint["meta"]["CLASSES"]
          else:
              warnings.warn(
                  f"CLASSES is not provided and this may cause error. Please provide sample_data_path in predictor's initialization."
              )
  
      self.name_to_id = self.get_layer_ids()
      self.head_layer_names = [
          n for n, layer_id in self.name_to_id.items() if layer_id <= 0
      ]
  
imports: import logging
  import os
  import time
  import warnings
  from typing import Optional
  import torch
  from torch import nn
  from ..constants import BBOX, BBOX_FORMATS, COLUMN, IMAGE, IMAGE_VALID_NUM, LABEL, XYXY
  from .utils import freeze_model_layers, lookup_mmdet_config, update_mmdet_config
label_desc: Use image node_id 4 for calling the MMDetAutoModelForObjectDetection obj's underlying member method code with example usage: obj._load_checkpoint(checkpoint_file) without return types