def load_images_from_folder(folder, model_angle_dict, test_angle_dict):
    train_frames = []
    train_labels = []
    probe_frames = []
    probe_labels = []
    for i in xrange(11):
        train_frames.append([])
    for i in xrange(11):
        train_labels.append([])
    for i in xrange(11):
        probe_frames.append([])
    for i in xrange(11):
        probe_labels.append([])
    for human_id in os.listdir(os.path.join(folder, 'train')):
        if (int(human_id) < 74):
            continue
        for angle in os.listdir(os.path.join(folder, 'train', human_id)):
            for _type in os.listdir(os.path.join(folder, 'train', human_id, angle)):
                img = cv2.imread(os.path.join(folder, 'train', human_id, angle, _type), 0)
                if (img is not None):
                    train_frames[(int(angle) // 18)].append(img.flatten())
                    train_labels[(int(angle) // 18)].append(get_label(human_id, 124))
    for human_id in os.listdir(os.path.join(folder, 'test')):
        for angle in os.listdir(os.path.join(folder, 'test', human_id)):
            for _type in os.listdir(os.path.join(folder, 'test', human_id, angle)):
                img = cv2.imread(os.path.join(folder, 'test', human_id, angle, _type), 0)
                if (img is not None):
                    probe_frames[(int(angle) // 18)].append(img.flatten())
                    probe_labels[(int(angle) // 18)].append(get_label(human_id, 124))
    return (train_frames, train_labels, probe_frames, probe_labels)
def load_images_from_folder(folder, model_angle_dict, test_angle_dict):
    train_frames = []
    train_labels = []
    probe_frames = []
    probe_labels = []
    for i in xrange(11):
        train_frames.append([])
    for i in xrange(11):
        train_labels.append([])
    for i in xrange(11):
        probe_frames.append([])
    for i in xrange(11):
        probe_labels.append([])
    for human_id in os.listdir(os.path.join(folder, 'train')):
        if (int(human_id) < 74):
            continue
        for angle in os.listdir(os.path.join(folder, 'train', human_id)):
            for _type in os.listdir(os.path.join(folder, 'train', human_id, angle)):
                img = cv2.imread(os.path.join(folder, 'train', human_id, angle, _type), 0)
                if (img is not None):
                    train_frames[(int(angle) // 18)].append(img.flatten())
                    train_labels[(int(angle) // 18)].append(get_label(human_id, 124))
    for human_id in os.listdir(os.path.join(folder, 'test')):
        for angle in os.listdir(os.path.join(folder, 'test', human_id)):
            for _type in os.listdir(os.path.join(folder, 'test', human_id, angle)):
                img = cv2.imread(os.path.join(folder, 'test', human_id, angle, _type), 0)
                if (img is not None):
                    probe_frames[(int(angle) // 18)].append(img.flatten())
                    probe_labels[(int(angle) // 18)].append(get_label(human_id, 124))
    return (train_frames, train_labels, probe_frames, probe_labels)