AttributeError:“功能”对象在构建CNN时没有属性“摘要”

我正在尝试建立CNN模型。但是我遇到此错误,无法解决。

from keras.models import Sequential
from keras.layers import Conv2D,MaxPooling2D,Flatten,Dense
from keras.optimizers import Adam
def vgg():
    kernel=(3,3)
    pool=(2,2)
    model=Sequential()
    model.add(Conv2D(96,kernel,padding='same',input_shape=(32,32,1),activation='relu'))
    model.add(Conv2D(96,kernel,padding='same',activation='relu'))
    model.add(MaxPooling2D(pool,strides=2,padding='same'))

    model.add(Conv2D(128,kernel,padding='same',activation='relu'))
    model.add(Conv2D(128,kernel,padding='same',activation='relu'))
    model.add(MaxPooling2D(pool,strides=2,padding='same'))

    model.add(Conv2D(256,kernel,padding='same',activation='relu'))
    model.add(Conv2D(256,kernel,padding='same',activation='relu'))
    model.add(Conv2D(256,kernel,padding='same',activation='relu'))
    model.add(MaxPooling2D(pool,strides=2,padding='same'))

    model.add(Conv2D(512,kernel,padding='same',activation='relu'))
    model.add(Conv2D(512,kernel,padding='same',activation='relu'))
    model.add(Conv2D(512,kernel,padding='same',activation='relu'))
    model.add(MaxPooling2D(pool,strides=2,padding='same'))

    model.add(Conv2D(512,kernel,padding='same',activation='relu'))
    model.add(Conv2D(512,kernel,padding='same',activation='relu'))
    model.add(Conv2D(512,kernel,padding='same',activation='relu'))
    model.add(MaxPooling2D(pool,strides=2,padding='same'))

    model.add(Flatten())
    model.add(Dense(4096,activation='relu'))
    model.add(Dense(4096,activation='relu'))

    model.add(Dense(43,activation='softmax'))
    model.compile(Adam(lr=0.001),loss='categorical_crossentropy',metrics=['accuracy'])
    return vgg

model=vgg()
print(model.summary())

我找不到解决方案。 是由于没有更多的过滤器还是由于密集中的值较高,导致在另一个模型中我使用了较小的值并且它们工作正常