Created
December 9, 2015 00:33
-
-
Save aferriss/e80a120e0f9dc39b307f to your computer and use it in GitHub Desktop.
Small script for extracting images out of the svhn dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy.io | |
import numpy as np | |
from PIL import Image | |
np.set_printoptions(threshold=np.nan) | |
mat = scipy.io.loadmat('train_32x32.mat') | |
arr = np.array(mat["X"]) | |
for i in range(5000): | |
img = Image.fromarray(arr[:,:,:,i], 'RGB') | |
img.save("svhn"+str(i)+".jpg") | |
print "saving: " + str(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment