0

I am trying to fine tune Alexnet for a multi-label regression task. For this I have replaced the last layer producing 1000-label output (for image classification task) to 6 label output which provides me with 6 floats. I replaced the last layers as mentioned here.

My training data is prepared in h5 format and is shaped as (11000, 3, 544, 1024) for data and (11000, 1, 6) for labels. While retraining the weights of Alexnet in Caffe library, I get the following error:

I1013 10:50:49.759560  3107 net.cpp:139] Memory required for data: 950676640

I1013 10:50:49.759562  3107 layer_factory.hpp:77] Creating layer accuracy_retrain

I1013 10:50:49.759567  3107 net.cpp:86] Creating Layer accuracy_retrain

I1013 10:50:49.759568  3107 net.cpp:408] accuracy_retrain <- fc8_fc8_retrain_0_split_0

I1013 10:50:49.759572  3107 net.cpp:408] accuracy_retrain <- label_data_1_split_0

I1013 10:50:49.759575  3107 net.cpp:382] accuracy_retrain -> accuracy

F1013 10:50:49.759587  3107 accuracy_layer.cpp:31] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (10 vs. 60) Number of labels must match number of predictions; e.g., if label axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be N*H*W, with integer values in {0, 1, ..., C-1}.

My Batchsize for both training and testing phases is 10. The error arises in the testing phase, possibly in the accuracy layer Complete Error Log here. I am not sure why this problem arises, might be my label is misshaped. Any help in this regard will be highly appreciated.

Ali Anwar
  • 1
  • 3

1 Answers1

0

I solved this problem. Seems like the accuracy layer is only used for classification tasks along with SoftmaxWithLoss layer. As stated in this answer, the EuclideanLoss can be used to test the regression network.

Ali Anwar
  • 1
  • 3