Dual Focal Loss (DFL)

Dual Focal Loss (DFL) function for neural networks
78 Downloads
Updated 3 Jan 2022

View License

Dual Focal Loss:
Dual Focal Loss (DFL) function [1] alleviates the class imbalance issue in classification as well as semantic segmentation. This loss function is inspired by the characteristic of the Focal Loss (FL) [2] function that intensifies the loss for a data point yielding a large difference between the predicted and the actual output. Hence, if a data point is hard-to-classify, due to class imbalance or some other reasons, FL makes the neural network focus more on that as well as similar data points. DFL adopts this idea and improves the performance of FL by enhancing the gradient condition.
Files and Instruction:
The files attached are as follows:
**The code file for DFL: dfl_loss_function.m
**An example of classification using DFL: Classification_example_with_DFL.m
Before using the file: dfl_loss_function.m, please make sure you put this file into the same folder of your main file (where you will be using DFL). Or, if you must put this into a different folder, make sure you add the folder path to the MATLAB path.
References:
[1] Hossain, Md Sazzad, et al. “Dual Focal Loss to Address Class Imbalance in Semantic Segmentation.” Neurocomputing, vol. 462, Elsevier BV, Oct. 2021, pp. 69–87, doi:10.1016/j.neucom.2021.07.055.
[2] Lin, T. Y., Goyal, P., Girshick, R., He, K., & Dollár, P. (2017). Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision (pp. 2980-2988).
(Note: Equation (9) in the published paper [1], showing the expression for DFL, is slightly incorrect, where the sign before the last term (having the 'alpha' parameter) is currently '+', which is supposed to be '-'. A corrigendum has been proposed on this to the journal publication team.)

Cite As

Hossain, Md Sazzad, et al. “Dual Focal Loss to Address Class Imbalance in Semantic Segmentation.” Neurocomputing, vol. 462, Elsevier BV, Oct. 2021, pp. 69–87, doi:10.1016/j.neucom.2021.07.055.

View more styles
MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.2

Revised instructions.

1.0.1

Edited description. Modified attached files.

1.0.0