Update inference_video.py
This commit is contained in:
parent
679422249c
commit
62038dff89
|
@ -172,15 +172,15 @@ while True:
|
|||
I0 = I1
|
||||
I1 = torch.from_numpy(np.transpose(frame, (2,0,1))).to(device, non_blocking=True).unsqueeze(0).float() / 255.
|
||||
I1 = F.pad(I1, padding)
|
||||
p = (F.interpolate(I0, (ph // 16, pw // 16), mode='bilinear', align_corners=False)
|
||||
- F.interpolate(I1, (ph // 16, pw // 16), mode='bilinear', align_corners=False)).abs().mean()
|
||||
if p < 1e-3 and args.skip:
|
||||
diff = (F.interpolate(I0, (ph // 16, pw // 16), mode='bilinear', align_corners=False)
|
||||
- F.interpolate(I1, (ph // 16, pw // 16), mode='bilinear', align_corners=False)).abs()
|
||||
if diff.max() < 2e-3 and args.skip:
|
||||
if skip_frame % 100 == 0:
|
||||
print("Warning: Your video has {} static frames, skipping them may change the duration of the generated video.".format(skip_frame))
|
||||
skip_frame += 1
|
||||
pbar.update(1)
|
||||
continue
|
||||
if p > 0.2:
|
||||
if diff.mean() > 0.2:
|
||||
output = []
|
||||
for i in range((2 ** args.exp) - 1):
|
||||
output.append(I0)
|
||||
|
|
Loading…
Reference in New Issue