docstr: Args:
      inputs: A Tensor of shape `(batch_size, height, width, channels)`.
  
  Returns:
      A dict of feature maps to be consumed by an SSD network
docstr_tok: ["Args",":","inputs",":","A","Tensor","of","shape","`","(","batch_size",",","height",",","width",",","channels",")","`",".","Returns",":","A","dict","of","feature","maps","to","be","consumed","by","an","SSD","network"]
code: def _build(self, inputs, is_training=True):
      """
      Args:
          inputs: A Tensor of shape `(batch_size, height, width, channels)`.
  
      Returns:
          A dict of feature maps to be consumed by an SSD network
      """
      # TODO: Is there a better way to manage scoping in these cases?
      scope = self.module_name
      if self.parent_name:
          scope = self.parent_name + "/" + scope
  
      base_net_endpoints = super(SSDFeatureExtractor, self)._build(
          inputs, is_training=is_training
      )["end_points"]
  
      if self.truncated_vgg_16_type:
          # As it is pointed out in SSD and ParseNet papers, `conv4_3` has a
          # different features scale compared to other layers, to adjust it
          # we need to add a spatial normalization before adding the
          # predictors.
          vgg_conv4_3 = base_net_endpoints[
              scope + "/vgg_16/conv4/conv4_3"
          ]
          tf.summary.histogram("conv4_3_hist", vgg_conv4_3)
          with tf.variable_scope("conv_4_3_norm"):
              # Normalize through channels dimension (dim=3)
              vgg_conv4_3_norm = tf.nn.l2_normalize(
                  vgg_conv4_3, 3, epsilon=1e-12
              )
              # Scale.
              scale_initializer = (
                  tf.ones([1, 1, 1, vgg_conv4_3.shape[3]]) * 20.0
              )  # They initialize to 20.0 in paper
              scale = tf.get_variable(
                  "gamma",
                  dtype=vgg_conv4_3.dtype.base_dtype,
                  initializer=scale_initializer,
              )
              vgg_conv4_3_norm = tf.multiply(vgg_conv4_3_norm, scale)
              tf.summary.histogram(
                  "conv4_3_normalized_hist", vgg_conv4_3
              )
          tf.add_to_collection("FEATURE_MAPS", vgg_conv4_3_norm)
  
          # The original SSD paper uses a modified version of the vgg16
          # network, which we'll modify here
          vgg_network_truncation_endpoint = base_net_endpoints[
              scope + "/vgg_16/conv5/conv5_3"
          ]
          tf.summary.histogram(
              "conv5_3_hist", vgg_network_truncation_endpoint
          )
  
          # Extra layers for vgg16 as detailed in paper
          with tf.variable_scope("extra_feature_layers"):
              self._init_vgg16_extra_layers()
              net = tf.nn.max_pool(
                  vgg_network_truncation_endpoint,
                  [1, 3, 3, 1],
                  padding="SAME",
                  strides=[1, 1, 1, 1],
                  name="pool5",
              )
              net = self.conv6(net)
              net = self.activation_fn(net)
              net = self.conv7(net)
              net = self.activation_fn(net)
              tf.summary.histogram("conv7_hist", net)
              tf.add_to_collection("FEATURE_MAPS", net)
              net = self.conv8_1(net)
              net = self.activation_fn(net)
              net = self.conv8_2(net)
              net = self.activation_fn(net)
              tf.summary.histogram("conv8_hist", net)
              tf.add_to_collection("FEATURE_MAPS", net)
              net = self.conv9_1(net)
              net = self.activation_fn(net)
              net = self.conv9_2(net)
              net = self.activation_fn(net)
              tf.summary.histogram("conv9_hist", net)
              tf.add_to_collection("FEATURE_MAPS", net)
              net = self.conv10_1(net)
              net = self.activation_fn(net)
              net = self.conv10_2(net)
              net = self.activation_fn(net)
              tf.summary.histogram("conv10_hist", net)
              tf.add_to_collection("FEATURE_MAPS", net)
              net = self.conv11_1(net)
              net = self.activation_fn(net)
              net = self.conv11_2(net)
              net = self.activation_fn(net)
              tf.summary.histogram("conv11_hist", net)
              tf.add_to_collection("FEATURE_MAPS", net)
  
          # This parameter determines onto which variables we try to load the
          # pretrained weights
          self.pretrained_weights_scope = scope + "/vgg_16"
  
      # It's actually an ordered dict
      return utils.convert_collection_to_dict("FEATURE_MAPS")
  
file_path: luminoth/luminoth/models/ssd/feature_extractor.py
imports: import sonnet
  import tensorflow
  from sonnet.python.modules.conv import Conv2D
  from tensorflow.contrib.layers.python.layers import utils
  from luminoth.models.base import BaseNetwork
label_desc: Use image node_id 3 for calling the SSDFeatureExtractor obj's underlying member method code with example usage: obj._build(inputs, is_training) and returns: utils