Image Segmentation
Transformers
Safetensors
PyTorch
segformer
brain-mri
medical
medical-imaging
semantic-segmentation
Eval Results (legacy)
Instructions to use kiselyovd/brain-mri-segmentation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kiselyovd/brain-mri-segmentation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="kiselyovd/brain-mri-segmentation")# Load model directly from transformers import AutoImageProcessor, SegformerForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("kiselyovd/brain-mri-segmentation") model = SegformerForSemanticSegmentation.from_pretrained("kiselyovd/brain-mri-segmentation") - Notebooks
- Google Colab
- Kaggle
Upload artifacts
Browse files- README.md +56 -0
- baseline/checkpoints/best.ckpt +3 -0
- best.ckpt +3 -0
- checkpoints/best.ckpt +3 -0
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- semantic-segmentation
|
| 5 |
+
- medical-imaging
|
| 6 |
+
- brain-mri
|
| 7 |
+
- pytorch-lightning
|
| 8 |
+
- segformer
|
| 9 |
+
library_name: pytorch
|
| 10 |
+
datasets:
|
| 11 |
+
- mateuszbuda/lgg-mri-segmentation
|
| 12 |
+
pipeline_tag: image-segmentation
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# brain-mri-segmentation
|
| 16 |
+
|
| 17 |
+
Production-grade binary brain-tumor MRI segmentation (LGG / TCGA).
|
| 18 |
+
|
| 19 |
+
Binary semantic segmentation of brain-tumor regions (low-grade glioma) from FLAIR MRI slices. Main model: SegFormer-B2 fine-tuned on the Mateusz Buda LGG MRI dataset (TCGA, 110 patients, 3 929 paired slices) with a patient-level 80/10/10 split. Baseline: hand-rolled U-Net (4 levels, 32→256 ch, ~1.9 M params).
|
| 20 |
+
|
| 21 |
+
Output is a binary mask at 256 × 256 resolution (1 = tumor, 0 = background).
|
| 22 |
+
|
| 23 |
+
## Metrics
|
| 24 |
+
|
| 25 |
+
| Metric | Value |
|
| 26 |
+
|---|---|
|
| 27 |
+
| Main model | SegFormer-B2 |
|
| 28 |
+
| Main Dice | 65.5% |
|
| 29 |
+
| Main IoU | 66.2% |
|
| 30 |
+
| Main Pixel accuracy | 99.73% |
|
| 31 |
+
| Baseline model | U-Net (small) |
|
| 32 |
+
| Baseline Dice | 51.9% |
|
| 33 |
+
| Baseline IoU | 57.7% |
|
| 34 |
+
| Baseline Pixel accuracy | 99.66% |
|
| 35 |
+
| Test size (slices) | 387 |
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
from huggingface_hub import snapshot_download
|
| 41 |
+
|
| 42 |
+
from brain_mri_segmentation.inference.predict import load_model, predict
|
| 43 |
+
|
| 44 |
+
ckpt_dir = snapshot_download("kiselyovd/brain-mri-segmentation")
|
| 45 |
+
model = load_model(f"{ckpt_dir}/best.ckpt")
|
| 46 |
+
result = predict(model, "path/to/slice.png")
|
| 47 |
+
# {"mask": [[0, 0, 1, ...], ...], "shape": [256, 256]}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Intended use
|
| 51 |
+
|
| 52 |
+
Research and educational purposes only. **This is not a medical device.** Do not use for clinical decision-making. The model was trained on a single publicly available dataset and has not been validated against clinical ground truth, population diversity, acquisition-device variation, or downstream clinical workflows.
|
| 53 |
+
|
| 54 |
+
## Source
|
| 55 |
+
|
| 56 |
+
https://github.com/kiselyovd/brain-mri-segmentation
|
baseline/checkpoints/best.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:067ed818857992d3a5cc481f9cdd403a13022ddf94c1b47621ce2a5d8e3bd3b2
|
| 3 |
+
size 23244634
|
best.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e318305b3f352691af0bf9fc0970b33224db541dd2f61c73213bf18d3d5ba3f2
|
| 3 |
+
size 328664225
|
checkpoints/best.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e318305b3f352691af0bf9fc0970b33224db541dd2f61c73213bf18d3d5ba3f2
|
| 3 |
+
size 328664225
|