class_docstr: Light-Head R-CNN based on ResNet101.
  
  When you specify the path of a pre-trained chainer model serialized as
  a :obj:`.npz` file in the constructor, this chain model automatically
  initializes all the parameters with it.
  When a string in prespecified set is provided, a pretrained model is
  loaded from weights distributed on the Internet.
  The list of pretrained models supported are as follows:
  
  * :obj:`coco`: Loads weights trained with the trainval split of         COCO Detection Dataset.
  * :obj:`imagenet`: Loads weights trained with ImageNet Classfication         task for the feature extractor and the head modules.         Weights that do not have a corresponding layer in ResNet101         will be randomly initialized.
  
  For descriptions on the interface of this model, please refer to
  :class:`~light_head_rcnn.links.model.light_head_rcnn_base.LightHeadRCNN`
  
  :class:`~light_head_rcnn.links.model.light_head_rcnn_base.LightHeadRCNN`
  supports finer control on random initializations of weights by arguments
  :obj:`resnet_initialW`, :obj:`rpn_initialW`, :obj:`loc_initialW` and
  :obj:`score_initialW`.
  It accepts a callable that takes an array and edits its values.
  If :obj:`None` is passed as an initializer, the default initializer is
  used.
  
  Args:
      n_fg_class (int): The number of classes excluding the background.
      pretrained_model (string): The destination of the pre-trained
          chainer model serialized as a :obj:`.npz` file.
          If this is one of the strings described
          above, it automatically loads weights stored under a directory
          :obj:`$CHAINER_DATASET_ROOT/pfnet/chainercv/models/`,
          where :obj:`$CHAINER_DATASET_ROOT` is set as
          :obj:`$HOME/.chainer/dataset` unless you specify another value
          by modifying the environment variable.
      min_size (int): A preprocessing paramter for :meth:`prepare`.
      max_size (int): A preprocessing paramter for :meth:`prepare`.
      ratios (list of floats): This is ratios of width to height of
          the anchors.
      anchor_scales (list of numbers): This is areas of anchors.
          Those areas will be the product of the square of an element in
          :obj:`anchor_scales` and the original area of the reference
          window.
      resnet_initialW (callable): Initializer for the layers corresponding to
          the ResNet101 layers.
      rpn_initialW (callable): Initializer for Region Proposal Network
          layers.
      loc_initialW (callable): Initializer for the localization head.
      score_initialW (callable): Initializer for the score head.
      proposal_creator_params (dict): Key valued paramters for
          :class:`~chainercv.links.model.faster_rcnn.ProposalCreator`.
