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

Warping Result #47

Closed
zhangyahu1 opened this issue Oct 28, 2021 · 8 comments
Closed

Warping Result #47

zhangyahu1 opened this issue Oct 28, 2021 · 8 comments

Comments

@zhangyahu1
Copy link

zhangyahu1 commented Oct 28, 2021

Hi @AliaksandrSiarohin,

May I ask a question about the warping result like this:
1
It seems the moved region is filled in the warping image (the third column) based on the estimated optical flow. I try to use the off-the-self model to predict the optical flow, however, the warping result have the issue about double region like this:
3
I would appreciate it if you can give me any hint to solve this problem.

@AliaksandrSiarohin
Copy link
Collaborator

Don't understand what you mean, but you should use occlusion mask to get rid of double regions.

@zhangyahu1
Copy link
Author

zhangyahu1 commented Oct 28, 2021

For example, the arrow part has the right leg in the source image but the arrow apart in the warping result is filled with the background. However, the warping results for my implementation have double regions.

@zhangyahu1
Copy link
Author

This is the code:

bsz, c, h, w = inp.size()
xx = torch.arange(0, w).view(1 ,-1).repeat(h ,1)
yy = torch.arange(0, h).view(-1 ,1).repeat(1 ,w)
xx = xx.view(1,1,h,w).repeat(bsz,1,1,1)
yy = yy.view(1,1,h,w).repeat(bsz,1,1,1)
grid = torch.cat((xx,yy), dim=1).float().cuda()
vgrid = grid + flow
# scale to [-1, 1]
vgrid[:,0,:,:] = 2.0 * vgrid[:,0,:,:].clone()/max(w-1,1) - 1.0
vgrid[:,1,:,:] = 2.0 * vgrid[:,1,:,:].clone()/max(h-1,1) - 1.0
vgrid = vgrid.permute(0,2,3,1)
warping = F.grid_sample(inp, vgrid, mode='bilinear', padding_mode='zeros', align_corners = True)

@AliaksandrSiarohin
Copy link
Collaborator

It is filled with some random staff nearby, the generator should not consider this part. Occlusion mask will instruct the generator to exclude this part from consideration.

@zhangyahu1
Copy link
Author

Thanks!

@zhangyahu1
Copy link
Author

So do you mean the part is filled with background by 'inacccurate' estimated optical flow (but may contribute to the final performance) instead of interpolation operation? If not, could you please tell me which part in your code does this operation?

@AliaksandrSiarohin
Copy link
Collaborator

Yes. Optical flow in these regions is undefined, this is just an accedent that it is decently warped.

@zhangyahu1
Copy link
Author

I see. Thanks a lot!

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

2 participants