def test_detection_iou_same(self):
        d1 = tf.constant([[1, 1, 1, 3, 3, 1, 1]], dtype=tf.float32)
        d2 = tf.constant([1, 1, 1, 3, 3, 1, 1], dtype=tf.float32)

        iou = wbf.vectorized_iou(d1, d2)

        self.assertAllClose(iou[0][0], 1.0)
    def test_detection_iou_vector(self):
        vector_to_match = tf.constant(
            [
                [1, 1, 1, 3, 3, 1, 1],
                [1, 2, 2, 4, 4, 1, 1],
                [1, 3, 3, 5, 5, 1, 1],
            ],
            dtype=tf.float32,
        )

        detection = tf.constant([1, 1, 1, 3, 3, 1, 1], dtype=tf.float32)

        ious = wbf.vectorized_iou(vector_to_match, detection)
        self.assertAllClose(tf.reshape(ious, [3]), [1, 1.0 / 7.0, 0])