Ayush Deshmukh Home

Finding the 0.01%

Tumour segmentation in PET/CT scans with a loss built for extreme class imbalance · Image and Speech Processing Lab, NITK

Ayush Deshmukh · supervised by Assoc. Prof. Jeny Rajan, NIT Karnataka

TL;DR In these PET/CT scans, tumour pixels are under 0.01% of the data, so a model can score almost perfectly by predicting "no tumour" everywhere. I wrote a binary weighted focal Tversky loss that makes missed tumour pixels expensive, combined it with BCE and Dice, and took a TransUNet from a Dice score of 0.41 to 0.656. It was the best of the 23 configurations I tested.

The problem

Tumour segmentation should be about the rare pixels. Here, across more than 30,000 PET and CT images, tumour made up less than one pixel in ten thousand. With standard losses the easy answer wins: predict background everywhere, get a great-looking pixel accuracy and a useless model. Accuracy doesn't matter here; what matters is whether you find the tumour, and whether what you mark as tumour really is one.

The loss

I started from the Tversky index, a Dice-like overlap score that weighs false positives and false negatives separately, and changed it in two ways:

On its own the Tversky term can be unstable, so the final objective is a weighted mix: 0.6 × BCE + 0.4 × weighted focal Tversky + 0.6 × Dice. BCE keeps per-pixel gradients well behaved, Dice rewards overlap, and the Tversky term is what makes the rare class count.

Setup

Results

Context

This was a research project from October 2023 to February 2024 with the Image and Speech Processing Lab at NIT Karnataka, supervised by Assoc. Prof. Jeny Rajan. It's also where I first ran into the problem that came back in the Mpox work: when the class you care about is rare, the loss function decides what the model learns.