Rubén Escobedo
commited on
Commit
·
df71250
1
Parent(s):
392b092
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,30 @@ import torchvision.transforms as transforms
|
|
4 |
import torch
|
5 |
|
6 |
# Definimos todo lo necesario para hacer inferencia
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
class TargetMaskConvertTransform(ItemTransform):
|
8 |
def __init__(self):
|
9 |
pass
|
|
|
4 |
import torch
|
5 |
|
6 |
# Definimos todo lo necesario para hacer inferencia
|
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 |
class TargetMaskConvertTransform(ItemTransform):
|
32 |
def __init__(self):
|
33 |
pass
|