Skip to content

Instantly share code, notes, and snippets.

@frenzy2106
Last active March 17, 2020 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frenzy2106/80348f59aaffa224e979dc12c9851398 to your computer and use it in GitHub Desktop.
Save frenzy2106/80348f59aaffa224e979dc12c9851398 to your computer and use it in GitHub Desktop.
# We have grayscale images, so while loading the images we will keep grayscale=True, if you have RGB images, you should set grayscale as False
train_image = []
for i in tqdm(range(train.shape[0])):
img = image.load_img('train/'+train['id'][i].astype('str')+'.png', target_size=(28,28,1), color_mode="grayscale")
img = image.img_to_array(img)
img = img/255
train_image.append(img)
X = np.array(train_image)
# Preprocessing the Target
y=train['label'].values
y = to_categorical(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment