Пытаюсь загрузить изображение таким способом:
img_path = '2.png'
img = image.load_img(img_path, target_size=(300, 300), grayscale=True)
# Преобразуем изображением в массив numpy
x = image.img_to_array(img)
x = 255 - x
x /= 255
x = np.expand_dims(x, axis=0)
prediction = model.predict(x)
Выходит такая ошибка:
ValueError: Error when checking input: expected conv2d_3_input to have shape (300, 300, 3) but got array with shape (300, 300, 1)
Как правильно преобразовать картинку?