def test_batch_iou_with_negative_data(self): boxes = tf.constant([[[0, -0.01, 0.1, 1.1], [0, 0.2, 0.2, 5.0], [0, -0.01, 0.1, 1.], [-1, -1, -1, -1]]], tf.float32) iou = post_processing.batch_iou(boxes, boxes) expected_iou = [[[0.99999994, 0.0917431, 0.9099099, -1.], [0.0917431, 1., 0.08154944, -1.], [0.9099099, 0.08154944, 1., -1.], [-1., -1., -1., -1.]]] with self.test_session() as sess: iou = sess.run(iou) self.assertAllClose(iou, expected_iou)
def graph_fn(): boxes = tf.constant([[[0, -0.01, 0.1, 1.1], [0, 0.2, 0.2, 5.0], [0, -0.01, 0.1, 1.], [-1, -1, -1, -1]]], tf.float32) iou = post_processing.batch_iou(boxes, boxes) return iou