roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
5.43k stars 855 forks source link

[Enhancement] Reusing trained model for other sports? #12

Closed timtensor closed 1 year ago

timtensor commented 1 year ago

Hi first of all thanks for such a good notebook and a follow along youtube tutorial. I was thinking of the possibility to reuse the model for smaller sports like doubles tennis etc.

  1. So four players + tennis ball. If i understand correctly the pre trained mode , from the Yolo V5 model should detect the ball . But perhaps the tracking is lost.
  2. How can i get the x,y co-ordinates of the ball and also the players in action. The idea would be to draw the movement of the ball, players over a 2D plane , shown in the image below
  3. For visual purposes , how can one modify the implementation image to have a set of trail spots basically for the visualization process.
SkalskiP commented 1 year ago

Hi, @timtensor 👋🏻! Thanks for your interest in Notebooks repository. First very important question is, is the camera stationary or is it moving?

timtensor commented 1 year ago

Stationary , facing the players.

SkalskiP commented 1 year ago

@timtensor, if the camera is stationary, it should be pretty simple. I did a project a few years - https://github.com/SkalskiP/fast-as-hell - it calculates the speed of cars moving on the video, and one of the key parts here is to transform the image from camera view to BEV. Most of the transformation lives in this file https://github.com/SkalskiP/fast-as-hell/blob/master/src/pipeline/nodes/transform.py.

timtensor commented 1 year ago

Thanks, i though first just outputting the x,y value of the objects. so the displacement would be x pixels, y pixel. If i know the ball is round 4 or 5 pixel i plan to convert pixel into meters. Perhaps it is not the best way.

So can i just use the pretrained model to run it on a video (tennis or volley) and check for the outputs. I think for that I would not need the kaggle and bundesliga datasets as they are specifically used for football?

SkalskiP commented 1 year ago

So can i just use the pretrained model to run it on a video (tennis or volley) and check for the outputs. I think for that I would not need the kaggle and bundesliga datasets as they are specifically used for football?

Yup lets start with model pre-trained on COCO dataset, to have some baseline.

Thanks, i though first just outputting the x,y value of the objects. so the displacement would be x pixels, y pixel. If i know the ball is round 4 or 5 pixel i plan to convert pixel into meters.

What I usually do is I measure size of real life object in m or cm, and I use those dimensions like in example I showed you.

SkalskiP commented 1 year ago

@timtensor can I close the issue?

SkalskiP commented 1 year ago

I'm closing the issue for now. Feel free to reopen if you'll have more questions.