class_docstr: Base class for single-stage detectors.
  
  Single-stage detectors directly and densely predict bounding boxes on the
  output features of the backbone+neck.
class_docstr_tok: ["Base","class","for","single-stage","detectors",".","Single-stage","detectors","directly","and","densely","predict","bounding","boxes","on","the","output","features","of","the","backbone+neck","."]
docstr: Exchange bbox_head key to rpn_head key when loading two-stage
  weights into single-stage model.
docstr_tok: ["Exchange","bbox_head","key","to","rpn_head","key","when","loading","two-stage","weights","into","single-stage","model","."]
code: def _load_from_state_dict(
      self,
      state_dict: dict,
      prefix: str,
      local_metadata: dict,
      strict: bool,
      missing_keys: Union[List[str], str],
      unexpected_keys: Union[List[str], str],
      error_msgs: Union[List[str], str],
  ) -> None:
      """Exchange bbox_head key to rpn_head key when loading two-stage
      weights into single-stage model."""
      bbox_head_prefix = (
          prefix + ".bbox_head" if prefix else "bbox_head"
      )
      bbox_head_keys = [
          k for k in state_dict.keys() if k.startswith(bbox_head_prefix)
      ]
      rpn_head_prefix = prefix + ".rpn_head" if prefix else "rpn_head"
      rpn_head_keys = [
          k for k in state_dict.keys() if k.startswith(rpn_head_prefix)
      ]
      if len(bbox_head_keys) == 0 and len(rpn_head_keys) != 0:
          for rpn_head_key in rpn_head_keys:
              bbox_head_key = (
                  bbox_head_prefix
                  + rpn_head_key[len(rpn_head_prefix) :]
              )
              state_dict[bbox_head_key] = state_dict.pop(rpn_head_key)
      super()._load_from_state_dict(
          state_dict,
          prefix,
          local_metadata,
          strict,
          missing_keys,
          unexpected_keys,
          error_msgs,
      )
  
file_path: mmdetection/mmdet/models/detectors/single_stage.py
imports: from typing import List, Tuple, Union
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import OptSampleList, SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .base import BaseDetector
label_desc: Use image node_id 2 for calling the SingleStageDetector obj's underlying member method code with example usage: obj._load_from_state_dict(state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs) without return types