【问题标题】:Numpy error in mtrand.pyx filemtrand.pyx 文件中的 Numpy 错误
【发布时间】:2016-10-16 19:31:43
【问题描述】:

我在台式机上运行 Keras 模型,在我的笔记本电脑上运行流畅。但在桌面上它给了我以下错误:

 File "mtrand.pyx", line 1252, in mtrand.RandomState.uniform (numpy/random/mtrand/mtrand.c:12988)
 OverflowError: Range exceeds valid bounds

我的编辑器显示该行发生了错误:

model.add(Dense(128, activation='relu'))

【问题讨论】:

  • 64 位笔记本电脑和 32 位台式机?运行 keras 模型是什么意思?运行代码,加载腌制模型并运行?可能还有更多信息可以提供。

标签: python numpy ubuntu-14.04 keras


【解决方案1】:

这可能是由于您的笔记本电脑和台式机之间的 Keras 版本不同。见Keras issue #2681。修复方法可能是更新参数已更改的 input_shape() 方法调用,如下所示:

input_shape=(IMAGE_HEIGHT, IMAGE_WIDTH,1)

如果这不起作用,您可以尝试更改图像的尺寸顺序:

from keras import backend as K
K.set_image_dim_ordering('th')

据报道,这两种解决方案都适用于遇到此问题的人。

【讨论】:

    猜你喜欢
    • 2021-05-26
    • 1970-01-01
    • 2012-03-26
    • 2016-12-31
    • 2016-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    相关资源
    最近更新 更多