eugenehp commited on
Commit
d90efc3
·
verified ·
1 Parent(s): 9c0c15c

Initial release: BrainIAC ViT-B backbone + 4 downstream task heads (safetensors)

Browse files
LICENSE ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BrainIAC Research-Only License
2
+
3
+ Copyright © 2026
4
+ Mass General Brigham and contributors
5
+
6
+ Permission is hereby granted to use, copy, modify, and distribute this
7
+ software and associated documentation files (the “Software”) solely for
8
+ non-commercial academic research and educational purposes.
9
+
10
+ Commercial use of the Software is strictly prohibited without a separate
11
+ written license from Mass General Brigham. Commercial use includes, but is
12
+ not limited to:
13
+ - Use in products, services, or platforms offered for a fee or other
14
+ commercial advantage;
15
+ - Use in clinical workflows, decision support systems, or healthcare
16
+ operations;
17
+ - Use by for-profit entities for internal or external commercial purposes;
18
+ - Redistribution or deployment of the Software or derived works as part
19
+ of a commercial offering.
20
+
21
+ The Software may not be sublicensed, sold, leased, or otherwise transferred
22
+ for commercial purposes without prior written authorization from
23
+ Mass General Brigham.
24
+
25
+ The Software is provided “AS IS”, without warranty of any kind, express or
26
+ implied, including but not limited to the warranties of merchantability,
27
+ fitness for a particular purpose, and non-infringement. In no event shall
28
+ the authors or copyright holders be liable for any claim, damages, or other
29
+ liability, whether in an action of contract, tort, or otherwise, arising
30
+ from, out of, or in connection with the Software or the use or other
31
+ dealings in the Software.
32
+
33
+ All commercial rights are expressly reserved.
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: mass-general-brigham-non-commercial
4
+ license_link: LICENSE
5
+ tags:
6
+ - brain
7
+ - mri
8
+ - neuroimaging
9
+ - vit
10
+ - foundation-model
11
+ - medical-imaging
12
+ library_name: brainiac-rs
13
+ pipeline_tag: feature-extraction
14
+ ---
15
+
16
+ # BrainIAC — Brain Imaging Adaptive Core
17
+
18
+ **A generalizable foundation model for analysis of human brain MRI**
19
+
20
+ BrainIAC is a Vision Transformer (ViT-B/16) pretrained with SimCLR on structural brain MRI scans.
21
+ Published in [Nature Neuroscience](https://www.nature.com/articles/s41593-026-02202-6) (2026).
22
+
23
+ ## Model Details
24
+
25
+ | Property | Value |
26
+ |----------|-------|
27
+ | Architecture | MONAI ViT-B/16³ (3D) |
28
+ | Parameters | 88.4M |
29
+ | Input | 96×96×96 single-channel brain MRI |
30
+ | Patches | 216 (6×6×6 grid, 16³ voxel patches) |
31
+ | Hidden dim | 768 |
32
+ | Layers | 12 transformer blocks |
33
+ | Heads | 12 attention heads |
34
+ | MLP dim | 3072 |
35
+ | Pretraining | SimCLR contrastive learning |
36
+ | Output | 768-dim feature vector (first patch token) |
37
+
38
+ ## Files
39
+
40
+ - `backbone.safetensors` — Pretrained ViT backbone weights
41
+ - `config.json` — Model configuration
42
+ - `LICENSE` — Non-commercial academic research license
43
+
44
+ ## Downstream Tasks
45
+
46
+ The backbone can be fine-tuned for:
47
+ - **Brain age prediction** (regression)
48
+ - **IDH mutation classification** (binary, dual-scan FLAIR+T1CE)
49
+ - **MCI classification** (binary)
50
+ - **Glioma overall survival** (binary, quad-scan T1+T1CE+T2+FLAIR)
51
+ - **MR sequence classification** (4-class: T1/T2/FLAIR/T1CE)
52
+ - **Time-to-stroke prediction** (regression)
53
+ - **Tumor segmentation** (UNETR decoder)
54
+
55
+ ## Usage with brainiac-rs (Rust)
56
+
57
+ ```bash
58
+ cargo run --release --bin infer -- \
59
+ --weights backbone.safetensors \
60
+ --input brain_t1.nii.gz
61
+ ```
62
+
63
+ ```rust
64
+ use brainiac_rs::{BrainiacEncoder, TaskType};
65
+
66
+ let (encoder, _) = BrainiacEncoder::<B>::load(
67
+ "backbone.safetensors", None,
68
+ TaskType::FeatureExtraction, 1, device,
69
+ )?;
70
+ let features = encoder.encode_nifti(Path::new("brain.nii.gz"))?;
71
+ // features: Vec<f32> with 768 dimensions
72
+ ```
73
+
74
+ ## Usage with Python
75
+
76
+ ```python
77
+ import torch
78
+ from monai.networks.nets import ViT
79
+ from safetensors.torch import load_file
80
+
81
+ model = ViT(in_channels=1, img_size=(96,96,96), patch_size=(16,16,16),
82
+ hidden_size=768, mlp_dim=3072, num_layers=12, num_heads=12)
83
+
84
+ weights = load_file("backbone.safetensors")
85
+ model.load_state_dict(weights, strict=False)
86
+ model.eval()
87
+
88
+ # features[0][:, 0] gives the 768-dim feature vector
89
+ features = model(preprocessed_mri)
90
+ ```
91
+
92
+ ## Preprocessing
93
+
94
+ Input MRI volumes must be:
95
+ 1. Skull-stripped (HD-BET recommended)
96
+ 2. Registered to standard space (MNI152)
97
+ 3. Bias field corrected (N4)
98
+ 4. Resized to 96×96×96 voxels (trilinear)
99
+ 5. Z-score normalized (nonzero voxels only)
100
+
101
+ ## Citation
102
+
103
+ ```bibtex
104
+ @article{tak2026generalizable,
105
+ title={A generalizable foundation model for analysis of human brain MRI},
106
+ author={Tak, Divyanshu and Gormosa, B.A. and Zapaishchykova, A. and others},
107
+ journal={Nature Neuroscience},
108
+ year={2026},
109
+ publisher={Springer Nature},
110
+ doi={10.1038/s41593-026-02202-6}
111
+ }
112
+ ```
113
+
114
+ ## License
115
+
116
+ This model is licensed for **non-commercial academic research use only**.
117
+ Commercial use requires a separate license from Mass General Brigham.
118
+ See [LICENSE](LICENSE) for details.
backbone.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12b7745715724862c92e7b0bb1252d257abf8a7af055122cb09771368831e275
3
+ size 353376032
brainage_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:920fd51409f9ebdfe3f0a53d5eea5836803d4446b2e96e0a93f404890c419797
3
+ size 3220
config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "brainiac-vit",
3
+ "architecture": "MONAI ViT-B/16\u00b3",
4
+ "img_size": 96,
5
+ "patch_size": 16,
6
+ "in_channels": 1,
7
+ "hidden_size": 768,
8
+ "mlp_dim": 3072,
9
+ "num_layers": 12,
10
+ "num_heads": 12,
11
+ "num_patches": 216,
12
+ "norm_eps": 1e-06,
13
+ "pretraining": "SimCLR",
14
+ "input_format": "NIfTI (.nii.gz), skull-stripped, registered, 96\u00d796\u00d796",
15
+ "preprocessing": "trilinear resize to 96\u00b3 + z-score normalization (nonzero voxels)"
16
+ }
idh_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:257fdbabfe6d09dc1d99dd59c0db648ce1a9526df1680764d6c25181b0712a01
3
+ size 3220
mci_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c859063b6529f370ea198aede2f5a92998b9055d8db185c86c8a74c8a74cc27
3
+ size 3220
stroke_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b51e35274929ce06f2feb46089c70689d0952dc4d22fa8125000fda98bd8bb6a
3
+ size 3220