code: def _fasterrcnn_mobilenet_v3_large_fpn(
      *,
      weights: Optional[
          Union[
              FasterRCNN_MobileNet_V3_Large_FPN_Weights,
              FasterRCNN_MobileNet_V3_Large_320_FPN_Weights,
          ]
      ],
      progress: bool,
      num_classes: Optional[int],
      weights_backbone: Optional[MobileNet_V3_Large_Weights],
      trainable_backbone_layers: Optional[int],
      **kwargs: Any,
  ) -> FasterRCNN:
      if weights is not None:
          weights_backbone = None
          num_classes = _ovewrite_value_param(
              "num_classes",
              num_classes,
              len(weights.meta["categories"]),
          )
      elif num_classes is None:
          num_classes = 91
  
      is_trained = weights is not None or weights_backbone is not None
      trainable_backbone_layers = _validate_trainable_layers(
          is_trained, trainable_backbone_layers, 6, 3
      )
      norm_layer = (
          misc_nn_ops.FrozenBatchNorm2d
          if is_trained
          else nn.BatchNorm2d
      )
  
      backbone = mobilenet_v3_large(
          weights=weights_backbone,
          progress=progress,
          norm_layer=norm_layer,
      )
      backbone = _mobilenet_extractor(
          backbone, True, trainable_backbone_layers
      )
      anchor_sizes = (
          (
              32,
              64,
              128,
              256,
              512,
          ),
      ) * 3
      aspect_ratios = ((0.5, 1.0, 2.0),) * len(anchor_sizes)
      model = FasterRCNN(
          backbone,
          num_classes,
          rpn_anchor_generator=AnchorGenerator(
              anchor_sizes, aspect_ratios
          ),
          **kwargs,
      )
  
      if weights is not None:
          model.load_state_dict(
              weights.get_state_dict(progress=progress, check_hash=True)
          )
  
      return model
  
imports: from typing import Any, Callable, List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from torch import nn
  from torchvision.ops import MultiScaleRoIAlign
  from ...ops import misc
  from ...transforms._presets import ObjectDetection
  from .._api import register_model, Weights, WeightsEnum
  from .._meta import _COCO_CATEGORIES
  from .._utils import _ovewrite_value_param, handle_legacy_interface
  from ..mobilenetv3 import mobilenet_v3_large, MobileNet_V3_Large_Weights
  from ..resnet import resnet50, ResNet50_Weights
  from ._utils import overwrite_eps
  from .anchor_utils import AnchorGenerator
  from .backbone_utils import _mobilenet_extractor, _resnet_fpn_extractor, _validate_trainable_layers
  from .generalized_rcnn import GeneralizedRCNN
  from .roi_heads import RoIHeads
  from .rpn import RegionProposalNetwork, RPNHead
  from .transform import GeneralizedRCNNTransform
label_desc: Use image node_id 4 for calling a global function with example usage: _fasterrcnn_mobilenet_v3_large_fpn() and returns: model