Skip to content

Commit

Permalink
Merge branch 'video_demo' of https://github.com/open-mmlab/mmediting
Browse files Browse the repository at this point in the history
…into video_demo
  • Loading branch information
ckkelvinchan committed Dec 23, 2021
2 parents d47e563 + 1e5b658 commit b67cf98
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/restoration_video_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def main():
args.filename_tmpl, args.max_seq_len)

file_extension = os.path.splitext(args.output_dir)[1]
if file_extension in VIDEO_EXTENSIONS: # save as mp4
if file_extension in VIDEO_EXTENSIONS: # save as video
h, w = output.shape[-2:]
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
video_writer = cv2.VideoWriter(args.output_dir, fourcc, 25, (w, h))
Expand Down
Binary file added tests/data/test_inference.mp4
Binary file not shown.
14 changes: 14 additions & 0 deletions tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,17 @@ def test_restoration_video_inference():
model.cfg.val_pipeline = model.cfg.val_pipeline[1:]
output = restoration_video_inference(model, img_dir, window_size,
start_idx, filename_tmpl)

# video (mp4) input
model = init_model(
'./configs/restorers/basicvsr/basicvsr_reds4.py',
None,
device='cuda')
img_dir = './tests/data/test_inference.mp4'
window_size = 0
start_idx = 1
filename_tmpl = 'im{}.png'

output = restoration_video_inference(model, img_dir, window_size,
start_idx, filename_tmpl)
assert output.shape == (1, 5, 3, 256, 256)

0 comments on commit b67cf98

Please sign in to comment.