-
Notifications
You must be signed in to change notification settings - Fork 606
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
Add yolov5-youtube example #1201
Conversation
@dsuess this is really awesome!! I like how simple the API is: send a youtube link, and get back and annotated video!
Does this help improve latency or just throughput? Are you running the API with
Yes, I agree, this makes for a nice example!
Yes, I think this is a great example! I can't think of any suggestions for improvements at the moment.
I will add it to our
This is also an interesting one, similar to the discussion about ffmpeg. My intuition says that downloading the video async could increase throughput (and not latency) assuming Thanks again for adding this! |
To be honest, the main reason for using ffmpeg-python was that I didn't want to implement the resize-padding for the hundredth time 😄 I think it improves both (especially when you run on a GPU) since it allows you to run model inference and data preprocessing (decoding, resizing) in parallel. But I haven't done any tests and there are definitely better solutions if you actually need to optimize either performance metric.
You're right on this one, this would only benefit throughput. And just increasing either |
OK, I've send through the ONNX file and fixed the things that needed fixing. So if someone with the necessary permissions can a) upload the ONNX file and change the path in the config and b) fix the failing test, we're good to go IMO. |
@dsuess Thank you a lot for adding this! I tried pushing to your branch, but apparently, I don't have write permissions. I think this might be because Also, I'd want to test this over the weekend. For that, do you have a public link to your ONNX model I could use? |
The box is ticked as far as I can tell, so not sure what's going on. For the ONNX file: https://drive.google.com/file/d/1p0nbSHUFpZhp6RxR2scNFaMk0ANHu_1e/view?usp=sharing I've also included the steps how to create that ONNX file from the original repo, so you could also try to reproduce those setps |
@dsuess thanks for the link. As for the write access, that was a false alarm (an old peculiarity of my setup). It now works! |
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.
This is a really great example, thanks again!
@RobertLucian @dsuess I've uploaded the model to |
Fixes error "conda libgnutls.so.30: symbol mpn_add_1 version HOGWEED_4 not defined in file libhogweed.so.4 with link time reference"
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.
This looks well to me! I took the liberty of modifying a few things here and there:
- Read the output video file as bytes and deleted the file before returning the bytes as the response's payload.
- Fix a bug with
ffmpeg
where the latest version of it from conda, which was released on the 6th of July, lead to this error:ffmpeg: relocation error: /opt/conda/envs/env/bin/../lib/./libgnutls.so.30: symbol mpn_add_1 version H OGWEED_4 not defined in file libhogweed.so.4 with link time reference
. Reverting it to its previous version4.2.3
made it work again - which is most likely the version @dsuess used. - Use a context manager when instantiating an object of
FrameWriter
's class. - Move functions to the
utils
module. - Decrease the line thickness by 4 times.
- Create GIF using the sample YT video.
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.
Everything looks and works great, thanks again for adding this example!
@dsuess is it ready to merge from your perspective? If so, we can go ahead and merge it now.
Yes, all good from my side |
addresses #1130
This is work in progress. I opened the PR to discuss some details.
Here's what this example does:
This demonstrates both, how to load any Yolo model from the ultralytics repo and how to process video pretty easily.
I am using ffmpeg-python (instead of the more standard opencv/scikkit-video) since it allows you to do large parts of the pre-processing (resizing & padding) in a separate process. The reason I am using youtube-dl (instead of passing in a video directly) is that we don't have to provide an example video ourselves.
Would this be a good example? Any suggestions for improvements? How do you want to store the ONNX file?
Here's what still needs to be done:
update the documentation on the websitea bit of performance optimizationasync the video-download?checklist:
make test
andmake lint
summary.md
(view in gitbook after merging)