Last active
October 27, 2019 03:50
-
-
Save guilhermefgs/9f3f740353e86ca7a8cc7abbfb45572f to your computer and use it in GitHub Desktop.
Normalização e formatação
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
# Mudando o formato das entradas para que cada imagem seja uma lista, ao invés de uma matriz | |
x_train = x_train.reshape(x_train.shape[0], 28*28) | |
x_test = x_test.reshape(x_test.shape[0], 28*28) | |
# Converte os valores para float, para que eles possam ter parte decimal. | |
x_train = x_train.astype('float32') | |
x_test = x_test.astype('float32') | |
# Divide pelo valor RGB máximo, para que a entrada tenha valores entre 0 e 1. | |
x_train /= 255 | |
x_test /= 255 | |
print('x_train shape:', x_train.shape) | |
print('Número de imagens em x_train', x_train.shape[0]) | |
print('Número de imagens em x_test', x_test.shape[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment