问题
I am familiar with how to use multiple loss in a CNN while all the labels of these loss are identical.
My case here is handling hierarchical labels using multiple losses, as shown in figure bellow:
loss1 is responsible for labelset1:{Sport, Food}. loss2 for labelset2:{volley, soccer}, loss3 for labelset3:{Pizza, Pasta, burger}. For example, Sample A∈{sport, soccer}, sample B∈{food,burger}.
Any ideas how to do this?
回答1:
Adding "don't care" lables, you should have three labels for each sample. For example: {sports, volleyball, don't care}
.
Then you can have the three losses of type "SoftmaxWithLoss"
. For the two specific losses you should add ignore_label
for the don't care labels.
来源:https://stackoverflow.com/questions/51574159/caffe-cnn-multiple-hierarchical-losses-for-hierarchical-classification