def test_get_correct_box_encoding_and_class_prediction_shapes(self):
    image_features = tf.random_uniform([4, 8, 8, 64], dtype=tf.float32)
    proposal_boxes = tf.random_normal([4, 2, 4], dtype=tf.float32)
    rfcn_box_predictor = box_predictor.RfcnBoxPredictor(is_training=False, num_classes=2, conv_hyperparams=self._build_arg_scope_with_conv_hyperparams(), num_spatial_bins=[3, 3], depth=4, crop_size=[12, 12], box_code_size=4)
    box_predictions = rfcn_box_predictor.predict(image_features, num_predictions_per_location=1, scope='BoxPredictor', proposal_boxes=proposal_boxes)
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    class_predictions_with_background = 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, class_predictions_shape) = sess.run([tf.shape(box_encodings), tf.shape(class_predictions_with_background)])
        self.assertAllEqual(box_encodings_shape, [8, 1, 2, 4])
        self.assertAllEqual(class_predictions_shape, [8, 1, 3])
def test_get_correct_box_encoding_and_class_prediction_shapes(self):
    image_features = tf.random_uniform([4, 8, 8, 64], dtype=tf.float32)
    proposal_boxes = tf.random_normal([4, 2, 4], dtype=tf.float32)
    rfcn_box_predictor = box_predictor.RfcnBoxPredictor(is_training=False, num_classes=2, conv_hyperparams=self._build_arg_scope_with_conv_hyperparams(), num_spatial_bins=[3, 3], depth=4, crop_size=[12, 12], box_code_size=4)
    box_predictions = rfcn_box_predictor.predict(image_features, num_predictions_per_location=1, scope='BoxPredictor', proposal_boxes=proposal_boxes)
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    class_predictions_with_background = 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, class_predictions_shape) = sess.run([tf.shape(box_encodings), tf.shape(class_predictions_with_background)])
        self.assertAllEqual(box_encodings_shape, [8, 1, 2, 4])
        self.assertAllEqual(class_predictions_shape, [8, 1, 3])