【发布时间】:2017-07-12 15:07:12
【问题描述】:
我在keras doc看到了特征提取的例子,并使用以下代码从输入图像中提取特征
input_shape = (224, 224, 3)
model = VGG16(weights = 'imagenet', input_shape = (input_shape[0],
input_shape[1], input_shape[2]), pooling = 'max', include_top = False)
img = image.load_img(img_path, target_size=(input_shape[0],
input_shape[1]))
img = image.img_to_array(img)
img = np.expand_dims(img, axis=0)
img = preprocess_input(img)
feature = model.predict(img)
然后当我输出feature变量的形状时,我发现它是(1, 512)。为什么是这个维度?
print model.summary() 显示了 maxpooling 后最后一个 conv 层输出的形状为 (7, 7, 512),这是我期望 feature 应该的尺寸。
【问题讨论】:
标签: computer-vision conv-neural-network feature-extraction