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
?
Asked
Active
Viewed 1,327 times
0

Shai
- 111,146
- 38
- 238
- 371

Omkar Acharya
- 67
- 7
-
If you simply add another layer that layer's weights wont be trained. So your feature vector might just be random. – DollarAkshay Jul 02 '18 at 08:10
2 Answers
3
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
}
}

Harsh Wardhan
- 2,110
- 10
- 36
- 51
2
Yes.

Shai
- 111,146
- 38
- 238
- 371
-
-
1@foo well you asked if you need to add another layer on top of `fc7` to reduce output dim from 4096 to 1024, and the answer is YES that's the elegant way of reducing dimension trained for the specific task you are trying to achieve. – Shai Jan 06 '16 at 07:49
-
2This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/10790862) – Andrew Stephens Jan 06 '16 at 09:13
-
4@AndrewStephens if you read the question and my comment above you. you'll see that it does answer – Shai Jan 06 '16 at 10:52