d22cs051 commited on
Commit
19d6989
·
1 Parent(s): 666a03b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -75,7 +75,8 @@ def predict(image, model_name: str = "detr",) -> Tuple[Dict, float]:
75
  # A tensor of shape (height, width) where each value denotes a segment id, filled with -1 if no segment is found
76
  panoptic_seg = result[0]["segmentation"]
77
  # Convert the tensor to PIL image
78
- plt.plot("predicted_panoptic_map.png", panoptic_seg, cmap="viridis")
 
79
  fig = plt.gcf()
80
  output = fig2img(fig)
81
  # output = PIL.Image.open("predicted_panoptic_map.png")
@@ -94,7 +95,8 @@ def predict(image, model_name: str = "detr",) -> Tuple[Dict, float]:
94
  result = processor.post_process_panoptic_segmentation(outputs, target_sizes=[image.size[::-1]])[0]
95
  # we refer to the demo notebooks for visualization (see "Resources" section in the MaskFormer docs)
96
  predicted_panoptic_map = result["segmentation"]
97
- plt.plot("predicted_panoptic_map.png", predicted_panoptic_map, cmap="viridis")
 
98
  fig = plt.gcf()
99
  output = fig2img(fig)
100
  # output = PIL.Image.open("predicted_panoptic_map.png")
 
75
  # A tensor of shape (height, width) where each value denotes a segment id, filled with -1 if no segment is found
76
  panoptic_seg = result[0]["segmentation"]
77
  # Convert the tensor to PIL image
78
+ plt.plot(panoptic_seg, cmap="viridis")
79
+ # plt.imsave("predicted_panoptic_map.png", panoptic_seg, cmap="viridis")
80
  fig = plt.gcf()
81
  output = fig2img(fig)
82
  # output = PIL.Image.open("predicted_panoptic_map.png")
 
95
  result = processor.post_process_panoptic_segmentation(outputs, target_sizes=[image.size[::-1]])[0]
96
  # we refer to the demo notebooks for visualization (see "Resources" section in the MaskFormer docs)
97
  predicted_panoptic_map = result["segmentation"]
98
+ plt.plot(predicted_panoptic_map, cmap="viridis")
99
+ # plt.imsave("predicted_panoptic_map.png", predicted_panoptic_map, cmap="viridis")
100
  fig = plt.gcf()
101
  output = fig2img(fig)
102
  # output = PIL.Image.open("predicted_panoptic_map.png")