Thiago Hersan commited on
Commit
ae2a815
1 Parent(s): 3e5e0ae

using new labels

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -9,7 +9,7 @@ ade_mean=[0.485, 0.456, 0.406]
9
  ade_std=[0.229, 0.224, 0.225]
10
 
11
  palette = [
12
- [120, 120, 120], [4, 200, 4], [180, 120, 120], [6, 230, 230],
13
  [80, 50, 50], [120, 120, 80], [140, 140, 140], [204, 5, 255]
14
  ]
15
 
@@ -36,6 +36,7 @@ def visualize_instance_seg_mask(img_in, mask, id2label):
36
  img_out = np.zeros((mask.shape[0], mask.shape[1], 3))
37
  image_total_pixels = mask.shape[0] * mask.shape[1]
38
  label_ids = np.unique(mask)
 
39
 
40
  id2color = {id: palette[id] for id in label_ids}
41
  id2count = {id: 0 for id in label_ids}
@@ -51,7 +52,7 @@ def visualize_instance_seg_mask(img_in, mask, id2label):
51
  f"{id2label[id]}",
52
  f"{(100 * id2count[id] / image_total_pixels):.2f} %",
53
  f"{np.sqrt(id2count[id] / image_total_pixels):.2f} m"
54
- ] for id in label_ids if 'tree' in id2label[id]]
55
 
56
  return image_res, dataframe
57
 
 
9
  ade_std=[0.229, 0.224, 0.225]
10
 
11
  palette = [
12
+ [120, 120, 120], [4, 200, 4], [4, 4, 250], [6, 230, 230],
13
  [80, 50, 50], [120, 120, 80], [140, 140, 140], [204, 5, 255]
14
  ]
15
 
 
36
  img_out = np.zeros((mask.shape[0], mask.shape[1], 3))
37
  image_total_pixels = mask.shape[0] * mask.shape[1]
38
  label_ids = np.unique(mask)
39
+ vegetation_labels = ["vegetation"]
40
 
41
  id2color = {id: palette[id] for id in label_ids}
42
  id2count = {id: 0 for id in label_ids}
 
52
  f"{id2label[id]}",
53
  f"{(100 * id2count[id] / image_total_pixels):.2f} %",
54
  f"{np.sqrt(id2count[id] / image_total_pixels):.2f} m"
55
+ ] for id in label_ids if id2label[id] in vegetation_labels]
56
 
57
  return image_res, dataframe
58