mtrand.pyx 文件中的 Numpy 错误
Numpy error in mtrand.pyx file
我在台式机上 运行 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'))
这可能是由于您的笔记本电脑和台式机之间的 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')
据报道,这两种解决方案都适用于遇到此问题的人。
我在台式机上 运行 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'))
这可能是由于您的笔记本电脑和台式机之间的 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')
据报道,这两种解决方案都适用于遇到此问题的人。