This project implements different loss functions using PyTorch.
from losses import CrossEntropyLoss, DiceLoss, DiceCELoss, FocalLoss
# input is logits of (N, *)
# target is (N, C), C is class index
criterion = DiceLoss()
loss = criterion(input, target)
This project implements the following loss functions:
Loss Name | Status | Link | Task |
---|---|---|---|
Cross-entropy loss | ✅ passed | cross_entropy_loss.py | Segmentation |
Binary cross-entropy loss | Row 2, Column 2 | Row 2, Column 3 | |
Mean squared error (MSE) loss | Row 3, Column 2 | Row 3, Column 3 | |
Mean absolute error (MAE) loss | Row 4, Column 2 | Row 4, Column 3 | |
Dice loss | ✅ passed | dice_loss.py | Segmentation |
Dice Cross Entropy loss | ✅ passed | dice_loss.py | Segmentation |
Focal loss | ✅ passed | focal_loss.py | Segmentation |
Poly Cross Entropy Loss | ✅ passed | poly_loss.py | Classification |
Smooth Poly Loss | ✅ passed | poly_loss.py | Classification |
Contributions are welcome! If you have a suggestion for a new loss function or an improvement to an existing one, please open an issue or a pull request.
This project is licensed under the MIT License - see the LICENSE
file for details.