Код: Выделить всё
from tensorflow.preprocessing import image
# Other imports for tensorlfow etc.
#...
# Sample image
img_path = "./Model/data/brain/train/Glioma/images/gg (2).jpg"
img = image.load_img(img_path,target_size=(256,256))
arr = image.img_to_array(img)
t_img = tf.convert_to_tensor(arr)
print(t_img.shape) # Returns (256,256,3)
# Client testing
client = Client("brain") # Custom Class. Contains model: Sequential (compiled and trained)
client.predict(img=t_img) # Calls self.model.predict(t_img)
Код: Выделить всё
Invalid input shape for input Tensor("data:0", shape=(32, 256, 3), dtype=float32). Expected shape (None, 256, 256, 3), but input has incompatible shape (32, 256, 3)
Можете ли вы помочь мне понять проблему и решить ее?
Подробнее здесь: https://stackoverflow.com/questions/791 ... nput-shape