File size: 412 Bytes
46a8d8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy as np
import os
from PIL import Image

#The same for all subjects
images = np.load('data/processed_data/subj01/nsd_test_stim_sub1.npy')

test_images_dir = 'data/nsddata_stimuli/test_images/'

if not os.path.exists(test_images_dir):
   os.makedirs(test_images_dir)
for i in range(len(images)):
    im = Image.fromarray(images[i].astype(np.uint8))
    im.save('{}/{}.png'.format(test_images_dir,i))