Official repository for the paper "Brain-Diffuser: Natural scene reconstruction from fMRI signals using generative latent diffusion" by Furkan Ozcelik and Rufin VanRullen.
The following are a few reconstructions obtained :
conda env create -f environment.yml
. It is an extensive environment and may include redundant libraries. You may also create environment by checking requirements yourself. cd data
python download_nsddata.py
cd data
python prepare_nsddata.py -sub 1
python prepare_nsddata.py -sub 2
python prepare_nsddata.py -sub 5
python prepare_nsddata.py -sub 7
vdvae/model/
folder
wget https://openaipublic.blob.core.windows.net/very-deep-vaes-assets/vdvae-assets-2/imagenet64-iter-1600000-log.jsonl
wget https://openaipublic.blob.core.windows.net/very-deep-vaes-assets/vdvae-assets-2/imagenet64-iter-1600000-model.th
wget https://openaipublic.blob.core.windows.net/very-deep-vaes-assets/vdvae-assets-2/imagenet64-iter-1600000-model-ema.th
wget https://openaipublic.blob.core.windows.net/very-deep-vaes-assets/vdvae-assets-2/imagenet64-iter-1600000-opt.th
python scripts/vdvae_extract_features.py -sub x
python scripts/vdvae_regression.py -sub x
python scripts/vdvae_reconstruct_images.py -sub x
versatile_diffusion/pretrained/
folderpython scripts/cliptext_extract_features.py -sub x
python scripts/clipvision_extract_features.py -sub x
python scripts/cliptext_regression.py -sub x
python scripts/clipvision_regression.py -sub x
python scripts/versatilediffusion_reconstruct_images.py -sub x
. This code is written as you are using two 12GB GPUs but you may edit according to your setup. Although results are expected to be similar, it may vary because of variations at reconstruction
python scripts/save_test_images.py
python scripts/eval_extract_features.py -sub 0
python scripts/eval_extract_features.py -sub x
python scripts/evaluate_reconstruction.py -sub x
It has a bug that prevents to get the exact results but provides an approximation for most of ROIs, hopefully will be fixed soon.
python scripts/roi_extract.py -sub x
python scripts/roi_generate_features.py -sub x
python scripts/roi_vdvae_reconstruct.py -sub x
python scripts/roi_versatilediffusion_reconstruct.py -sub x