class_docstr_tok: ["Light-Head","R-CNN","based","on","ResNet101",".","When","you","specify","the","path","of","a","pre-trained","chainer","model","serialized","as","a",":","obj",":","`",".npz","`","file","in","the","constructor",",","this","chain","model","automatically","initializes","all","the","parameters","with","it",".","When","a","string","in","prespecified","set","is","provided",",","a","pretrained","model","is","loaded","from","weights","distributed","on","the","Internet",".","The","list","of","pretrained","models","supported","are","as","follows",":","*",":","obj",":","`","coco","`",":","Loads","weights","trained","with","the","trainval","split","of","COCO","Detection","Dataset",".","*",":","obj",":","`","imagenet","`",":","Loads","weights","trained","with","ImageNet","Classfication","task","for","the","feature","extractor","and","the","head","modules",".","Weights","that","do","not","have","a","corresponding","layer","in","ResNet101","will","be","randomly","initialized",".","For","descriptions","on","the","interface","of","this","model",",","please","refer","to",":","class",":","`","~light_head_rcnn.links.model.light_head_rcnn_base.LightHeadRCNN","`",":","class",":","`","~light_head_rcnn.links.model.light_head_rcnn_base.LightHeadRCNN","`","supports","finer","control","on","random","initializations","of","weights","by","arguments",":","obj",":","`","resnet_initialW","`",",",":","obj",":","`","rpn_initialW","`",",",":","obj",":","`","loc_initialW","`","and",":","obj",":","`","score_initialW","`",".","It","accepts","a","callable","that","takes","an","array","and","edits","its","values",".","If",":","obj",":","`","None","`","is","passed","as","an","initializer",",","the","default","initializer","is","used",".","Args",":","n_fg_class","(","int",")",":","The","number","of","classes","excluding","the","background",".","pretrained_model","(","string",")",":","The","destination","of","the","pre-trained","chainer","model","serialized","as","a",":","obj",":","`",".npz","`","file",".","If","this","is","one","of","the","strings","described","above",",","it","automatically","loads","weights","stored","under","a","directory",":","obj",":","`","$","CHAINER_DATASET_ROOT\/pfnet\/chainercv\/models\/","`",",","where",":","obj",":","`","$","CHAINER_DATASET_ROOT","`","is","set","as",":","obj",":","`","$","HOME\/.chainer\/dataset","`","unless","you","specify","another","value","by","modifying","the","environment","variable",".","min_size","(","int",")",":","A","preprocessing","paramter","for",":","meth",":","`","prepare","`",".","max_size","(","int",")",":","A","preprocessing","paramter","for",":","meth",":","`","prepare","`",".","ratios","(","list","of","floats",")",":","This","is","ratios","of","width","to","height","of","the","anchors",".","anchor_scales","(","list","of","numbers",")",":","This","is","areas","of","anchors",".","Those","areas","will","be","the","product","of","the","square","of","an","element","in",":","obj",":","`","anchor_scales","`","and","the","original","area","of","the","reference","window",".","resnet_initialW","(","callable",")",":","Initializer","for","the","layers","corresponding","to","the","ResNet101","layers",".","rpn_initialW","(","callable",")",":","Initializer","for","Region","Proposal","Network","layers",".","loc_initialW","(","callable",")",":","Initializer","for","the","localization","head",".","score_initialW","(","callable",")",":","Initializer","for","the","score","head",".","proposal_creator_params","(","dict",")",":","Key","valued","paramters","for",":","class",":","`","~chainercv.links.model.faster_rcnn.ProposalCreator","`","."]
code: def __init__(
      self,
      n_fg_class=None,
      pretrained_model=None,
      min_size=800,
      max_size=1333,
      roi_size=7,
      ratios=[0.5, 1, 2],
      anchor_scales=[2, 4, 8, 16, 32],
      loc_normalize_mean=(0.0, 0.0, 0.0, 0.0),
      loc_normalize_std=(0.1, 0.1, 0.2, 0.2),
      resnet_initialW=None,
      rpn_initialW=None,
      global_module_initialW=None,
      loc_initialW=None,
      score_initialW=None,
      proposal_creator_params=None,
  ):
      param, path = utils.prepare_pretrained_model(
          {"n_fg_class": n_fg_class}, pretrained_model, self._models
      )
  
      if resnet_initialW is None and pretrained_model:
          resnet_initialW = chainer.initializers.HeNormal()
      if rpn_initialW is None:
          rpn_initialW = chainer.initializers.Normal(0.01)
      if global_module_initialW is None:
          global_module_initialW = chainer.initializers.Normal(0.01)
      if loc_initialW is None:
          loc_initialW = chainer.initializers.Normal(0.001)
      if score_initialW is None:
          score_initialW = chainer.initializers.Normal(0.01)
      if proposal_creator_params is not None:
          self.proposal_creator_params = proposal_creator_params
  
      extractor = ResNet101Extractor(initialW=resnet_initialW)
      rpn = RegionProposalNetwork(
          1024,
          512,
          ratios=ratios,
          anchor_scales=anchor_scales,
          feat_stride=self.feat_stride,
          initialW=rpn_initialW,
          proposal_creator_params=self.proposal_creator_params,
      )
  
      head = LightHeadRCNNResNet101Head(
          param["n_fg_class"] + 1,
          roi_size=roi_size,
          spatial_scale=1.0 / self.feat_stride,
          global_module_initialW=global_module_initialW,
          loc_initialW=loc_initialW,
          score_initialW=score_initialW,
      )
      mean = np.array([122.7717, 115.9465, 102.9801], dtype=np.float32)[
          :, None, None
      ]
  
      super(LightHeadRCNNResNet101, self).__init__(
          extractor,
          rpn,
          head,
          mean,
          min_size,
          max_size,
          loc_normalize_mean,
          loc_normalize_std,
      )
  
      if path == "imagenet":
          self._copy_imagenet_pretrained_resnet()
      elif path:
          chainer.serializers.load_npz(path, self)
  
imports: from __future__ import division
  import numpy
  import chainer
  import chainer.functions
  import chainer.links
  from chainercv.functions import ps_roi_max_align_2d
  from chainercv.links.connection.conv_2d_bn_activ import Conv2DBNActiv
  from chainercv.links.model.faster_rcnn.region_proposal_network import RegionProposalNetwork
  from chainercv.links.model.light_head_rcnn.global_context_module import GlobalContextModule
  from chainercv.links.model.light_head_rcnn.light_head_rcnn import LightHeadRCNN
  from chainercv.links.model.resnet.resblock import ResBlock
  from chainercv.links.model.resnet.resnet import ResNet101
  from chainercv import utils
label_desc: Use image node_id 1 to create a new LightHeadRCNNResNet101 object from inherited base classes: LightHeadRCNN with example: obj = LightHeadRCNNResNet101(n_fg_class, pretrained_model, min_size, max_size, roi_size, ratios, anchor_scales, loc_normalize_mean, loc_normalize_std, resnet_initialW, rpn_initialW, global_module_initialW, loc_initialW, score_initialW, proposal_creator_params)