josand commited on
Commit
d4bbcc5
·
verified ·
1 Parent(s): e2f3a68

Clean model card formatting and usage

Browse files
Files changed (1) hide show
  1. README.md +90 -44
README.md CHANGED
@@ -2,80 +2,126 @@
2
  license: cc-by-nc-4.0
3
  library_name: mlx
4
  tags:
5
- - medical-imaging
 
6
  - apple-silicon
 
 
 
 
7
  - research
8
  language:
9
  - en
 
 
10
  ---
11
- # FleXray flux0375 single member, label 'lungs', threshold 0.5, no TTA
12
 
13
- Native MLX package: [flexray-mlx](https://github.com/MedMLX/flexray-mlx).
14
- Evaluated revision: `d768bb15d04ee677ecec0c469fd3170256b345df`.
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: VictorButoi.
21
- Original implementation: [https://github.com/VictorButoi/FleXray](https://github.com/VictorButoi/FleXray).
22
- Source revision or version: `bf6d01426fd3ae012aff9253ec9c9952c58bc960`.
23
- Original checkpoint: https://huggingface.co/VictorButoi/flexray/resolve/6b63ddf09cfdff99aea494e3738cf243a4e22cdb/members/flux0375/model.safetensors
 
 
 
 
 
24
 
25
- Conversion: released safetensors snapshot loaded directly.
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
- NLM Montgomery County CXR / MCUCXR_0001_0
 
 
 
 
31
 
32
  ```python
33
  from flexray_mlx.medmlx import run
34
 
35
- # Replace file and directory names with your locally obtained inputs and weights.
36
- kwargs = {
37
- "image_path": "MCUCXR_0001_0.png",
38
- "weights_path": "flexray",
39
- "output_dir": "out",
40
- "label_name": "lungs",
41
- "ensemble": False,
42
- "overwrite": True
43
- }
44
- result = run(**kwargs)
45
  print(result["outputs"])
46
  ```
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  Native result: **success**. Original-code comparison: **pass**, `minimum_per_label_dice` = `0.9999704176268988`.
49
 
50
  Paper uses flux0375 only; the prepared bundle supports `ensemble=False`. The unchanged upstream ensemble descriptor lists all five members, but only the flagship member is packaged. Original comparison passes. Montgomery radiograph panels are excluded from submission/distribution pending image-sharing clearance.
51
 
52
- 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.
 
 
 
53
 
54
- ## Distribution terms
 
55
 
56
- Upstream code: **MIT**. Weights: **CC-BY-NC-4.0**.
57
- Converted weights are hosted in this repository.
58
 
59
- Paper uses flux0375 only; the prepared bundle supports `ensemble=False`. The unchanged upstream ensemble descriptor lists all five members, but only the flagship member is packaged. Original comparison passes. Montgomery radiograph panels are excluded from submission/distribution pending image-sharing clearance. Converted weights may retain the identified upstream license and required notices; the accompanying notices describe the redistribution terms.
60
 
61
- Full [upstream license](LICENSE) accompanies any weight distribution.
62
 
63
- Required notices:
 
 
 
64
 
65
- - Retain the applicable license, copyright and attribution notices; identify the upstream checkpoint, authors, and MLX conversion changes.
66
- - Credit the creator and source, link the applicable CC license, retain supplied notices, and identify conversion changes.
67
- - Label converted weights noncommercial and preserve the applicable noncommercial limitation.
 
68
 
69
- Review sources:
70
 
71
- - https://github.com/VictorButoi/FleXray
72
- - https://huggingface.co/VictorButoi/flexray/resolve/6b63ddf09cfdff99aea494e3738cf243a4e22cdb/members/flux0375/model.safetensors
73
 
74
- ## Packaged files
 
75
 
76
- - `ensemble.json`
77
- - `members/flux0375/checksums.json`
78
- - `members/flux0375/config.yml`
79
- - `members/flux0375/label_schema.json`
80
- - `members/flux0375/model.safetensors`
81
- - `members/flux0375/preprocessing.json`
 
 
 
 
 
 
 
2
  license: cc-by-nc-4.0
3
  library_name: mlx
4
  tags:
5
+ - mlx
6
+ - native-mlx
7
  - apple-silicon
8
+ - medical-imaging
9
+ - x-ray
10
+ - segmentation
11
+ - noncommercial
12
  - research
13
  language:
14
  - en
15
+ inference: false
16
+ pipeline_tag: image-segmentation
17
  ---
 
18
 
19
+ # FleXray Radiograph Segmentation
 
20
 
21
+ Native MLX port of [FleXray](https://github.com/VictorButoi/FleXray).
22
+ Segment anatomical structures in radiographs locally on Apple Silicon.
23
 
24
+ - Released `flux0375` member
25
+ - Lung segmentation in the quick start
26
+ - Single-member inference; noncommercial weights
27
 
28
+ MLX implementation by [MedMLX](https://github.com/MedMLX).
29
+ [GitHub](https://github.com/MedMLX/flexray-mlx) · [Usage](https://github.com/MedMLX/flexray-mlx#quick-start) · [Upstream](https://github.com/VictorButoi/FleXray)
30
+
31
+ **Requires the companion `flexray-mlx` runtime.** Follow the quick start below.
32
+
33
+ ## Requirements
34
+
35
+ Apple Silicon Mac with Metal GPU access, Python 3.12 and [uv](https://docs.astral.sh/uv/).
36
+ The weights are included here; checkpoint conversion is not needed.
37
 
38
+ ## Quick start
 
39
 
40
+ ```bash
41
+ uv venv --python 3.12
42
+ source .venv/bin/activate
43
+ uv pip install "flexray-mlx @ git+https://github.com/MedMLX/flexray-mlx.git" huggingface_hub
44
 
45
+ hf download MedMLX/flexray-mlx --local-dir models
46
+ ```
47
+
48
+ Authenticate with `hf auth login` if repository access is required.
49
+ Run this example in the same environment, replacing the input paths with your own:
50
 
51
  ```python
52
  from flexray_mlx.medmlx import run
53
 
54
+ result = run(
55
+ image_path='chest.png',
56
+ weights_path='models',
57
+ output_dir='outputs',
58
+ label_name='lungs',
59
+ ensemble=False,
60
+ )
 
 
 
61
  print(result["outputs"])
62
  ```
63
 
64
+ Only `flux0375` is packaged. Keep `ensemble=False`; the retained upstream
65
+ ensemble descriptor lists five members, but the other four are not included.
66
+
67
+ ## Input and output
68
+
69
+ Input is one radiograph: a raster image supported by Pillow or a single-frame
70
+ 2D DICOM. The example segments the lungs.
71
+
72
+ Each run writes:
73
+
74
+ - `source_image_label.png` — 0/1 mask at source resolution
75
+ - `source_image.png` — 8-bit grayscale input
76
+ - `probabilities.npy` — float32 probabilities for all 61 labels
77
+ - `prediction.json` — label, threshold and member metadata
78
+
79
+ ## Technical details
80
+
81
  Native result: **success**. Original-code comparison: **pass**, `minimum_per_label_dice` = `0.9999704176268988`.
82
 
83
  Paper uses flux0375 only; the prepared bundle supports `ensemble=False`. The unchanged upstream ensemble descriptor lists all five members, but only the flagship member is packaged. Original comparison passes. Montgomery radiograph panels are excluded from submission/distribution pending image-sharing clearance.
84
 
85
+ These are recorded results for one configuration, not a new benchmark or an
86
+ estimate of clinical accuracy. The [native run](https://huggingface.co/MedMLX/flexray-mlx/blob/main/native-run.json)
87
+ and [original-code comparison](https://huggingface.co/MedMLX/flexray-mlx/blob/main/reference-comparison.json)
88
+ retain the commands, precision, geometry and output checks.
89
 
90
+ <details>
91
+ <summary>Checkpoint provenance and recorded configuration</summary>
92
 
93
+ Recorded configuration: **FleXray flux0375 single member, label 'lungs', threshold 0.5, no TTA**.
 
94
 
95
+ Evaluated package revision: `d768bb15d04ee677ecec0c469fd3170256b345df`.
96
 
97
+ Recorded input: NLM Montgomery County CXR / MCUCXR_0001_0.
98
 
99
+ Original publisher: VictorButoi.
100
+ Original implementation: [upstream source](https://github.com/VictorButoi/FleXray).
101
+ Source revision or version: `bf6d01426fd3ae012aff9253ec9c9952c58bc960`.
102
+ Original checkpoint: [pinned checkpoint](https://huggingface.co/VictorButoi/flexray/resolve/6b63ddf09cfdff99aea494e3738cf243a4e22cdb/members/flux0375/model.safetensors).
103
 
104
+ The released safetensors snapshot is loaded directly, without retraining.
105
+
106
+ The [replay harness](https://github.com/MedMLX/Med-MLX/blob/main/benchmarks/README.md)
107
+ describes how to reproduce the recorded configuration with local paths.
108
 
109
+ </details>
110
 
111
+ ## Intended use
 
112
 
113
+ Research and education. Outputs require human review and are not intended for
114
+ clinical diagnosis or treatment decisions.
115
 
116
+ ## License
117
+
118
+ Weights: **CC-BY-NC-4.0** ([license](https://huggingface.co/MedMLX/flexray-mlx/blob/main/LICENSE)).
119
+ Upstream code: **MIT**. MLX port code:
120
+ [Apache-2.0](https://github.com/MedMLX/flexray-mlx/blob/main/LICENSE).
121
+
122
+ Retain the [attribution and notices](https://huggingface.co/MedMLX/flexray-mlx/blob/main/NOTICE) when redistributing
123
+ the bundle or a conversion:
124
+
125
+ - Retain the applicable license, copyright and attribution notices; identify the upstream checkpoint, authors, and MLX conversion changes.
126
+ - Credit the creator and source, link the applicable CC license, retain supplied notices, and identify conversion changes.
127
+ - Label converted weights noncommercial and preserve the applicable noncommercial limitation.