SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.18274 · NeurIPS · 2023

Reconstructing the Mind's Eye: fMRI-to-Image with Contrastive Learning and Diffusion Priors

Tanishq Abraham, Paul Scotti, Atmadeep Banerjee, Jimmie Goode, Stepan Shabalin, Alex Nguyen, Ethan Cohen, Aidan Dempster, Nathalie Verlinde, Elad Yundler, David Weisberg, Kenneth Norman

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2305.18274.json · badge: /api/ran/2305.18274.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
medarc-ai/fmri-reconstruction-nsd canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
Image_to_torch Ran
ran, honoured the contract we drafted
medarc-ai/fmri-reconstruction-nsd/src/utils.py
code served (permissive licence) · get_code("10c69d73c8ea8690")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (1, 3, 32, 32) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from PIL import Image

# Create a small PIL Image to pass to Image_to_torch
# The function expects either a PIL Image or a list containing a PIL Image
img_array = np.random.randint(0, 256, (32, 32, 3), dtype=np.uint8)
pil_image = Image.fromarray(img_array)

ARGS = {
    "x": pil_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (1, 3, 32, 32) — shape (1, 3, 32, 32) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MLP Ran
ran; our contract draft was wrong, not the code
medarc-ai/fmri-reconstruction-nsd/src/convnext.py
code served (permissive licence) · get_code("9016165a0276448e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'mlp': '256-128-64',
    'embedding': '512',
    'norm_layer': 'batch_norm'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_stimuli_list Ran
ran on a synthesized input
medarc-ai/fmri-reconstruction-nsd/src/train_autoencoder_bold.py
code served (permissive licence) · get_code("e6d197791f0b0002")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil
import numpy as np

# Create a temporary directory structure that mimics what the function expects
temp_root = tempfile.mkdtemp()
sub = "subject_01"

# Create the directory structure: root/Stimuli_Presentation_Lists/sub/folder/file.txt
stim_path = os.path.join(temp_root, 'Stimuli_Presentation_Lists', sub)
os.makedirs(stim_path, exist_ok=True)

# Create subdirectories and text files with stimulus names
folder1 = os.path.join(stim_path, 'folder_001')
folder2 = os.path.join(stim_path, 'folder_002')
os.makedirs(folder1, exist_ok=True)
os.makedirs(folder2, exist_ok=True)

# Create text files with stimulus names (some with 'rep_' prefix)
stimuli_1 = np.array(['rep_stimulus_001', 'stimulus_002', 'rep_stimulus_003'])
stimuli_2 = np.array(['stimulus_004', 'rep_stimulus_005'])

np.savetxt(os.path.join(folder1, 'list_1.txt'), stimuli_1, fmt='%s')
np.savetxt(os.path.join(folder2, 'list_2.txt'), stimuli_2, fmt='%s')

ARGS = {
    'root': temp_root,
    'sub': sub
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
list_get_all_index Ran
ran on a synthesized input
medarc-ai/fmri-reconstruction-nsd/src/train_autoencoder_bold.py
code served (permissive licence) · get_code("e7f5cd89fd5e1a5a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function list_get_all_index takes a list and a value,
# then returns indices where the value appears in the list.
# We need to construct a list with some repeated values.

test_list = [1, 2, 3, 2, 4, 2, 5]
test_value = 2

ARGS = {
    "list": test_list,
    "value": test_value
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
np_to_Image Ran
ran; our contract draft was wrong, not the code
medarc-ai/fmri-reconstruction-nsd/src/utils.py
code served (permissive licence) · get_code("d36f277eefb3c8c9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import PIL

torch_manual_seed = None

# Analyze the function:
# - Takes parameter 'x' which should be a numpy array
# - Checks if x.ndim == 4, if so takes x[0]
# - Calls x.transpose(1, 2, 0) - so after potential indexing, needs 3 dimensions
# - Performs arithmetic: * 127.5 + 128
# - Calls .clip(0, 255)
# - Calls .astype('uint8')
# - Passes to PIL.Image.fromarray()

# So x should be either:
# - 3D array of shape (C, H, W) where C is channels
# - 4D array of shape (B, C, H, W) where B is batch

# Create a 4D numpy array (batch, channels, height, width)
# Using values in range [-1, 1] since the function scales by 127.5 and adds 128
x = np.random.randn(2, 3, 4, 5).astype('float32') * 0.5  # 2 batches, 3 channels, 4x5 spatial

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
torch_to_Image Ran
ran; our contract draft was wrong, not the code
medarc-ai/fmri-reconstruction-nsd/src/utils.py
code served (permissive licence) · get_code("d36059a0fce5fa4e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torchvision import transforms

torch.manual_seed(0)

# Create a small 4D tensor (batch_size=2, channels=3, height=4, width=5)
# This matches the function's expectation: if x.ndim == 4, it takes x[0]
x = torch.randint(0, 256, (2, 3, 4, 5), dtype=torch.uint8)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
create_BOLD5000_dataset Not yet run
unverified (harvested, no recorded run)
medarc-ai/fmri-reconstruction-nsd/src/train_autoencoder_bold.py
code served (permissive licence) · get_code("0a792899d6ffa09d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 4 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 4 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
Image_to_torch 3 other papers
3 later
2403.11207 (2024-03)
MindEye2: Shared-Subject Models Enable fMRI-To-Image With 1 Hour of Data
2410.19452 (2024-10)
NeuroClips: Towards High-fidelity and Smooth fMRI-to-Video Reconstruction
2508.10298 (2025-08)
SynBrain: Enhancing Visual-to-fMRI Synthesis via Probabilistic Representation Learning
np_to_Image 3 other papers
3 later
2403.11207 (2024-03)
MindEye2: Shared-Subject Models Enable fMRI-To-Image With 1 Hour of Data
2410.19452 (2024-10)
NeuroClips: Towards High-fidelity and Smooth fMRI-to-Video Reconstruction
2508.10298 (2025-08)
SynBrain: Enhancing Visual-to-fMRI Synthesis via Probabilistic Representation Learning
torch_to_Image 3 other papers
3 later
2403.11207 (2024-03)
MindEye2: Shared-Subject Models Enable fMRI-To-Image With 1 Hour of Data
2410.19452 (2024-10)
NeuroClips: Towards High-fidelity and Smooth fMRI-to-Video Reconstruction
2508.10298 (2025-08)
SynBrain: Enhancing Visual-to-fMRI Synthesis via Probabilistic Representation Learning
MLP 2 other papers
1 dated earlier, 1 later
2210.01571 (2022-10)
VICRegL: Self-Supervised Learning of Local Visual Features
2403.11207 (2024-03)
MindEye2: Shared-Subject Models Enable fMRI-To-Image With 1 Hour of Data

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We present MindEye, a novel fMRI-to-image approach to retrieve and reconstruct viewed images from brain activity. Our model comprises two parallel submodules that are specialized for retrieval (using contrastive learning) and reconstruction (using a diffusion prior). MindEye can map fMRI brain activity to any high dimensional multimodal latent space, like CLIP image space, enabling image reconstruction using generative models that accept embeddings from this latent space. We comprehensively compare our approach with other existing methods, using both qualitative side-by-side comparisons and quantitative evaluations, and show that MindEye achieves state-of-the-art performance in both reconstruction and retrieval tasks. In particular, MindEye can retrieve the exact original image even among highly similar candidates, indicating that its brain embeddings retain fine-grained image-specific information. This allows us to accurately retrieve images even from large-scale databases like LAION-5B. We demonstrate through ablations that Mind-Eye's performance improvements over previous methods result from specialized submodules for retrieval and reconstruction, improved training techniques, and training models with orders of magnitude more parameters. Furthermore, we show that MindEye can better preserve low-level image features in the reconstructions by using img2img, with outputs from a separate autoencoder. All code is available on GitHub. * Equal contributions. † Core contribution. ‡ Joint senior authors. 37th Conference on Neural Information Processing Systems (NeurIPS 2023).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2305.18274")
get_code_for_paper("2305.18274")
have("2305.18274")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2305.18274.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2305.18274.svg)](https://syntology.ai/paper/2305.18274)

Connect an agent — have() is free.