[1]} RetinaNet is another one-stage detector that introduced a new loss function to be exploited during the training phase, named Focal loss. The authors of this network demonstrated that one-stage detectors did not reach the accuracy of two-stage detectors because of the extreme class imbalance encountered during training. In particular, in two-stage detectors such as Faster R-CNN, the first stage (i.e., the rpn) narrows down the number of candidate object locations to a small number (e.g., 1–2k), filtering out most background samples. Then, in the second classification stage, sampling heuristics, such as a fixed foreground-to-background ratio (1:3) or online hard example mining (OHEM) [2]} are performed to maintain a manageable balance between foreground and background. On the other hand, a one-stage detector must process a much larger set of candidate object locations regularly sampled across an image. In practice, this often amounts to enumerating about 100k locations that densely cover spatial positions, scales, and aspect ratios. This large number prevents the adoption of the above-mentioned sampling heuristics, and, consequently, the training procedure is dominated by easily classified background examples. To contrast this issue, the authors of [1]} introduced the focal loss, which, intuitively, can automatically down-weight the contribution of easy examples during training and rapidly focus the model on hard examples. In particular, the focal loss is the reshaping of cross-entropy loss such that it down-weights the loss assigned to well-classified examples. In other words, this novel loss focuses training on a sparse set of hard examples and prevents the vast number of easy negatives from overwhelming the detector during training.
