class_docstr: Faster RCNN Network module
  
  Builds the Faster RCNN network architecture using different submodules.
  Calculates the total loss of the model based on the different losses by
  each of the submodules.
  
  It is also responsible for building the anchor reference which is used in
  graph for generating the dynamic anchors.
class_docstr_tok: ["Faster","RCNN","Network","module","Builds","the","Faster","RCNN","network","architecture","using","different","submodules",".","Calculates","the","total","loss","of","the","model","based","on","the","different","losses","by","each","of","the","submodules",".","It","is","also","responsible","for","building","the","anchor","reference","which","is","used","in","graph","for","generating","the","dynamic","anchors","."]
code: def __init__(self, config, name="fasterrcnn"):
      super(FasterRCNN, self).__init__(name=name)
  
      # Main configuration object, it holds not only the necessary
      # information for this module but also configuration for each of the
      # different submodules.
      self._config = config
  
      # Total number of classes to classify. If not using RCNN then it is not
      # used. TODO: Make it *more* optional.
      self._num_classes = config.model.network.num_classes
  
      # Generate network with RCNN thus allowing for classification of
      # objects and not just finding them.
      self._with_rcnn = config.model.network.with_rcnn
  
      # Turn on debug mode with returns more Tensors which can be used for
      # better visualization and (of course) debugging.
      self._debug = config.train.debug
      self._seed = config.train.seed
  
      # Anchor config, check out the docs of base_config.yml for a better
      # understanding of how anchors work.
      self._anchor_base_size = config.model.anchors.base_size
      self._anchor_scales = np.array(config.model.anchors.scales)
      self._anchor_ratios = np.array(config.model.anchors.ratios)
      self._anchor_stride = config.model.anchors.stride
  
      # Anchor reference for building dynamic anchors for each image in the
      # computation graph.
      self._anchor_reference = generate_anchors_reference(
          self._anchor_base_size,
          self._anchor_ratios,
          self._anchor_scales,
      )
  
      # Total number of anchors per point.
      self._num_anchors = self._anchor_reference.shape[0]
  
      # Weights used to sum each of the losses of the submodules
      self._rpn_cls_loss_weight = config.model.loss.rpn_cls_loss_weight
      self._rpn_reg_loss_weight = config.model.loss.rpn_reg_loss_weights
  
      self._rcnn_cls_loss_weight = (
          config.model.loss.rcnn_cls_loss_weight
      )
      self._rcnn_reg_loss_weight = (
          config.model.loss.rcnn_reg_loss_weights
      )
      self._losses_collections = ["fastercnn_losses"]
  
      # We want the pretrained model to be outside the FasterRCNN name scope.
      self.base_network = TruncatedBaseNetwork(
          config.model.base_network
      )
  
file_path: luminoth/luminoth/models/fasterrcnn/fasterrcnn.py
imports: import numpy
  import sonnet
  import tensorflow
  from luminoth.models.fasterrcnn.rcnn import RCNN
  from luminoth.models.fasterrcnn.rpn import RPN
  from luminoth.models.base import TruncatedBaseNetwork
  from luminoth.utils.anchors import generate_anchors_reference
  from luminoth.utils.vars import VAR_LOG_LEVELS, variable_summaries
label_desc: Use image node_id 1 to create a new FasterRCNN object from inherited base classes: snt with example: obj = FasterRCNN(config, name)