# bermanmaxim/LovaszSoftmax

Code for the Lovász-Softmax loss (CVPR 2018)

Repository: https://github.com/bermanmaxim/LovaszSoftmax
Canonical: https://ross.abutalabs.com/products/lovaszsoftmax
Homepage: http://bmax.im/LovaszSoftmax
Language: Jupyter Notebook
License: MIT
License Family: permissive
Topics: image-segmentation, pytorch, neural-networks, loss-functions
Last push: 2024-04-12T21:01:35+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3115, "days_push": 873, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1410, forks 266 (observed 2026-08-28T04:04:38.776662+00:00)

## What it is
Standalone PyTorch and TensorFlow implementations of the Lovász-Softmax and Lovász Hinge loss functions for optimizing the Jaccard index (IoU) in neural networks. Published as a CVPR 2018 paper, it includes demo Jupyter notebooks for binary and multiclass segmentation training.

## Use cases
- optimize intersection-over-union directly when training segmentation models
- train semantic segmentation networks with a differentiable IoU surrogate loss
- improve mIoU on imbalanced segmentation datasets like satellite imagery
- fine-tune a cross-entropy-trained model with the Lovász-Softmax loss
- use Lovász Hinge for binary segmentation tasks in PyTorch or TensorFlow

## When to choose
- you need a differentiable loss that directly targets the Jaccard index/IoU metric
- you are doing semantic segmentation with PyTorch or TensorFlow and want a drop-in loss layer
- your segmentation dataset has class imbalance where cross-entropy underperforms on mIoU

## When to avoid
- you need a maintained library with regular updates and broad framework support
- you want losses for tasks beyond binary/multiclass segmentation
- you need a full training framework rather than standalone loss functions

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, deep-learning
- domain: machine-learning, computer-vision, image-processing
- platform: python
- tags: loss-functions, image-segmentation, pytorch, tensorflow, jaccard-index, cvpr-2018, semantic-segmentation, gpu

## Member repositories
- bermanmaxim/LovaszSoftmax (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:38.776662+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:38:27.804903+00:00, confidence not recorded.
  - readme: https://github.com/bermanmaxim/LovaszSoftmax (fetched 2026-08-28T04:04:38.776662+00:00, sha efaf1fed49b1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
