【发布时间】:2019-07-06 05:53:12
【问题描述】:
现在,我想要图像的特征来计算它们的相似度。我们可以在 tensorflow 中使用预训练的 VGG19 模型轻松获得特征。但是 VGG19 模型有很多层,我不知道应该使用哪一层来获取特征。哪一层的输出适合这个问题?
# I think this how is correct to extract feature
model = tf.keras.application.VGG19(include_top=True,
weight='imagenet')
input = model.input
output = model.layers[-2].output
extract_model = tf.keras.Model(input, output)
我的推断是越接近最后的输出,模型输出的功能就越强大。但是有些教程说'使用include_top=False提取特征'(例如Image Captioning with Attention TensorFlow)
所以,我不知道应该使用哪一层。请尝试在此线程中帮助我。
【问题讨论】:
标签: python tensorflow machine-learning tf.keras