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

Fix pts -> index conversion in get_frame_at_timestamps[_in_range] #287

Merged
merged 3 commits into from
Oct 24, 2024

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Oct 24, 2024

This is a fix for the bug described in #286. We use a sightly different solution as suggested in #286 (comment).

This PR fixes the behavior of both get_frame_at_timestamps() and get_frames_at_timestamps_in_range().

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2024
@NicolasHug NicolasHug added the bug Something isn't working label Oct 24, 2024
stop_seconds=all_pts_seconds_ref[-1] + 1e-4,
)
assert_tensor_equal(pts_seconds, all_pts_seconds_ref)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: all test-cases above were passing on main.

The ones below this line were failing. We never caught the one on get_frames_by_pts_in_range because it was only triggered when start_seconds was later than the second-to-last frame. And the error message is quite.... interesting!

    def __call__(self, /, *args, **kwargs):
>       return self._op(*args, **kwargs)
E       RuntimeError: Trying to create tensor with negative dimension -1: [-1, 270, 480, 3]

Copy link
Contributor

@ahmadsharif1 ahmadsharif1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

@NicolasHug
Copy link
Member Author

Thanks for the review Ahmad. @scotts , I'll merge this now so I can move #284 forward, but I'll happily address any further comment you may have

@NicolasHug NicolasHug merged commit 1bdf928 into pytorch:main Oct 24, 2024
39 of 40 checks passed
@NicolasHug NicolasHug deleted the fix_alternative branch October 24, 2024 14:59
@scotts
Copy link
Contributor

scotts commented Oct 24, 2024

Just commenting to chime in on the actual merged PR that is is a great catch. Thanks for fixing my bug. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants