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

Forward vs. Backward Flow Field Estimation #7

Open
cverrier opened this issue Sep 12, 2024 · 0 comments
Open

Forward vs. Backward Flow Field Estimation #7

cverrier opened this issue Sep 12, 2024 · 0 comments

Comments

@cverrier
Copy link

Hi, I just found your repository and I tried to dig deeper into the details of the model you built to estimate optical flow.

I have a question regarding the direction of the flow field that the network outputs: is it a forward flow field or a backward flow field?

Some precisions:

  • By 'forward flow field', I mean "start with pixels in the first frame and try to find where they move to in the second frame", or in other words, "where does each pixel in the first frame end up in the second frame?", which also means that "the flow vectors point from the first frame to the second frame".
  • By 'backward flow field', I mean the opposite of the forward flow field, i.e. "start with pixels in the second frame and try to find where they came from in the first frame", i.e. "where did each pixel in the second frame come from in the first frame?", i.e. "the flow vectors point from the second frame back to the first frame".

Based on the code that I read, the flow estimation starts with the computation of the correlations between the features associated with the two input frames:

flow0 = self.matching_s16.global_correlation_softmax(feature0_s16, feature1_s16)

correspondence = F.scaled_dot_product_attention(feature0, feature1, self.flatten_grid)

Then the flow is calculated as

flow = correspondence - self.grid

Though I am not entirely sure, I think this represents the displacement from the source frame (i.e. the first frame) to the target frame (i.e. the second frame). Therefore, I would assume that the forward flow field is what the network estimates.

Is this correct?

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

1 participant