text_plain_output_1.png image_output_1.png
import os

import pandas as pd

train_dir = '/kaggle/input/happy-sad-7125/train/'
test_dir = '/kaggle/input/happy-sad-7125/test/'
row, col = (48, 48)
classes = 2
def count_exp(path, set_):
    dict_ = {}
    for expression in os.listdir(path):
        dir_ = path + expression
        dict_[expression] = len(os.listdir(dir_))
    df = pd.DataFrame(dict_, index=[set_])
    return df
train_count = count_exp(train_dir, 'train')
test_count = count_exp(test_dir, 'test')

print(classes)