Exemple #1
0
    def test_detection_iou_none(self):
        d1 = tf.constant([[1, 1, 1, 3, 3, 1, 1]], dtype=tf.float32)
        d2 = tf.constant([1, 3, 3, 5, 5, 1, 1], dtype=tf.float32)

        iou = wbf.vectorized_iou(d1, d2)

        self.assertAllClose(iou[0][0], 0)
Exemple #2
0
    def test_detection_iou_ends(self):
        d1 = tf.constant([[1, 1, 1, 3, 2, 1, 1]], dtype=tf.float32)
        d2 = tf.constant([1, 2, 1, 4, 2, 1, 1], dtype=tf.float32)

        iou = wbf.vectorized_iou(d1, d2)

        self.assertAllClose(iou[0][0], 1.0 / 3.0)
Exemple #3
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])