code: def create_model(num_classes):
      # 以resnet50为backbone
      # 预训练权重地址：https://download.pytorch.org/models/resnet50-19c8e357.pth
      res50 = resnet50()
      res50.load_state_dict(
          torch.load("./resnet50.pth", map_location="cpu")
      )
      backbone = create_feature_extractor(
          res50, return_nodes={"layer3": "0"}
      )
      backbone.out_channels = 1024
  
      anchor_generator = AnchorsGenerator(
          sizes=((32, 64, 128, 256, 512),),
          aspect_ratios=((0.5, 1.0, 2.0),),
      )
  
      roi_pooler = torchvision.ops.MultiScaleRoIAlign(
          featmap_names=["0"],  # 在哪些特征层上进行roi pooling
          output_size=[7, 7],  # roi_pooling输出特征矩阵尺寸
          sampling_ratio=2,
      )  # 采样率
  
      model = FasterRCNN(
          backbone=backbone,
          num_classes=num_classes,
          rpn_anchor_generator=anchor_generator,
          box_roi_pool=roi_pooler,
      )
  
      return model
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/train_coco_dataset/train_multi_GPU.py
imports: import time
  import os
  import datetime
  import torch
  import torchvision
  import transforms
  from my_dataset import CocoDetection
  from backbone import resnet50
  from network_files import FasterRCNN, AnchorsGenerator
  import train_utils.train_eval_utils
  from train_utils import GroupedBatchSampler, create_aspect_ratio_groups, init_distributed_mode, save_on_master, mkdir
  from torchvision.models.feature_extraction import create_feature_extractor
label_desc: Use image node_id 1 for calling a global function with example usage: create_model(num_classes) and returns: model