roboflow / inference

A fast, easy-to-use, production-ready inference server for computer vision supporting deployment of many popular model architectures and fine-tuned models.
https://inference.roboflow.com
Other
1.38k stars 133 forks source link

Add a custom video processing cookbook for fitness training with Inference, Supervision, and GPT integration. #820

Closed Matvezy closed 1 week ago

Matvezy commented 1 week ago

Description

Please include a summary of the change and which issue is fixed or implemented. Please also include relevant motivation and context (e.g. links, docs, tickets etc.).

This cookbook demonstrates a custom video processing use-case: creating a video-based fitness trainer. It uses Roboflow Inference to track body keypoints, calculate joint angles, and annotate them on video frames in real-time with Supervision. Additionally, it integrates GPT to provide fitness advice based on video frames and recorded data. The goal of this cookbook is to demonstrate how integrating Inference can enhance foundation models with vision capabilities like GPT 4o for more accurate, data-informed video processing.

List any dependencies that are required for this change.

openai, supervision: Installed automatically in the notebook.

Type of change

Please delete options that are not relevant.

How has this change been tested, please provide a testcase or example of how you tested the change?

This notebook was tested by running end-to-end on a sample fitness video. The outputs included annotated video frames with joint angles and GPT-generated fitness advice. Since the notebook runs independently, it does not affect other code or dependencies.

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Include a link to the cookbook in documentation for similar use cases (e.g., video processing, Yolo-Pose models, or GPT integrations).

Ensure users are aware of potential costs when using GPT and processing video data.

Docs

CLAassistant commented 1 week ago

CLA assistant check
All committers have signed the CLA.

PawelPeczek-Roboflow commented 1 week ago

Hi there, thanks for contribution, we do really appreciate that.

Few comments and I believe we could move forward with this change:

Comments about the content of the notebook (may be treated as potential enhancements or just ignored):

Matvezy commented 1 week ago

Thank you very much for your feedback Paweł! Your comments and suggestions for potential enhancements are great. I will address all of them and make another PR shortly.

PawelPeczek-Roboflow commented 1 week ago

is that you who is squating at the video?

Matvezy commented 1 week ago

is that you who is squating at the video?

Yes, I took that video on purpose so that it wouldn't have any copyright issues. I added the --no-check-certificate since I have the video stored on google drive and in some cases the download without it didn't work. So if we could place the media on your hosting that would be a great solution for that!

Matvezy commented 1 week ago

Hello Paweł,

I just committed a new version with the changes you requested. Your suggestions for potential enhancements are fantastic! Unfortunately, I was only able to implement one of them—the butt wink detection and analysis. For this, I added left and right pelvic tilt angle detection and processing.

The ideas for tracking the barbell's center of trajectory and incorporating different squat variations are excellent too. However, they would require quite a bit of additional code, which might push this notebook beyond the intended simplicity of a cookbook example. For now, I’ve decided to move forward with this version. That said, if any of those ideas are something you'd really like to see, please let me know, and I'll be happy to add them!

Please let me know if you have any thoughts, questions, or concerns. Thank you so much!

PawelPeczek-Roboflow commented 1 week ago

ok, that works - when I have some free time this week I will push the video on our hosting and then that would be simple wget to pull it- I will provide a link, then you can update a notebook and we are good to go

Matvezy commented 1 week ago

Awesome, thank you so much Paweł! I'm ready to make the changes anytime.

PawelPeczek-Roboflow commented 1 week ago

Ok, could you please just !wget 'https://media.roboflow.com/inference/notebooks/community/fitness_gpt_coach/squat_video.mp4' -O squat_video.mp4 - that should work now

also - please attribute you as the author of the example in readme

PawelPeczek-Roboflow commented 1 week ago

and could you also remove gif bin from the repository? I will squash merge such that there should not be a mark of the bins in git history

PawelPeczek-Roboflow commented 1 week ago

ok, URL left to be changed and we are good to go

Matvezy commented 1 week ago

Oh, I thought I changed a URL cell in my notebook, ie it is now !wget 'https://media.roboflow.com/inference/notebooks/community/fitness_gpt_coach/squat_video.mp4' -O squat_video.mp4

I can see it in my most recent "Fixes" commit, is it not displaying for you there? I may be missing something here.

PawelPeczek-Roboflow commented 1 week ago

a ok, did not get displayed in diff

PawelPeczek-Roboflow commented 1 week ago

ok, we are good to go, I will merge and release tmr and will try to get a decent exposure.

Thanks for contribution

Matvezy commented 1 week ago

Awesome, thank you so much Paweł! I really appreciate all of your help and great advice! I'm glad I got to contribute!