Dual Focal Loss (DFL)
Version 1.0.2 (3.02 KB) by
Md Sazzad Hossain
Dual Focal Loss (DFL) function for neural networks
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.
MATLAB Release Compatibility
Created with
R2017b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
