ShehryarAli commited on
Commit
58d1872
·
verified ·
1 Parent(s): 79c72fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -28,16 +28,20 @@ def draw_panoptic_segmentation(segmentation, segments_info):
28
  instances_counter = defaultdict(int)
29
  handles = []
30
  # for each segment, draw its legend
 
 
 
 
 
 
 
 
 
 
 
31
  for segment in segments_info:
32
  segment_id = segment['id']
33
- segment_label_id = segment['label_id']
34
- segment_label = model.config.id2label[segment_label_id]
35
- label = f"{segment_label}-{instances_counter[segment_label_id]}"
36
- instances_counter[segment_label_id] += 1
37
- color = viridis(segment_id)
38
- handles.append(mpatches.Patch(color=color, label=label))
39
-
40
- ax.legend(handles=handles)
41
 
42
  # Save the figure to a buffer and convert it to a PIL image
43
  buf = BytesIO()
 
28
  instances_counter = defaultdict(int)
29
  handles = []
30
  # for each segment, draw its legend
31
+ # for segment in segments_info:
32
+ # segment_id = segment['id']
33
+ # segment_label_id = segment['label_id']
34
+ # segment_label = model.config.id2label[segment_label_id]
35
+ # label = f"{segment_label}-{instances_counter[segment_label_id]}"
36
+ # instances_counter[segment_label_id] += 1
37
+ # color = viridis(segment_id)
38
+ # handles.append(mpatches.Patch(color=color, label=label))
39
+
40
+ # ax.legend(handles=handles)
41
+
42
  for segment in segments_info:
43
  segment_id = segment['id']
44
+ color = viridis(segment_id
 
 
 
 
 
 
 
45
 
46
  # Save the figure to a buffer and convert it to a PIL image
47
  buf = BytesIO()