Using Computer Vision to Calculate a 1 rep max Part III: The Redemption

Screen Shot 2014-10-30 at 7.23.44 PM

Oh hey, I’m CT Fletcher. Just doing some flaming benchpress.

In the past few weeks I’ve been playing around with a small project, all of which I’ve blogged about:

If you noticed the progression of events, I was trying to make the project publicly available with a standalone web application. You can see the application itself at OneRepMaxCalculator.com.


Screen Shot 2014-10-30 at 7.23.57 PM

The idea is that a user simply uploads a video of a benchpress, presumably filmed with just a camera phone at a gym, and after about an hour of processing, the user is emailed with a new video that displays a one rep max estimate.


Screen Shot 2014-10-30 at 7.24.30 PM

Screen Shot 2014-10-30 at 7.24.15 PM

Beyond that the app is pretty self-explanatory, but I just wanted to put together a quick post about the different techmologies used to tie everything together:

OpenCV

I used OpenCV for all of the image processing. It’s a nice library with a robust python API.

Heroku

Heroku is an awesome cloud platform service that abstracts away a lot of the headaches associated with deployments. Its end game is to make a deployment as simple as “git push heroku master”. The biggest headache for me was getting OpenCV to work on it, which you can check out in my earlier post.

Backbone

Server side template rendering is so 2013. Backbone allows you to easily create the front end needed to interact with an API and is half the formula associated with making a robust, single page web application. In making the majority of your server-side code nothing but a robust API, it creates a lot of flexibility down the road. For instance, if I wanted to write an iPhone app for this application, it could be done fairly quickly.

Mailgun

Mailgun turns email management into a simple API call and is also extremely cheap. At my volume, it will likely always be completely free.

Stripe

Stripe has solved a problem that is both challenging and boring: credit card payments. By using their API, I don’t have to store credit card information or deal with any of the security issues that would normally be a hassle.

Django

Django is my web development framework of choice. Probably because it’s the only one I’ve used, and Python is my favorite high level language.

Celery

I used Celery and RabbitMQ to create asynchronous tasks. In this case, all of the video processing is done outside of the request/response cycle, and this will allow me to scale as needed.

Amazon S3

Dealing with large video files, I was able to use Amazon S3 to offload any files that were not immediately being processed. It’s really easy to manage using boto, and storage is extremely cheap. On a random side note, don’t ever store your Amazon keys on a public github repository. Some nerds eating hot pockets in some basement are going to find it with some automated crawler and then spin up the maximum possible EC2 instances and charge $2,000 to your account. And then you’re going to be on your commute to work in the morning and be all “Why did Amazon charge me $2,000? The bill last month was $0.12. I didn’t think I uploaded that much stuff to S3.” But it turns out it wasn’t you at all. It was some nerd eating hot pockets that likes to write malicious code and play World of Warcraft for at least 12 hours at a time.