code: def create_model(num_classes):
      # https://download.pytorch.org/models/vgg16-397923af.pth
      # 如果使用vgg16的话就下载对应预训练权重并取消下面注释，接着把mobilenetv2模型对应的两行代码注释掉
      # vgg_feature = vgg(model_name="vgg16", weights_path="./backbone/vgg16.pth").features
      # backbone = torch.nn.Sequential(*list(vgg_feature._modules.values())[:-1])  # 删除features中最后一个Maxpool层
      # backbone.out_channels = 512
  
      # https://download.pytorch.org/models/mobilenet_v2-b0353104.pth
      backbone = MobileNetV2(
          weights_path="./backbone/mobilenet_v2.pth"
      ).features
      backbone.out_channels = 1280  # 设置对应backbone输出特征矩阵的channels
  
      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/faster_rcnn/train_mobilenetv2.py
imports: import os
  import datetime
  import torch
  import torchvision
  import transforms
  from network_files import FasterRCNN, AnchorsGenerator
  from backbone import MobileNetV2, vgg
  from my_dataset import VOCDataSet
  from train_utils import GroupedBatchSampler, create_aspect_ratio_groups
  from train_utils import train_eval_utils
label_desc: Use image node_id 1 for calling a global function with example usage: create_model(num_classes) and returns: model