While I was trying to apply focal loss on Faster RCNN, I got error message like this:
google.protobuf.text_format.ParseError: 28:5 : Message type "object_detection.protos.FasterRcnn" has no field named "loss".
It appears I'm unable to change loss function for Faster RCNN models. In this case, how could I apply focal loss on Faster RCNN models if I really need to? Thank you.
Adding code owner for more input. @pkulzc, feel free to add more people to the thread.
Currently focal loss is only implemented for SSD. So you can not train Faster RCNN with focal loss by simply changing the config. Contributions are welcomed if you're interested in this implementation.
@AmemiyaYuko @pkulzc I implemented like this
淇敼builders/losss_buider.py
def build_faster_rcnn_classification_loss(loss_config):
...
loss_type = loss_config.WhichOneof('classification_loss')
# add the code below
if loss_type == 'weighted_sigmoid_focal':
config = loss_config.weighted_sigmoid_focal
return losses.SigmoidFocalClassificationLoss(gamma=config.gamma,alpha=config.alpha)
...
淇敼pipeline.config
model{
faster_rcnn{
...
second_stage_classification_loss{
weighted_sigmoid_focal{
gamma:2
alpha:0.5
}
}
...
}
}
@fryng any train or validate report?
Hi any implementation of faster rcnn+ focal loss?
Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
Most helpful comment
@AmemiyaYuko @pkulzc I implemented like this
淇敼builders/losss_buider.py
淇敼pipeline.config