Example #1
0
def test_from_array():
    array = np.array([1, 2, 3, 4, 5, 6, 7, 8], dtype=np.float32)

    b = Box.from_array(array)

    assert 1 == b.x
    assert isinstance(b.x, float)
    assert 2 == b.y
    assert isinstance(b.y, float)
    assert 3 == b.w
    assert isinstance(b.w, float)
    assert 4 == b.h
    assert isinstance(b.h, float)
    assert 5 == b.objectness
    assert isinstance(b.objectness, float)
    assert [float(x) for x in range(6, 9)] == b.classes
    for c in b.classes:
        assert isinstance(c, float)
Example #2
0
def test_to_list():
    array = np.array([1, 2, 3, 4, 5, 6, 7, 8], dtype=np.float32)

    b = Box.from_array(array)
    assert [1., 2., 3., 4., 5., 6., 7., 8.] == b.to_list()