Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RIFE 4.0 causes tensor size mismatch errors for some resolutions #6

Closed
n00mkrad opened this issue Dec 6, 2021 · 3 comments
Closed

Comments

@n00mkrad
Copy link

n00mkrad commented Dec 6, 2021

Interpolating 720p or 1440p video with RIFE 4.0 throws an error after some frames:

File "D:\Code\GitHub\flowframes\Code\bin\x64\Release\FlowframesData\pkgs\rife-cuda\arch\RIFE_HDv3.py", line 59, in inference
flow, mask, merged = self.flownet(imgs, timestep, scale_list)
File "D:\Software\Python38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Code\GitHub\flowframes\Code\bin\x64\Release\FlowframesData\pkgs\rife-cuda\arch\IFNet_HDv3.py", line 99, in forward
f0, m0 = block[i](torch.cat((warped_img0[:, :3], warped_img1[:, :3], timestep, mask), 1), flow, scale=scale_list[i])
RuntimeError: Sizes of tensors must match except in dimension 2. Got 768 and 736 (The offending index is 2)

1080p works fine, it seems to be some scaling/cropping issue?

I can reliably reproduce this problem on 4.0, but not on 3.9, so it seems to be caused by IFNet_HDv3.py changes.

@hzwer
Copy link
Owner

hzwer commented Dec 7, 2021

tmp = max(128, int(128 / args.scale))

Increasing this padding number to 128 can fix this issue.

@SportsmanLee
Copy link

Hi, is this RIFE 4.0 model trained with perceptual loss? Thx.

@hzwer
Copy link
Owner

hzwer commented Dec 9, 2021

@SportsmanLee Yes, 0.5 l1 loss + 0.5 perceptual loss ->

class VGGPerceptualLoss(torch.nn.Module):

@hzwer hzwer closed this as completed Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants