Last active
May 19, 2018 12:55
-
-
Save rish-16/af5dfe580893665413a3de0b3d04eb8a to your computer and use it in GitHub Desktop.
Cat Faces dataset preprocessing function
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 | |
| from sklearn.model_selection import train_test_split | |
| def load_cats(): | |
| cats = np.load("./cats.npy") | |
| print (cats.shape) | |
| Y = [] | |
| for i in range(cats.shape[0]): | |
| Y.append([1,0]) | |
| Y = np.array(Y) | |
| (x_train, y_train, x_test, y_test) = train_test_split(cats, Y) | |
| x_train = (x_train.astype(np.float32)) / 255 | |
| x_train = x_train.reshape(x_train.shape[0], 784) | |
| return (x_train, y_train, x_test, y_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment