-
Notifications
You must be signed in to change notification settings - Fork 7k
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
VideoClips Assertion Error #1884
Comments
Hello and thank you for the thorough analysis. This issue seems like a corrupted file, but as you say, FFMPEG info looks ok. Best, |
I'm having a similar problem: Traceback (most recent call last):
File "/Users/fernando/git/sudep/scripts/infer_video_kinetics.py", line 99, in <module>
sample = dataset[i]
File "/Users/fernando/git/sudep/scripts/infer_video_kinetics.py", line 74, in __getitem__
video, audio, info, video_idx = self.video_clips.get_clip(idx)
File "/usr/local/Caskroom/miniconda/base/envs/sudep/lib/python3.6/site-packages/torchvision/datasets/video_utils.py", line 367, in get_clip
video.shape, self.num_frames
AssertionError: torch.Size([6, 128, 228, 3]) x 8 I'm iterating over a |
I haven't been able to try with /usr/local/Caskroom/miniconda/base/envs/sudep/lib/python3.6/site-packages/torchvision/__init__.py:64: UserWarning: video_reader video backend is not available
warnings.warn("video_reader video backend is not available") |
@fmassa this seems like a problem similar to what I had on my devmachine which I have attributed to the overall messiness of my conda installation and such: namely, I've had several issues where a standard install would not build the note: often a few iterations of a) and b) before everything was working properly @fepegar can you confirm that this is what's happening? Thanks and best wishes, |
I'm not sure exactly what you'd like me to confirm 😅 I'm on macOS, ran this: $ conda create -n tv python -y && conda activate tv && pip install torch torchvision
$ python -c "import torchvision; torchvision.set_video_backend('video_reader')" And got the above message. I'll investigate further. But I feel like this discussion should maybe move to a new issue. |
My value of vision/torchvision/io/_video_opt.py Line 24 in 7a36388
I just tried building from source, but I'm still not able to set the |
@fmassa do you have a idea about the issue? |
Hello, We digged a bit more in this and found that setting vision/torchvision/io/video.py Line 110 in 85b8fbf
The problem is in this section that reads the frames: vision/torchvision/io/video.py Lines 144 to 150 in 85b8fbf
PTS might not be read in order and this causes the break to happen before all the relevant frames have been read. For example in our case our It seems this can happen with AVI videos, I found this discussion on PyAV relevant PyAV-Org/PyAV#534. We confirm we are in a similar case, our AVI video has frames without PTS as it is not strictly required. Setting the |
Hi @mjunyent Thanks for the investigation! We could make The issue I found with empty pts was due to packed b-frames in DivX, but that was the only case I found for this type of video. I agree that the handling for this is very fragile though. If you could do some performance benchmarks comparing the runtime penalty of always setting |
Thanks! Shall I create an issue about |
I'm still having this issue (on Linux). I'm using version 0.6.0 and I set My video:
|
Should I open a new issue for this? |
@fepegar Hi, do you solve this probem? |
@mjunyent Hi, do you solve this probem? |
I still run into this issue |
Still seeing this error. |
@jramapuram Could you please confirm if #5489 fixes your error? |
I am running into a similar issue, where the VideoClips instance is returns exactly one more frame than expected (tested with several values). I am using PyAV as a backend on I have no idea of how to solve this, or if it's even a problem. I could just drop the last frame, but that doesn't seem like what I should do. |
Hello,
I'm trying to load a big video. Following #1446 I used a VideoClips object, but it's crashing when trying to get clips with certain ids with this error:
The code I use is just this:
video_clips.num_clips()
is much bigger than the ids that are failing. Changing the clipt_length or frames_between doesn't help.Checking the code I see [0,1,1,3] is returned by
read_video
when no vframes are read:vision/torchvision/io/video.py
Lines 251 to 254 in 85b8fbf
But, for some clip ids and clip_lengths it's just that the sizes don't match, as the assertion error is something like this
AssertionError: torch.Size([19, 360, 640, 3]) x 128
I followed the issue to
_read_from_stream
and checked no AV exceptions where raised. And running this part of the function:vision/torchvision/io/video.py
Lines 144 to 150 in 85b8fbf
I saw that for an
start_pts=32032
,end_pts=63063
it returned just one frame onframes
withpts=237237
. Which is later discarted as it's a lot bigger thanend_pts
.Also, the
stream.time_base
isFraction(1, 24000)
which doesn't match the start and end pts provided by VideoClips.So it seems there is a problem with the seeking on my video. But it has a standard h264 encoding and I have no problem reading it sequentially with pyav.
I'm wondering if I'm doing something wrong or there might be an issue with the
read_video
seeking (as the warning says it should be using seconds?).This is the video info according to ffmpeg:
Thanks!
The text was updated successfully, but these errors were encountered: