添加的层必须是类Layer的实例。找到:<keras.layers.convolutional.Conv3D对象位于0x000001D009782400>

时间:2020-02-07 11:44:07

标签: keras instance typeerror layer convolution

TypeError跟踪(最近一次通话最近) 在 1个模型= tf.keras.models.Sequential() ----> 2 model.add(Conv3D(64,kernel_size =(3,3,3),步幅=(1,1,1),padding ='same',input_shape =(input_shape),activation ='relu ')) 3 model.add(Conv3D(64,kernel_size =(3,3,3),步幅=(1,1,1),padding ='same',Activation ='relu')) 4 model.add(MaxPooling3D(pooling_size =(2,2,2),步幅=(2,2,2))) 5 model.add(Conv3D(128,kernel_size =(3,3,3),strides =(1,1,1),padding ='same',activation ='relu'))

1 个答案:

答案 0 :(得分:1)

Conv3D中添加了keras.layers.convolutional.Conv3D层后,您正在使用tf.keras

将图层导入更改为:

from tensorflow.keras.layers import Conv3D