Created
March 29, 2020 17:35
-
-
Save siakon89/0f9a43796e5ebd5f50e844a0dfb84e75 to your computer and use it in GitHub Desktop.
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
from tensorflow.keras.utils import to_categorical | |
# Normalize the images | |
train_images = train_images / 255.0 | |
test_images = test_images / 255.0 | |
# Reshape them for our CNN model | |
train_images = train_images.reshape(60000,28,28,1) | |
test_images = test_images.reshape(10000,28,28,1) | |
print(train_images.shape) | |
# Encode labels to one-hot | |
train_labels = to_categorical(train_labels) | |
test_labels = to_categorical(test_labels) | |
print(train_labels[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment