I have a fully connected layer
with a SoftmaxWithLoss
layer. What I am trying to do is to retrieve the data in form of 3D
rather than 1D
.
My input ground_truth images are 3x128x128 and my last layers look like this:
layer {
name: "fc1"
type: "InnerProduct"
bottom: "conv"
top: "fc1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 49152 # 128 x 128 x 3
...
}
}
layer {
name: "result"
type: "SoftmaxWithLoss"
bottom: "fc1"
bottom: "label"
top: "result"
}
And here I get the following error:
softmax_loss_layer.cpp:47] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (1 vs. 49152) Number of labels must match number of predictions; e.g., if softmax axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be NHW, with integer values in {0, 1, ..., C-1}.
What is wrong here? I have my label which is 3x128x128 and my output_num is 49152 = 3 x 128 x128??
My follow up question would be how to transform this 1D data into 3D data:
I am using the python API for caffe. I know I "just" have to reshape the 1D vector to a 3D vector. But how do I know where to "reshape" as in which location in the 1D vector corresponds to the location in the 3D vector. Can anyone help me?
Thanks in advance!