From 28eaa320413fb0c6081ece68afa778f51166f8fa Mon Sep 17 00:00:00 2001 From: hzwer <598460606@163.com> Date: Thu, 11 Nov 2021 16:07:57 +0800 Subject: [PATCH] Update inference_video.py --- inference_video.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inference_video.py b/inference_video.py index 6ca4615..3c56e51 100644 --- a/inference_video.py +++ b/inference_video.py @@ -212,9 +212,11 @@ while True: I1_small = F.interpolate(I1, (32, 32), mode='bilinear', align_corners=False) ssim = ssim_matlab(I0_small[:, :3], I1_small[:, :3]) + break_flag = False if ssim > 0.996: frame = read_buffer.get() # read a new frame if frame is None: + break_flag = True frame = lastframe else: temp = frame @@ -253,6 +255,8 @@ while True: write_buffer.put(mid[:h, :w]) pbar.update(1) lastframe = frame + if break_flag: + break if args.montage: write_buffer.put(np.concatenate((lastframe, lastframe), 1))