1

I am trying to scale the contribution of the positive samples and negative samples in the classification loss (l_cls) differentially in the multitask loss function(L) of RPN in Faster-RCNN.

As far as I know, the straight forward way to do this in Caffe is to use ‘InfoGainLossLayer’ and pass an infoGainMatrix(H) which contains the different scales. Unfortunately, to my knowledge, the infoGainMatrix(H) cannot be computed on the fly and passed to InfoGainLossLayer. (ref). I would like to have my H computed dynamically.

It would be great if anyone could explain how this can be circumvented.

Joseph
  • 2,327
  • 1
  • 19
  • 21

1 Answers1

0

You can write a "Python" layer that computes H "on the fly" and feed it as a third "bottom" of "InfogainLoss" layer:

layers {
  name: "computeH"
  bottom: "label"
  top: "H"
  type: "Python"
  python_param { ... }
}
layer {
  name: "loss"
  type: "InfogainLoss"
  bottom: "pred"
  bottom: "label"
  bottom: "H"  # new H for each batch
  top: "loss"
}
Shai
  • 111,146
  • 38
  • 238
  • 371
  • Thank you! The tip of the caffe that I am using is bit old. It is https://github.com/rbgirshick/caffe-fast-rcnn/tree/0dcd397b29507b8314e252e850518c5695efbb83 Would the solution that you suggested work with this version of Caffe? – Joseph Jan 28 '18 at 08:20