Hello everyone,
I am currently trying to set up a semantic-segmentation with class-frequency weighting in the windows branch of caffe. To do this, I tried to specify the Data (1x7xHxW), the Labels (1x1xHxW with integer values 0-6, specifying the label per pixel) and the class frequency weighting map as binaryproto (1x1x7x7, with the diagonal entry containing the weighting as float for each class) and feed it into a InfogainLoss layer. Generating the prototxt works fine, but when trying to solve it, i get the following error during initialization of the network:
I0629 12:09:27.114768 16132 layer_factory.hpp:77] Creating layer loss
I0629 12:09:27.114768 16132 net.cpp:91] Creating Layer loss
I0629 12:09:27.114768 16132 net.cpp:425] loss <- score_score_0_split_1
I0629 12:09:27.114768 16132 net.cpp:425] loss <- label_label_0_split_0
I0629 12:09:27.114768 16132 net.cpp:399] loss -> loss
F0629 12:09:27.114768 16132 infogain_loss_layer.cpp:35] Check failed: bottom[1]->height() == 1 (356 vs. 1)
356 is the Height and Width of both Data and Labels. The last layers from my prototext are this:
layer {
name: "score"
type: "Convolution"
bottom: "conv1_4"
top: "score"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 7
kernel_size: 1
weight_filler {
type: "xavier"
}
}
}
layer {
name: "label"
type: "Crop"
bottom: "Data1"
bottom: "score"
top: "label"
crop_param {
axis: 2
offset: 92
}
}
layer {
name: "loss"
type: "InfogainLoss"
bottom: "score"
bottom: "label"
top: "loss"
include {
phase: TRAIN
}
loss_param {
ignore_label: 0
}
infogain_loss_param {
source: "infogain_Matrix.binaryproto"
}
}
Using the Data and Labels as bottoms in a SoftmaxWithLoss layer seems to work just fine, however it does not support class-frequency weighting. According to what I researched, per-pixel loss with frequency weighting should be doable with InfogainLoss layer (see
here, and an official
PR was made which was merged successfully). My caffe version is up to date.
Any help would be greatly appreciated.