An interactive Colab tool for fMRI-to-image decoding using real 7T neuroimaging data from the Natural Scenes Dataset (NSD) / Algonauts 2023 Challenge.
Given an input image, the pipeline:
- Encodes it into a CLIP ViT-L/14 embedding
- Predicts the whole-cortex fMRI response (~39k vertices, LH + RH) via ridge regression trained on real NSD trials
- Decodes predicted fMRI back into CLIP space
- Renders an approximate retinotopic visual field map of predicted activation
- Retrieves the top-5 most similar training images via decoded CLIP similarity
- Generates a natural language caption from the decoded representation (BLIP)
- Synthesizes an audio chord from the decoded embedding
Optionally: GPU image reconstruction via Kandinsky 2.2 unCLIP (requires A100/T4).
Subject 01 from NSD, in Algonauts 2023 format:
subj01/
training_split/
training_fmri/
lh_training_fmri.npy
rh_training_fmri.npy
training_images/
Expected at: /content/drive/MyDrive/Colab Notebooks/Algonauts Files/subj01
pip install open-clip-torch scikit-learn diffusers>=0.25.0 transformers accelerate soundfileOpen BrainSim_Decoder.ipynb in Google Colab (T4 or A100). Mount Drive, set DATA_ROOT, and run all cells. First run encodes all training images with CLIP (~10 min); subsequent runs load from cache (<30 sec).
- Natural Scenes Dataset — Allen et al. (2022)
- Algonauts 2023 Challenge — Gifford et al. (2023)
- MindEye — Scotti et al. (2023)
Aayush Gandhi