【问题标题】:How to shape images for labels [duplicate]如何为标签塑造图像[重复]
【发布时间】:2019-12-28 11:58:53
【问题描述】:

我正在尝试训练卫星图像。我的训练集有 2 个输入文件夹(样本)和基本事实(标签)。

图片总数为:496
我的 X_train 形状是:(496,3,256,256)
y_train 形状为:(496,256,256)

对于每个模型,我都会收到关于密集层的错误。

ValueError: Expected dense to have 2 dimensions, but got an array with shape (496,256,256)

【问题讨论】:

    标签: python machine-learning keras keras-layer


    【解决方案1】:

    您正在将图像馈送到密集层。使用 .flatten() 展平图像或使用具有 CNN 层的模型。形状 (496,3,256,256) 表示您有 496 张图像,大小为 256x256,具有 3 个维度 (rgb)。

    在这个answer 上查找 CNN 模型。

    CNN: Error when checking input: expected dense to have 2 dimensions, but got array with shape (391, 605, 700, 3)

    【讨论】:

      猜你喜欢
      • 2015-08-01
      • 2014-05-03
      • 1970-01-01
      • 1970-01-01
      • 2021-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多