14
u/booleanhooligan May 09 '20
Very cool I wouldn’t be surprised if this is already implemented in the nba
12
u/chonyyy May 09 '20
Actually they did, with a way more advanced technique. They got so so many interesting data with it. And I'm really into it. Too bad I could only build a simple one like this :(
9
u/Bhanureddy38 May 09 '20
Don’t worry. You started something. That’s great. I didn’t even start to learn machine learning. Inspired from you, I will learn the basics first.
2
0
u/r-_-mark May 09 '20
I just dunno how to start learn AI / ML What is the first course I should take it’s so overwhelming for me + I dunno do I start with tenserflow immediately or there are some background therotical stuff I need to learn
1
u/joshred May 09 '20
What do you know already (python/mathwiseA)?
1
u/r-_-mark May 09 '20
2+ years and started python for 6+ months + I know flask/numpy Also am taking CS course about three years Took the into to AI (three jars problem / Env Agnet model ..etc ) all these Hindu still didn’t quit help me to know what to do next
9
17
May 09 '20
Curious, how does it perform when it is an "air ball"?
10
u/chonyyy May 09 '20
It will judge it as a miss. The logic that I'm currently implementing in it is actually really simple.
At the moment the ball goes below the hoop, we check if it's directly below the hoop. I know there will still be misjudgements with this method. So I'm still trying my best to optimize the accuracy.
BTW, I have provided the source code, feel free to try out your own footage!
3
u/CottonCandyLollipops May 09 '20
Could you use two cameras for that? Or like a Kinect camera for depth?
2
u/chonyyy May 09 '20
Sure that will be a great idea. But I will like to keep it as simple as one camera. Trying to work with the motion on the net.
3
May 09 '20
Could you please tell me how long did you take to build this awesome project and from how long have you been into AI. Thanks in advance.
6
u/chonyyy May 09 '20
I have been planning on it for quite a long time. For the actual working time, I would say it's around one month. But I'm really dumb, so it depends.
I am not being humble, I actually know nothing about AI. I just found out a way to integrate different implementations. I only understand the basics of deep neural network, CNN, RNN.
1
2
u/Funny-Promise May 18 '20
The model Faster-RCNN seems slow on performance on video input. Thought of optimizing the model using tf-lite or using a faster model like ssd-mobilenet(the accuracy will decrease though) ?
2
u/chonyyy May 18 '20
Hi, I have tried the ssd-mobilenet, and the accuracy is an absolute disaster.
Actually, I really wanna improve the inference time of the video. I will definitely check out tf-lite and see if it could help. Thanks!
127
u/hareeshkrkollam May 09 '20
Hey, actually it seems so good. Congratulations. These will definitely encourage us to learn ML. Thanks for the inspiration.
3
2
u/Kaltane May 09 '20
What if you shoot behind but it seems like you scored from a 2d perspective?
4
u/chonyyy May 09 '20
Great question. It will misjudge it as a score. And I'm still trying my best to optimize the accuracy.
BTW, I have provided the source code, feel free to try out your own footage!
4
u/Dontneedflashbro May 09 '20
As a sports fan I love this! It's amazing what you can do with python.
1
u/BoroPaul Jun 04 '20
Steve Balmer owns the La Clippers and they have something called Courtvision which is delayed by a couple of seconds from the live feed but has lots of AI driven overlays
1
3
u/ApoorvWatsky May 09 '20
What data did you use to train your model? Is it publicly available or you created it on your own?
3
u/jpm2892 May 09 '20
Could someone please explain to me how can you get information about the location of the ball in the video? What library or framework or knowledge is used? How do you "read" pictures in python? It's something I've always been curious about.
3
u/nitrobamtastic May 09 '20
Although not quite the same, you might find this video kind of interesting. A guys details his journey of making a basketball hoop that always goes in. Even ends up sharing his code and breaking down exactly how he did it.
1
u/lambda5x5 May 09 '20
Did you train your own model? How much data did you need and how did you collect it?
4
u/chonyyy May 09 '20
Yes I trained it with faster RCNN.
As for the data, I basically used my phone to take about 500 photos on the court. And manually labelled them all.
Yes, I know I'm out of my mind lul.
2
2
u/you-cant-twerk May 09 '20
This is fucking awesome! Dude you could totally create a device that people could use to livestream basketball games, and control the UI with the score. Can you give it a "score" based on the position of the player?
2
May 09 '20
Really neat and impressive project! Have you tested how different or dynamic camera angles affect the accuracy of the analysis?
2
u/old_enough_to_drink May 09 '20
Great job! I am curious about how much does it cost to run this app every day. Would you mind to share?
2
2
2
2
1
0
-3
24
May 09 '20
[removed] — view removed comment
44
u/chonyyy May 09 '20
TBH, someone already did it lul. It's called Homecourt and I was actually inspired by it. My ultimate goal is to clone most of the features with my machine learning knowledge.
I have no intention of making money with this project. I built it simply because I think it would be fun, and also be a good practice for me.
11
1
u/Smok3dSalmon May 09 '20
They had something like this in the NHL over a decade ago. It would track the puck on the screen and alter the color and contrast so that it would be easier for the audience to see it on TV. People HATED it, I don't know why lol. Maybe it created a delay on live TV... who knows.
90
u/chonyyy May 09 '20 edited May 09 '20
GitHub link:
https://github.com/chonyy/AI-basketball-analysis
Hi guys, this is the first AI project that I built with Python, TensorFlow, and OpenCV.
I removed some features and built this demo site. It's a web App and API hosted with Flask. Please feel free to try it out.
There are still many aspects that I can improve and extend. At this current stage, I would like to take as much feedback as possible. Any kind of thought is welcomed.