Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ import math
|
|
| 21 |
from scipy.optimize import linear_sum_assignment
|
| 22 |
from obj365_name import categories as OBJ365_CATEGORIESV2
|
| 23 |
import copy
|
| 24 |
-
|
| 25 |
|
| 26 |
this_dir = path.dirname(path.abspath(__file__))
|
| 27 |
|
|
@@ -616,10 +616,14 @@ def segment_video(video, prompt_mode, categoryname, custom_category, expressiong
|
|
| 616 |
size = (ori_width,ori_height)
|
| 617 |
print('writing video...')
|
| 618 |
output_file = "test.mp4"
|
| 619 |
-
|
| 620 |
for i in range(len(ourput_frames)):
|
| 621 |
-
|
| 622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
del out_logits, out_masks, out_embds, out_boxes, pred_masks
|
| 624 |
torch.cuda.empty_cache()
|
| 625 |
return output_file
|
|
|
|
| 21 |
from scipy.optimize import linear_sum_assignment
|
| 22 |
from obj365_name import categories as OBJ365_CATEGORIESV2
|
| 23 |
import copy
|
| 24 |
+
import skvideo.io
|
| 25 |
|
| 26 |
this_dir = path.dirname(path.abspath(__file__))
|
| 27 |
|
|
|
|
| 616 |
size = (ori_width,ori_height)
|
| 617 |
print('writing video...')
|
| 618 |
output_file = "test.mp4"
|
| 619 |
+
writer = skvideo.io.FFmpegWriter(output_file)
|
| 620 |
for i in range(len(ourput_frames)):
|
| 621 |
+
writer.writeFrame(ourput_frames[i])
|
| 622 |
+
writer.close()
|
| 623 |
+
# out = cv2.VideoWriter(output_file,cv2.VideoWriter_fourcc(*'avc1'), read_fps, size)
|
| 624 |
+
# for i in range(len(ourput_frames)):
|
| 625 |
+
# out.write(ourput_frames[i])
|
| 626 |
+
# out.release()
|
| 627 |
del out_logits, out_masks, out_embds, out_boxes, pred_masks
|
| 628 |
torch.cuda.empty_cache()
|
| 629 |
return output_file
|