Skip to main content

🧩 RankSEG

Metric-Aware Dice/IoU Post-Processing Without Retraining

PyPI License Python PyTorch GitHub Stars Documentation Hugging Face Spaces Open In Colab 中文文档

JMLR NeurIPS

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.

Pancreas CT slice: ground truth, argmax (Dice 35.0), and RankSEG (Dice 49.3). White outlines mark ground truth.

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

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.

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).

Selected RankSEG benchmark results comparing Dice and IoU with argmax on five datasets

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.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rankseg 0.0.6
File Size Uploaded
rankseg-0.0.6.tar.gz 58.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rankseg 0.0.6
File Interpreter ABI Platform
rankseg-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 93.8 kB

Release files / rankseg-0.0.6.tar.gz

Download URL rankseg-0.0.6.tar.gz
Size 58.9 kB
Tags Source
SHA-256 checksum
How to use checksums
517f5d06502b6d9f10cf3218c785285c646a3c5cc407d520d6d01ed6d3431872
BLAKE2b-256 checksum
How to use checksums
d3a9ec1d283dac430edccb61e2449288f7d4235861a57f6d281a4bd13797a6f2
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.6-py3-none-any.whl

Download URL rankseg-0.0.6-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7a32cba7d8e2ffe247eb49a25fadf9d769fd22b0876794313a9ad49f945c73a
BLAKE2b-256 checksum
How to use checksums
df209dd503ee4ceb68359a45eb999cdc070e2ed032060279f29a5b13ab5aab67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

0.0.7

2 release files

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page