%matplotlib inline
from keras.preprocessing import image
import matplotlib.pyplot as plt
import numpy as np
img = np.random.rand(224,224,3)
plt.imshow(img)
plt.show()
img_path = "image.jpeg"
img = image.load_img(img_path, target_size=(224, 224))
print(type(img))
x = image.img_to_array(img)
print(type(x))
print(x.shape)
plt.imshow(x)
我有这样一段代码,本应该显示图片。但是它在错误的通道中显示图像。我错过了什么吗?Translated text:
我有这样一段代码,本应该显示图片。但是它在错误的通道中显示图像。我错过了什么吗?
target_size
的作用是什么,您是否想忽略颜色通道? - ImportanceOfBeingErnest