File "mtrand.pyx", line 1289, in mtrand.RandomState.uniform (numpy/random/mtrand/mtrand.c:19267)
OverflowError: Range exceeds valid bounds
是的邢隧!之前我們?cè)趡/.keras/keras.json里改的theano它還是不長(zhǎng)記性!
從異常跑出的棧里看是numpy的random函數(shù)有越界太抓,
解決:
文件前面初始化設(shè)置:
from keras import backend
backend.set_image_dim_ordering('th')
if "image_dim_ordering": is "th" and "backend": "theano", your input_shape must be (channels, height, width)
if "image_dim_ordering": is "tf" and "backend": "tensorflow", your input_shape must be (height, width, channels)
用tensorflow+gpu的時(shí)候奕扣,在代碼里添加這個(gè),注意input此時(shí)變成了(samples,row,col,channels)的格式
from keras import backend
import tensorflow
sess=tensorflow.Session()
backend.set_session(sess)