josand commited on
Commit
c77fb2c
·
verified ·
1 Parent(s): 30bbb7a

Clean model card formatting and usage

Browse files
Files changed (1) hide show
  1. README.md +87 -41
README.md CHANGED
@@ -2,77 +2,123 @@
2
  license: apache-2.0
3
  library_name: mlx
4
  tags:
5
- - medical-imaging
 
6
  - apple-silicon
 
 
 
 
7
  - research
8
  language:
9
  - en
 
 
 
10
  ---
11
- # MONAI brats_mri_segmentation (SegResNet, 4-channel MRI)
12
 
13
- Native MLX package: [segresnet-mlx](https://github.com/MedMLX/segresnet-mlx.git).
14
- Evaluated revision: `40cbce54523632fbc8cdfc564a9cce48d8df3424`.
15
 
16
- This card describes the one configuration evaluated in the MedMLX paper. It is research software; the single-case comparison does not estimate clinical accuracy.
 
17
 
18
- ## Source and checkpoint
 
 
19
 
20
- Original publisher: MONAI.
21
- Original implementation: [https://huggingface.co/MONAI/brats_mri_segmentation](https://huggingface.co/MONAI/brats_mri_segmentation).
22
- Source revision or version: `370f7f9d062745fbac445e7fe6d6616d35df04ec`.
23
- Original checkpoint: https://huggingface.co/MONAI/brats_mri_segmentation/resolve/370f7f9d062745fbac445e7fe6d6616d35df04ec/models/model.pt
 
 
24
 
25
- Conversion: segresnet_mlx.convert_checkpoint(spec=BUNDLES['brats_mri_segmentation'].spec).
26
- Conversion changes tensor layout or storage as specified by the native package; it does not retrain the model.
27
 
28
- ## Recorded example
29
 
30
- MSD Task01 BrainTumour (training) / BRATS_001; MSD Task01 BrainTumour (training) / BRATS_001; MSD Task01 BrainTumour (training) / BRATS_001; MSD Task01 BrainTumour (training) / BRATS_001
 
 
 
 
 
 
 
 
 
31
 
32
  ```python
33
  from segresnet_mlx.medmlx import run
34
 
35
- # Replace file and directory names with your locally obtained inputs and weights.
36
- kwargs = {
37
- "bundle": "brats_mri_segmentation",
38
- "weights_path": "segresnet-brats.safetensors",
39
- "output_dir": "out",
40
- "t1c_path": "T1gd.nii.gz",
41
- "t1_path": "T1w.nii.gz",
42
- "t2_path": "T2w.nii.gz",
43
- "flair_path": "FLAIR.nii.gz",
44
- "overwrite": True
45
- }
46
- result = run(**kwargs)
47
  print(result["outputs"])
48
  ```
49
 
 
 
 
 
 
 
 
 
 
 
 
50
  Native result: **success**. Original-code comparison: **pass**, `minimum_per_label_dice` = `1.0`.
51
 
52
  Native whole-volume output compared with the original MONAI bundle; the October 12 renal operator repair also has a full-case BraTS regression.
53
 
54
- The complete [native run](native-run.json) and [original-code comparison](reference-comparison.json) retain commands, geometry, precision, and output-specific checks. Use the [replay harness](https://github.com/MedMLX/Med-MLX/blob/main/benchmarks/README.md) to substitute local paths. The package README documents installation and conversion.
 
 
 
 
 
 
55
 
56
- ## Distribution terms
57
 
58
- Upstream code: **Apache-2.0**. Weights: **Apache-2.0**.
59
- Converted weights are hosted in this repository.
60
 
61
- Native whole-volume output compared with the original MONAI bundle; the October 12 renal operator repair also has a full-case BraTS regression. Converted weights may retain the identified upstream license and required notices; the accompanying notices describe the redistribution terms.
62
 
63
- Full [upstream license](LICENSE) accompanies any weight distribution.
 
 
 
64
 
65
- Required notices:
 
66
 
67
- - Retain the applicable license, copyright and attribution notices; identify the upstream checkpoint, authors, and MLX conversion changes.
68
- - Include Apache-2.0, retain applicable upstream NOTICE content, and mark modifications.
69
 
70
- Review sources:
71
 
72
- - https://huggingface.co/MONAI/brats_mri_segmentation
73
- - https://huggingface.co/MONAI/brats_mri_segmentation/resolve/370f7f9d062745fbac445e7fe6d6616d35df04ec/models/model.pt
74
- - https://huggingface.co/MONAI/brats_mri_segmentation/blob/370f7f9d062745fbac445e7fe6d6616d35df04ec/LICENSE
75
 
76
- ## Packaged files
 
77
 
78
- - `segresnet-brats.safetensors`
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  library_name: mlx
4
  tags:
5
+ - mlx
6
+ - native-mlx
7
  - apple-silicon
8
+ - medical-imaging
9
+ - mri
10
+ - brain-tumor
11
+ - segmentation
12
  - research
13
  language:
14
  - en
15
+ inference: false
16
+ pipeline_tag: image-segmentation
17
+ base_model: MONAI/brats_mri_segmentation
18
  ---
 
19
 
20
+ # SegResNet Brain Tumor Segmentation
 
21
 
22
+ Native MLX port of [MONAI BraTS MRI segmentation](https://huggingface.co/MONAI/brats_mri_segmentation).
23
+ Segment brain tumor regions from four MRI sequences locally on Apple Silicon.
24
 
25
+ - T1, contrast-enhanced T1, T2 and FLAIR inputs
26
+ - Native whole-volume segmentation with MLX
27
+ - Converted MONAI SegResNet checkpoint included
28
 
29
+ MLX implementation by [MedMLX](https://github.com/MedMLX).
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
+ **Requires the companion `segresnet-mlx` runtime.** Follow the quick start below.
33
+
34
+ ## Requirements
35
 
36
+ Apple Silicon Mac with Metal GPU access, Python 3.12 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.12
43
+ source .venv/bin/activate
44
+ uv pip install "segresnet-mlx @ git+https://github.com/MedMLX/segresnet-mlx.git" huggingface_hub
45
+
46
+ hf download MedMLX/segresnet-brats-mlx --local-dir models
47
+ ```
48
+
49
+ Authenticate with `hf auth login` if repository access is required.
50
+ Run this example in the same environment, replacing the input paths with your own:
51
 
52
  ```python
53
  from segresnet_mlx.medmlx import run
54
 
55
+ result = run(
56
+ bundle='brats_mri_segmentation',
57
+ weights_path='models/segresnet-brats.safetensors',
58
+ output_dir='outputs',
59
+ t1c_path='T1gd.nii.gz',
60
+ t1_path='T1w.nii.gz',
61
+ t2_path='T2w.nii.gz',
62
+ flair_path='FLAIR.nii.gz',
63
+ )
 
 
 
64
  print(result["outputs"])
65
  ```
66
 
67
+ ## Input and output
68
+
69
+ Input is four 3D NIfTI MRI volumes on the same voxel grid: T1,
70
+ contrast-enhanced T1, T2 and FLAIR. The example names each modality explicitly.
71
+
72
+ Output is `brats_mri_segmentation_mask.nii.gz` on the input grid. Exported
73
+ labels use the bundle’s BraTS convention: 0 background, 1 tumor core,
74
+ 2 whole tumor outside the core, 4 enhancing tumor.
75
+
76
+ ## Technical details
77
+
78
  Native result: **success**. Original-code comparison: **pass**, `minimum_per_label_dice` = `1.0`.
79
 
80
  Native whole-volume output compared with the original MONAI bundle; the October 12 renal operator repair also has a full-case BraTS regression.
81
 
82
+ These are recorded results for one configuration, not a new benchmark or an
83
+ estimate of clinical accuracy. The [native run](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/native-run.json)
84
+ and [original-code comparison](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/reference-comparison.json)
85
+ retain the commands, precision, geometry and output checks.
86
+
87
+ <details>
88
+ <summary>Checkpoint provenance and recorded configuration</summary>
89
 
90
+ Recorded configuration: **MONAI brats_mri_segmentation (SegResNet, 4-channel MRI)**.
91
 
92
+ Evaluated package revision: `40cbce54523632fbc8cdfc564a9cce48d8df3424`.
 
93
 
94
+ Recorded input: MSD Task01 BrainTumour (training) / BRATS_001.
95
 
96
+ Original publisher: MONAI.
97
+ Original implementation: [upstream source](https://huggingface.co/MONAI/brats_mri_segmentation).
98
+ Source revision or version: `370f7f9d062745fbac445e7fe6d6616d35df04ec`.
99
+ Original checkpoint: [pinned checkpoint](https://huggingface.co/MONAI/brats_mri_segmentation/resolve/370f7f9d062745fbac445e7fe6d6616d35df04ec/models/model.pt).
100
 
101
+ Weights were converted with the companion MLX package, without retraining.
102
+ Conversion changes tensor layout or storage as required by that implementation.
103
 
104
+ The [replay harness](https://github.com/MedMLX/Med-MLX/blob/main/benchmarks/README.md)
105
+ describes how to reproduce the recorded configuration with local paths.
106
 
107
+ </details>
108
 
109
+ ## Intended use
 
 
110
 
111
+ Research and education. Outputs require human review and are not intended for
112
+ clinical diagnosis or treatment decisions.
113
 
114
+ ## License
115
+
116
+ Weights: **Apache-2.0** ([license](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/LICENSE)).
117
+ Upstream code: **Apache-2.0**. MLX port code:
118
+ [Apache-2.0](https://github.com/MedMLX/segresnet-mlx/blob/main/LICENSE).
119
+
120
+ Retain the [attribution and notices](https://huggingface.co/MedMLX/segresnet-brats-mlx/blob/main/NOTICE) when redistributing
121
+ the bundle or a conversion:
122
+
123
+ - Retain the applicable license, copyright and attribution notices; identify the upstream checkpoint, authors, and MLX conversion changes.
124
+ - Include Apache-2.0, retain applicable upstream NOTICE content, and mark modifications.