def augment(img_list, hflip=True, rot=True):
    hflip = (hflip and (random.random() < 0.5))
    vflip = (rot and (random.random() < 0.5))
    rot90 = (rot and (random.random() < 0.5))

    def _augment(img):
        if hflip:
            img = np.flip(img, axis=1)
        if vflip:
            img = np.flip(img, axis=0)
        if rot90:
            img = np.rot90(img, 1)
        return img
    return [_augment(img) for img in img_list]
def augment(img_list, hflip=True, rot=True):
    hflip = (hflip and (random.random() < 0.5))
    vflip = (rot and (random.random() < 0.5))
    rot90 = (rot and (random.random() < 0.5))

    def _augment(img):
        if hflip:
            img = np.flip(img, axis=1)
        if vflip:
            img = np.flip(img, axis=0)
        if rot90:
            img = np.rot90(img, 1)
        return img
    return [_augment(img) for img in img_list]