Tissue error against SegFormer on the Tissues with Issues test set: 0.5 mm² per slide, every slide against the dataset's own mask
48db9ee verified |
Download README.md from CancerCenterAI/macrotome-segformer-fast: direct link, hf CLI and curl.
- Browser
- Download file 3.98 kB
-
https://huggingface.co/CancerCenterAI/macrotome-segformer-fast/resolve/main/README.md
- Command line
-
hf download hf://CancerCenterAI/macrotome-segformer-fast/README.md
-
curl -L -o README.md https://huggingface.co/CancerCenterAI/macrotome-segformer-fast/resolve/main/README.md
3.98 kB
| license: cc-by-nc-sa-4.0 | |
| base_model: nvidia/mit-b0 | |
| base_model_relation: finetune | |
| tags: | |
| - pathology | |
| - whole-slide-image | |
| - tissue-segmentation | |
| - image-segmentation | |
| - quality-control | |
| pipeline_tag: image-segmentation | |
| # macrotome SegFormer fast | |
| SegFormer with the small MiT-B0 encoder (3.7 M parameters) and three sigmoid heads, trained with the recipe and labels of the first release of [macrotome SegFormer](https://huggingface.co/CancerCenterAI/macrotome-segformer) (MiT-B2, `macrotome-segformer-0.1`): 768 px crops on the labels of 12 November 2026. Made for computers without a GPU: about 30 s per 50 × 25 mm slide on 24 CPU cores (SegFormer 70 s), 1.5 s on an RTX 3090 (SegFormer 2 s), in 2048 px tiles at 8 µm/px. It has more tissue error (false and missed tissue) than SegFormer: about 0.9 mm² more per slide on the held-out set and 0.5 mm² on the Tissues with Issues test set; on the Conflux test slides the two do not differ measurably. | |
| Segmentation of brightfield whole-slide images into three layers at 8 µm/px, for any stain, organ and scanner: | |
| - **tissue**: every piece of tissue on the glass, including fat, pale IHC and small fragments; | |
| - **pen**: marker ink and printed marks, on glass or over tissue; | |
| - **quality**: image defects such as bubbles, folds, blur, debris, coverslip edges and dark scan corners. | |
| Part of [macrotome](https://github.com/cancercenterai/macrotome). Other macrotome models: [SegFormer](https://huggingface.co/CancerCenterAI/macrotome-segformer), [SAM 2.1](https://huggingface.co/CancerCenterAI/macrotome-sam2.1), [SAM 3](https://huggingface.co/CancerCenterAI/macrotome-sam3). | |
| ## Use | |
| ```bash | |
| pip install "macrotome[segformer] @ git+https://github.com/cancercenterai/macrotome" | |
| macrotome segment slide.svs --model segformer-fast --out out/ | |
| ``` | |
| ```python | |
| import macrotome | |
| model = macrotome.load("segformer-fast") # downloads the weights from this repository | |
| res = model.segment("slide.svs") | |
| tissue, pen, quality = res.mask("tissue"), res.mask("pen"), res.mask("quality") | |
| res.write("out/") # label TIFF, QuPath GeoJSON, JSON summary, overlay | |
| ``` | |
| ## QuPath | |
| `segformer_b0.torchscript.pt` (float32, for the CPU and Apple's GPU) and `segformer_b0.torchscript-bf16.pt` (bfloat16, for an NVIDIA GPU, as the | |
| published scores) are this model as TorchScript, for the macrotome QuPath extension, which downloads them itself. They | |
| take float RGB in 0..255 and return the three probabilities; the tile size, overlap, the 32 px white margin at image | |
| edges and the resolution are in `macrotome.json` inside each file. | |
| ## Results | |
| 98 held-out slides (Tissues with Issues, Conflux, pathologist-labelled breast slides). The SegFormers were trained on none | |
| of them. The two SAM models were trained on an earlier label snapshot that still held the 20 breast slides; on those | |
| 20 slides they score the same as SegFormer models that never saw them (Dice 0.967–0.971). | |
| | | Tissue Dice median / p10 | False tissue mm²/slide | Pen F1 | Quality P / R | | |
| |---|---|---|---|---| | |
| | SegFormer | 0.988 / 0.962 | 3.1 | 0.941 | 0.68 / 0.77 | | |
| | **SegFormer fast** | 0.984 / 0.954 | 3.4 | 0.932 | 0.72 / 0.73 | | |
| | SAM 2.1 tuned | 0.984 / 0.951 | 5.5 | 0.903 | 0.76 / 0.63 | | |
| | SAM 3 tuned | 0.984 / 0.958 | 4.1 | 0.932 | 0.86 / 0.62 | | |
| | SlideSegmenter | 0.951 / 0.751 | 14.2 | 0.691 | – | | |
| Every row is scored on the labels of 26 November 2026. | |
| Training data, evaluation on the public test sets, examples and limitations are in the | |
| [repository README](https://github.com/cancercenterai/macrotome). | |
| ## Licence | |
| CC BY-NC-SA 4.0: research and other non-commercial use, with attribution, and adaptations under the same terms. The training data include sets under non-commercial and share-alike terms. The encoder starts from NVIDIA's MiT-B0 ImageNet weights (NVIDIA Source Code License, non-commercial). | |
| Not for clinical use: the models are research tools and are not validated for diagnosis or any clinical decision. | |