Dataset Viewer
Auto-converted to Parquet Duplicate
row
int64
stimulus_id
string
n_presentations_averaged
int64
0
pair_41_w_gym1.jpg
2
1
special_18434.jpg
1
2
notspecial_56042.png
1
3
special_37059.jpg
1
4
notspecial_21526.png
1
5
special_65872.jpg
1
6
pair_1_3_89.png
2
7
special_62960.jpg
1
8
pair_4_6_44.png
2
9
special_6431.jpg
1
10
special_3809.jpg
1
11
notspecial_11827.png
1
12
special_38641.jpg
1
13
notspecial_15492.png
1
14
pair_17_21_33.png
2
15
notspecial_28303.png
1
16
notspecial_60119.png
1
17
special_61873.jpg
1
18
notspecial_68023.png
1
19
special_3171.jpg
1
20
special_3682.jpg
1
21
special_43820.jpg
1
22
notspecial_26119.png
1
23
notspecial_58144.png
1
24
notspecial_5714.png
1
25
notspecial_63746.png
1
26
special_8933.jpg
1
27
special_3626.jpg
1
28
pair_43_w_lighthouse2.jpg
2
29
special_66216.jpg
1
30
special_53881.jpg
1
31
notspecial_65187.png
1
32
special_20738.jpg
1
33
pair_45_w_pagoda1.jpg
2
34
special_9048.jpg
1
35
special_9434.jpg
1
36
special_43619.jpg
1
37
notspecial_18796.png
1
38
pair_43_w_lighthouse1.jpg
2
39
notspecial_19690.png
1
40
special_50811.jpg
1
41
special_46462.jpg
1
42
notspecial_36569.png
1
43
notspecial_21318.png
1
44
notspecial_39547.png
1
45
special_44844.jpg
1
46
notspecial_16723.png
1
47
notspecial_28788.png
1
48
notspecial_12798.png
1
49
special_26909.jpg
1
50
notspecial_22782.png
1
51
notspecial_25711.png
1
52
notspecial_53070.png
1
53
notspecial_56782.png
1
54
notspecial_34089.png
1
55
notspecial_44369.png
1
56
pair_42_w_icerink2.jpg
2
57
special_68168.jpg
1
58
pair_2_4_22.png
2
59
special_25091.jpg
1
60
special_47687.jpg
1
61
pair_11_15_89.png
2
62
special_15506.jpg
1
63
special_44144.jpg
1
64
notspecial_24787.png
1
65
notspecial_44097.png
1
66
special_45129.jpg
1
67
special_56269.jpg
1
68
notspecial_25959.png
1
69
notspecial_46861.png
1
70
notspecial_33131.png
1
71
special_52070.jpg
1
72
pair_7_10_89.png
2
73
special_72719.jpg
1
74
notspecial_24740.png
1
75
notspecial_70764.png
1
76
notspecial_49969.png
1
77
special_59585.jpg
1
78
notspecial_27830.png
1
79
special_25284.jpg
1
80
pair_12_16_22.png
2
81
pair_44_w_log_cabin1.jpg
2
82
notspecial_58681.png
1
83
pair_6_9_56.png
2
84
pair_47_w_roller_coaster1.jpg
2
85
special_51788.jpg
1
86
notspecial_3146.png
1
87
special_43984.jpg
1
88
notspecial_57906.png
1
89
special_11796.jpg
1
90
special_7654.jpg
1
91
notspecial_17463.png
1
92
special_21950.jpg
1
93
notspecial_51052.png
1
94
notspecial_31123.png
1
95
special_56867.jpg
1
96
pair_5_8_78.png
2
97
special_53728.jpg
1
98
notspecial_45999.png
1
99
notspecial_53858.png
1
End of preview. Expand in Data Studio

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

sub-005 task-C encoder inputs

Ready-to-use, z-scored fMRI and images for training and evaluating an image → fMRI encoder on participant 5 of Real-time Reconstruction of Human Visual Perception from fMRI. Voxel selection, z-scoring and repeat averaging are already done. The files are plain .npy in the format of the original Universal Brain Encoder code (WeizmannVision/universal-brain-encoder-code): images [N, 224, 224, 3] uint8 and fMRI [N, V] float32, row i of one matching row i of the other.

Source betas: GLMsingle TYPED_FITHRF_GLMDENOISE_RR from rishab-iyer1/glmsingle (offline) and rishab-iyer1/3t (real-time). Stimuli: Goeschel/sub-005_task-C_stimuli.

Files

