Rubén Escobedo commited on
Commit
073fc60
1 Parent(s): 98062cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -20
app.py CHANGED
@@ -7,26 +7,6 @@ import torch
7
  learn = load_learner('export.pkl')
8
 
9
  # Definimos todo lo necesario para hacer inferencia
10
- class TargetMaskConvertTransform(ItemTransform):
11
- def __init__(self):
12
- pass
13
- def encodes(self, x):
14
- img,mask = x
15
-
16
- #Convert to array
17
- mask = np.array(mask)
18
-
19
- # background = 0, leaves = 1, pole = 74 o 76, wood = 25 o 29, grape = 255
20
- mask[mask == 255] = 1 # grape
21
- mask[mask == 150] = 2 # leaves
22
- mask[mask == 76] = 3 ; mask[mask == 74] = 3 # pole
23
- mask[mask == 29] = 4 ; mask[mask == 25] = 4 # wood
24
- mask[mask >= 5] = 0 # resto: background
25
-
26
- # Back to PILMask
27
- mask = PILMask.create(mask)
28
- return img, mask
29
-
30
  def transform_image(image, device):
31
  my_transforms = transforms.Compose([transforms.ToTensor(),
32
  transforms.Normalize(
 
7
  learn = load_learner('export.pkl')
8
 
9
  # Definimos todo lo necesario para hacer inferencia
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  def transform_image(image, device):
11
  my_transforms = transforms.Compose([transforms.ToTensor(),
12
  transforms.Normalize(