Summary
Congratulations on learning how to build a binary audio classification model.
You learned how analog sound is represented as digital samples, how waveforms show amplitude over time, and how spectrograms show frequency content over time. You also saw how to load the yes and no classes from the Speech Commands dataset, convert waveforms into spectrogram tensors, train a convolutional neural network, and evaluate the model on held-out data.
Next steps
To go deeper, try these ideas:
- Extend the model to classify all eight commands in the mini Speech Commands dataset by loading
SOURCE_DATASET_PATHinstead of the binaryBINARY_DATASET_PATH. Thelabel_namesarray andnum_labelsvalue update automatically from the directory names. - Use the full Speech Commands dataset and the
train,validation, andtestsplits provided by TensorFlow Datasets for a more rigorous evaluation. TensorFlow Datasets exposes the standard keyword-spotting label set, including target commands plus_unknown_and_silence_, so update the output layer and label handling for that label set. - Try transfer learning for audio recognition with a pretrained YAMNet model.