使用medicala图像,我将VGG16用于两个类别的分类,我删除了最后一层(预测(密集)),然后添加了两层,在200个时期内我的准确度为71%,我想使用我的预训练模型使用Grad CAM +++定位图像中的区域,所以当我调用模型时,出现此错误!!
我怎么解决这个问题?我的方法正确吗?请帮助
vgg16_model=keras.applications.vgg16.VGG16()
vgg16_model.layers.pop()`
model=Sequential()
for layer in vgg16_model.layers:
model.add(layer)
for layer in model.layers:
layer.trainable=False
model.add(Dropout(0.5))
model.add(Dense(num_classes, activation='softmax', name='predic'))
from keras.optimizers import SGD
#model.compile(Adam(lr=0.0001),loss='categorical_crossentropy',metrics=['accuracy'])
import time
`
start = time.time()
history = model.fit_generator(generator=train_batches,
epochs=epochs,
steps_per_epoch=steps_train,
#callbacks=callbacks_list,
validation_data=valid_batches,
validation_steps=steps_valid,
shuffle=True)
end = time.time()
model = model(include_top=True, weights='imagenet',input_shape=(224,224,3))
TypeError跟踪(最近的呼叫 最后) ----> 1个模型=模型(include_top = True,权重='imagenet',input_shape =(224,224,3))
TypeError:调用()缺少1个必需的位置参数:“ inputs”