'Extracts first stage RPN features.
Extracts features using the first half of the Inception Resnet v2 network.
We construct the network in `align_feature_maps=True` mode, which means
that all VALID paddings in the network are changed to SAME padding so that
the feature maps are aligned.
Args:
preprocessed_inputs: A [batch, height, width, channels] float32 tensor
representing a batch of images.
scope: A scope name.
Returns:
rpn_feature_map: A tensor with shape [batch, height, width, depth]
Raises:
InvalidArgumentError: If the spatial size of `preprocessed_inputs`
(height or width) is less than 33.
ValueError: If the created network is missing the required activation.'

def _extract_proposal_features(self, preprocessed_inputs, scope):

    if (len(preprocessed_inputs.get_shape().as_list()) != 4):
        raise ValueError(('`preprocessed_inputs`    must    be    4    dimensional,    got    a    tensor    of    shape    %s' % preprocessed_inputs.get_shape()))
    with slim.arg_scope(inception_resnet_v2.inception_resnet_v2_arg_scope(weight_decay=self._weight_decay)):
        with slim.arg_scope([slim.batch_norm], is_training=False):
            with tf.variable_scope('InceptionResnetV2', reuse=self._reuse_weights) as scope:
                (rpn_feature_map, _) = inception_resnet_v2.inception_resnet_v2_base(preprocessed_inputs, final_endpoint='PreAuxLogits', scope=scope, output_stride=self._first_stage_features_stride, align_feature_maps=True)
    return rpn_feature_map
