AIOmarRehan commited on
Commit
c58b7d0
·
verified ·
1 Parent(s): 52c197e

SegResNet weights, TorchScript export and model card

Browse files
.gitattributes CHANGED
@@ -1,35 +1 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.pt filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: monai
4
+ pipeline_tag: image-segmentation
5
+ tags:
6
+ - medical-imaging
7
+ - mri
8
+ - brain-tumour
9
+ - segmentation
10
+ - segresnet
11
+ - monai
12
+ - brats
13
+ - 3d
14
+ ---
15
+
16
+ # MEDTRACE brain tumour segmentation (SegResNet)
17
+
18
+ 3D tumour compartment segmentation from four co-registered MRI sequences. Trained on BraTS 2023 GLI and used by the [MEDTRACE](https://huggingface.co/spaces/AIOmarRehan/medtrace) longitudinal workstation.
19
+
20
+ > [!WARNING]
21
+ > **Research prototype. Not a medical device.** Not for diagnosis, treatment planning, or any clinical decision. Not clinically validated. It has been measured against one annotation protocol on one dataset, which is agreement, not clinical accuracy.
22
+
23
+ ## Results on the held-out test split
24
+
25
+ 186 cases from 169 subjects, split by subject so no subject appears in two splits.
26
+
27
+ | Region | Dice mean | Dice median | HD95 median | Sensitivity | Precision |
28
+ |---|---|---|---|---|---|
29
+ | Tumour core | 0.908 | 0.956 | 2.00 | 0.917 | 0.917 |
30
+ | Whole tumour | 0.922 | 0.949 | 2.45 | 0.925 | 0.924 |
31
+ | Enhancing tumour | 0.852 | 0.898 | 1.41 | 0.883 | 0.849 |
32
+
33
+ Empty regions follow the BraTS convention: with empty ground truth, Dice is 1 if the prediction is also empty and 0 otherwise, rather than being averaged away as NaN.
34
+
35
+ **Use the test figures, not the validation ones.** Epoch selection and post-processing thresholds were both tuned on the validation split, so validation numbers are optimistic by construction.
36
+
37
+ ## Files
38
+
39
+ | File | Size | Contents |
40
+ |---|---|---|
41
+ | `medtrace_seg_best.pt` | 72 MB | Selected weights, epoch 32 |
42
+ | `medtrace_seg.torchscript.pt` | 72 MB | TorchScript export, no MONAI needed to run |
43
+ | `model_card.json` | 6 KB | Full machine-readable card: architecture, contracts, metrics, environment |
44
+
45
+ ## Input contract
46
+
47
+ **Channel order is not recoverable from the weights. The wrong order gives wrong output and no error.**
48
+
49
+ ```
50
+ channels: [t1c, t1n, t2f, t2w]
51
+ normalisation: per case, per channel, zero mean unit variance over NON-ZERO voxels only
52
+ spacing: 1.0 x 1.0 x 1.0 mm
53
+ preprocessing: skull-stripped and co-registered, as BraTS 2023 distributes it
54
+ cropping: non-zero bounding box of the summed channels, 4 voxel margin
55
+ patch size: 128 x 128 x 128
56
+ inference: sliding window, overlap 0.5, gaussian blend
57
+ ```
58
+
59
+ ## Output contract
60
+
61
+ Three **overlapping** channels with independent sigmoid activation, not a softmax over classes.
62
+
63
+ | Channel | Meaning |
64
+ |---|---|
65
+ | `TC` | Tumour core: necrotic core + enhancing |
66
+ | `WT` | Whole tumour: necrotic core + oedema + enhancing |
67
+ | `ET` | Enhancing tumour |
68
+
69
+ Thresholded at 0.5, with enhancing tumour suppressed below 200 voxels. To convert to BraTS integer labels, write `WT` as 2, then `TC` as 1, then `ET` as 3, **in that order**: the regions overlap, so the write order is what produces the correct nesting.
70
+
71
+ ## Architecture and training
72
+
73
+ `monai.networks.nets.SegResNet`, 18.8M parameters, 4 input channels, 3 output channels, `init_filters=32`, `blocks_down=[1,2,2,4]`, `blocks_up=[1,1,1]`, `dropout_prob=0.2`.
74
+
75
+ DiceFocalLoss with AdamW at lr 2e-4, cosine annealing, AMP float16, on a Tesla T4. 37 epochs completed of 60 planned; epoch 32 selected on mean validation Dice. Patch sampling was 80% centred on whole tumour, 20% uniform. Augmentation was random axis flips and intensity scale and shift within 10%. Seed 20260813.
76
+
77
+ MONAI 1.6.0, PyTorch 2.10.0+cu128.
78
+
79
+ ## Limitations
80
+
81
+ - Trained on **pre-operative adult glioma only**. Post-treatment appearances, including resection cavities and radiation change, are not represented.
82
+ - Requires **all four sequences**. Behaviour with one missing is untested.
83
+ - Assumes BraTS preprocessing: skull-stripped, co-registered, 1 mm isotropic.
84
+ - Agreement with one annotation protocol on one dataset is not a measure of clinical accuracy.
85
+
86
+ ## A note on how MEDTRACE uses this
87
+
88
+ The hosted MEDTRACE demo does **not** run this model. Its measurements come from expert-corrected segmentations shipped with RHUH-GBM, because that dataset is post-operative and post-treatment, which is exactly the regime this model was not trained for. Publishing the model and measuring with it are separate decisions, and only one of them is justified by the numbers above.
89
+
90
+ ## Training data and required citations
91
+
92
+ Trained on the **BraTS 2023 GLI** challenge training split, the only labelled split. The BraTS data use agreement grants use and requires citation; it does **not** grant redistribution, so no BraTS imaging appears in this repository or in any MEDTRACE artefact.
93
+
94
+ > Menze, B. H., et al. (2015). The Multimodal Brain Tumor Image Segmentation Benchmark (BRATS). IEEE Transactions on Medical Imaging, 34(10), 1993-2024. https://doi.org/10.1109/TMI.2014.2377694
95
+
96
+ > Bakas, S., et al. (2017). Advancing The Cancer Genome Atlas glioma MRI collections with expert segmentation labels and radiomic features. Scientific Data, 4, 170117. https://doi.org/10.1038/sdata.2017.117
97
+
98
+ > Baid, U., et al. (2021). The RSNA-ASNR-MICCAI BraTS 2021 Benchmark on Brain Tumor Segmentation and Radiogenomic Classification. arXiv:2107.02314. https://doi.org/10.48550/arXiv.2107.02314
99
+
100
+ ## Related
101
+
102
+ - Space: [AIOmarRehan/medtrace](https://huggingface.co/spaces/AIOmarRehan/medtrace)
103
+ - Dataset: [AIOmarRehan/medtrace-rhuh-gbm-derived](https://huggingface.co/datasets/AIOmarRehan/medtrace-rhuh-gbm-derived)
104
+ - Code: [github.com/AIOmarRehan/medtrace](https://github.com/AIOmarRehan/medtrace)
medtrace_seg.torchscript.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a3ae7875399bef7fe905e0b336c3a5f75f428c5952b67299220cafcf15d7992
3
+ size 75452080
medtrace_seg_best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:885b7acf5332a86b94afa6c3fdb0fb03532526c7f81e3bfd7636cf818817ac89
3
+ size 75228900
model_card.json ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "medtrace-brats-seg",
3
+ "version": "1.0.0",
4
+ "task": "3D brain tumour segmentation from four MRI sequences",
5
+ "intended_use": "Produce tumour compartment masks for MEDTRACE's longitudinal measurement pipeline. Research use. Not a diagnostic device and not for clinical decision-making.",
6
+ "architecture": {
7
+ "class": "monai.networks.nets.SegResNet",
8
+ "spatial_dims": 3,
9
+ "in_channels": 4,
10
+ "out_channels": 3,
11
+ "init_filters": 32,
12
+ "blocks_down": [
13
+ 1,
14
+ 2,
15
+ 2,
16
+ 4
17
+ ],
18
+ "blocks_up": [
19
+ 1,
20
+ 1,
21
+ 1
22
+ ],
23
+ "dropout_prob": 0.2,
24
+ "parameters": 18798627
25
+ },
26
+ "input_contract": {
27
+ "channel_order": [
28
+ "t1c",
29
+ "t1n",
30
+ "t2f",
31
+ "t2w"
32
+ ],
33
+ "note": "Channel order is not recoverable from the weights. Wrong order, wrong output, no error.",
34
+ "normalisation": "per case, per channel, zero mean unit variance over NON-ZERO voxels only",
35
+ "spacing_mm": [
36
+ 1.0,
37
+ 1.0,
38
+ 1.0
39
+ ],
40
+ "orientation": "as distributed by BraTS 2023 (already co-registered and skull-stripped)",
41
+ "cropping": "crop to the non-zero bounding box of the summed channels, 4 voxel margin",
42
+ "patch_size": [
43
+ 128,
44
+ 128,
45
+ 128
46
+ ],
47
+ "inference": {
48
+ "method": "sliding window",
49
+ "overlap": 0.5,
50
+ "blend": "gaussian"
51
+ }
52
+ },
53
+ "output_contract": {
54
+ "activation": "sigmoid, independent per channel",
55
+ "channels": [
56
+ "TC",
57
+ "WT",
58
+ "ET"
59
+ ],
60
+ "channel_meaning": {
61
+ "TC": "tumour core = necrotic core + enhancing",
62
+ "WT": "whole tumour = necrotic core + oedema + enhancing",
63
+ "ET": "enhancing tumour"
64
+ },
65
+ "overlapping": true,
66
+ "postprocessing": {
67
+ "threshold": 0.5,
68
+ "min_component_voxels": 0,
69
+ "et_min_voxels": 200
70
+ },
71
+ "to_integer_labels": {
72
+ "convention": "BRATS",
73
+ "mapping": {
74
+ "1": "necrotic_core",
75
+ "2": "oedema",
76
+ "3": "enhancing"
77
+ },
78
+ "procedure": "write WT as 2, then TC as 1, then ET as 3, in that order"
79
+ }
80
+ },
81
+ "training_data": {
82
+ "dataset": "BraTS 2023 GLI, challenge training split (the only labelled split)",
83
+ "split_unit": "subject",
84
+ "split_seed": 20260813,
85
+ "cases": {
86
+ "train": 874,
87
+ "val": 191,
88
+ "test": 186
89
+ },
90
+ "subjects": {
91
+ "train": 792,
92
+ "val": 172,
93
+ "test": 169
94
+ },
95
+ "label_mapping_verified": true,
96
+ "excluded_cases": []
97
+ },
98
+ "training": {
99
+ "epochs_completed": 37,
100
+ "epochs_planned": 60,
101
+ "selected_epoch": 32,
102
+ "selection_metric": "mean Dice over TC, WT, ET on the validation split",
103
+ "loss": "DiceFocalLoss(sigmoid=True, squared_pred=True, batch=True)",
104
+ "optimizer": "AdamW lr=0.0002 wd=1e-05",
105
+ "scheduler": "CosineAnnealingLR",
106
+ "precision": "AMP float16",
107
+ "augmentation": [
108
+ "random axis flips",
109
+ "intensity scale +-10%",
110
+ "intensity shift +-10%"
111
+ ],
112
+ "patch_sampling": "80% centred on whole tumour, 20% uniform",
113
+ "seed": 20260813
114
+ },
115
+ "metrics": {
116
+ "validation": {
117
+ "TC": {
118
+ "dice_mean": 0.9015418441673284,
119
+ "dice_median": 0.947789848286196,
120
+ "hd95_median": 2.0
121
+ },
122
+ "WT": {
123
+ "dice_mean": 0.9177529638232264,
124
+ "dice_median": 0.939965202760836,
125
+ "hd95_median": 3.316624879837036
126
+ },
127
+ "ET": {
128
+ "dice_mean": 0.8503461605067909,
129
+ "dice_median": 0.9047415373334963,
130
+ "hd95_median": 1.4142135381698608
131
+ }
132
+ },
133
+ "test": {
134
+ "TC": {
135
+ "dice_mean": 0.9078361539305267,
136
+ "dice_median": 0.9563434942782733,
137
+ "hd95_median": 2.0,
138
+ "sensitivity_mean": 0.9165695598827129,
139
+ "precision_mean": 0.9170155149790782
140
+ },
141
+ "WT": {
142
+ "dice_mean": 0.921562897191002,
143
+ "dice_median": 0.9489419374016819,
144
+ "hd95_median": 2.4494898319244385,
145
+ "sensitivity_mean": 0.9247750225794058,
146
+ "precision_mean": 0.9235932925559869
147
+ },
148
+ "ET": {
149
+ "dice_mean": 0.852042452735223,
150
+ "dice_median": 0.8984435921432055,
151
+ "hd95_median": 1.4142135381698608,
152
+ "sensitivity_mean": 0.8833305802745401,
153
+ "precision_mean": 0.8486887298796273
154
+ }
155
+ },
156
+ "empty_region_rule": "BraTS convention: with empty ground truth, Dice is 1 if the prediction is also empty and 0 otherwise. Not averaged away as NaN."
157
+ },
158
+ "limitations": [
159
+ "Trained on pre-operative adult glioma only. LUMIERE's post-treatment appearances, including resection cavities and radiation change, are not represented.",
160
+ "Requires all four sequences. Behaviour with a missing sequence is untested.",
161
+ "Assumes BraTS preprocessing: skull-stripped, co-registered, 1 mm isotropic.",
162
+ "Agreement with one annotation protocol on one dataset. Not a measure of clinical accuracy.",
163
+ "Selection and post-processing tuning both used the validation split, so validation figures are optimistic. Use the test figures."
164
+ ],
165
+ "environment": {
166
+ "monai": "1.6.0",
167
+ "torch": "2.10.0+cu128",
168
+ "numpy": "2.0.2",
169
+ "device": "Tesla T4, 15.6 GB",
170
+ "amp": true
171
+ }
172
+ }