Skip to content
← Back to writing

Field notes

Shipping Songline to TFLite

Getting a bird-call model small enough to run on a phone, without losing the recordings I actually cared about.

By Spencer Calimlim
Shipping Songline to TFLite
Click me for the TL;DR (too long; didn’t read)⌄
Getting a bird-call model small enough to run on a phone, without losing the recordings I actually cared about.

Songline started as a personal question: could I get a working species classifier onto a phone and have it still be right in a real street, where the audio is full of traffic, wind, and people?

The hard part was never the architecture. It was the field recordings. My clean test set did great. The moment I recorded near a jeepney it fell apart, because the model had learned my microphone and my quiet room as much as it had learned birds.

So most of the work went into augmentation and feature extraction rather than the network itself. I added noise and reverb that matched what I was actually recording, and I moved the spectrogram computation to the edge so the phone was not uploading raw audio anywhere.

Quantization was the last pass. Shrinking the model cost me accuracy on exactly the calls I cared about, so I tuned the augmentation mix until the compressed model matched the original on the samples that mattered to me.

The notes here are the version I wish I had while doing it.