INNER CODE UNIT · Python

get_test_faces

MITDeepLearning/introtodeeplearning · mitdeeplearning/lab2.py:112

def get_test_faces(channels_last=True):
    cwd = os.path.dirname(__file__)
    images = {"LF": [], "LM": [], "DF": [], "DM": []}
    for key in images.keys():
        files = glob.glob(os.path.join(cwd, "data", "faces", key, "*.png"))
        for file in sorted(files):
            image = cv2.resize(cv2.imread(file), (64, 64))[:, :, ::-1] / 255.0
            if not channels_last:
                image = np.transpose(image, (2, 0, 1))
            images[key].append(image)

    return images["LF"], images["LM"], images["DF"], images["DM"]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…