Skip to content

Learning Blocks

Transfer Learning (Audio)

Start from a pre-trained MobileNetV2 network and fine-tune it on your sounds.

Try it in Studio
On this page

What is this learning block?

Transfer Learning (Keyword Spotting) reuses a network that has already learned to recognise patterns, and teaches only its last part about your sounds. In PetalEdge the starting network is MobileNetV2 (width 0.35) trained on the ImageNet picture collection.

What does it do?

Like Classification, it takes the feature grid of one window and gives a score for every label. The difference is that most of the network is not learned from scratch.

How does it learn?

  1. Studio treats your feature grid like a small picture: it scales the values, copies the grid into three colour channels and resizes it to 96 × 96.
  2. The first 70 % of MobileNetV2's layers are frozen: they keep what they learned from ImageNet, such as edges and textures.
  3. The remaining layers and a new small head (Dense 64 with dropout 0.1, then one output per label) are trained on your clips.
  4. Training uses the Adam optimizer and stops early if validation accuracy stops improving for 20 cycles.

Because most of the network is already trained, it can learn useful patterns from fewer recordings.

What model architecture does it use?

  1. 1InputFeature grid, resized to 96 × 96 × 3
  2. 2MobileNetV2 0.35ImageNet weights, first 70 % frozen
  3. 3PoolingGlobal average pooling
  4. 4Dense 64dropout 0.1
  5. 5OutputOne score per label (softmax)
Transfer Learning network

What settings can I configure?

SettingDefaultWhat it does
Number of training cycles50Passes over the training data.
Learning rate0.001Size of each weight adjustment. Keep it small when fine-tuning a pre-trained network.
Validation split0.2Share of the training data kept aside to check the model.
Training processorCPUChoose GPU only if your PetalEdge server offers it.

Batch size is fixed at 32. Select Start Training to begin.

What problems can it solve?

The same problems as Classification (keywords, sound events), especially when:

  • you have only a few dozen clips per label, or
  • Classification is not accurate enough.

Simple example

You have 25 clips each of lights on, lights off and noise. Train Classification first, then add Transfer Learning to the same impulse and train it with the default 50 cycles. Compare both on Model testing and keep the one with more correct predictions.

How do I understand the training results?

  • Accuracy and Loss: accuracy should rise and loss should fall over the training cycles.
  • Confusion Matrix (Validation): rows are the real labels, columns the predicted labels; check which sounds get mixed up.
  • The model is larger than the Classification model, because it contains MobileNetV2. Check the size on the Deployment page before choosing a small device.