FastAI Training metrics as Notification on mobile

Get the model updates on mobile as notifications — this would work on any of the Cloud providers or even Google Colab

Sai Nath
Tensorpad
3 min readAug 5, 2019

--

Ever had to train a machine learning model for so long that you had to sit and stare at the screen every time an epoch got over to have a look at the model metrics?

Forget it! using the combined power of Fastai callbacks and pushover.net you can get training notifications right on your mobile phone

This is possible because of the rich callbacks system in FastAI library

Lets split our tutorial into three sections

  • pushover.net configuration on mobile
  • Pneumonia detection model training with Fastai

Github repo link → pneumonia-detection-fastai

Training notifs on mobile

STEP 1 -> Setting up a workspace on your favourite cloud provider

Open the terminal from Jupyter lab and clone the repo git clone https://github.com/zszazi/pneumonia-detection-fastai.git to your workspace

  • now open the Jupyter notebook by name pneumonia_prediction_using_fastau_with_mobile_notification.ipynb

STEP 2 -> Pushover.net configuration on mobile

Head over to https://pushover.net and set up an account and download the mobile app too, You will only be able to receive notifications on mobile if you have their app installed. They have extensive docs and faq which cover on setting up, to receive notifications on your pushover mobile app.

pushover currently offers a 7 day trial on signup accross all platforms

Copy the API keys; there are two of these found in your account section

STEP 3 -> Training the model and getting notifications on mobile

To run the cell press Shift+Enter

  • Make sure to upload the kaggle.json (watch this Youtube video)
  • We can use the upload button in Jupyter workspace to upload the kaggle.jsonfile
  • On running the cell containing learn.fit_one_cycle() you should have got the push notifications on your mobile, and this would be sent for each epoch

🔔 Training Notifications on mobile 🔔

What’s more? You can even send your loss plots as 🔔 to mobile.

LossPlot as notification!

Here’s a Github gist showing you the central part of mobile callback notification

code

GitHub gist

FastAI provides you with a rich collection of callbacks (see pic), but we mainly have used the following ones: whose name are self-explanatory :)

  • on_train_begin
  • on_epoch_begin
  • on_train_end
Screenshot from Fastai doc

Resources

  1. FastAI forums
  2. FastAI Callbacks
  3. Kaggle dataset
  4. Pushover docs

--

--