Example #1
0
def test_sp_mean_cupy():
    sp_mean = select('sp_mean', backend='cupy')
    im_test = read_resize(ASSETS('beach24.png'), (224,224))[...,0]
    segments = np.load(ASSETS('beach_sp.npy'))
    y = sp_mean(im_test, segments)
    y_true = np.load(ASSETS('beach_sp_mean.npy'))
    npt.assert_allclose(y, y_true, rtol=1e-03)
Example #2
0
def test_read_resize_shape():
    im_test = read_resize(ASSETS('beach24.png'), (224, 224))
    assert im_test.shape == (224, 224, 3)
Example #3
0
def test_read_resize_range():
    im_test = read_resize(ASSETS('beach24.png'), (224, 224))
    assert 178 < im_test.mean() < 180
Example #4
0
def test_sp_mean():
    im_test = read_resize(ASSETS('beach24.png'), (224, 224))[..., 0]
    segments = np.load(ASSETS('beach_sp.npy'))
    y = sp_mean(im_test, segments)
    y_true = np.load(ASSETS('beach_sp_mean.npy'))
    npt.assert_allclose(y, y_true, rtol=0.005)
Example #5
0
def test_read_resize_dtype():
    im_test = read_resize(ASSETS('beach24.png'), (224, 224))
    assert im_test.dtype == np.dtype('u1')