With the proliferation of wearable devices, athletes are monitoring their performance and activity levels in ways that were unimaginable 10 years ago. However, beyond step counting and simple KPI readings there remain exciting possibilities in classifying different types of motions to help the athlete achieve a more graceful and efficient technique.
Racefox, a Stockholm-based company, started by looking into cross-country skiing as a possible testing ground to explore its vision of real-time digital coaching. Cross-country skiing involves a number of types of strides. In its classical variants, there are three distinct types of motion. These photos show double polling and diagonal. There is also another type of motion, which is double polling with kick.
For each type of motion, Racefox analyzes the full motion to gauge proper execution in different stages of the motion. This entails reading motion data from a 3D accelerometer that the athlete wears around her/his upper torso. The data stream from the accelerometer is piped to a mobile device for motion classification and analysis.
Racefox’s classification and motion analysis algorithms were first implemented in C++ to ensure fast execution. Initially, the team planned to send raw accelerometer data from the mobile device to the cloud for processing. In the summer of 2014, Racefox noticed that the initial approach was not working satisfactorily as they added more users to the system. The richness of the subtleties in motion were not captured adequately using the initial approach. Racefox needed to tweak the existing algorithms or try a new approach.
Modifying the existing C++ code was proving too slow owing to the brittleness of the language, verbosity, and the need to go through lengthy modify-compile-run cycles. Racefox’s initial attempt to reimplement their algorithms in Matlab did not work very well. It involved a great deal of signal processing with for-loops and conditionals, something that Matlab was particularly bad at. The whole modify-run-analyze cycle was incredibly slow on Matlab, limiting the scope of experimentation. Also, even if they had been able to settle on a suitable approach, Racefox was still faced with the unpleasant prospect of having to re-implement in C++.
At that point, Racefox stumbled on Wired’s 2014 article about Julia titled “Man Creates One Programming Language to Rule Them All” and decided to give Julia a try. In about a week, they had a Julia implementation up and running that was orders of magnitude faster than their Matlab implementation. This was back in the Julia 0.2 days. Even as a young language, Julia was proving indispensable. Racefox was able to (very happily) abandon their C++ implementation and focus on one code base for both experimentation and production.
According to Racefox, Julia truly delivered on the promise of solving the two language problem. What’s more, this allowed Racefox to experiment with a myriad of techniques until they came up with very efficient algorithms that could be implemented on mobile devices. This was done by translating Julia code to Java and Swift. Racefox still does all their algorithm development in Julia and conducts very large scale virtual experiments with ever increasing volume of user data.
Racefox does a great deal of analysis using Julia on servers in the cloud for data exploration, to gain insights and add new features. Racefox does statistical learning using Markov Chains, shallow neural networks, and deep learning. In their day to day analysis, Racefox makes extensive use of Juno.jl, IJulia.jl, Plots.jl, DataFrames.jl, TensorFlow.jl, and lately Flux.jl. Racefox also has a number of Julia-based services that their app calls through an API. For that they use Mux.jl extensively and have contributed to open source Julia by creating the Heroku buildpack used for fast push button deployment.
Racefox continues on its quest to innovate in the area of digital sports coaching. In the last four years they have been featured 3 times on the list of the 33 most innovative companies in Sweden. Racefox has also been featured in this August’s issue of Wired UK as one of the top 100 hottest startups in Europe.