Skip to content

Unify video metadata in VideoClips #1527

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

Merged
merged 3 commits into from
Oct 29, 2019

Conversation

fmassa
Copy link
Member

@fmassa fmassa commented Oct 28, 2019

This PR unifies the metadata information in VideoClips, relying on the new unified backend functionality from #1514

It still keeps the call to the internal _read_video_from_file, because we still need to pass _video_height / etc for efficiency (but maybe that can be removed in the future?)
The downside of the current approach is that we now need to call _probe_video_from_file at every call to get_clip, which should be fine given that _probe_video_from_file is very cheap.

cc @stephenyan1231 , as this will probably break old checkpoints from internal runs that relied on the old metadata.

@codecov-io
Copy link

codecov-io commented Oct 28, 2019

Codecov Report

Merging #1527 into master will increase coverage by 0.04%.
The diff coverage is 55%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1527      +/-   ##
=========================================
+ Coverage   64.56%   64.6%   +0.04%     
=========================================
  Files          87      87              
  Lines        6694    6742      +48     
  Branches     1033    1034       +1     
=========================================
+ Hits         4322    4356      +34     
- Misses       2071    2085      +14     
  Partials      301     301
Impacted Files Coverage Δ
torchvision/datasets/video_utils.py 72.25% <51.51%> (+7.16%) ⬆️
torchvision/io/_video_opt.py 65.89% <71.42%> (+0.03%) ⬆️
torchvision/models/detection/roi_heads.py 54.63% <0%> (-1.52%) ⬇️
torchvision/transforms/functional.py 71.67% <0%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30cb4e1...9694d5d. Read the comment docs.

@@ -383,7 +383,7 @@ def get_pts(time_base):
audio_timebase = info['audio_timebase']
audio_pts_range = get_pts(audio_timebase)

return _read_video_from_file(
vframes, aframes, info = _read_video_from_file(
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems a few arguments of _read_video_from_file , such as video_width, video_height, video_min_dimension, are not used here, and can not be specified in API _read_video.

Video frame resizing is fast if done inside of video reader. I would like to keep those argument exposed.

However, pyav backends does not support such resizing. For now, you already raise ValueError when they are not zero. In the long-run, we can consider applying video resizing transform to keep the same behavior between pyav and video_reader backend.

Copy link
Member Author

@fmassa fmassa Oct 29, 2019

Choose a reason for hiding this comment

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

My thinking is that I want to first properly benchmark the benefits of having the rescaling happening in ffmpeg to have an idea of how much improvements it will bring us.

Once we have the numbers, we should analyze them and then decide on how to expose the resizing functionality in a clean way to the users. I think this should be done after December though

Note that power users can still use the private API for specifying the video_width / etc, so this functionality is available but not part of the public API

@fmassa fmassa merged commit 7d509c5 into pytorch:master Oct 29, 2019
@fmassa fmassa deleted the unify-video-metadata-in-videoclips branch October 29, 2019 12:58
@fmassa fmassa mentioned this pull request Oct 31, 2019
fmassa added a commit that referenced this pull request Oct 31, 2019
* Unify video metadata in VideoClips

* Bugfix

* Make tests a bit more robust

* Fix merge conflicts for cherry-pick for 0.4.2
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.

3 participants