text_plain_output_1.png image_output_2.png image_output_1.png
from sklearn.model_selection import train_test_split

import numpy as np

import pickle

data = pickle.load(open('../input/dog-and-cat/DOGnCAT50x50.pickle', 'rb'))

X = np.array([e[0] for e in data]).astype('float32')
y = np.array([e[1] for e in data])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
X_train = np.resize(X_train, (len(X_train), 50, 50, 1))
X_test = np.resize(X_test, (len(X_test), 50, 50, 1))
X_train /= 255.0
X_test /= 255.0

print('X_train shape: ', X_train.shape)
print('y_train shape: ', y_train.shape)
print('X_test shape: ', X_test.shape)
print('y_test shape: ', y_test.shape)