Focal Loss with Label Smoothing Label Smoothing applied in Focal Loss This code is based on the below papers. Focal Loss for Dense Object Detection. When Does Label Smoothing Help? How to use criteria = FocalLossWithSmoothing(num_classes) logits = model(inputs) loss = criteria(logits, labels) optim.zero_grad() loss.backward() optim.step()