File size: 19,249 Bytes
2dfe372 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | ---
pretty_name: "MindEye: fMRI-to-Image Reconstruction Dataset"
license: mit
tags:
- neuroscience
- fMRI
- brain-decoding
- image-reconstruction
- contrastive-learning
- diffusion-models
- CLIP
- natural-scenes
task_categories:
- image-to-image
- feature-extraction
size_categories:
- 10K<n<100K
configs:
- config_name: nsd-brain-trials
data_files: "datasets/flat-clips/nsd-train-task-clips-16t/*.pt"
default: true
dataset_info:
features:
- name: subject_id
dtype: string
description: "Subject identifier (e.g., 'subj01')"
- name: session
dtype: int32
description: "Scanning session number (1-40)"
- name: run
dtype: int32
description: "fMRI run number within session"
- name: n_frames
dtype: int32
description: "Total frames in the fMRI run (~301)"
- name: fmri_data
sequence:
sequence: float16
description: "Brain activity tensor"
- name: start_frame
dtype: int32
description: "Frame index where stimulus presentation begins"
- name: onset_time
dtype: float32
description: "Stimulus onset time in seconds"
- name: duration
dtype: float32
description: "Stimulus presentation duration (3.0s)"
- name: trial_type
dtype: string
description: "Always 'nsd' for this dataset"
- name: nsd_image_id
dtype: int32
description: "NSD image identifier (links to COCO dataset)"
- name: target_class
dtype: int32
description: "Target class/category for the stimulus"
- config_name: hcp-brain-trials
data_files: "datasets/flat-clips/hcp-train-task-clips-16t/*.pt"
dataset_info:
features:
- name: subject_id
dtype: string
description: "HCP subject identifier (6-digit code)"
- name: modality
dtype: string
description: "Imaging modality ('tfMRI' or 'rfMRI')"
- name: task
dtype: string
description: "HCP task name (e.g., RELATIONAL, SOCIAL, WM, REST1)"
- name: field_strength
dtype: string
description: "Magnetic field strength ('3T' or '7T')"
- name: phase_encoding
dtype: string
description: "Phase encoding direction ('LR', 'RL', 'PA', 'AP')"
- name: n_frames
dtype: int32
description: "Total frames in the fMRI run (126-918)"
- name: fmri_data
sequence:
sequence: float16
description: "Brain activity tensor"
- name: start_frame
dtype: int32
description: "Frame index where trial begins"
- name: onset_time
dtype: float32
description: "Trial onset time in seconds"
- name: duration
dtype: float32
description: "Trial duration in seconds"
- name: trial_type
dtype: string
description: "Specific trial condition (e.g., relation, mental, story)"
- name: target_class
dtype: int32
description: "Target class mapped via hcp-task-mapping config"
- config_name: hcp-flat-archives
data_files: "datasets/hcp-flat/*.tar"
- config_name: clip-image-embeddings
data_files: "datasets/nsd_clip_embeds.npy"
dataset_info:
features:
- name: image_embeddings
sequence:
sequence: float32
description: "CLIP ViT-L/14 embeddings for 73,000 NSD stimulus images"
- config_name: semantic-clusters
data_files: "datasets/nsd_coco_73k_semantic_cluster_ids.npy"
dataset_info:
features:
- name: cluster_ids
sequence: int64
description: "Semantic cluster assignments for COCO/NSD images (range: 0-40)"
- config_name: brain-parcellations
data_files:
- "datasets/Schaefer2018_400Parcels_7Networks_order.flat.npy"
- "datasets/Yeo2011_RSFC_7Networks.flat.npy"
dataset_info:
features:
- name: parcellation_type
dtype: string
description: "Atlas type ('Schaefer2018_400Parcels_7Networks' or 'Yeo2011_RSFC_7Networks')"
- name: parcellation_map
sequence:
sequence: int64
description: "Brain region mapping"
- name: max_regions
dtype: int32
description: "Maximum number of regions (400 for Schaefer, 7 for Yeo)"
- config_name: hcp-task-mapping
data_files: "datasets/hcp_trial_type_target_id_map.json"
dataset_info:
features:
- name: trial_type
dtype: string
description: "HCP task condition name"
- name: target_id
dtype: int32
description: "Mapped numerical identifier (0-20)"
- config_name: hcp-session-metadata
data_files: "datasets/session_metadata.json"
dataset_info:
features:
- name: session_key
dtype: string
description: "Session identifier (e.g., 'sub-349244_mod-tfMRI_task-RELATIONAL_mag-3T_dir-RL')"
- name: subject_id
dtype: string
description: "HCP subject identifier (6-digit code)"
- name: task
dtype: string
description: "HCP task name"
- name: modality
dtype: string
description: "Imaging modality ('tfMRI' or 'rfMRI')"
- name: field_strength
dtype: string
description: "Magnetic field strength ('3T' or '7T')"
- name: phase_encoding
dtype: string
description: "Phase encoding direction ('LR', 'RL', 'PA', 'AP')"
- name: n_frames
dtype: int32
description: "Total frames in session (126-918)"
- name: n_voxels
dtype: int32
description: "Total voxels in session (77,763)"
---
# ๐ง MindEye: fMRI-to-Image Reconstruction Dataset
[](https://arxiv.org/abs/2305.18274)
[](LICENSE)
[](https://huggingface.co/datasets/medarc/fmri-fm)
[](https://discord.gg/tVR4TWnRM9)
MindEye is a groundbreaking fMRI-to-image dataset that enables state-of-the-art reconstruction and retrieval of viewed natural scene images from human brain activity.
- ๐ฅ Built on the **Natural Scenes Dataset (NSD)**, containing brain responses from **4 participants** who passively viewed **MS-COCO natural scenes** during **7-Tesla fMRI scanning**
- ๐ Achieves **>90% accuracy** across multiple reconstruction metrics and **>93% top-1 retrieval accuracy**, marking a major breakthrough in neural decoding
- ๐ Maps **fMRI brain activity to CLIP image embeddings** through **specialized contrastive learning frameworks** and **diffusion-based generative models**
- ๐จ Combines **high-level semantic information** with **low-level perceptual features**, enabling **fine-grained decoding** that can distinguish between **highly similar images** (e.g., different zebras)
- ๐ Demonstrates scalability to **billion-image retrieval tasks** using **LAION-5B**, extending its impact to internet-scale benchmarks

**Figure:** Paired side-by-side example โ **Left:** MS-COCO stimulus shown during scanning; **Right:** MindEye reconstruction (Subject 01) derived from `fmri_voxels` + `clip_embeddings`.
---
## ๐ Table of Contents
- [Quickstart](#quickstart)
- [Dataset Configurations](#dataset-configurations)
- [nsd-brain-trials (Default)](#nsd-brain-trials-default)
- [hcp-brain-trials](#hcp-brain-trials)
- [clip-image-embeddings](#clip-image-embeddings)
- [hcp-session-metadata](#hcp-session-metadata)
- [Other Configurations](#other-configurations)
- [Provenance & Processing](#provenance--processing)
- [Intended Uses & Limitations](#intended-uses--limitations)
- [Recommended Uses](#recommended-uses)
- [Out-of-Scope Uses](#out-of-scope-uses)
- [Known Limitations](#known-limitations)
- [Bias & Fairness Considerations](#bias--fairness-considerations)
- [Results](#results)
- [Dataset Scale](#dataset-scale)
- [Citation](#citation)
- [License](#license)
---
<a id="quickstart"></a>
# ๐ Quickstart
```python
from datasets import load_dataset
# 1. Load the default NSD brain trials (streaming recommended for large configs)
nsd_ds = load_dataset("medarc/fmri-fm", name="nsd-brain-trials", streaming=True, split="train")
example = next(iter(nsd_ds))
print(f"Subject: {example['subject_id']}, Session: {example['session']}, NSD Image ID: {example['nsd_image_id']}")
print(f"fMRI Data (first 5 values of first frame): {example['fmri_data'][0][:5]}")
# 2. Load the supplementary HCP brain trials (streaming)
hcp_ds = load_dataset("medarc/fmri-fm", name="hcp-brain-trials", streaming=True, split="train")
hcp_example = next(iter(hcp_ds))
print(f"HCP Subject: {hcp_example['subject_id']}, Task: {hcp_example['task']}")
# 3. Load CLIP image embeddings for all NSD stimuli (dense table, non-streaming)
clip_ds = load_dataset("medarc/fmri-fm", name="clip-image-embeddings", split="train")
print(f"Total embeddings: {len(clip_ds)}")
print(f"Embedding vector length (first image): {len(clip_ds[0]['image_embeddings'])}")
# 4. Load HCP session metadata
metadata_ds = load_dataset("medarc/fmri-fm", name="hcp-session-metadata", split="train")
meta_example = next(iter(metadata_ds))
print(f"Example Session Key: {meta_example['session_key']}")
print(f"Number of voxels in session: {meta_example['n_voxels']}")
```
---
<a id="dataset-configurations"></a>
# ๐ฆ Dataset Configurations
---
<a id="nsd-brain-trials"></a>
## ๐น nsd-brain-trials (Default)
Contains the primary fMRI signals from the Natural Scenes Dataset, used as the main inputs for the MindEye model.
| **Field Name** | **Type** | **Description** |
|------------------|---------------------------|---------------------------------------------------------------------------------|
| `subject_id` | `string` | Subject identifier (e.g., "subj01") |
| `session` | `int32` | Scanning session number (1-40) |
| `run` | `int32` | fMRI run number within session |
| `fmri_data` | `sequence[sequence[float16]]` | Brain activity tensor |
| `nsd_image_id` | `int32` | NSD image identifier (links to COCO dataset) |
---
<a id="hcp-brain-trials"></a>
## ๐น hcp-brain-trials
Contains supplementary fMRI data from the Human Connectome Project (HCP) for various cognitive tasks.
| **Field Name** | **Type** | **Description** |
|------------------|---------------------------|---------------------------------------------------------------------------------|
| `subject_id` | `string` | HCP subject identifier (6-digit code) |
| `modality` | `string` | Imaging modality (`"tfMRI"` or `"rfMRI"`) |
| `task` | `string` | HCP task name (RELATIONAL, SOCIAL, WM, etc.) |
| `fmri_data` | `sequence[sequence[float16]]` | Brain activity tensor |
| `trial_type` | `string` | Specific trial condition (relation, mental, etc.) |
---
<a id="clip-image-embeddings"></a>
## ๐น clip-image-embeddings
Contains the target CLIP (ViT-L/14) image embeddings for the 73,000 NSD stimulus images.
| **Field Name** | **Type** | **Description** |
|-----------------------|---------------------------|---------------------------------------------------------------------------------|
| `image_embeddings` | `sequence[sequence[float32]]` | CLIP ViT-L/14 embeddings for NSD images |
---
<a id="hcp-session-metadata"></a>
## ๐น hcp-session-metadata
Detailed metadata for each fMRI session in the HCP dataset.
| **Field Name** | **Type** | **Description** |
|------------------|------------|-----------------------------------------------------|
| `session_key` | `string` | Unique session identifier |
| `subject_id` | `string` | HCP subject identifier |
| `task` | `string` | HCP task name |
| `n_voxels` | `int32` | Total voxels in session (77,763) |
---
<a id="other-configurations"></a>
## ๐น Other Configurations
- **hcp-session-archives:** Raw .tar archives of preprocessed fMRI data from the HCP dataset.
- **semantic-clusters:** Semantic cluster assignments for the 73k COCO/NSD images.
- **brain-parcellations:** Brain atlas files (Schaefer 2018, Yeo 2011) used for feature engineering.
- **hcp-task-mapping:** JSON file mapping HCP task conditions to numerical target IDs.
---
<a id="provenance-processing"></a>
# ๐ฌ Provenance & Processing
This dataset is constructed from two major sources:
- **Natural Scenes Dataset (NSD)**
- **Human Connectome Project (HCP)**
The primary neuroimaging data was collected using a **7-Tesla (7T) fMRI scanner**. All fMRI data underwent rigorous preprocessing including:
- **GLMsingle**: General Linear Model single-trial estimation
- **Z-scoring**: Session-wise normalization of signals
- **Brain parcellation**: Feature vectors constructed via atlases such as the **Schaefer 2018 (400 Parcels)** and **Yeo 2011 (7 Networks)**โreducing volumetric brain data into region-wise summaries suitable for machine learning tasks.
---
<a id="intended-uses-limitations"></a>
# โ
Intended Uses & Limitations
<a id="recommended-uses"></a>
### Recommended Uses
- **Neuroscience Research**: Understanding visual cortex representations, brain-computer interfaces, and neural mechanisms of visual perception
- **Computer Vision**: Developing novel multimodal learning approaches between brain signals and visual data, contrastive learning research
- **AI Model Development**: Training and benchmarking brain decoding models, diffusion-based reconstruction systems
- **Medical Applications**: Research into locked-in syndrome communication, depression assessment through visual bias analysis, neurological disorder diagnosis
---
<a id="out-of-scope-uses"></a>
### Out-of-Scope Uses
- โ ๏ธ **Clinical Diagnosis**: Not validated for medical diagnosis without extensive additional clinical validation and regulatory approval
- โ ๏ธ **Cross-subject Generalization**: Models are subject-specific and do not generalize across individuals without additional training data
- โ ๏ธ **Non-consensual Applications**: Requires active participant compliance; easily defeated by head movement, unrelated thinking, or non-compliance
---
### Known Limitations
- **Subject Specificity**: Each participant requires individual model training with extensive fMRI data (up to 40 hours scanning)
- **Compliance Requirement**: Non-invasive neuroimaging requires participant cooperation and cannot be used covertly
- **Single-trial Degradation**: Performance significantly degrades when using single-trial vs. averaged responses
---
<a id="bias-fairness"></a>
# โ๏ธ Bias & Fairness Considerations
- **Sampling Biases**: Limited to 4 participants, all capable of undergoing extensive MRI scanning. Geographic and cultural representation not specified.
- **Image Distribution**: Images limited to MS-COCO natural scenes, which may not represent diverse visual experiences across cultures, environments, or individual visual preferences.
- **Technical Access**: Requires expensive 7-Tesla MRI equipment and substantial computational resources, limiting accessibility and reproducibility across research groups.
<a id="results"></a>
# ๐ Results

| **Category** | **Best Prior SOTA** | **MindEye** |
|-------------------------|---------------------|-------------|
| Pixel Correlation | 0.254 (Ozcelik) | **0.309** |
| SSIM | 0.356 (Ozcelik) | **0.323** |
| Image Retrieval (top-1)| 94.2% (Ozcelik) | **97.8%** |
| Brain Retrieval (top-1)| 30.3% (Ozcelik) | **90.1%** |
| CLIP Identification | 91.5% (Ozcelik) | **94.1%** |
| Parameter Efficiency | 1.45B (Ozcelik LL) | **206M** |
<a id="dataset-scale"></a>
# ๐ Dataset Scale:
- **Training samples**: 24,980 across 4 subjects (individual trials preserved)
- **Test samples**: 982 (averaged across 3 repetitions per image)
- **Voxels per subject**: 13,000-16,000 from nsdgeneral brain region
<a id="citation"></a>
# ๐ Citation
Please cite:
```
@article{scotti2023reconstructing,
title={Reconstructing the Mind's Eye: fMRI-to-Image with Contrastive Learning and Diffusion Priors},
author={Paul S. Scotti and Atmadeep Banerjee and Jimmie Goode and Stepan Shabalin and Alex Nguyen and Ethan Cohen and Aidan J. Dempster and Nathalie Verlinde and Elad Yundler and David Weisberg and Kenneth A. Norman and Tanishq Mathew Abraham},
journal={arXiv preprint arXiv:2305.18274},
year={2023},
url={[https://arxiv.org/abs/2305.18274v2}](https://arxiv.org/abs/2305.18274v2%7D)
}
```
<a id="license"></a>
# ๐ License
```
MIT License
Copyright (c) 2022 MEDARC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
``` |