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
Upload converted segresnet-brats weights and release metadata
Browse files- LICENSE +201 -0
- NOTICE +7 -0
- README.md +78 -0
- native-run.json +211 -0
- reference-comparison.json +59 -0
- segresnet-brats.safetensors +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
NOTICE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Original publisher: MONAI
|
| 2 |
+
Original source: https://huggingface.co/MONAI/brats_mri_segmentation
|
| 3 |
+
|
| 4 |
+
Retain the applicable license, copyright and attribution notices; identify the upstream checkpoint, authors, and MLX conversion changes.
|
| 5 |
+
Include Apache-2.0, retain applicable upstream NOTICE content, and mark modifications.
|
| 6 |
+
|
| 7 |
+
MLX conversion by Joseph Sandoval and Alfredo Sandoval Jr.; no retraining.
|
README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 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`
|
native-run.json
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "medmlx.run.v1",
|
| 3 |
+
"model": "segresnet-brats",
|
| 4 |
+
"configuration": "MONAI brats_mri_segmentation (SegResNet, 4-channel MRI)",
|
| 5 |
+
"date": "2026-10-08",
|
| 6 |
+
"package": {
|
| 7 |
+
"name": "segresnet-mlx",
|
| 8 |
+
"path": "<repositories>/segresnet-mlx",
|
| 9 |
+
"git_revision": "40cbce54523632fbc8cdfc564a9cce48d8df3424",
|
| 10 |
+
"branch": "main",
|
| 11 |
+
"dirty": false,
|
| 12 |
+
"remote": "https://github.com/MedMLX/segresnet-mlx.git"
|
| 13 |
+
},
|
| 14 |
+
"environment": {
|
| 15 |
+
"machine": "MacBook Pro (2021), Apple M1 Max, 10-core CPU, 24-core GPU, 64 GB",
|
| 16 |
+
"macos": "27.0",
|
| 17 |
+
"python": "3.12.12",
|
| 18 |
+
"mlx_version": "0.32.3",
|
| 19 |
+
"device": "gpu"
|
| 20 |
+
},
|
| 21 |
+
"command": {
|
| 22 |
+
"entry_point": "segresnet_mlx.medmlx:run",
|
| 23 |
+
"kwargs": {
|
| 24 |
+
"bundle": "brats_mri_segmentation",
|
| 25 |
+
"weights_path": "<paper-repo>/work/runs/weights/segresnet-brats.safetensors",
|
| 26 |
+
"output_dir": "<paper-repo>/work/runs/segresnet-brats/out",
|
| 27 |
+
"t1c_path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/T1gd.nii.gz",
|
| 28 |
+
"t1_path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/T1w.nii.gz",
|
| 29 |
+
"t2_path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/T2w.nii.gz",
|
| 30 |
+
"flair_path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/FLAIR.nii.gz",
|
| 31 |
+
"overwrite": true
|
| 32 |
+
},
|
| 33 |
+
"invocation": "cd <repositories>/segresnet-mlx && .venv/bin/python <paper-repo>/work/runs/_harness/run_one.py segresnet_mlx.medmlx <kwargs.json> <run_result.json>",
|
| 34 |
+
"process": "fresh Python process per model"
|
| 35 |
+
},
|
| 36 |
+
"checkpoint": {
|
| 37 |
+
"path": "<paper-repo>/work/runs/weights/segresnet-brats.safetensors",
|
| 38 |
+
"sha256": "9044dcf3e2a82ef18f14d7abf507debbea52e14560c304b990a4c0e412bc9c30",
|
| 39 |
+
"source": "huggingface.co/MONAI/brats_mri_segmentation@370f7f9d models/model.pt (local HF cache)",
|
| 40 |
+
"source_sha256": "860ccb3f1c21c99d0410ad8a1ac4ef6b8fab60cec0a503b0ba42675741a750ae",
|
| 41 |
+
"registry_sha256_match": true,
|
| 42 |
+
"conversion": "segresnet_mlx.convert_checkpoint(spec=BUNDLES['brats_mri_segmentation'].spec)"
|
| 43 |
+
},
|
| 44 |
+
"inputs": [
|
| 45 |
+
{
|
| 46 |
+
"role": "t1c_path",
|
| 47 |
+
"path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/T1gd.nii.gz",
|
| 48 |
+
"sha256": "96abcdbb541c4af37f03bef466eee5d11a3f91b9a1ea10b1a4a22cb38b7b3978",
|
| 49 |
+
"dataset": "MSD Task01 BrainTumour (training)",
|
| 50 |
+
"case_id": "BRATS_001",
|
| 51 |
+
"derivation": "channel split of imagesTr/BRATS_001.nii.gz (MSD order FLAIR,T1w,T1gd,T2w)"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"role": "t1_path",
|
| 55 |
+
"path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/T1w.nii.gz",
|
| 56 |
+
"sha256": "740b0adfa8de83fcbdfa5cd5f14689f6d947120bfbf057fe82954c07477bb173",
|
| 57 |
+
"dataset": "MSD Task01 BrainTumour (training)",
|
| 58 |
+
"case_id": "BRATS_001",
|
| 59 |
+
"derivation": "channel split of imagesTr/BRATS_001.nii.gz (MSD order FLAIR,T1w,T1gd,T2w)"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"role": "t2_path",
|
| 63 |
+
"path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/T2w.nii.gz",
|
| 64 |
+
"sha256": "8e2de5df0abd8b25ac1136c6570a6d03f2255107ef1265145b606f07acd1f1af",
|
| 65 |
+
"dataset": "MSD Task01 BrainTumour (training)",
|
| 66 |
+
"case_id": "BRATS_001",
|
| 67 |
+
"derivation": "channel split of imagesTr/BRATS_001.nii.gz (MSD order FLAIR,T1w,T1gd,T2w)"
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"role": "flair_path",
|
| 71 |
+
"path": "<home>/Documents/Codex/2026-10-08/https-drive-google-com-drive-folders/outputs/medmlx/datasets/qualification-2026-10-08/derived/msd-brain-channels/BRATS_001/FLAIR.nii.gz",
|
| 72 |
+
"sha256": "7571148ce691dccff5a84109091f43385b7c069a99cd7a967b2002aaeec64cdd",
|
| 73 |
+
"dataset": "MSD Task01 BrainTumour (training)",
|
| 74 |
+
"case_id": "BRATS_001",
|
| 75 |
+
"derivation": "channel split of imagesTr/BRATS_001.nii.gz (MSD order FLAIR,T1w,T1gd,T2w)"
|
| 76 |
+
}
|
| 77 |
+
],
|
| 78 |
+
"outputs": {
|
| 79 |
+
"mask": {
|
| 80 |
+
"path": "<paper-repo>/work/runs/segresnet-brats/out/brats_mri_segmentation_mask.nii.gz",
|
| 81 |
+
"sha256": "ce7f2ca25eeb2e1dea09e748dfdf1ec666a16296bc523a0b537608575ed5dcd6",
|
| 82 |
+
"label_voxel_counts": {
|
| 83 |
+
"0": 8791633,
|
| 84 |
+
"1": 27348,
|
| 85 |
+
"2": 74690,
|
| 86 |
+
"4": 34329
|
| 87 |
+
}
|
| 88 |
+
},
|
| 89 |
+
"details": {
|
| 90 |
+
"labels_present": [
|
| 91 |
+
0,
|
| 92 |
+
1,
|
| 93 |
+
2,
|
| 94 |
+
4
|
| 95 |
+
],
|
| 96 |
+
"input_shape": [
|
| 97 |
+
240,
|
| 98 |
+
240,
|
| 99 |
+
155
|
| 100 |
+
],
|
| 101 |
+
"sliding_window": {
|
| 102 |
+
"roi_size": [
|
| 103 |
+
240,
|
| 104 |
+
240,
|
| 105 |
+
160
|
| 106 |
+
],
|
| 107 |
+
"sw_batch_size": 1,
|
| 108 |
+
"overlap": 0.5
|
| 109 |
+
},
|
| 110 |
+
"seconds": {
|
| 111 |
+
"load_inputs_and_weights": 0.3394,
|
| 112 |
+
"preprocess": 0.1134,
|
| 113 |
+
"inference": 1.4535,
|
| 114 |
+
"postprocess_and_write": 0.2894
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
"checks": [
|
| 119 |
+
{
|
| 120 |
+
"name": "mask_reopens",
|
| 121 |
+
"result": "pass",
|
| 122 |
+
"detail": {
|
| 123 |
+
"dtype": "uint8",
|
| 124 |
+
"shape": [
|
| 125 |
+
240,
|
| 126 |
+
240,
|
| 127 |
+
155
|
| 128 |
+
]
|
| 129 |
+
}
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"name": "finite_integer_labels",
|
| 133 |
+
"result": "pass",
|
| 134 |
+
"detail": null
|
| 135 |
+
},
|
| 136 |
+
{
|
| 137 |
+
"name": "shape_matches_input",
|
| 138 |
+
"result": "pass",
|
| 139 |
+
"detail": {
|
| 140 |
+
"input": [
|
| 141 |
+
240,
|
| 142 |
+
240,
|
| 143 |
+
155
|
| 144 |
+
],
|
| 145 |
+
"mask": [
|
| 146 |
+
240,
|
| 147 |
+
240,
|
| 148 |
+
155
|
| 149 |
+
]
|
| 150 |
+
}
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"name": "affine_matches_input",
|
| 154 |
+
"result": "pass",
|
| 155 |
+
"detail": {
|
| 156 |
+
"max_abs_diff": 0.0
|
| 157 |
+
}
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"name": "labels_in_expected_set",
|
| 161 |
+
"result": "pass",
|
| 162 |
+
"detail": {
|
| 163 |
+
"observed": [
|
| 164 |
+
0,
|
| 165 |
+
1,
|
| 166 |
+
2,
|
| 167 |
+
4
|
| 168 |
+
],
|
| 169 |
+
"allowed": [
|
| 170 |
+
0,
|
| 171 |
+
1,
|
| 172 |
+
2,
|
| 173 |
+
4
|
| 174 |
+
]
|
| 175 |
+
}
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"name": "foreground_nonempty",
|
| 179 |
+
"result": "pass",
|
| 180 |
+
"detail": {
|
| 181 |
+
"foreground_voxels": 136367
|
| 182 |
+
}
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"name": "required_labels_present",
|
| 186 |
+
"result": "pass",
|
| 187 |
+
"detail": {
|
| 188 |
+
"required": [
|
| 189 |
+
1,
|
| 190 |
+
2
|
| 191 |
+
]
|
| 192 |
+
}
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"name": "tumor_overlaps_annotated_region",
|
| 196 |
+
"result": "pass",
|
| 197 |
+
"detail": {
|
| 198 |
+
"whole_tumor_dice_vs_msd_label_informational": 0.8897
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
],
|
| 202 |
+
"duration_s": 2.271,
|
| 203 |
+
"timing_boundary": "wall clock around the single run() call: weight loading, preprocessing, MLX inference and export; interpreter start-up and package import excluded; one run, no warmup",
|
| 204 |
+
"mlx_peak_gb": 6.954,
|
| 205 |
+
"memory_definition": "mx.get_peak_memory() after mx.reset_peak_memory() immediately before run(); decimal GB",
|
| 206 |
+
"panel": "paper/figures/runs/segresnet-brats.png",
|
| 207 |
+
"status": "success",
|
| 208 |
+
"failure_cause": null,
|
| 209 |
+
"notes": "BRATS_001 is training-exposed MSD data; overlap with the MSD label is a sanity check, not an accuracy claim.",
|
| 210 |
+
"key_check": "labels [1, 2, 4]; whole_tumor_dice_vs_msd_label_informational = 0.8897"
|
| 211 |
+
}
|
reference-comparison.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "medmlx.reference.v1",
|
| 3 |
+
"model": "segresnet-brats",
|
| 4 |
+
"date": "2026-10-12",
|
| 5 |
+
"case": {
|
| 6 |
+
"dataset": "MSD Task01 BrainTumour (training)",
|
| 7 |
+
"case_id": "BRATS_001",
|
| 8 |
+
"input_sha256": {
|
| 9 |
+
"t1c_path": "96abcdbb541c4af37f03bef466eee5d11a3f91b9a1ea10b1a4a22cb38b7b3978",
|
| 10 |
+
"t1_path": "740b0adfa8de83fcbdfa5cd5f14689f6d947120bfbf057fe82954c07477bb173",
|
| 11 |
+
"t2_path": "8e2de5df0abd8b25ac1136c6570a6d03f2255107ef1265145b606f07acd1f1af",
|
| 12 |
+
"flair_path": "7571148ce691dccff5a84109091f43385b7c069a99cd7a967b2002aaeec64cdd"
|
| 13 |
+
}
|
| 14 |
+
},
|
| 15 |
+
"original": {
|
| 16 |
+
"code": "MONAI / MONAI model-zoo brats_mri_segmentation",
|
| 17 |
+
"version_or_commit": "MONAI 1.6.0 (eccefc57550b111ed781d82249dfe77872a0e918); model-zoo db9eeeef7ba64ce2ced0230d9bd4c524f69b7f0c",
|
| 18 |
+
"device": "cpu",
|
| 19 |
+
"precision": "float32 (AMP disabled on CPU)",
|
| 20 |
+
"checkpoint_sha256": "860ccb3f1c21c99d0410ad8a1ac4ef6b8fab60cec0a503b0ba42675741a750ae",
|
| 21 |
+
"command": "<paper-repo>/work/reference/segresnet-brats/.venv/bin/python -I -B <paper-repo>/benchmarks/reference/segresnet-brats.py"
|
| 22 |
+
},
|
| 23 |
+
"mlx": {
|
| 24 |
+
"run_record": "results/runs/segresnet-brats.json",
|
| 25 |
+
"output_path": "<paper-repo>/work/runs/segresnet-brats/out/brats_mri_segmentation_mask.nii.gz",
|
| 26 |
+
"output_sha256": "ce7f2ca25eeb2e1dea09e748dfdf1ec666a16296bc523a0b537608575ed5dcd6"
|
| 27 |
+
},
|
| 28 |
+
"comparison": {
|
| 29 |
+
"metric": "minimum_per_label_dice",
|
| 30 |
+
"value": 1.0,
|
| 31 |
+
"per_label": {
|
| 32 |
+
"0": {
|
| 33 |
+
"dice": 1.0,
|
| 34 |
+
"original_voxels": 8791633,
|
| 35 |
+
"mlx_voxels": 8791633
|
| 36 |
+
},
|
| 37 |
+
"1": {
|
| 38 |
+
"dice": 1.0,
|
| 39 |
+
"original_voxels": 27348,
|
| 40 |
+
"mlx_voxels": 27348
|
| 41 |
+
},
|
| 42 |
+
"2": {
|
| 43 |
+
"dice": 1.0,
|
| 44 |
+
"original_voxels": 74690,
|
| 45 |
+
"mlx_voxels": 74690
|
| 46 |
+
},
|
| 47 |
+
"4": {
|
| 48 |
+
"dice": 1.0,
|
| 49 |
+
"original_voxels": 34329,
|
| 50 |
+
"mlx_voxels": 34329
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"threshold": 0.99,
|
| 54 |
+
"differing_voxel_count": 0,
|
| 55 |
+
"result": "pass"
|
| 56 |
+
},
|
| 57 |
+
"notes": "Pinned original MONAI CPU SegResNet and full bundle preprocessing, SlidingWindowInferer and postprocessing. Channel order T1gd,T1w,T2w,FLAIR is exactly the recorded MLX order; case.input_sha256 contains each recorded role's checksum. Original model.pt was found in the recorded HF snapshot 370f7f9d062745fbac445e7fe6d6616d35df04ec and matches source_sha256. Sigmoid, inverse transform, threshold 0.5 and original BraTS label precedence 4 > 1 > 2 used. Dice covers every label including background; all MRI grids and both mask affines/shapes match. AMP is disabled for CPU float32 inference. Raw outputs, source configuration, dependency versions and log: work/reference/segresnet-brats/. Training-exposed MSD case; this is reproducibility evidence, not an accuracy study.",
|
| 58 |
+
"failure": null
|
| 59 |
+
}
|
segresnet-brats.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9044dcf3e2a82ef18f14d7abf507debbea52e14560c304b990a4c0e412bc9c30
|
| 3 |
+
size 18817003
|