我在我的机器上运行关于 CNN 的代码,但它得到了一个错误反馈。
我的代码片段:
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
如何解决这个问题呢?