def test_get_boxes_for_five_aspect_ratios_per_location(self):
    image_features = tf.random_uniform([4, 8, 8, 64], dtype=tf.float32)
    conv_box_predictor = box_predictor.ConvolutionalBoxPredictor(is_training=False, num_classes=0, conv_hyperparams=self._build_arg_scope_with_conv_hyperparams(), min_depth=0, max_depth=32, num_layers_before_predictor=1, use_dropout=True, dropout_keep_prob=0.8, kernel_size=1, box_code_size=4)
    box_predictions = conv_box_predictor.predict(image_features, num_predictions_per_location=5, scope='BoxPredictor')
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    objectness_predictions = box_predictions[box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND]
    init_op = tf.global_variables_initializer()
    with self.test_session() as sess:
        sess.run(init_op)
        (box_encodings_shape, objectness_predictions_shape) = sess.run([tf.shape(box_encodings), tf.shape(objectness_predictions)])
        self.assertAllEqual(box_encodings_shape, [4, 320, 1, 4])
        self.assertAllEqual(objectness_predictions_shape, [4, 320, 1])
def test_get_boxes_for_five_aspect_ratios_per_location(self):
    image_features = tf.random_uniform([4, 8, 8, 64], dtype=tf.float32)
    conv_box_predictor = box_predictor.ConvolutionalBoxPredictor(is_training=False, num_classes=0, conv_hyperparams=self._build_arg_scope_with_conv_hyperparams(), min_depth=0, max_depth=32, num_layers_before_predictor=1, use_dropout=True, dropout_keep_prob=0.8, kernel_size=1, box_code_size=4)
    box_predictions = conv_box_predictor.predict(image_features, num_predictions_per_location=5, scope='BoxPredictor')
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    objectness_predictions = box_predictions[box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND]
    init_op = tf.global_variables_initializer()
    with self.test_session() as sess:
        sess.run(init_op)
        (box_encodings_shape, objectness_predictions_shape) = sess.run([tf.shape(box_encodings), tf.shape(objectness_predictions)])
        self.assertAllEqual(box_encodings_shape, [4, 320, 1, 4])
        self.assertAllEqual(objectness_predictions_shape, [4, 320, 1])