【问题标题】:Discrepancy PyCharm - Google Colab差异 PyCharm - Google Colab
【发布时间】:2020-09-01 16:51:24
【问题描述】:

我正在做一个关于自动驾驶汽车的项目(使用 Udacity 开源模拟器)。我一直在尝试使用 Google Colab,如果我在 PC 上运行完全相同的代码,我会遇到很多错误。我猜这一切都与我上传数据的方式有关,所以我用许多不同的方式重复了这个过程,但我似乎无法弄清楚。

这是参考代码:https://colab.research.google.com/drive/123Q-1e8Csl6xYw_DfVTejtw0oozUjj7 (这次我得到的数据和他一样:https://colab.research.google.com/drive/1W5I8NYsavde4iy-1uiztNKwwYw7_Pfs_)。

无论如何,你可以看到我得到了这个错误:Error when checking input: expected cropping2d_9_input to have 4 dimensions, but got array with shape (64, 64, 1),我在 Pycharm 上没有得到完全相同的代码。 知道为什么吗?

【问题讨论】:

    标签: python pycharm google-colaboratory conv-neural-network


    【解决方案1】:

    您应该将输入形状转换(重塑)为 4 维数组。

    x_train = x_train.reshape(x_train.shape[0], 64, 64, 1)
    x_test = x_test.reshape(x_test.shape[0], 64, 64, 1)
    

    【讨论】:

    • 嗨!感谢您的回答!我收到ValueError: cannot reshape array of size 4096 into shape (64,64,64,1)
    猜你喜欢
    • 2020-01-13
    • 2021-09-02
    • 2020-06-14
    • 1970-01-01
    • 2021-05-21
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 2012-07-04
    相关资源
    最近更新 更多