Exemple #1
0
def test_random_flip(code, func, target):
    img = np.array(
        [[1, 1, 1],
         [0, 1, 1],
         [0, 0, 1]], dtype=np.uint8)
    img = convert_2d_to_target_format([img], target=target)
    assert np.array_equal(F.random_flip(img, code), func(img))
Exemple #2
0
def test_random_flip_float(code, func, target):
    img = np.array(
        [[0.4, 0.4, 0.4],
         [0.0, 0.4, 0.4],
         [0.0, 0.0, 0.4]], dtype=np.float32)
    img = convert_2d_to_target_format([img], target=target)
    assert_array_almost_equal_nulp(F.random_flip(img, code), func(img))
def test_random_flip(code, func, target):
    img = np.array(
        [[1, 1, 1],
         [0, 1, 1],
         [0, 0, 1]], dtype=np.uint8)
    if target == 'image':
        img = convert_2d_to_3d(img)
    assert np.array_equal(F.random_flip(img, code), func(img))
Exemple #4
0
def test_random_flip(code, func, target):
    img = np.array([[1, 1, 1], [0, 1, 1], [0, 0, 1]], dtype=np.uint8)
    if target == 'image':
        img = convert_2d_to_3d(img)
    assert np.array_equal(F.random_flip(img, code), func(img))