我试图将MNIST测试图像的尺寸从28 * 28缩小到14 * 14,缩小的图像显示得很好,但是当检查调整后的测试图像的形状时,尺寸保持为10000、28、28。
x_test.shape
(10000, 28, 28)
# resize parameters
resize_img_rows = 14
resize_img_cols = 14
# downsize test images
from skimage import transform
resized_x_test = np.zeros((10000, resize_img_rows, resize_img_cols))
for i in range (10000):
resized_x_test[i] = transform.resize(x_test[i], (resize_img_rows, resize_img_cols))
plt.imshow(resized_x_test[100], cmap = plt.cm.binary)
plt.show()
resize_x_test.shape
(10000, 28, 28)