提交 024ffd16 编写于 作者: W wangmeng28

Add rotate augmentation in SE-ResNeXt

上级 4f3aafe8
......@@ -46,6 +46,12 @@ def crop_image(img, target_size, center):
return img
def rotate_image(img):
angle = random.randint(-10, 10)
img = img.rotate(angle)
return img
def distort_color(img):
def random_brightness(img, lower=0.5, upper=1.5):
e = random.uniform(lower, upper)
......@@ -75,6 +81,7 @@ def process_image(sample, mode):
img = Image.open(img_path)
if mode == 'train':
img = resize_short(img, DATA_DIM + 32)
img = rotate_image(img)
else:
img = resize_short(img, DATA_DIM)
img = crop_image(img, target_size=DATA_DIM, center=(mode != 'train'))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册