Skip to content

deel-ai-papers/consema

Repository files navigation

Conformal Prediction for Image Segmentation Using Morphological Prediction Sets

arXiv Proceedings bibtex Poster

Accepted at MICCAI 2025. Official code for the paper "Conformal Prediction for Image Segmentation Using Morphological Prediction Sets".

Luca MossinaCorentin Friedrich¹

¹ IRT Saint Exupéry. Toulouse, France

Idea

Visual example of our conformal margin: we build a morphological margin (via dilation) that covers all missed pixels (false negatives). Dataset: WBC Morphological Prediction Set Example

Synthetic example

The animation shows a sequence of four dilations by a $(3 \times 3)$ cross structuring element, which expand the margin of the predicted mask (darker blue, see fig. below). Four iterations is the minimal number of iterations needed, i.e. the nonconformity score for this specific image: all missing pixels are recovered with 4 iterations (shown in orange).

Dilation Animation

In the following image, we have a ground truth mask (in red) and a predicted mask (in blue). In purple, we have the pixels that were correctly predicted. The remaining red ones, are false negatives, i.e. pixels that belong to the ground truth but were not predicted.

Example

Method

We use morphological operations (dilation, sequences of dilations, etc.) to add a margin $\mu_{\lambda}(\hat{Y})$ around a predicted (binary) segmentation mask $\hat{Y}$, such that the ground-truth mask $Y$ is covered with high probability, and false negative pixels are statistically controlled. (Hence the repo's name, consema = Conformalized Segmentation Margins).

To make this statistically rigorous, we use conformal prediction: using calibration data, we find the minimal number of dilations $\lambda$ (applied to the predicted mask) needed to cover the ground truth, on average. We write $\delta^{\lambda}(\hat{Y})$ to say that we apply dilation $\lambda$ times, at each step adding a margin of pixels to the predicted mask $\hat{Y}$. The choice of structuring element (e.g., a cross, square, or disk) is arbitrary, the users can craft any kind of element or sequence of operations, as long as $\hat{Y}$ can "grow" in all directions and cover the whole ground truth mask $Y$.

This gives us a prediction set $C_{\lambda}(\hat{Y}) = \hat{Y} \cup \mu_{\lambda}(\hat{Y}) = \delta^{\lambda}(\hat{Y})$, which is a set of pixels that are either predicted or added by the dilation operation. The prediction set is guaranteed to cover the ground truth with a user-defined probability $\geq 1 - \alpha$, e.g., 90%:

$$\mathbb{P}(Y \subseteq C_{\lambda}(\hat{Y})) \geq 1 - \alpha$$

This is a nonparametric method, which does not require any training or hyperparameter tuning, and is model-agnostic: it can be applied to any segmentation model, including deep learning models, classical methods, or even human annotators.

  • requirement: having a set of (previously unseen) annotated calibration pairs $(X_i, Y_i)_{i=1}^n$, that are i.i.d. samples from the same distribution as the test data.

Getting started

$ make install

Examples

The directory notebooks contains complete examples for the datasets:

  • WBC and OASIS, using the UniverSeg segmentation model
  • polyps tumors dataset, using PraNet (we use precomputed predictions as distributed by A. Angelopoulos.

Sources

Starting points for datasets:

Models used:

For full bibliographic references, see the Experiments section in our paper.

License

MIT License © 2025 IRT Saint Exupéry.

Acknowledgements

Part of the DEEL project on trustworthy AI (deel.ai).

Citation

@InProceedings{Mossina_2025_conformal_morpho,
    title={Conformal Prediction for Image Segmentation Using Morphological Prediction Sets},
    author={Mossina, Luca and Friedrich, Corentin},
    booktitle={Medical Image Computing and Computer Assisted Intervention -- MICCAI 2025},
    year={2026},
    publisher={Springer Nature Switzerland},
    address={Cham},
    pages={78--88},
}

About

[MICCAI 2025] Conformal Prediction for Image Segmentation Using Morphological Prediction Sets (Conformalized Segmentation Margins)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published