[92cc18]: / data / augmentation.py

Download this file

43 lines (31 with data), 950 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import albumentations as A
from torchvision import transforms
def pipeline_tranforms():
return transforms.Compose([
transforms.Resize((512, 512)),
transforms.ToTensor()
])
def albumentation_pixelwise_transforms():
return A.Compose([
A.ImageCompression(1, 50, p=0.1),
A.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2, hue=0.01, p=0.1),
A.RandomSnow(p=0.1),
A.GlassBlur(p=0.1),
A.CLAHE(p=0.1)
])
def albumentation_mask_transforms():
return A.Compose([
A.HorizontalFlip(),
A.VerticalFlip(),
A.RandomRotate90(p=0.25),
A.ElasticTransform(p=0.1),
A.OpticalDistortion(p=0.1)
])
def image_transforms():
return transforms.Compose([
transforms.ColorJitter(0.1, 0.1, 0.1),
transforms.RandomAdjustSharpness(0.9, 0.1),
transforms.RandomAutocontrast()
])
if __name__ == '__main__':
pass