The Neural Aesthetic - Transfer Learning Exercise - Motivational Coach
This week, as a exercise to get a bit more acquainted with ml5 and transfer learning models in particular I adapted this basic object recognition p5.js code to function as a bicep curl tracker and motivational coach.
The first thing I did was adapt the training tools to make them a bit more user friendly — specifically I changed the “submit training images” buttons to be toggles so that once you click it it begins submitting training images every half second until you click it again. This makes it much simpler to submit images of the motion of curling a barbell up and down because it does not require clicks during the action of lifting.
In order to train the model for this specific task, it simply requires submitting a series of images when the barbell is below the screen, and then a series of images during which it is visible in the web cam. Then in order to count the number of reps, I wrote a debounce that checks for 5 classifications in a row of either “dumbell up” or dumbell down” before either adding a rep to the counter or resetting the itsARep variable to false.
Finally, the most important touch was of course the addition of the motivational messages to keep user on task and laser focused on their goal to get swole. Periodically as the rep counter increases, the message for the lifter gets more and more positive motivating their progress.