如何在CNN Caffemodel中将4096维特征向量缩减为1024维向量? [英] How do I reduce 4096-dimensional feature vector to 1024-dimensional vector in CNN Caffemodel?
本文介绍了如何在CNN Caffemodel中将4096维特征向量缩减为1024维向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用16层VGGnet从图像中提取特征.它输出4096维特征向量.但是,我需要一个1024维向量.如何将这个4096个向量进一步缩减为1024个向量?我是否需要在fc7
之上添加一个新层?
I used 16-layers VGGnet to extract features from an image. It outputs a 4096-dimensional feature vector. However, I need a 1024-dimensional vector. How do I further reduce this 4096-vector into 1024-vector? Do I need to add a new layer on top of fc7
?
推荐答案
是的,您需要在fc7
之上添加另一层.这就是最后几层的样子
Yes, you need to add another layer on top of fc7
. This is how your last few layers should be like
layers {
bottom: "fc7"
top: "fc7"
name: "relu7"
type: RELU
}
layers {
bottom: "fc7"
top: "fc7"
name: "drop7"
type: DROPOUT
dropout_param {
dropout_ratio: 0.5
}
}
layers {
name: "fc8"
bottom: "fc7"
top: "fc8"
type: INNER_PRODUCT
inner_product_param {
num_output: 1024
}
blobs_lr: 0
blobs_lr: 0
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "fc8"
bottom: "label"
top: "loss/loss"
}
layers {
name: "accuracy/top1"
type: ACCURACY
bottom: "fc8"
bottom: "label"
top: "accuracy@1"
include: { phase: TEST }
accuracy_param {
top_k: 1
}
}
这篇关于如何在CNN Caffemodel中将4096维特征向量缩减为1024维向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文