code: def create_model(num_classes):
      # mobileNetv2+faster_RCNN
      # backbone = MobileNetV2().features
      # backbone.out_channels = 1280
      #
      # 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'],
      #                                                 output_size=[7, 7],
      #                                                 sampling_ratio=2)
      #
      # model = FasterRCNN(backbone=backbone,
      #                    num_classes=num_classes,
      #                    rpn_anchor_generator=anchor_generator,
      #                    box_roi_pool=roi_pooler)
  
      # resNet50+fpn+faster_RCNN
      # 注意，这里的norm_layer要和训练脚本中保持一致
      backbone = resnet50_fpn_backbone(norm_layer=torch.nn.BatchNorm2d)
      model = FasterRCNN(
          backbone=backbone,
          num_classes=num_classes,
          rpn_score_thresh=0.5,
      )
  
      return model
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/faster_rcnn/predict.py
imports: import os
  import time
  import json
  import torch
  import torchvision
  from PIL import Image
  import matplotlib.pyplot
  from torchvision import transforms
  from network_files import FasterRCNN, FastRCNNPredictor, AnchorsGenerator
  from backbone import resnet50_fpn_backbone, MobileNetV2
  from draw_box_utils import draw_objs
label_desc: Use image node_id 1 for calling a global function with example usage: create_model(num_classes) and returns: model