sczhou commited on
Commit
5fa813d
·
1 Parent(s): c1637a6

resize large video to avoid out of memory.

Browse files
web-demos/hugging_face/inpainter/base_inpainter.py CHANGED
@@ -205,6 +205,12 @@ class ProInpainter:
205
  # The ouput size should be divided by 2 so that it can encoded by libx264
206
  size = (int(ratio*size[0])//2*2, int(ratio*size[1])//2*2)
207
 
 
 
 
 
 
 
208
  frames_len = len(frames)
209
  frames, size, out_size = resize_frames(frames, size)
210
  flow_masks, masks_dilated = read_mask_demo(masks, frames_len, size, dilate_radius, dilate_radius)
 
205
  # The ouput size should be divided by 2 so that it can encoded by libx264
206
  size = (int(ratio*size[0])//2*2, int(ratio*size[1])//2*2)
207
 
208
+ # TODO: hard code to reduce memory
209
+ if max(size[0], size[1]) > 720:
210
+ scale = 720.0 / max(size[0], size[1])
211
+ # The ouput size should be divided by 2 so that it can encoded by libx264
212
+ size = (int(scale*size[0])//2*2, int(scale*size[1])//2*2)
213
+
214
  frames_len = len(frames)
215
  frames, size, out_size = resize_frames(frames, size)
216
  flow_masks, masks_dilated = read_mask_demo(masks, frames_len, size, dilate_radius, dilate_radius)