code: def faster_rcnn_resnet101_v1d_coco(
      pretrained=False, pretrained_base=True, **kwargs
  ):
      r"""Faster RCNN model from the paper
      "Ren, S., He, K., Girshick, R., & Sun, J. (2015). Faster r-cnn: Towards
      real-time object detection with region proposal networks"
  
      Parameters
      ----------
      pretrained : bool, optional, default is False
          Load pretrained weights.
      pretrained_base : bool or str, optional, default is True
          Load pretrained base network, the extra layers are randomized. Note that
          if pretrained is `True`, this has no effect.
      ctx : Context, default CPU
          The context in which to load the pretrained weights.
      root : str, default '~/.mxnet/models'
          Location for keeping the model parameters.
  
      Examples
      --------
      >>> model = get_faster_rcnn_resnet101_v1d_coco(pretrained=True)
      >>> print(model)
      """
      from gluoncv.data import COCODetection
      from gluoncv.model_zoo.resnetv1b import resnet101_v1d
  
      classes = COCODetection.CLASSES
      pretrained_base = False if pretrained else pretrained_base
      base_network = resnet101_v1d(
          pretrained=pretrained_base,
          dilated=False,
          use_global_stats=True,
          **kwargs,
      )
      features = nn.HybridSequential()
      top_features = nn.HybridSequential()
      for layer in [
          "conv1",
          "bn1",
          "relu",
          "maxpool",
          "layer1",
          "layer2",
          "layer3",
      ]:
          features.add(getattr(base_network, layer))
      for layer in ["layer4"]:
          top_features.add(getattr(base_network, layer))
      train_patterns = "|".join(
          [
              ".*dense",
              ".*rpn",
              ".*down(2|3|4)_conv",
              ".*layers(2|3|4)_conv",
          ]
      )
      return get_faster_rcnn(
          name="resnet101_v1d",
          dataset="coco",
          pretrained=pretrained,
          features=features,
          top_features=top_features,
          classes=classes,
          short=800,
          max_size=1333,
          train_patterns=train_patterns,
          nms_thresh=0.5,
          nms_topk=-1,
          post_nms=100,
          roi_mode="align",
          roi_size=(14, 14),
          strides=16,
          clip=4.14,
          rpn_channel=1024,
          base_size=16,
          scales=(2, 4, 8, 16, 32),
          ratios=(0.5, 1, 2),
          alloc_size=(128, 128),
          rpn_nms_thresh=0.7,
          rpn_train_pre_nms=12000,
          rpn_train_post_nms=2000,
          rpn_test_pre_nms=6000,
          rpn_test_post_nms=1000,
          rpn_min_size=1,
          num_sample=128,
          pos_iou_thresh=0.5,
          pos_ratio=0.25,
          max_num_gt=3000,
          **kwargs,
      )
  
imports: from __future__ import absolute_import
  import os
  import warnings
  import mxnet
  from gluoncv.model_zoo.faster_rcnn.rcnn_target import RCNNTargetGenerator, RCNNTargetSampler
  from gluoncv.model_zoo.rcnn import RCNN
  from gluoncv.model_zoo.rpn import RPN
  from gluoncv.nn.feature import FPNFeatureExpander
  from mxnet import autograd
  from mxnet.gluon import nn
  from mxnet.gluon.contrib.nn import SyncBatchNorm
label_desc: Use image node_id 4 for calling a global function with example usage: faster_rcnn_resnet101_v1d_coco(pretrained, pretrained_base) and returns: get_faster_rcnn