text_plain_output_2.png text_plain_output_1.png
import h5py

import numpy as np # linear algebra

def load_dataset():
    train_dataset = h5py.File('../input/hand-sign/train_signs.h5', 'r')
    train_set_x_orig = np.array(train_dataset['train_set_x'][:])
    train_set_y_orig = np.array(train_dataset['train_set_y'][:])
    test_dataset = h5py.File('../input/hand-sign-test/test_signs.h5', 'r')
    test_set_x_orig = np.array(test_dataset['test_set_x'][:])
    test_set_y_orig = np.array(test_dataset['test_set_y'][:])
    train_set_y_orig = train_set_y_orig.reshape((1, train_set_y_orig.shape[0]))
    test_set_y_orig = test_set_y_orig.reshape((1, test_set_y_orig.shape[0]))
    return (train_set_x_orig, train_set_y_orig, test_set_x_orig, test_set_y_orig)

train_x, train_y, test_x, test_y = load_dataset()
(train_x.shape, train_y.shape, test_x.shape, test_y.shape)

train_y = train_y.reshape((1080,))
test_y = test_y.reshape((120,))
Y_train = np.zeros([1080, 6])
count = 0
for i in train_y:
    Y_train[count, i] = 1
    count = count + 1
Y_test = np.zeros([120, 6])
count = 0
for i in test_y:
    Y_test[count, i] = 1
    count = count + 1

train_y