Calibrating deep neural networks using focal loss

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. We show that, as opposed to the standard cross-entropy loss, focal loss (L...

Full description

Bibliographic Details
Main Authors: Mukhoti, J, Kulharia, V, Sanyal, A, Golodetz, S, Torr, PHS, Dokania, PK
Format: Conference item
Language:English
Published: Curran Associates 2020
_version_ 1797061568918192128
author Mukhoti, J
Kulharia, V
Sanyal, A
Golodetz, S
Torr, PHS
Dokania, PK
author_facet Mukhoti, J
Kulharia, V
Sanyal, A
Golodetz, S
Torr, PHS
Dokania, PK
author_sort Mukhoti, J
collection OXFORD
description 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. 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.
first_indexed 2024-03-06T20:33:04Z
format Conference item
id oxford-uuid:31b60972-2e7f-4388-8551-1f3b59020245
institution University of Oxford
language English
last_indexed 2024-03-06T20:33:04Z
publishDate 2020
publisher Curran Associates
record_format dspace
spelling oxford-uuid:31b60972-2e7f-4388-8551-1f3b590202452022-03-26T13:09:41ZCalibrating deep neural networks using focal lossConference itemhttp://purl.org/coar/resource_type/c_5794uuid:31b60972-2e7f-4388-8551-1f3b59020245EnglishSymplectic ElementsCurran Associates2020Mukhoti, JKulharia, VSanyal, AGolodetz, STorr, PHSDokania, PKMiscalibration -- 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. 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.
spellingShingle Mukhoti, J
Kulharia, V
Sanyal, A
Golodetz, S
Torr, PHS
Dokania, PK
Calibrating deep neural networks using focal loss
title Calibrating deep neural networks using focal loss
title_full Calibrating deep neural networks using focal loss
title_fullStr Calibrating deep neural networks using focal loss
title_full_unstemmed Calibrating deep neural networks using focal loss
title_short Calibrating deep neural networks using focal loss
title_sort calibrating deep neural networks using focal loss
work_keys_str_mv AT mukhotij calibratingdeepneuralnetworksusingfocalloss
AT kulhariav calibratingdeepneuralnetworksusingfocalloss
AT sanyala calibratingdeepneuralnetworksusingfocalloss
AT golodetzs calibratingdeepneuralnetworksusingfocalloss
AT torrphs calibratingdeepneuralnetworksusingfocalloss
AT dokaniapk calibratingdeepneuralnetworksusingfocalloss