【问题标题】:ValueError: Found array with dim 4. Estimator expected <= 2. what to do?ValueError: Found array with dim 4. Estimator expected <= 2. 怎么办?
【发布时间】:2018-10-05 21:38:11
【问题描述】:

我已经从一个目录加载了一些图像数据集,并且想要对这些图像进行分类。我已将其调整为 (64,64,3) 大小的图像,但无法放入模型中。

它说: ValueError:找到暗淡为 4 的数组。估计器预期

【问题讨论】:

  • 看看你正在谈论的一些代码可能会有用。

标签: image model dataset dimension valueerror


【解决方案1】:

假设X 是您的训练数据,形状为 (N_samples, 64,64,3) Found array with dim 4 表示你的图片是上面显示的形状。

N_samples, img_width, img_height, ch = X.shape
X_reshaped = X.reshape(N_samples, -1 )

在这里工作

【讨论】:

    猜你喜欢
    • 2020-06-30
    • 2019-12-02
    • 2020-09-07
    • 2020-11-27
    • 2019-07-19
    • 2017-07-28
    • 2018-08-21
    • 2017-10-26
    • 2018-05-19
    相关资源
    最近更新 更多