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

Some questions of sampler.py #32

Open
UncleChuanchuan opened this issue Sep 23, 2020 · 1 comment
Open

Some questions of sampler.py #32

UncleChuanchuan opened this issue Sep 23, 2020 · 1 comment

Comments

@UncleChuanchuan
Copy link

UncleChuanchuan commented Sep 23, 2020

1、
pscores = (feat1[None,:,:] * feat2[b2, :, xy2p[1], xy2p[0]]).sum(dim=-1).t()

I can't understand the code above, in the sampler.py, to compute the pscores.

2、
Does the mask get from the dataloader has been used? I found that the mask which the loss using is from the sampler.py.
I trid to pop the 'mask' from inputs of net, it still work.

Is there someone can explain it for me?
Thx a lot!

@jerome-revaud
Copy link
Contributor

Hi.

Well, it is quite complicated for sure. This is essentially computing the dot-product between features from the first image and the second image, given the pixel alignment in xy2p. You first need to get familiar with advanced slicing techniques, see this link for instance.

About the mask. What actually happens is that invalid pixels (area where the optical flow is undefined) are set to nan according to the mask:

aflow[~mask.view(bool)] = np.nan # mask bad pixels!

So the mask is superfluous after that, since the validity is directly encoded into the optical flow matrix. Note that if there is no mask, the dataloader will assume that all pixels are valid (see this line).

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