我在python中使用Keras库来制作视频。 我的Keras版本是2.0.2
kernel_size=3
model = Sequential()
model.add(Convolution3D(nb_filters[0], kernel_size,nb_depth=nb_conv[0], nb_row=nb_conv[0],
nb_col=nb_conv[0],input_shape=(1, img_rows, img_cols, patch_size),
activation='relu'))
我收到以下错误。
Using Theano Backened
Traceback (most recent call last):
File "F:/Project/codes/foreg.py", line 131, in <module>
input_shape=(1, img_rows, img_cols, patch_size), activation='relu'))
File "C:\Users\lenov\Anaconda3\envs\3dcnn\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "C:\Users\lenov\Anaconda3\envs\3dcnn\lib\site-packages\keras\layers\convolutional.py", line 580, in __init__
**kwargs)
File "C:\Users\lenov\Anaconda3\envs\3dcnn\lib\site-packages\keras\layers\convolutional.py", line 100, in __init__
super(_Conv, self).__init__(**kwargs)
File "C:\Users\lenov\Anaconda3\envs\3dcnn\lib\site-packages\keras\engine\topology.py", line 277, in __init__
raise TypeError('Keyword argument not understood:', kwarg)
TypeError: ('Keyword argument not understood:', 'nb_depth')
请帮我解决这个错误。
答案 0 :(得分:0)
您需要在过滤器数量之后指定内核大小,例如:
kernel_size = 3
model.add(Convolution3D(nb_filters[0], kernel_size, nb_depth=nb_conv[0], nb_row=nb_conv[0],
nb_col=nb_conv[0],input_shape=(1, img_rows, img_cols, patch_size),
activation='relu'))
kernel_size:3个整数的整数或元组/列表,指定3D卷积窗口的宽度和高度。可以是单个整数,为所有空间维度指定相同的值。
答案 1 :(得分:0)
正如错误消息所示:您没有为Convolution3D构造函数提供kernel_size参数。
来自文档:
Conv3D (过滤器,kernel_size,strides =(1,1,1),padding =&#39;有效&#39;, data_format =无,dilation_rate =(1,1,1),激活=无, use_bias = True,kernel_initializer =&#39; glorot_uniform&#39;, bias_initializer =&#39;零&#39;,kernel_regularizer =无, bias_regularizer =无,activity_regularizer =无, kernel_constraint = None,bias_constraint = None)
答案 2 :(得分:0)
我通过安装mkdocs解决了我的问题
pip install mkdocs
在工作环境中。