How do I reduce 4096-dimensional feature vector to 1024-dimensional vector in CNN Caffemodel?

余生长醉 提交于 2019-12-11 22:07:18

问题


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?


回答1:


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
  }
}



回答2:


Yes.‏‏‏ ‏‏ ‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏



来源:https://stackoverflow.com/questions/34626535/how-do-i-reduce-4096-dimensional-feature-vector-to-1024-dimensional-vector-in-cn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!