Set should_buffer to True by default in _read_from_stream video.py #2201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following the discussion, fixes #1884
I used VideoClips and the following code to test the drop in performance on
_read_from_stream
:In my local machine, with a 2:30s video (3577 clips) and after several iterations the mean times where
997s
for the current code and1050s
for the version withshould_buffer
enabled. This accounts for an increase of ~0,015s per clip.The default VideoClips length is 16 frames and the buffer size is 5 frames on each side. The drop in performance should be less noticeable with a bigger length.
The code related to DivX might still disable the
should_buffer
if it's not necessary on DivX cases:vision/torchvision/io/video.py
Lines 112 to 127 in 85b8fbf
I don't know if that part should be removed or if it's better to keep it.