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

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

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! ⭐

Metadata

Release files for rankseg 0.0.8

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.8
File Size Uploaded Provenance Actions
rankseg-0.0.8.tar.gz 112.3 kB Without provenance Details for rankseg-0.0.8.tar.gz

Built distribution (wheel)

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

Total release size: 162.5 kB

Release files / rankseg-0.0.8.tar.gz

Download URL rankseg-0.0.8.tar.gz
Size 112.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d1ad0d37853eaf6e68c1ce2f281501a2a6383b4d2cd034592c87c7aedd1585e3
BLAKE2b-256 checksum
How to use checksums
b52169a9516028a9a251114d21be3b119c167e866f144e916a6e16e813a0b190
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.8-py3-none-any.whl

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

Security for rankseg 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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