def transform_train_img(img):
    '''
    input: cv2.imread image.
    return: transformed PIL from torchvision.transform
    '''
    # do a series of transform on images
    img_processed = img_transform.random_gaussian_noise(img, sigma=0.1)
    img_processed = img_transform.random_angle_rotate(img_processed)
    img_processed = img_transform.random_crop(img_processed)
    img = Image.fromarray(img_processed)

    transform_basic = img_transform.transforms_img()
    return transform_basic(img)
Beispiel #2
0
def transform_image(img):
    img = Image.fromarray(img)
    transform_basic = img_transform.transforms_img()
    return transform_basic(img)