text_plain_output_1.png
import cv2

import numpy as np

import numpy as np # linear algebra

import os

data_path = '../input/ckplus/CK+48/'
for dir1 in os.listdir(data_path):
    count = 0
    for f in os.listdir(data_path + dir1):
        count += 1

data_path = '../input/ckplus/CK+48'
data_dir_list = os.listdir(data_path)
img_rows = 256
img_cols = 256
num_channel = 1
num_epoch = 10
img_data_list = []
for dataset in data_dir_list:
    img_list = os.listdir(data_path + '/' + dataset)
    for img in img_list:
        input_img = cv2.imread(data_path + '/' + dataset + '/' + img)
        input_img_resize = cv2.resize(input_img, (48, 48))
        img_data_list.append(input_img_resize)
img_data = np.array(img_data_list)
img_data = img_data.astype('float32')
img_data = img_data / 255
img_data.shape

num_classes = 7
num_of_samples = img_data.shape[0]
labels = np.ones((num_of_samples,), dtype='int64')
labels[0:134] = 0
labels[135:188] = 1
labels[189:365] = 2
labels[366:440] = 3
labels[441:647] = 4
labels[648:731] = 5
labels[732:980] = 6
names = ['anger', 'contempt', 'disgust', 'fear', 'happy', 'sadness', 'surprise']
def getLabel(id):
    return ['anger', 'contempt', 'disgust', 'fear', 'happy', 'sadness', 'surprise'][id]

np.argmax(y_test[9])