File Shape What it is
train/images.npy (481, 224, 224, 3) uint8 every ses-01 image except the 50 shown 3 times (special515)
train/fmri.npy (481, 2792) float32 z-scored per voxel over all 693 non-blank ses-01 trials, then the 62 images shown twice averaged over their two presentations
train/rows.csv 481 rows stimulus_id and number of presentations averaged (1 or 2) for each row
test/images.npy (50, 224, 224, 3) uint8 the 50 ses-03 special515 images, each shown 3 times in ses-03
test/fmri_offline_avg3.npy (50, 2792) float32 offline betas, z-scored per voxel over all 693 non-blank ses-03 trials, 3 presentations averaged after z-scoring
test/fmri_offline_rep1.npy (50, 2792) float32 offline betas, same z-scoring, first presentation only
test/fmri_rt_delay63_rep1.npy (50, 2792) float32 real-time betas, end of run; first presentation
test/fmri_rt_delay5_rep1.npy (50, 2792) float32 real-time betas, slow; first presentation
test/fmri_rt_delay0_rep1.npy (50, 2792) float32 real-time betas, fast; first presentation
test/rows.csv 50 rows stimulus_id for each row
masks/voxel_idx.npy (2792,) int64 each fMRI column's position in the 19,174-voxel sub-005_final_mask.nii.gz
masks/train_ses1_reliability_mask.npy (19,174,) bool the 2,792 selected voxels, in the final mask's voxel order
masks/train_ses1_reliability_mask.nii.gz, train_ses1_reliability_r.nii.gz 76×90×74 the same mask, and the per-voxel split-half r, as volumes
masks/sub-005_final_mask.nii.gz 76×90×74 the 19,174-voxel space shared by ses-01 and ses-03
score_retrieval.py top-1 retrieval in both directions, for any model (numpy only)
predict_ube.py test-set predictions from a checkpoint trained with the original UBE code
predictions/train_pred.npy (481, 2792) float32 fine-tuned UBE predictions for train/images.npy (in-sample)
predictions/test_pred.npy (50, 2792) float32 fine-tuned UBE predictions for test/images.npy

Real-time betas are z-scored causally: each trial uses the mean and std of the ses-03 trials up to and including itself, so no future data is used. The offline rows use the whole session.

All fMRI arrays have the same 2,792 columns in the same order: the voxels whose ses-01 betas correlate at r > 0.2 between first and second presentations (across the 112 images shown at least twice in ses-01). Row i is the same image in test/images.npy and every test/fmri_*.npy. No test image appears in training. stimulus_id matches the file names in the stimuli dataset.

Training and evaluating

Any model works: train on train/images.npy → train/fmri.npy, predict a (50, 2792) array for test/images.npy, save it as .npy, and score it:

python score_retrieval.py --pred my_predictions.npy --fmri sub-005/test/fmri_*.npy

For each test file this prints top-1 in both directions (chance 0.02), from the Pearson correlation between every predicted and every measured pattern:

  • image → brain: for each test image, its prediction must correlate best with that image's own measured pattern among all 50 measured patterns.
  • brain → image: for each measured pattern, the prediction for the image that was actually shown must correlate best among all 50 predictions.

With the original UBE code

From the root of a clone of universal-brain-encoder-code, with its pretrained encoder downloaded (python data/scripts/download/download_encoder.py):

huggingface-cli download Goeschel/sub-005_task-C_ube-inputs --repo-type dataset --local-dir sub-005

python train_transfer/train_encoder_transfer_custom.py \
    --images sub-005/train/images.npy --fmri sub-005/train/fmri.npy --name sub-005

python sub-005/predict_ube.py --model results/saved_models/transfer/sub-005.pth \
    --images sub-005/test/images.npy --out sub-005_pred.npy

python sub-005/score_retrieval.py --pred sub-005_pred.npy --fmri sub-005/test/fmri_*.npy

Precomputed UBE predictions

predictions/ holds the output of the commands above: the original UBE code, unmodified, fine-tuned for 50 epochs on train/ (only the per-voxel embeddings are learned), then predict_ube.py on the train and test images. Rows and columns line up with train/fmri.npy and test/fmri_*.npy. The values are raw model outputs, on the scale of the z-scored training betas. The training predictions are in-sample, because the model was fit on these images. Test top-1 from score_retrieval.py --pred predictions/test_pred.npy (chance 0.02):

Test fMRI image → brain brain → image
fmri_offline_avg3 0.78 1.00
fmri_offline_rep1 0.54 0.86
fmri_rt_delay63_rep1 0.54 0.68
fmri_rt_delay5_rep1 0.48 0.56
fmri_rt_delay0_rep1 0.34 0.56

Putting voxels back on the brain

For example, to write the first training image's pattern as a NIfTI volume (paths relative to this dataset's root):

import numpy as np, nibabel as nib

m = nib.load("masks/sub-005_final_mask.nii.gz")
mask = m.get_fdata() > 0                          # 19,174 voxels
fmri = np.load("train/fmri.npy")
voxel_idx = np.load("masks/voxel_idx.npy")

flat = np.zeros(mask.sum(), np.float32)           # one value per mask voxel
flat[voxel_idx] = fmri[0]                         # the 2,792 selected voxels; the rest stay 0
vol = np.zeros(mask.shape, np.float32)
vol[mask] = flat                                  # vol[mask] is in C order
nib.save(nib.Nifti1Image(vol, m.affine), "train_image0.nii.gz")
Downloads last month
32

Paper for Goeschel/sub-005_task-C_ube-inputs