code: def convert(ckpt):
      new_ckpt = OrderedDict()
  
      for k, v in list(ckpt.items()):
          new_v = v
          if "backbone.bottom_up" in k:
              new_k = k.replace("backbone.bottom_up", "backbone")
              # for Transformer backbone
              if "patch_embed.proj" in new_k:
                  new_k = new_k.replace(
                      "patch_embed.proj", "patch_embed.projection"
                  )
              elif "pos_drop" in new_k:
                  new_k = new_k.replace("pos_drop", "drop_after_pos")
  
              if "layers" in new_k:
                  new_k = new_k.replace("layers", "stages")
                  if "mlp.fc1" in new_k:
                      new_k = new_k.replace("mlp.fc1", "ffn.layers.0.0")
                  elif "mlp.fc2" in new_k:
                      new_k = new_k.replace("mlp.fc2", "ffn.layers.1")
                  elif "attn" in new_k:
                      new_k = new_k.replace("attn", "attn.w_msa")
  
                  if "downsample" in k:
                      if "reduction." in k:
                          new_v = correct_unfold_reduction_order(v)
                      elif "norm." in k:
                          new_v = correct_unfold_norm_order(v)
              # for resnet
              if "base." in k:
                  new_k = new_k.replace("base.", "")
  
          elif "backbone.fpn" in k or "backbone.top_block" in k:
              old_k = k.replace(".weight", "")
              old_k = old_k.replace(".bias", "")
              new_k = k.replace(old_k, convert_dict_fpn[old_k])
          elif "proposal_generator" in k:
              old_k = k.replace(".weight", "")
              old_k = old_k.replace(".bias", "")
              new_k = k.replace(old_k, convert_dict_rpn[old_k])
          elif "roi_heads" in k:
              old_k = k.replace(".weight", "")
              old_k = old_k.replace(".bias", "")
              new_k = k.replace(old_k, convert_dict_roi[old_k])
          else:
              print("skip:", k)
              continue
  
          new_ckpt[new_k] = new_v
      return new_ckpt
  
file_path: mmdetection/tools/model_converters/detic_to_mmdet.py
imports: import argparse
  import subprocess
  from collections import OrderedDict
  import torch
  from mmengine.runner import CheckpointLoader
label_desc: Use image node_id 3 for calling a global function with example usage: convert(ckpt) and returns: new_ckpt