Calibrating Deep Neural Networks using Focal Loss

Jishnu Mukhoti, Viveka Kulharia, Amartya Sanyal, Stuart Golodetz, Philip H. S. Torr +1 more
2/21/2020
708 citations
cs.LGcs.CVstat.ML

Official code: torrvision/focal_calibration (161 stars, Jupyter Notebook, MIT, last commit 2024-01-10).

Abstract

Miscalibration - a mismatch between a model's confidence and its correctness - of Deep Neural Networks (DNNs) makes their predictions hard to rely on. Ideally, we want networks to be accurate, calibrated and confident.

Show full abstract

We show that, as opposed to the standard cross-entropy loss, focal loss [Lin et. al., 2017] allows us to learn models that are already very well calibrated. When combined with temperature scaling, whilst preserving accuracy, it yields state-of-the-art calibrated models. We provide a thorough analysis of the factors causing miscalibration, and use the insights we glean from this to justify the empirically excellent performance of focal loss. To facilitate the use of focal loss in practice, we also provide a principled approach to automatically select the hyperparameter involved in the loss function. We perform extensive experiments on a variety of computer vision and NLP datasets, and with a wide variety of network architectures, and show that our approach achieves state-of-the-art calibration without compromising on accuracy in almost all cases. Code is available at https://github.com/torrvision/focal_calibration.

View on arXivView PDF

Code Implementations(1)

MIT

Code for the paper "Calibrating Deep Neural Networks using Focal Loss"

16129Jupyter Notebook, PythonOct 16, 20202 years agoMIT

Similar Papers

Cite this paper

@article{mukhoti2020calibrating,
  title  = {Calibrating Deep Neural Networks using Focal Loss},
  author = {Jishnu Mukhoti and Viveka Kulharia and Amartya Sanyal and Stuart Golodetz and Philip H. S. Torr and Puneet K. Dokania},
  year   = {2020},
  eprint = {2002.09437},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2002.09437}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2002.09437.svg)](https://codeofpaper.com/paper/2002.09437)

Discussion