Slicing Layer

35 views
Skip to first unread message

Shuai Li

unread,
Dec 29, 2015, 9:26:37 PM12/29/15
to Caffe Users
Hi,

I am using a Slicing layer in the model. It slices the input into two outputs ("part0" and "part1"). I used "part0" in the following model and "part1" is not used. When training the model, "part1" is always displayed together with the accuracy and loss. I am not sure whether this will affect the accuracy and loss. 

Following shows the displayed info. Is the accuracy and loss correct? Thanks a lot.

I1230 12:21:30.059252 32475 solver.cpp:340]     Test net output #0: accuracy = 0.014375
I1230 12:21:30.059293 32475 solver.cpp:340]     Test net output #1: part1 = -33.918
I1230 12:21:30.059299 32475 solver.cpp:340]     Test net output #2: part1 = -33.6117
I1230 12:21:30.059303 32475 solver.cpp:340]     Test net output #3: part1 = -33.522
....
....
....
I1230 12:21:37.660116 32475 solver.cpp:340]     Test net output #2473393: loss = 4.6144 (* 1 = 4.6144 loss)

Shuai Li

unread,
Dec 30, 2015, 6:36:41 PM12/30/15
to Caffe Users
Hi,

It just occurred to me that this not only happens to the slicing layer. Any data, that has not been used further, will be displayed with the loss and accuracy information, probably as labels.

Thanks.

Shuai Li

unread,
Dec 30, 2015, 9:27:48 PM12/30/15
to Caffe Users
The accuracy is right. The data are processed separately. Actually all the remaining blobs are considered as output blob including the accuracy layer. So all the blobs work separately.
Possible ways to disable displaying the all the remaining blobs while displaying the accuracy:
1: change net.cpp, not to include the remaining blobs other than the accuracy layer.
  // In the end, all remaining blobs are considered output blobs.
  for (set<string>::iterator it = available_blobs.begin();
      it != available_blobs.end(); ++it) {
    LOG(INFO) << "This network produces output " << *it;
    net_output_blobs_.push_back(blobs_[blob_name_to_idx[*it]].get());
    net_output_blob_indices_.push_back(blob_name_to_idx[*it]);
  }
2: change solver.cpp, only output the accuracy.
  for (int i = 0; i < test_score.size(); ++i) {
    const int output_blob_index =
        test_net->output_blob_indices()[test_score_output_id[i]];
    const string& output_name = test_net->blob_names()[output_blob_index];
    const Dtype loss_weight = test_net->blob_loss_weights()[output_blob_index];
    ostringstream loss_msg_stream;
    const Dtype mean_score = test_score[i] / param_.test_iter(test_net_id);
    if (loss_weight) {
      loss_msg_stream << " (* " << loss_weight
                      << " = " << loss_weight * mean_score << " loss)";
    }
    LOG(INFO) << "    Test net output #" << i << ": " << output_name << " = "
        << mean_score << loss_msg_stream.str();
  }
Reply all
Reply to author
Forward
0 new messages