I have an image I loaded with the image.load_img()
function but when I try to reshape it I get this error:
ValueError: cannot reshape array of size 12288 into shape (64,64)
Here is my code:
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()
test_image.shape
. Also I have assumed you were using the PIL library: it helps to show all your imports at the top of the code snippet. stackoverflow.com/help/minimal-reproducible-example is even better! $\endgroup$