Focal Loss is a loss function that multiplies cross-entropy by a factor that shrinks the loss of examples the model already classifies correctly, so that training concentrates on hard examples. Lin et al. proposed it in 2017 for object detection, the task of locating and classifying objects in an image.
is the probability the model assigns to the correct class. controls how strongly the loss of easy examples is reduced; with , Focal Loss is identical to cross-entropy.
The motivation is the extreme class imbalance that arises when training one-stage object detectors.
- Most candidates are background: One-stage detectors such as SSD and YOLO classify roughly 100,000 candidate boxes (anchors) tiled over the whole image at once. Only a handful of them contain an object; almost all the rest are boxes that are easily judged to be "background."
- The easy background losses dominate training in aggregate: With cross-entropy, even a well-classified example such as keeps a non-negligible loss of about 0.1. Each one is small, but summed over tens of thousands of background boxes, these losses outweigh the losses of the few object boxes.
The figure at the top plots loss against for several values of , as in Figure 1 of the paper. The larger is, the closer the loss of examples with large (easy examples) gets to 0. With , the loss of an example with is 1/100 of the cross-entropy loss.
As an analogy, it is like a study plan for an exam that automatically cuts the time spent reviewing problems you can already solve and moves that time to the problems you still cannot.

