High-Quality Reconstruction of fMRI Visual Stimuli Using an Optimized Autoencoder Architecture
Code Repository: GitHub - braindecoding/supl
Code Page: Page - braindecoding/oaa
Supplementary Files Repository: GitHub - braindecoding/supl
Supplementary Files Page: Page - braindecoding/supl
FID calculation must be done separately because it utilizes multi-threading, so it cannot be combined into a single file.
To run tests using the Van Gerven dataset, execute:
runvg.sh
This script will run the Python scripts dgmmvangerven.py and fidvg.py.
oaavangerven.py: Performs image reconstruction with MSE error, generating an output folder for each hyperparameter, which contains subfolders with the reconstruction results.fidvg.py: Calculates the FID (Fréchet Inception Distance) from the stim folder, which contains the original stimuli, and the rec folder, which contains the reconstruction results from dgmmvangerven.py.Miyawaki dataset generated by slr code repository.
To perform reconstruction on the Miyawaki dataset, execute:
runmy.sh
This script will run the Python scripts dgmmmiyawaki.py and fid.py.
oaamiyawaki.py: Performs image reconstruction with MSE error, generating an output folder for each hyperparameter, which contains subfolders with the reconstruction results.fidmy.py: Calculates the FID from the stim folder, which contains the original stimuli, and the rec folder, which contains the reconstruction results from dgmmmiyawaki.py.uv python install 3.8
uv venv --python 3.8
source .venv/bin/activate
uv pip install -r requirements.txt
If your server has multiple GPUs, you can specify which GPU to use by setting the environment variable CUDA_VISIBLE_DEVICES.
To do this, edit line 11 in your script:
os.environ["CUDA_VISIBLE_DEVICES"] = "3" # Change to "2" to use GPU2, or "0" for GPU0
This ensures that only the specified GPU will be visible to TensorFlow.