Viet-Anh on Software Logo

What is: Focal Loss?

SourceFocal Loss for Dense Object Detection
Year2000
Data SourceCC BY-SA - https://paperswithcode.com

A Focal Loss function addresses class imbalance during training in tasks like object detection. Focal loss applies a modulating term to the cross entropy loss in order to focus learning on hard misclassified examples. It is a dynamically scaled cross entropy loss, where the scaling factor decays to zero as confidence in the correct class increases. Intuitively, this scaling factor can automatically down-weight the contribution of easy examples during training and rapidly focus the model on hard examples.

Formally, the Focal Loss adds a factor (1p_t)γ(1 - p\_{t})^\gamma to the standard cross entropy criterion. Setting γ>0\gamma>0 reduces the relative loss for well-classified examples (p_t>.5p\_{t}>.5), putting more focus on hard, misclassified examples. Here there is tunable focusing parameter γ0\gamma \ge 0.

FL(p_t)=(1p_t)γlog(p_t){\text{FL}(p\_{t}) = - (1 - p\_{t})^\gamma \log\left(p\_{t}\right)}