Spaces:
Build error
Build error
Update utils.py
Browse files
utils.py
CHANGED
@@ -5,6 +5,7 @@ import numpy as np
|
|
5 |
from detectron2.utils.colormap import colormap
|
6 |
from detectron2.utils.visualizer import VisImage, Visualizer
|
7 |
from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET
|
|
|
8 |
|
9 |
|
10 |
CLASSES = [
|
@@ -286,4 +287,14 @@ def show_result(img,
|
|
286 |
if show:
|
287 |
all_rel_vis.append(output_viz_graph)
|
288 |
|
289 |
-
return all_rel_vis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
from detectron2.utils.colormap import colormap
|
6 |
from detectron2.utils.visualizer import VisImage, Visualizer
|
7 |
from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET
|
8 |
+
from PIL import Image
|
9 |
|
10 |
|
11 |
CLASSES = [
|
|
|
287 |
if show:
|
288 |
all_rel_vis.append(output_viz_graph)
|
289 |
|
290 |
+
return all_rel_vis
|
291 |
+
|
292 |
+
|
293 |
+
def make_gif(np_images):
|
294 |
+
frames = [Image.fromarray(numpy_image.astype('uint8'), 'RGB') for numpy_image in np_images]
|
295 |
+
# frames = [Image.open(image) for image in images]
|
296 |
+
frame_one = frames[0]
|
297 |
+
file_name = "top_rel.gif"
|
298 |
+
frame_one.save(file_name, format="GIF", append_images=frames,
|
299 |
+
save_all=True, duration=1000, loop=0)
|
300 |
+
return file_name
|