Project: AI App That Count Repetition
Hi! Today I want to share my project. The Project is Flutter app that use AI to count repetition or time when you exercise using the camera. The app name is AI Trainer.
Why?
Training is quite a difficult thing, not only physically, but also mentally — you need to make sure you do the exercise in the right technique, count the repetitions, or the time, and also try to overcome the physical difficulty. The purpose of the app is to help the trainee and save useful data for him, for example: the number of repetitions.
The app is kind of social network that allow you to upload exercises. Every exercise you upload needs a video that demonstrates it and some data about it. After uploading a particular exercise — the user who uploaded the exercise, as well as the other users of the app, will be able to practice this exercise — meaning the app will count the time or repetitions when the user performs the exercise, in real time.
How It Is Working?
The video uploaded by the user is converted to a large number of images that send to a model called PoseNet.
PoseNet — is an artificial intelligence model that evaluates the pose. The model gets a picture and it takes out landmarks of certain body parts.
The AI was built in TensorFlow. I used Tenserflow Lite to run artificial intelligence models on smartphones relatively quickly.
The pose estimation data comes out as X and Y coordinates. I take the waypoints and turn them into angels.
The angles send to an algorithm that I wrote, which calculates the repetitiveness of the exercise. The algorithm returns data that help the app count the repetitions or the time. The exercise data is sent to the server, so that another trainer can do the same exercise on his phone, and the app will count the repetitions or the time, if he wants to perform the exercise.
I use Firebase as backend. I chose to use Fairbase as a backend because I preferred to invest more time on the client side than build my brand new server side. I have been is very pleased with my choice of this product and even highly recommend it.
For the client side I chose to use Flutter. I chose Flutter because I wanted to learn this framework and also because I wanted to build the app for both Android and iOS. I personally had quite a lot of fun building a GUI on the platter after understand the layout system. But one of the disadvantages of a flutter is the reliance on plugins that other developers have written. For For example, I wanted a library that turns a video into a sequence of images and I did not find such a thing. So instead, I took a library that allows you to read an image from a video at a specific time and another library that allows you to read the length of a video. I connected the two libraries together to turn a video into a sequence of images.
You can see the code at this link. The code is open source, you can see it, learn from it and also use it. I wanted to upload the app to Google Play but should be 18, and I’m not 18 at the moment.