我想将我的图片调整为 (1, 28, 28)
这是我的代码
from keras.preprocessing.image import load_img
from keras.preprocessing import image
img1 = image.load_img(path=path,grayscale=True,target_size=(28,28))
img1 = image.img_to_array(img1)
print(img1.shape)
## (28, 28, 1)
如果
target_size=(1,28,28)
,那么它会给我 (1, 28, 1)
。我不知道为什么会得到这种输出,我该怎么做呢?谢谢!
numpy.swapaxes
能否给我这个尺寸? - Jose