Created
May 31, 2017 23:17
-
-
Save techedlaksh/18a23ba9e694735d584064f6178f6e18 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
import os | |
import cv2 | |
train_folder = 'GTRSB/train/GTSRB/Final_Training/Images' | |
image_paths = [os.listdir(x[0]) for x in os.walk(train_folder)] | |
labels = image_paths[0] | |
datax = image_paths[1:] | |
for iy in range(len(labels)): | |
l_image = [] | |
for ix in range(len(datax[iy])): | |
a = cv2.imread(train_folder+'/'+labels[iy]+'/'+datax[iy][ix],0) | |
try: | |
resized_a = cv2.resize(a, (32, 32)) | |
l_image.append(resized_a) | |
except: | |
pass | |
np.save('resized_data/' + labels[iy], l_image) | |
ls = np.load('resized_data/' + labels[2]+'.npy') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment