def _cohn_kanade_orig(datadir, im_shape, na_val=-1):
    """Creates dataset (pair of X and y) from Cohn-Kanade
    image data (CK+)"""
    images = []
    landmarks = []
    labels = []
    n = 0
    for name in os.listdir(os.path.join(datadir, 'images')):
        n += 1
        print('processed %d' % n)
        impath = os.path.join(datadir, 'images', name)
        lmname = name.replace('.png', '_landmarks.txt')
        lmpath = os.path.join(datadir, 'landmarks', lmname)
        labelname = name.replace('.png', '_emotion.txt')
        labelpath = os.path.join(datadir, 'labels', labelname)
        try:
            im = imread(impath)
        except __HOLE__:
            continue
        im = standartize(im, im_shape)
        images.append(im.flatten())
        landmarks.append(read_landmarks(lmpath).flatten())
        # processing labels
        if os.path.exists(labelpath):
            labels.append(read_label(labelpath))
        else:
            labels.append(-1)
    return np.vstack(images), np.array(landmarks), np.array(labels)
dataset/ETHPy150Open dfdx/masque/masque/datasets.py/_cohn_kanade_orig