0
我跑一下CNN的代碼在我的機器,但它得到了一個錯誤的反饋。Tensorflow + Keras + Convolution2d:類型錯誤:「詮釋」對象不是可調用
我的代碼片段:
model.add(Convolution2D(4 ,3 ,5, 5, border_mode='valid' ,input_shape=(200,200,3)))
,我也嘗試:
model.add(Convolution2D(4 ,3 ,5, 5, border_mode='valid' ,input_shape=(3,200,200)))
和錯誤是:
Traceback (most recent call last):
File "", line 1, in
File "/Users/liumengyang/anaconda/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "/Users/liumengyang/anaconda/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/Users/liumengyang/Desktop/visual/pre-processing.py", line 61, in
model.add(Convolution2D(4 ,3 ,5, 5, border_mode='valid' ,input_shape=(200,200,3)))
File "/Users/liumengyang/anaconda/lib/python3.5/site-packages/keras/models.py", line 280, in add
layer.create_input_layer(batch_input_shape, input_dtype)
File "/Users/liumengyang/anaconda/lib/python3.5/site-packages/keras/engine/topology.py", line 370, in create_input_layer
self(x)
File "/Users/liumengyang/anaconda/lib/python3.5/site-packages/keras/engine/topology.py", line 487, in __call__
self.build(input_shapes[0])
File "/Users/liumengyang/anaconda/lib/python3.5/site-packages/keras/layers/convolutional.py", line 410, in build
self.W = self.init(self.W_shape, name='{}_W'.format(self.name))
TypeError: 'int' object is not callable
如何解決這個問題呢?
非常感謝您的回答。 你的建議對我很有幫助。 問題恰恰是語法錯誤。 對你的祝福! –