Awesome
Reproduction of Focal-loss on Caffe
I didn't implement CPU version. If you want to see the details, please check focal_loss_layer.cu
To use Focal-Loss layer, you can:
-
Directly compile my CaffeMex_v2 on Linux or Windows, the layer is already embedded.
-
You can also add the three files,
focal_loss_layer.cpp
,focal_loss_layer.cu
andfocal_loss_layer.hpp
, and modifycaffe.proto
in your own caffe.
An example in prototxt
Using it as the way you use cross entropy loss layer
.
layer {
name: "loss_focal"
type: "FocalLoss"
bottom: "predicted"
bottom: "label"
top: "loss_focal"
loss_weight: 10
loss_param{
normalize: true
normalization: FULL
}
}
Implementation for softmax form
Please refer to this repo