【ML Method】Focal Loss explained
1. Focal Loss
Focal Loss is loss function designed to address class imbalance in machine learning, particularly in object detection and image classification tasks.
It extends the traditional cross-entropy loss by focusing hard examples-- those that more difficult for the model to calssify--while reducing the contribution of easy examples.
This way, it helps models learn from challenging samples, which can lead to improved performance in datasets with imbalanced class distributions.
2. How It Works
Focal Loss introduces a tunable parametor,
When
3. Formula
Formula of Focal Loss(FL) and traditional binary cross-entropy(BCE) are below:
・traditional cross-entropy(BCE)
・Focal Loss
Here,
Looking at the diagram above, as
4. When to Use
・Class Imbaranced
When the dataset has a significant imbalance between classes, Focal Loss can be useful.
・Object Detection
It is commonly used in tasks like object detection, where certain classes might be underrepresented.
Discussion