Skip to content

Learning Blocks

Classification (Audio)

A small convolutional neural network that names the sound in each window.

Try it in Studio
On this page

What is this learning block?

Classification is the recommended learning block for Audio projects. It is a small convolutional neural network (CNN) that looks at the time–pitch grid from your processing block, the same way an image model looks at a picture.

What does it do?

It takes the features of one window (for example the 98 × 40 grid from MFE) and gives a score for every label, such as yes 0.92, no 0.03, noise 0.05. The label with the highest score is the prediction.

How does it learn?

  1. The network starts with random weights.
  2. It predicts a batch of training windows.
  3. It measures how wrong it was (the loss).
  4. It adjusts its weights a little to reduce the loss (PetalEdge uses the Adam optimizer).
  5. It repeats this for every batch. One full pass over the training data is one training cycle.

After each cycle it is checked on validation windows that it did not train on. Validation windows come from different recordings than training windows. If the validation accuracy stops improving for 20 cycles, training stops early and the best version is kept.

What model architecture does it use?

  1. 1InputFeature grid of one window
  2. 2Conv 163 × 3 filters, batch norm, max pool
  3. 3Conv 323 × 3 filters, batch norm, max pool
  4. 4Conv 643 × 3 filters, batch norm, max pool
  5. 5Dense 128after global average pooling, dropout 0.3
  6. 6OutputOne score per label (softmax)
Audio Classification network
  • Convolution layers slide small 3 × 3 filters over the grid to find patterns such as a rising pitch or a short click.
  • Max pooling shrinks the grid, so later layers see bigger patterns.
  • Global average pooling turns the final grid into one list of numbers.
  • Dropout 0.3 switches off 30 % of the neurons during training, so the model can't just memorise.

What settings can I configure?

SettingDefaultWhat it does
Number of training cycles5Passes over the training data. 5 is a quick first try; 30–50 usually learns more.
Learning rate0.005Size of each weight adjustment. Lower is slower but steadier.
Training processorCPUWhere training runs. Choose GPU only if your PetalEdge server offers it.
Batch size (under Advanced training settings)32Windows per weight adjustment.
Validation split (under Advanced training settings)0.2Share of the training data kept aside to check the model during training.

Select Start Training to begin.

What problems can it solve?

  • Keyword spotting: yes, no, stop, go.
  • Sound events: glass breaking, dog barking, doorbell, alarm.
  • Telling machines or appliances apart by their sound.

Simple example

Three labels (yes, no, noise), about 60 one-second clips each, MFE with default settings. Set Number of training cycles to 30 and select Start Training. The confusion matrix then shows, for example, that most yes windows were predicted as yes, with a few mixed up with no.

How do I understand the training results?

  • Accuracy: the share of validation windows that got the right label.
  • Confusion Matrix (Validation): rows are the real labels, columns the predicted labels. Numbers off the diagonal show which sounds get mixed up.
  • Training graphs (on the Evaluation page): training and validation loss should both go down. If training keeps improving while validation gets worse, the model is overfitting: record more clips, or use fewer training cycles.

Then test the model on clips it has never heard with Model testing.