🧩 RankSEG
Metric-Aware Dice/IoU Post-Processing Without Retraining
News | Quick Start | Benchmarks | Integrations | Docs | Citation
RankSEG replaces argmax or fixed thresholds with metric-aware post-processing
designed to improve Dice or IoU—no retraining or fine-tuning.
Use it with frozen PyTorch segmentation models for multiclass, binary, and
multilabel tasks, from natural images to 3D medical scans.
RankSEG on 3D CT · Same model. No retraining.
20-volume mean Dice: 50.30 → 54.87 (+4.57 pp)
Frozen MONAI BTCV Swin UNETR · MSD Pancreas.
Illustrative slice above; white outline = ground truth. Research use only.
Evaluation protocol and example selection.
📰 News
- August 2026 — RankSEG joins the official MONAI Tutorials! Try metric-aware post-processing for 3D medical segmentation. Tutorial · Colab
⚡ Quick Start
pip install -U rankseg
Optional Linux x86-64 GPU acceleration: pip install "rankseg[cuda]"
(setup and activation).
For multiclass model logits shaped (batch, classes, *spatial), with at least two classes:
from rankseg import RankSEG
probs = model_logits.softmax(dim=1)
preds = RankSEG(metric="dice")(probs) # replaces argmax; shape: (batch, *spatial)
For binary/multilabel examples, the functional API, and solver options, see the Getting Started guide.
RMA Dice offers optional memory-saving screening with safe_screening="auto".
The default remains False, preserving the original computation path. Opting in
may change masks near numerical ties. Details.
Try it online: Colab · Interactive demo
📊 Benchmarks
Same probabilities. No retraining. Selected results compare argmax with
RankSEG-RMA using the Dice objective. Scores are percentages; gains are
percentage points (pp).
Gains vary by dataset. Full results, metric definitions, runtime, and reproduction commands: rankseg-benchmark. For the algorithm and additional experiments, see our NeurIPS 2025 paper.
🔌 Integrations
Choose your workflow:
| Ecosystem | Get started | Try online |
|---|---|---|
| PyTorch | Docs · Example | Colab |
| Hugging Face | Docs · Notebook | Colab |
| SAM family | Docs · Notebook | Colab |
| MONAI | Docs · Official tutorial | Colab |
| PaddleSeg (externally maintained) | Docs · Community branch | — |
🔗 Citation
If you use RankSEG in your research, please cite our papers:
- Dai, B., & Li, C. (2023). RankSEG: A Consistent Ranking-based Framework for Segmentation. Journal of Machine Learning Research, 24(224), 1-50. [link]
- Wang, Z., & Dai, B. (2025). RankSEG-RMA: An Efficient Segmentation Algorithm via Reciprocal Moment Approximation. Advances in Neural Information Processing Systems (NeurIPS 2025). [link]
@article{dai2023rankseg,
title={RankSEG: A Consistent Ranking-based Framework for Segmentation},
author={Dai, Ben and Li, Chunlin},
journal={Journal of Machine Learning Research},
volume={24},
number={224},
pages={1--50},
url={https://www.jmlr.org/papers/v24/22-0712.html},
year={2023}
}
@inproceedings{wang2025rankseg,
title={RankSEG-RMA: An Efficient Segmentation Algorithm via Reciprocal Moment Approximation},
author={Wang, Zixun and Dai, Ben},
booktitle={Advances in Neural Information Processing Systems},
url={https://arxiv.org/abs/2510.15362},
year={2025}
}
Star us on GitHub if RankSEG helps your project! ⭐
Release files for rankseg 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rankseg-0.0.7.tar.gz | 110.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rankseg-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 159.9 kB
Release files / rankseg-0.0.7.tar.gz
| Download URL | rankseg-0.0.7.tar.gz |
|---|---|
| Size | 110.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75f64a8230f3253fcd9ae8a2fd1dfb7f7bfb0a93ae00112598aa4ce54df8da38
|
|
BLAKE2b-256 checksum How to use checksums |
153a57e888b64a4281e7473ddd662b6cae5a9e046f341503481d27cee995de14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / rankseg-0.0.7-py3-none-any.whl
| Download URL | rankseg-0.0.7-py3-none-any.whl |
|---|---|
| Size | 49.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a421c6e198bcd5b45d1972f8e867d3e2d75b9b5227cbc435a0412359cdd313bc
|
|
BLAKE2b-256 checksum How to use checksums |
02173819a64cd7c6f5224049e352172f370d70f5134993fe0db6f2151dc56c89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|