这里是(我认为(代码的重要部分:
vgg_model = VGG16(include_top=False, weights='imagenet',input_shape=(img_width, img_height, 3))
model = Sequential()
model.add(vgg_model)
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))
print(model.summary)
我在控制台中得到的不是模型摘要,而是:
Using TensorFlow backend.
2019-11-17 01:53:56.153721: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-11-17 01:53:56.167311: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fe2a265c6c0 executing computations on platform Host. Devices:
2019-11-17 01:53:56.167326: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version
<bound method Network.summary of <keras.engine.sequential.Sequential object at 0x12ff2dad0>>
我希望这个错误不在别的地方。请帮忙。
附言:我试着只询问vgg_model的摘要。同样的事情。
附言:我在MacBook或windows PC上运行这个并不重要。我尝试了不同的tf和Keras版本。总是一样的。。。
model.summary
访问model
对象的summary
方法。要调用方法,请使用()
:
model.summary() # no need for print()