Exemple #1
0
def test_check1():
    """Test check without arguments"""
    bounding_boxes, confidences, labels, _ = setup_test_case()

    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)

    bb.check()
Exemple #2
0
def smoke_test_setup():
    bounding_boxes, confidences, labels, _ = setup_test_case()
    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)
    bb.check()

    metric = DefaultIntersectionOverTheUnion(threshold=0.35, direction="lt")
    selector = RandomSelector()
    return bb, metric, selector
Exemple #3
0
def test_check2():
    """Test check with arguments"""
    bounding_boxes, confidences, labels, _ = setup_test_case()
    bounding_box, confidence, label = one_additional()

    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)

    bb.check(bounding_box=bounding_box, confidence=confidence, label=label)
Exemple #4
0
def test_check7():
    """Test check without arguments - fail bb range"""
    bounding_boxes, confidences, labels, _ = setup_test_case()
    bounding_boxes[0, 0, 0] = 1.01

    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)

    with pytest.raises(ValueError):
        bb.check()
Exemple #5
0
def test_check5():
    """Test check without arguments - warn"""
    bounding_boxes, confidences, labels, _ = setup_test_case()
    labels = labels.astype(np.float64)

    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)

    with pytest.warns(SyntaxWarning):
        bb.check()
Exemple #6
0
def test_check6():
    """Test check with arguments - warn"""
    bounding_boxes, confidences, labels, _ = setup_test_case()
    bounding_box, confidence, label = one_additional()
    bounding_box = bounding_box.astype(np.int64)

    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)

    with pytest.warns(SyntaxWarning):
        bb.check(bounding_box=bounding_box, confidence=confidence, label=label)
Exemple #7
0
def test_check9():
    """Test check without arguments - fail bb shape len"""
    bounding_boxes, confidences, labels, _ = setup_test_case()
    bounding_boxes = np.array(
        (
            ((0.04, 0.19, 0.12), (0.14, 0.29, 0.81)),
            ((0.11, 0.15, 0.02), (0.21, 0.25, 0.14)),
        ),
        dtype=np.float64,
    )

    bb = BoundingBoxArray(bounding_boxes=bounding_boxes,
                          confidences=confidences,
                          labels=labels)

    with pytest.raises(ValueError):
        bb.check()