Image Segmentation
MLX
English
native-mlx
apple-silicon
medical-imaging
mri
brain-tumor
segmentation
research
Instructions to use MedMLX/segresnet-brats-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use MedMLX/segresnet-brats-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download MedMLX/segresnet-brats-mlx --local-dir segresnet-brats-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Simplify model card with concise usage and MedMLX branding
Browse files- README.md +17 -75
- banner.png +0 -0
- banner.svg +1 -0
README.md
CHANGED
|
@@ -17,38 +17,35 @@ pipeline_tag: image-segmentation
|
|
| 17 |
base_model: MONAI/brats_mri_segmentation
|
| 18 |
---
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
Segment brain tumor regions from four MRI sequences locally on Apple Silicon.
|
| 24 |
|
| 25 |
-
|
| 26 |
-
- Native whole-volume segmentation with MLX
|
| 27 |
-
- Converted MONAI SegResNet checkpoint included
|
| 28 |
|
| 29 |
-
|
| 30 |
-
[GitHub](https://github.com/MedMLX/segresnet-mlx) · [Usage](https://github.com/MedMLX/segresnet-mlx#quick-start) · [Upstream](https://huggingface.co/MONAI/brats_mri_segmentation)
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
Apple Silicon Mac with Metal GPU access, Python 3.13 or 3.14 and [uv](https://docs.astral.sh/uv/).
|
| 37 |
-
The weights are included here; checkpoint conversion is not needed.
|
| 38 |
|
| 39 |
## Quick start
|
| 40 |
|
| 41 |
```bash
|
| 42 |
uv venv --python 3.13
|
| 43 |
source .venv/bin/activate
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
uv tool install huggingface-hub
|
| 46 |
|
| 47 |
hf download MedMLX/segresnet-brats-mlx --local-dir models
|
| 48 |
```
|
| 49 |
|
| 50 |
-
|
| 51 |
-
Run this example in the same environment, replacing the input paths with your own:
|
| 52 |
|
| 53 |
```python
|
| 54 |
from segresnet_mlx.medmlx import run
|
|
@@ -65,65 +62,10 @@ result = run(
|
|
| 65 |
print(result["outputs"])
|
| 66 |
```
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
Input is four 3D NIfTI MRI volumes on the same voxel grid: T1,
|
| 71 |
-
contrast-enhanced T1, T2 and FLAIR. The example names each modality explicitly.
|
| 72 |
-
|
| 73 |
-
Output is `brats_mri_segmentation_mask.nii.gz` on the input grid. Exported
|
| 74 |
-
labels use the bundle’s BraTS convention: 0 background, 1 tumor core,
|
| 75 |
-
2 whole tumor outside the core, 4 enhancing tumor.
|
| 76 |
-
|
| 77 |
-
## Technical details
|
| 78 |
-
|
| 79 |
-
The companion runtime is [v0.2.1](https://github.com/MedMLX/segresnet-mlx/releases/tag/v0.2.1), source `b5cc265cd0426fe8f64b40a8ed9be4c42a599724`, with `medmlx-core==0.2.3`. All 83 tensors here exactly match a fresh CPU host conversion of the pinned BraTS source checkpoint through that installed release's public `convert_state_dict` API. The weights were retained unchanged.
|
| 80 |
-
|
| 81 |
-
The current fresh-wheel suite passed 145 tests with zero skips: 133 ordinary cases and 12 released **renal** checkpoint cases. Those renal results do not qualify this BraTS checkpoint. The full-volume BraTS comparison below is historical and retains its original software revision and one-case scope; no new full-volume BraTS or clinical performance claim is made.
|
| 82 |
-
|
| 83 |
-
Historical native result: **success**. Original-code comparison: **pass**, `minimum_per_label_dice` = `1.0`.
|
| 84 |
-
|
| 85 |
-
Native whole-volume output compared with the original MONAI bundle; the October 12 renal operator repair also has a full-case BraTS regression.
|
| 86 |
-
|
| 87 |
-
These are recorded results for one configuration, not a new benchmark or an
|
| 88 |
-
estimate of clinical accuracy. The [native run](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/native-run.json)
|
| 89 |
-
and [original-code comparison](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/reference-comparison.json)
|
| 90 |
-
retain the commands, precision, geometry and output checks.
|
| 91 |
-
|
| 92 |
-
<details>
|
| 93 |
-
<summary>Checkpoint provenance and recorded configuration</summary>
|
| 94 |
-
|
| 95 |
-
Recorded configuration: **MONAI brats_mri_segmentation (SegResNet, 4-channel MRI)**.
|
| 96 |
-
|
| 97 |
-
Evaluated package revision: `40cbce54523632fbc8cdfc564a9cce48d8df3424`.
|
| 98 |
-
|
| 99 |
-
Recorded input: MSD Task01 BrainTumour (training) / BRATS_001.
|
| 100 |
-
|
| 101 |
-
Original publisher: MONAI.
|
| 102 |
-
Original implementation: [upstream source](https://huggingface.co/MONAI/brats_mri_segmentation).
|
| 103 |
-
Source revision or version: `370f7f9d062745fbac445e7fe6d6616d35df04ec`.
|
| 104 |
-
Original checkpoint: [pinned checkpoint](https://huggingface.co/MONAI/brats_mri_segmentation/resolve/370f7f9d062745fbac445e7fe6d6616d35df04ec/models/model.pt).
|
| 105 |
-
|
| 106 |
-
Weights were converted with the companion MLX package, without retraining.
|
| 107 |
-
Conversion changes tensor layout or storage as required by that implementation.
|
| 108 |
-
|
| 109 |
-
The [replay harness](https://github.com/MedMLX/Med-MLX/blob/main/benchmarks/README.md)
|
| 110 |
-
describes how to reproduce the recorded configuration with local paths.
|
| 111 |
-
|
| 112 |
-
</details>
|
| 113 |
-
|
| 114 |
-
## Intended use
|
| 115 |
-
|
| 116 |
-
Research and education. Outputs require human review and are not intended for
|
| 117 |
-
clinical diagnosis or treatment decisions.
|
| 118 |
-
|
| 119 |
-
## License
|
| 120 |
|
| 121 |
-
|
| 122 |
-
Upstream code: **Apache-2.0**. MLX port code:
|
| 123 |
-
[Apache-2.0](https://github.com/MedMLX/segresnet-mlx/blob/main/LICENSE).
|
| 124 |
|
| 125 |
-
|
| 126 |
-
the bundle or a conversion:
|
| 127 |
|
| 128 |
-
-
|
| 129 |
-
- Include Apache-2.0, retain applicable upstream NOTICE content, and mark modifications.
|
|
|
|
| 17 |
base_model: MONAI/brats_mri_segmentation
|
| 18 |
---
|
| 19 |
|
| 20 |
+
<img src="https://huggingface.co/MedMLX/segresnet-brats-mlx/resolve/main/banner.png" alt="MedMLX — Segment. BRAIN MRI / SEGRESNET" width="100%">
|
| 21 |
|
| 22 |
+
# SegResNet · Brain Tumor
|
|
|
|
| 23 |
|
| 24 |
+
Segment brain tumor regions from four MRI sequences with the MONAI SegResNet checkpoint.
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
[GitHub](https://github.com/MedMLX/segresnet-mlx) · [Files](https://huggingface.co/MedMLX/segresnet-brats-mlx/tree/main) · [Docs](https://github.com/MedMLX/segresnet-mlx/blob/main/README.md#quick-start)
|
|
|
|
| 27 |
|
| 28 |
+
| Input | Output |
|
| 29 |
+
| :--- | :--- |
|
| 30 |
+
| T1, T1ce, T2 + FLAIR · NIfTI | Brain tumor segmentation |
|
| 31 |
|
| 32 |
+
**Apple Silicon · Metal · Python 3.13 / 3.14**
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
## Quick start
|
| 35 |
|
| 36 |
```bash
|
| 37 |
uv venv --python 3.13
|
| 38 |
source .venv/bin/activate
|
| 39 |
+
|
| 40 |
+
repo="https://github.com/MedMLX/segresnet-mlx"
|
| 41 |
+
release="$repo/releases/download/v0.2.1"
|
| 42 |
+
uv pip install "$release/segresnet_mlx-0.2.1-py3-none-any.whl"
|
| 43 |
uv tool install huggingface-hub
|
| 44 |
|
| 45 |
hf download MedMLX/segresnet-brats-mlx --local-dir models
|
| 46 |
```
|
| 47 |
|
| 48 |
+
Replace the example input paths with your own files.
|
|
|
|
| 49 |
|
| 50 |
```python
|
| 51 |
from segresnet_mlx.medmlx import run
|
|
|
|
| 62 |
print(result["outputs"])
|
| 63 |
```
|
| 64 |
|
| 65 |
+
All four MRI volumes must share the same voxel grid.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
## Use & license
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
For research and education. Not validated for clinical use.
|
|
|
|
| 70 |
|
| 71 |
+
Weights: [Apache-2.0](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/LICENSE). [Notices](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/NOTICE).
|
|
|
banner.png
ADDED
|
banner.svg
ADDED
|
|