Upload 6 files
Browse files- README.md +138 -1
- SHA256SUMS +4 -0
- primed_brats.safetensors +3 -0
- primed_brats_avail.safetensors +3 -0
- primed_brats_robust.safetensors +3 -0
- primed_ixi.safetensors +3 -0
README.md
CHANGED
|
@@ -1,3 +1,140 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
pipeline_tag: image-to-image
|
| 5 |
+
tags:
|
| 6 |
+
- medical-imaging
|
| 7 |
+
- mri
|
| 8 |
+
- brain
|
| 9 |
+
- brats
|
| 10 |
+
- missing-modality
|
| 11 |
+
- image-synthesis
|
| 12 |
+
- 3d
|
| 13 |
+
- wacv2027
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# PRIMED weights
|
| 17 |
+
|
| 18 |
+
Weights for **PRIMED** (PRior-Informed Missing-modality synthesis by Endpoint Displacement), from the WACV 2027
|
| 19 |
+
paper
|
| 20 |
+
|
| 21 |
+
**When Iteration Cannot Help: Single-Pass Missing-Modality MRI Synthesis and What Actually Limits It**<br>
|
| 22 |
+
Atharva Atul Rege, Adinath Madhavrao Dukre, Imran Razzak
|
| 23 |
+
|
| 24 |
+
Code: [github.com/adinathdukre/PRIMED](https://github.com/adinathdukre/PRIMED)
|
| 25 |
+
|
| 26 |
+
PRIMED synthesises a missing MRI contrast from the acquired ones in a single network evaluation, with no
|
| 27 |
+
noise schedule and no solver. It works in a fixed 3D Haar wavelet basis and starts from the mean of the
|
| 28 |
+
acquired contrasts (the informed prior). A 3D U-Net predicts the displacement from that prior to the target.
|
| 29 |
+
A learned target-contrast embedding lets one set of weights synthesise every contrast.
|
| 30 |
+
|
| 31 |
+
## Files
|
| 32 |
+
|
| 33 |
+
| File | Training data | Synthesises | Released weights |
|
| 34 |
+
|---|---|---|---|
|
| 35 |
+
| `primed_brats.safetensors` | BraTS 2023 GLI, 1032 subjects | any of T1n, T1c, T2w, T2f from the other three | best checkpoint, step 15 000 of up to 20 000 |
|
| 36 |
+
| `primed_brats_avail.safetensors` | as `primed_brats`, plus random input availability | any of the four from one, two or three acquired contrasts | final, 8 000 further steps |
|
| 37 |
+
| `primed_brats_robust.safetensors` | as `primed_brats`, plus misregistration and thick-slice augmentation | any of the four from three possibly misregistered or thick-slice contrasts | final, 8 000 further steps |
|
| 38 |
+
| `primed_ixi.safetensors` | IXI, 477 subjects | any of T1, T2, PD from the other two | best checkpoint, step 28 000 of up to 30 000 |
|
| 39 |
+
|
| 40 |
+
Each file holds the network weights only, 97.7M parameters in float32 (about 391 MB). The two fine-tunes
|
| 41 |
+
start from `primed_brats.safetensors` and are released with their final raw weights, as reported in the
|
| 42 |
+
paper.
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
git clone https://github.com/adinathdukre/PRIMED.git
|
| 48 |
+
cd PRIMED
|
| 49 |
+
pip install -e .
|
| 50 |
+
hf download adinathdukre/PRIMED --local-dir /path/to/weights
|
| 51 |
+
|
| 52 |
+
python synthesize.py \
|
| 53 |
+
--weights /path/to/weights/primed_brats.safetensors \
|
| 54 |
+
--target t1c \
|
| 55 |
+
--inputs t1n=/path/to/subject-t1n.nii.gz t2w=/path/to/subject-t2w.nii.gz t2f=/path/to/subject-t2f.nii.gz \
|
| 56 |
+
--output /path/to/subject-t1c-synthesized.nii.gz
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
import torch
|
| 61 |
+
from primed import load_model
|
| 62 |
+
from primed.data import load_volume
|
| 63 |
+
|
| 64 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 65 |
+
model = load_model("/path/to/weights/primed_brats.safetensors", device)
|
| 66 |
+
inputs = torch.stack(
|
| 67 |
+
[load_volume(f"/path/to/subject-{m}.nii.gz") for m in ("t1n", "t2w", "t2f")]
|
| 68 |
+
).unsqueeze(0).to(device)
|
| 69 |
+
prior = inputs.mean(dim=1)
|
| 70 |
+
t1c = model.synthesize(prior, inputs, torch.tensor([1], device=device))
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
**Inputs.** Co-registered volumes on the 1 mm BraTS grid (240 x 240 x 155). The BraTS models expect
|
| 74 |
+
skull-stripped volumes; `primed_ixi` expects volumes that are not skull-stripped, as IXI provides them. Each
|
| 75 |
+
volume is clipped to its 0.1 and 99.9 percentiles, rescaled to [0, 1], padded to 160 slices and cropped in
|
| 76 |
+
plane to 224 x 224; `load_volume` and `synthesize.py` do this automatically. The contrasts are, in class
|
| 77 |
+
order:
|
| 78 |
+
|
| 79 |
+
- BraTS: T1n, T1c, T2w, T2f;
|
| 80 |
+
- IXI: T1, T2, PD.
|
| 81 |
+
|
| 82 |
+
The acquired contrasts are passed in this order with the target left out. **Output:** the target contrast in
|
| 83 |
+
the same normalised [0, 1] range.
|
| 84 |
+
|
| 85 |
+
## Results
|
| 86 |
+
|
| 87 |
+
On 216 held-out BraTS 2023 GLI subjects, `primed_brats` reaches:
|
| 88 |
+
|
| 89 |
+
- whole-volume PSNR of 29.372 / 28.137 / 28.953 / 27.778 dB for T1 / T1c / T2 / FLAIR;
|
| 90 |
+
- **28.560 dB on average**, with 0.9439 SSIM;
|
| 91 |
+
- 0.152 s per volume on one NVIDIA RTX PRO 6000 Blackwell.
|
| 92 |
+
|
| 93 |
+
On cohorts not seen in training, `primed_brats` reaches:
|
| 94 |
+
|
| 95 |
+
- 26.555 dB on 60 BraTS-MEN training subjects;
|
| 96 |
+
- 26.413 dB on the 141-subject BraTS-MEN validation release;
|
| 97 |
+
- 26.398 dB on 99 BraTS-PED subjects.
|
| 98 |
+
|
| 99 |
+
`primed_ixi` reaches 31.436 dB on 96 held-out IXI subjects.
|
| 100 |
+
|
| 101 |
+
With fewer acquired contrasts, `primed_brats_avail` reaches 28.36 / 27.35 / 25.97 dB with three / two / one
|
| 102 |
+
inputs. The zero-shot `primed_brats` reaches 28.56 / 25.40 / 22.37 dB.
|
| 103 |
+
|
| 104 |
+
`primed_brats_robust` gives up 0.12 dB on registered inputs and reduces the loss under every perturbation
|
| 105 |
+
tested, for example:
|
| 106 |
+
|
| 107 |
+
| Inputs | `primed_brats` | `primed_brats_robust` |
|
| 108 |
+
|---|:-:|:-:|
|
| 109 |
+
| one input misregistered by 2 mm, 2° | 26.60 dB | 27.28 dB |
|
| 110 |
+
| inputs from 5 mm slices | 24.66 dB | 26.82 dB |
|
| 111 |
+
|
| 112 |
+
## Training
|
| 113 |
+
|
| 114 |
+
The training recipe:
|
| 115 |
+
|
| 116 |
+
- 3D Haar wavelet basis, with the low-pass band divided by 3;
|
| 117 |
+
- five-level MONAI `DiffusionModelUNet` with channels (64, 128, 128, 256, 256), three residual blocks per
|
| 118 |
+
level and one self-attention block in the bottleneck;
|
| 119 |
+
- mean squared error on the displacement at the source endpoint;
|
| 120 |
+
- AdamW with learning-rate warmup and cosine decay, gradient clipping and bf16 mixed precision;
|
| 121 |
+
- EMA decay 0.9999 and random flips;
|
| 122 |
+
- checkpoint selection on 12 held-out cases.
|
| 123 |
+
|
| 124 |
+
The BraTS model was fine-tuned from a network of the same architecture trained along the full bridge path,
|
| 125 |
+
which is not released. The IXI model was trained from random initialisation. The configs and subject lists
|
| 126 |
+
are in the code repository.
|
| 127 |
+
|
| 128 |
+
## Intended use and limitations
|
| 129 |
+
|
| 130 |
+
These are research models, not medical devices, and are not intended for clinical decisions. A synthesised
|
| 131 |
+
T1c is a conditional mean: it cannot recover contrast enhancement that the acquired contrasts do not reveal,
|
| 132 |
+
and it may show enhancement that is not there. The models assume co-registered inputs on the BraTS grid.
|
| 133 |
+
Performance drops on misregistered or thick-slice inputs, which `primed_brats_robust` partly addresses. The
|
| 134 |
+
models were trained on BraTS and IXI data only.
|
| 135 |
+
|
| 136 |
+
## License
|
| 137 |
+
|
| 138 |
+
CC BY-NC 4.0, for non-commercial use. The models are trained on
|
| 139 |
+
[BraTS 2023](https://www.synapse.org/Synapse:syn51156910/wiki/621282) and
|
| 140 |
+
[IXI](https://brain-development.org/ixi-dataset/) data; please respect their terms of use.
|
SHA256SUMS
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
3d03eb2f9b5bc16bf6f1cba1ad4279a7130f4c5993944f42a84f61a3c4837732 primed_brats_avail.safetensors
|
| 2 |
+
bfb3dafec070a8a7a3c4a960d3012ccdfe2a844c221cb05aea828353d09bbcf9 primed_brats_robust.safetensors
|
| 3 |
+
0c362accb5c338960dcd1abe2f57b9c4fae19f9283dfe47a5f97a0cd8f1c7c3b primed_brats.safetensors
|
| 4 |
+
21cbe965edc420a0ced37ef3d7eac1712a926bf4b1e508cc87a1e0053dff6e7a primed_ixi.safetensors
|
primed_brats.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c362accb5c338960dcd1abe2f57b9c4fae19f9283dfe47a5f97a0cd8f1c7c3b
|
| 3 |
+
size 390892624
|
primed_brats_avail.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d03eb2f9b5bc16bf6f1cba1ad4279a7130f4c5993944f42a84f61a3c4837732
|
| 3 |
+
size 390892656
|
primed_brats_robust.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bfb3dafec070a8a7a3c4a960d3012ccdfe2a844c221cb05aea828353d09bbcf9
|
| 3 |
+
size 390892672
|
primed_ixi.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21cbe965edc420a0ced37ef3d7eac1712a926bf4b1e508cc87a1e0053dff6e7a
|
| 3 |
+
size 390836264
|