我有一张使用该image.load_img()
功能加载的图像,但是当我尝试对其进行重塑时,出现此错误:
ValueError: cannot reshape array of size 12288 into shape (64,64)
这是我的代码:
test_image = image.load_img('xray_dataset_covid19/test/PNEUMONIA/streptococcus-pneumoniae-pneumonia-temporal-evolution-1-day2.jpg'
, target_size = (64, 64))
test_image = image.img_to_array(test_image)
test_image = np.expand_dims(test_image, axis = 0)
result = model.predict(test_image)
if result[0][0] == 1:
img = Image.fromarray(test_image.reshape(64,64) ,'L')
img.show()