clane9 commited on
Commit
9c12a8b
·
verified ·
1 Parent(s): 948953b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +105 -0
README.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CortexMAE
2
+
3
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MedARC-AI/CortexMAE/blob/main/notebooks/quickstart.ipynb)
4
+ [![Preprint](https://img.shields.io/badge/arXiv-2510.13768-green?logo=bookstack&logoColor=white)](https://arxiv.org/abs/2510.13768)
5
+ [![Discord](https://dcbadge.limes.pink/api/server/https://discord.gg/tVR4TWnRM9?style=flat)](https://discord.gg/tVR4TWnRM9)
6
+ [![Code License](https://img.shields.io/badge/Code_License-Apache_2.0-blue.svg)](https://github.com/MedARC-AI/CortexMAE/blob/main/LICENSE)
7
+ [![Model License](https://img.shields.io/badge/Model_License-CC_BY--NC_4.0-lightgrey)](https://creativecommons.org/licenses/by-nc/4.0/deed.en)
8
+
9
+ CortexMAE is an fMRI foundation model trained on 2.1K hours of fMRI data from the [Human Connectome Project](https://www.humanconnectome.org/study/hcp-young-adult/overview) using the [masked autoencoder](https://arxiv.org/abs/2205.09113) framework. We release a family of models trained with different fMRI input representations:
10
+ - **CortexMAE-P**: a computationally efficient model based on the Schaefer-400 parcellation.
11
+ - **CortexMAE-F**: our flagship model based on fMRI flat maps.
12
+ - **CortexMAE-V**: a dense volume model based on an efficient cortex-only representation.
13
+
14
+ <p align="center">
15
+ <img src="https://raw.githubusercontent.com/MedARC-AI/CortexMAE/refs/heads/main/.github/fmri_spaces.png" width="600">
16
+ </p>
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ uv pip install cortex_mae
22
+ ```
23
+
24
+ Or install the latest version from github
25
+
26
+ ```bash
27
+ uv pip install "cortex_mae @ git+https://github.com/MedARC-AI/CortexMAE.git"
28
+ ```
29
+
30
+ Or clone the repo and install locally
31
+
32
+ ```bash
33
+ git clone https://github.com/MedARC-AI/CortexMAE.git
34
+ cd CortexMAE
35
+ uv sync --python 3.11
36
+ ```
37
+
38
+ ## Quickstart
39
+
40
+ Load a pretrained model and compute embeddings on a preprocessed fMRI time series from OpenNeuro:
41
+
42
+ ```python
43
+ from cortex_mae import CortexMAE, resolve_file
44
+
45
+ model = CortexMAE.from_pretrained("cortex_mae_flat")
46
+
47
+ path = resolve_file(
48
+ "s3://openneuro.org/ds006072/NON_BIDS/ciftis/sub-1_Drug2_rsfMRI_uout_bpss_sr_noGSR_sm4.dtseries.nii",
49
+ anon=True,
50
+ )
51
+ embeds = model.run_embedding(path)
52
+ print(embeds.patch_embeds.shape) # (clips, tokens, dim)
53
+ ```
54
+
55
+ See the [quickstart notebook](https://colab.research.google.com/github/MedARC-AI/CortexMAE/blob/main/notebooks/quickstart.ipynb) on colab for the full demo.
56
+
57
+ ## Pretrained models
58
+
59
+ We release default models for each input space:
60
+
61
+ | name | input space | shape | size |
62
+ | --------------------- | ------------------ | ----------- | ----- |
63
+ | `cortex_mae_flat` | flat map | 224×560 | ViT-B |
64
+ | `cortex_mae_parcel` | Schaefer-400 | 400×1 | ViT-B |
65
+ | `cortex_mae_volume` | MNI cortex | 465×512 | ViT-B |
66
+
67
+ as well as >50 ablation variants covering data scale, model scale, alternative parcellations, etc. List all the available models with `cortex_mae.list_models()`.
68
+
69
+ ```python
70
+ model = CortexMAE.from_pretrained("cortex_mae_flat") # default
71
+ model = CortexMAE.from_pretrained("cortex_mae_flat_r2") # repeat with new seed
72
+ model = CortexMAE.from_pretrained("cortex_mae_flat_d6") # depth-6 model
73
+ ```
74
+
75
+ We also release the original configs (e.g. [`input_space_v3/flat_lr1e-3_1/pretrain/config.yaml`](input_space_v3/flat_lr1e-3_1/pretrain/config.yaml)) and logs for reproducibility.
76
+
77
+ ## Datasets
78
+
79
+ Benchmark datasets are distributed in HuggingFace Arrow format on the MedARC R2
80
+ bucket, maintained by [Brainmarks](https://github.com/MedARC-AI/brainmarks). To
81
+ request access, fill out [this form](https://forms.gle/VGnakBFCBoNnUt2C7), then
82
+ configure credentials:
83
+
84
+ ```bash
85
+ export AWS_ACCESS_KEY_ID=...
86
+ export AWS_SECRET_ACCESS_KEY=...
87
+ export AWS_ENDPOINT_URL_S3=... # Cloudflare R2 endpoint
88
+ ```
89
+
90
+ The HCP-YA pretraining data are also available as [webdataset](https://github.com/webdataset/webdataset) shards. The data can be streamed from R2 during pretraining or downloaded locally.
91
+
92
+ ## License
93
+
94
+ Model weights are relased under CC-BY-NC 4.0 ([LICENSE](LICENSE)).
95
+
96
+ ## Citation
97
+
98
+ ```bibtex
99
+ @inproceedings{lane2026scaling,
100
+ title={Scaling Vision Transformers for Functional MRI with Flat Maps},
101
+ author={Connor Lane and Mihir Tripathy and Leema Krishna Murali and Ratna Sagari Grandhi and Shamus Sim Zi Yang and Sam Gijsen and Debojyoti Das and Manish Ram and Utkarsh Kumar Singh and Cesar Kadir Torrico Villanueva and Yuxiang Wei and Will Beddow and Gianfranco Cortés and Suin Cho and Daniel Z. Kaplan and Benjamin Warner and Tanishq Mathew Abraham and Paul S. Scotti},
102
+ booktitle={ICML},
103
+ year={2026},
104
+ }
105
+ ```