code: def main():
      parser = argparse.ArgumentParser(
          description="Convert C2 model to Pytorch"
      )
      parser.add_argument(
          "--c2_model",
          type=str,
          default=None,
          help="Path to c2 RN-50 model",
      )
      parser.add_argument(
          "--output_model",
          type=str,
          default=None,
          help="Path to save torch RN-50 model",
      )
      parser.add_argument(
          "--bgr2rgb",
          dest="bgr2rgb",
          default=False,
          help="Revert bgr (openCV) order to rgb (PIL) order",
      )
      parser.add_argument(
          "--jigsaw",
          type=bool,
          default=False,
          help="Whether jigsaw model or not",
      )
      parser.add_argument(
          "--arch", type=str, default="R-50", help="R-50"
      )
      args = parser.parse_args()
  
      stages = _C2_STAGE_NAMES[args.arch]
  
      # load the caffe2 model weights
      state_dict = _load_c2_pickled_weights(args.c2_model)
  
      # for the pretext model from jigsaw, special processing
      if args.jigsaw:
          state_dict = remove_jigsaw_names(state_dict)
  
      # depending on the image reading library, we convert the weights to be
      # compatible order. The default order of caffe2 weights is BGR (openCV).
      if args.bgr2rgb:
          state_dict = convert_bgr2rgb(state_dict)
  
      state_dict = _rename_weights_for_resnet(state_dict, stages)
      logger.info(
          "Saving converted weights to: {}".format(args.output_model)
      )
      torch.save(state_dict, args.output_model)
      logger.info("Done!!")
  
file_path: vissl/extra_scripts/convert_caffe2_to_torchvision_resnet.py
imports: import argparse
  import logging
  import pickle
  import re
  import sys
  from collections import OrderedDict
  import torch
  from iopath.common.file_io import g_pathmgr
label_desc: Use image node_id 6 for calling a global function with example usage: main() without return types