Personally, I've always really enjoyed playing basketball. One of the most integral parts of the sport is dribbling, which can really only be done proficiently through lots of practice. However, not all practice is equal. I made this tool so that players can practice using a tool that will keep remind them when they are not looking up, since looking down at the basketball during practice rarely improves technique.

What it does

Levelhead uses computer vision to determine the angle a person's head is facing. If the head is too high or low, Levelhead gives an aural and visual alert to keep the head level. This ensures that the user will have a beneficial practice session while they practice dribbling. With this, players can keep their head level while practicing and remain level headed even during the most intense matches.

How I built it

I used OpenCV and mediapipe first to place facial landmarks on a user's head. Next, I picked specific landmarks and their respective locations and passed them through a Perspective and Point formula to determine the direction the person is facing. Next, I developed my own formula to determine the vertical component angle of the person's head. If facing too high/low, visual cues from OpenCV and audio cues from Playsound were used to tell the user to keep their head level while practicing.

Challenges I ran into

There were many challenges that came with the process of facial landmarking. Firstly, there were MANY choices that I could have used. I first started with dlib (the most commonly used one), then with HRNetV2, then with another lesser known pretrained model, and finally with Mediapipe (which actually worked). I spent way too much time trying to get each and every library to work, and learning Mediapipe was also a pain.

Accomplishments that I'm proud of

I am quite proud of my final product and how stable it is. I'm quite proud of how I got all of the Perspective and Point landmarks and their locations, which required a lot of documentation reading. My program was also surprisingly responsive considering how little time I had to make it.

What we learned

The last time I dabbled with computer vision was during my endeavors in the Hack the North hackathon where I made FreeNav (can probably be found somewhere on my github and devpost). This project helped me make another huge step in my computer vision journey. Though I didn't use many things, I still learned lots about many other formulas, ways to place facial landmarks, and even some linear algebra.

What's next for Levelhead

I would like Levelhead to be something more than just a dribbling trainer. But first, I would also like to create a stance commentor, which will tell you to go lower when dribbling if your stance is too high (dribbling in a lower stance also improves practice effectiveness). After that, I would like to also make a shooting coach which will analyze your shooting form as well. I hope to make Levelhead an effective, free resource for all prospective basketball players.

Built With

Share this project: