【发布时间】:2022-10-22 23:23:52
【问题描述】:
ValueError: Shapes... incompatible 在使用张量时是一个非常普遍的错误,但在我的情况下,它是在使用image_dataset_from_directory 方法使用 Keras 训练 CNN 时。
【问题讨论】:
-
数据集中的图像是什么形状,你为 CNN 的 InputLayer 指定了什么形状?
-
@Mark Lavin我正在使用 tf.keras.utils.image_dataset_from_directory 的 image_size 参数来调整图像的大小, image_size=(150, 150) 和模型定义 keras.Input(shape=(150, 150, 3)