Spaces:
Sleeping
Sleeping
Commit
·
c672521
1
Parent(s):
d50694f
Update app.py
Browse files
app.py
CHANGED
@@ -4,36 +4,6 @@ from fastai.vision.all import *
|
|
4 |
import PIL
|
5 |
import torchvision.transforms as transforms
|
6 |
|
7 |
-
from albumentations import (
|
8 |
-
Compose,
|
9 |
-
OneOf,
|
10 |
-
ElasticTransform,
|
11 |
-
GridDistortion,
|
12 |
-
OpticalDistortion,
|
13 |
-
HorizontalFlip,
|
14 |
-
Rotate,
|
15 |
-
Transpose,
|
16 |
-
CLAHE,
|
17 |
-
ShiftScaleRotate
|
18 |
-
)
|
19 |
-
|
20 |
-
class SegmentationAlbumentationsTransform(ItemTransform):
|
21 |
-
split_idx = 0
|
22 |
-
|
23 |
-
def __init__(self, aug):
|
24 |
-
self.aug = aug
|
25 |
-
|
26 |
-
def encodes(self, x):
|
27 |
-
img,mask = x
|
28 |
-
aug = self.aug(image=np.array(img), mask=np.array(mask))
|
29 |
-
return PILImage.create(aug["image"]), PILMask.create(aug["mask"])
|
30 |
-
|
31 |
-
transforms=Compose([HorizontalFlip(p=0.5),
|
32 |
-
Rotate(p=0.40,limit=10),GridDistortion()
|
33 |
-
],p=1)
|
34 |
-
|
35 |
-
transformPipeline=SegmentationAlbumentationsTransform(transforms)
|
36 |
-
|
37 |
class TargetMaskConvertTransform(ItemTransform):
|
38 |
def __init__(self):
|
39 |
pass
|
|
|
4 |
import PIL
|
5 |
import torchvision.transforms as transforms
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
class TargetMaskConvertTransform(ItemTransform):
|
8 |
def __init__(self):
|
9 |
pass
|