def test_sp_backfill_numba(): sp_backfill = select('sp_backfill', backend='numba') x = np.load(ASSETS('beach_sp_mean.npy')) segments = np.load(ASSETS('beach_sp.npy')) y = sp_backfill(x, segments) y_true = np.load(ASSETS('beach_sp_restore.npy')) npt.assert_allclose(y, y_true, rtol=0.005)
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)
def test_read_resize_lycon_shape(): read_resize = select('read_resize', backend='lycon') im_test = read_resize(ASSETS('beach24.png'), (224,224)) assert im_test.shape == (224,224,3)
def test_read_resize_lycon_range(): read_resize = select('read_resize', backend='lycon') im_test = read_resize(ASSETS('beach24.png'), (224,224)) assert 178 < im_test.mean() < 180
def test_read_resize_lycon_dtype(): read_resize = select('read_resize', backend='lycon') im_test = read_resize(ASSETS('beach24.png'), (224,224)) assert im_test.dtype == np.dtype('u1')