SoftmaxWithLoss incorrectly count "top blobs" versus "loss_weights"

400 views
Skip to first unread message

Tomáš Peterka

unread,
Apr 25, 2015, 5:44:02 AM4/25/15
to caffe...@googlegroups.com
Hi there,

I am building NN classifier of stelar spectra using Caffe. I encountered problem with SoftmaxWithLoss layer. I'll give two definitions of the layer and then the error messages which I find buggy.

layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "guess"
  bottom: "label"
  top: "loss"
  top: "prob"
}


$ run the classifier
[layer.hpp:386] Check failed: top.size() == num_loss_weights (2 vs. 1) loss_weight must be unspecified or specified once per top blob.


Alright, so let's specify two loss_weights (it is defined as repeated float loss_weight so no problem, right?)

layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "guess"
  bottom: "label"
  top: "loss"
  top: "prob"
  loss_weight: 1.0
  loss_weight: 0.0
}



$ run the classifier again
[layer.hpp:386] Check failed: top.size() == num_loss_weights (1 vs. 2) loss_weight must be unspecified or specified once per top blob.

So first it told me I don't have enough loss_weights defined and when I define them it tells me I don't have 2 top blobs anymore? But they are in the config file. So what is wrong?

Thank you for your help in advance
Tomas



P.S. The commit I took caffe from is quite recent
commit c6414ea7cab5917c904729c87f786e0a5909475c
Author: Evan Shelhamer
Date:   Fri Apr 17 12:26:48 2015 -0700

Yukang Gan

unread,
Aug 18, 2016, 9:28:00 AM8/18/16
to Caffe Users
hi, i have met the same problem, have u found a solution?

在 2015年4月25日星期六 UTC+8下午5:44:02,Tomáš Peterka写道:
Reply all
Reply to author
Forward
0 new messages