Я пытаюсь изменить размер своего изображения. для этого я использую изменение размера от лыжного мага.
Для этого на входе будет 3d массив изображений. И на выходе снова будет трехмерный массив меньшего размера.
downSample = []
for i in range(len(rgb_val)):
downSample.append(resize(rgb_val[i], (rgb_val[i].shape[0] / 16, rgb_val[i].shape[1] / 16),
anti_aliasing=True))
здесь, rgb_val - это не что иное, как список, содержащий трехмерный массив изображений в моем наборе данных.
Но при выполнении этого цикла он показывает следующую ошибку.
Что я должен сделать, чтобы устранить следующую ошибку?
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/skimage/_shared/utils.py in safe_as_int(val, atol)
147 try:
--> 148 np.testing.assert_allclose(mod, 0, atol=atol)
149 except AssertionError:
~/anaconda3/lib/python3.7/site-packages/numpy/testing/_private/utils.py in assert_allclose(actual, desired, rtol, atol, equal_nan, err_msg, verbose)
1451 assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
-> 1452 verbose=verbose, header=header, equal_nan=equal_nan)
1453
~/anaconda3/lib/python3.7/site-packages/numpy/testing/_private/utils.py in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision, equal_nan, equal_inf)
788 names=('x', 'y'), precision=precision)
--> 789 raise AssertionError(msg)
790 except ValueError:
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0.001
(mismatch 66.66666666666666%)
x: array([0.25, 0.5 , 0. ])
y: array(0)
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-27-754225493c2e> in <module>
1 for i in range(len(rgb_val)):
2 downSample.append(resize(rgb_val[i], ((rgb_val[i].shape[0]) / 16, (rgb_val[i].shape[1]) / 16),
----> 3 anti_aliasing=True))
4
5 # downSample.append(resize(i, i.shape[0]/4, i.shape[1]/4), anti_aliasing = True)
~/anaconda3/lib/python3.7/site-packages/skimage/transform/_warps.py in resize(image, output_shape, order, mode, cval, clip, preserve_range, anti_aliasing, anti_aliasing_sigma)
167 out = warp(image, tform, output_shape=output_shape, order=order,
168 mode=mode, cval=cval, clip=clip,
--> 169 preserve_range=preserve_range)
170
171 else: # n-dimensional interpolation
~/anaconda3/lib/python3.7/site-packages/skimage/transform/_warps.py in warp(image, inverse_map, map_args, output_shape, order, mode, cval, clip, preserve_range)
805 output_shape = input_shape
806 else:
--> 807 output_shape = safe_as_int(output_shape)
808
809 warped = None
~/anaconda3/lib/python3.7/site-packages/skimage/_shared/utils.py in safe_as_int(val, atol)
149 except AssertionError:
150 raise ValueError("Integer argument required but received "
--> 151 "{0}, check inputs.".format(val))
152
153 return np.round(val).astype(np.int64)
ValueError: Integer argument required but received (134.25, 186.5, 3), check inputs.