-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Change how frames are skipped in the generator #1348
Conversation
We'd like some help testing this! If you have the time, please run it on videos you have (any video will do!) and tell us if there are any issues. This will help us merge faster. It's pretty simple:
pip install git+https://github.com/roboflow/supervision.git@fix/no-frames-generated-for-some-videos
import supervision as sv
import cv2
path_to_video = "test2.mp4"
cv2.namedWindow("Frame", cv2.WINDOW_NORMAL)
for frame in sv.get_video_frames_generator(path_to_video):
cv2.imshow("Frame", frame)
# Press Q to stop
if cv2.waitKey(1) == ord("q"):
break I'd like to know:
|
Test on videos of #1345:
|
Hi @LinasKo, one question off the topic. How do you generate this pip of the branch(Step 1) that you are currently working on to install it on the Colab notebook? I am working on some other project and I wanted to test it on Colab soo... |
Here's how we do it: You may also find it at the very bottom of the cheatsheet Does that answer your question? |
@LinasKo Just one comment, this will make skipping large amounts of frames really slow. |
@piotr, requesting your review. Colab: https://colab.research.google.com/drive/1MGoj7Imgen9zYnMqzGDcP20hRmK76DNr?usp=sharing |
stride: int = 1, | ||
start: int = 0, | ||
end: Optional[int] = None, | ||
manual_seek: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably call it iterative_seek
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created PR #1481 to address this.
Description
For some videos, e.g. the one in #1345, the frame generator generates no frames. This happens when
video.get(cv2.CAP_PROP_POS_FRAMES, x)
is called, even whenx = video.get(cv2.CAP_PROP_FRAME_COUNT)
.Since we use this to skip the first N frames, we can do it manually instead by retrieving and dropping them.
This has the potential to affect many codebases, so thorough tests are needed.
At the very least. this should work on:
supervision.assets
Videos in Bug:Already tested.get_video_frames_generator
does not produce any frames. #1345Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Tested locally on Videos of #1345
Any specific deployment considerations
Docs