InfogainLoss Check failed: Bottom height > 1

46 views
Skip to first unread message

Oliver Rippel

unread,
Jun 29, 2017, 7:39:02 AM6/29/17
to Caffe Users
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.

Kanguru

unread,
Jul 3, 2017, 11:15:39 AM7/3/17
to Caffe Users
After a clean reinstall of caffe, everything seems to work now. Guess something was messed up with my installation.

Shai Bagon

unread,
Aug 14, 2017, 5:47:33 AM8/14/17
to Caffe Users
According to the error message you got, your code is NOT updated to include PR #3855. Make sure you update your code and REBUILD caffe afterwards.
Reply all
Reply to author
Forward
0 new messages