ML watchtrain

Fitbit
Side Project
ML
API
Streaming ML training progress to a Fitbit
Author

Johannes Tomasoni

Published

June 19, 2021

View On GitHub

About

This repository contains code to stream ML training progress (currently only fastai) to a Fitbit Versa 3. More details on this project can be found in my blog post.

The project consists of three components, which can be found in the github repository:

  • An API server that coordinates the communication between ML training and the watch.
  • Code that runs on the Fitbit Versa 3 to display the training progress received from the API server.
  • A websocket logger that uses fastai’s callback architecture to fetch training progress and metrics to send to the API server. The WebsocketLogger was heavily influenced by the original fastai CSVLogger and Progress Callback.

How to run it

The repository contains a Dockerfile that launches the API server. The fitbit code needs to be be deployed to the watch via Fitbit Studio. The API server address can be adjusted in the /fitbit/companion/index.js. A running example on how to use the fastai Callback for training can also be found in the repository.

The watch, the API server and the training scripts should run in the same network, if run locally. On a local net the subnet mask needs to be 192.168.0.*. Alternatively the API server needs to run on a trusted HTTPS host. (see blog post)

References

  • Blog post about this project
  • Fastapi Docker setup: https://fastapi.tiangolo.com/deployment/docker/
  • Fitbit IDE: https://studio.fitbit.com/
  • Fastai CSVLogger and Progress Callback: https://docs.fast.ai/callback.progress.html