Last active
February 18, 2018 15:17
-
-
Save manashmandal/8e8a9db16fc64c32ac09b7a1d00ba9d7 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
import matplotlib.pyplot as plt | |
import h5py | |
from sklearn.model_selection import train_test_split | |
def load(): | |
f = h5py.File("./data/dataset.h5") | |
x = f['x'].value | |
y = f['y'].value | |
f.close() | |
x_train , x_test, y_train, y_test = train_test_split(x,y,test_size=0.2,random_state=100) | |
# Making the data channel last | |
x_train = np.rollaxis(x_train, 1, 4) | |
x_test = np.rollaxis(x_test, 1, 4) | |
# Normalizing data | |
x_train = x_train / 255.0 | |
x_test = x_test / 255.0 | |
return x_train, x_test, y_train, y_test | |
x_train, x_test, y_train, y_test = load() | |
plt.imshow(x_train[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment