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

Emphasise the optical flow is calculated at input resolution. #5350

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

5had3z
Copy link
Contributor

@5had3z 5had3z commented Mar 2, 2024

Category:

Documentation

Description:

I personally have made a mistake in using this operator by misinterpreting the output vector quantities as the resolution of the output image. A common pattern pytorch to automate dealing with flow vectors is to autmatically scale the flow magnitude and resolution at the same time in the following code.

scale = image.shape[-1] / flow.shape[-1]
flow_scale = torch.nn.functional.interpolate(flow * scale, scale_factor=scale, mode='bilinear')

By emphasising the output of this operator is always at the resolution of the input, but the resolution of the output may differ, I hope to prevent others from making this same mistake.

Context

Original datapipe code...

pipedata["flow_pn"] = fn.optical_flow(image_seq)

...was fixed with (since default output_grid=4)

pipedata["flow_pn"] = fn.optical_flow(image_seq) / 4

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

@JanuszL
Copy link
Contributor

JanuszL commented Mar 4, 2024

!build

@JanuszL
Copy link
Contributor

JanuszL commented Mar 4, 2024

Hi @5had3z,

Thank you for your contribution.

@klecki
Copy link
Contributor

klecki commented Mar 4, 2024

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [13260491]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [13260491]: BUILD PASSED

@klecki klecki merged commit b3fbc98 into NVIDIA:main Mar 5, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

5 participants