Skip to content

yakhyo/pytorch-losses

Repository files navigation

Project Title

This project implements different loss functions using PyTorch.

Table of Contents

Introduction

Installation

Usage

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)

Loss Functions

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

Examples

Contributing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Implementation of various Loss function using PyTorch

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages