class_docstr: Anchor-free head (FCOS, Fovea, RepPoints, etc.).
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      feat_channels (int): Number of hidden channels. Used in child classes.
      stacked_convs (int): Number of stacking convs of the head.
      strides (tuple): Downsample factor of each feature map.
      dcn_on_last_conv (bool): If true, use dcn in the last layer of
          towers. Default: False.
      conv_bias (bool | str): If specified as `auto`, it will be decided by
          the norm_cfg. Bias of conv will be set as True if `norm_cfg` is
          None, otherwise False. Default: "auto".
      loss_cls (dict): Config of classification loss.
      loss_bbox (dict): Config of localization loss.
      conv_cfg (dict): Config dict for convolution layer. Default: None.
      norm_cfg (dict): Config dict for normalization layer. Default: None.
      train_cfg (dict): Training config of anchor head.
      test_cfg (dict): Testing config of anchor head.
class_docstr_tok: ["Anchor-free","head","(","FCOS",",","Fovea",",","RepPoints",",","etc.",")",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","feat_channels","(","int",")",":","Number","of","hidden","channels",".","Used","in","child","classes",".","stacked_convs","(","int",")",":","Number","of","stacking","convs","of","the","head",".","strides","(","tuple",")",":","Downsample","factor","of","each","feature","map",".","dcn_on_last_conv","(","bool",")",":","If","true",",","use","dcn","in","the","last","layer","of","towers",".","Default",":","False",".","conv_bias","(","bool","|","str",")",":","If","specified","as","`","auto","`",",","it","will","be","decided","by","the","norm_cfg",".","Bias","of","conv","will","be","set","as","True","if","`","norm_cfg","`","is","None",",","otherwise","False",".","Default",":","``","auto","''",".","loss_cls","(","dict",")",":","Config","of","classification","loss",".","loss_bbox","(","dict",")",":","Config","of","localization","loss",".","conv_cfg","(","dict",")",":","Config","dict","for","convolution","layer",".","Default",":","None",".","norm_cfg","(","dict",")",":","Config","dict","for","normalization","layer",".","Default",":","None",".","train_cfg","(","dict",")",":","Training","config","of","anchor","head",".","test_cfg","(","dict",")",":","Testing","config","of","anchor","head","."]
docstr: Hack some keys of the model state dict so that can load checkpoints
  of previous version.
docstr_tok: ["Hack","some","keys","of","the","model","state","dict","so","that","can","load","checkpoints","of","previous","version","."]
code: def _load_from_state_dict(
      self,
      state_dict,
      prefix,
      local_metadata,
      strict,
      missing_keys,
      unexpected_keys,
      error_msgs,
  ):
      """Hack some keys of the model state dict so that can load checkpoints
      of previous version."""
      version = local_metadata.get("version", None)
      if version is None:
          # the key is different in early versions
          # for example, 'fcos_cls' become 'conv_cls' now
          bbox_head_keys = [
              k for k in state_dict.keys() if k.startswith(prefix)
          ]
          ori_predictor_keys = []
          new_predictor_keys = []
          # e.g. 'fcos_cls' or 'fcos_reg'
          for key in bbox_head_keys:
              ori_predictor_keys.append(key)
              key = key.split(".")
              conv_name = None
              if key[1].endswith("cls"):
                  conv_name = "conv_cls"
              elif key[1].endswith("reg"):
                  conv_name = "conv_reg"
              elif key[1].endswith("centerness"):
                  conv_name = "conv_centerness"
              else:
                  assert NotImplementedError
              if conv_name is not None:
                  key[1] = conv_name
                  new_predictor_keys.append(".".join(key))
              else:
                  ori_predictor_keys.pop(-1)
          for i in range(len(new_predictor_keys)):
              state_dict[new_predictor_keys[i]] = state_dict.pop(
                  ori_predictor_keys[i]
              )
      super()._load_from_state_dict(
          state_dict,
          prefix,
          local_metadata,
          strict,
          missing_keys,
          unexpected_keys,
          error_msgs,
      )
  
imports: from abc import abstractmethod
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init
  from mmcv.runner import force_fp32
  from mmdet.core import multi_apply
  from ..builder import HEADS, build_loss
  from .base_dense_head import BaseDenseHead
  from .dense_test_mixins import BBoxTestMixin
label_desc: Use image node_id 7 for calling the AnchorFreeHead 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