Wake word classifier training example
This directory contains a simplified, self-contained example of the training loop used for the wake word classifier bundled with the application:
16 kHz mono PCM WAV
-> openWakeWord-compatible ONNX feature extractor (from ../models)
-> small PyTorch DNN classifier
-> ONNX export in the format the application loads
It is an educational example, not the production training pipeline.
The bundled models/privet_avrora*.onnx classifiers were trained on a much
larger internal dataset that is not distributed with this repository.
Layout
-
train_wakeword.py— the training script. -
requirements.txt— Python dependencies. -
demo_dataset/— a tiny set of real recordings for demonstration (see demo_dataset/README.md); extend it with your own recordings to experiment.
Usage
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 train_wakeword.py
The script loads clips from demo_dataset/, extracts embeddings with the
ONNX models from ../models, trains the classifier, prints validation
metrics (TP/TN/FP/FN, recall), and writes the result to outputs/:
-
wakeword_classifier.onnx— classifier in the same format as../models/privet_avrora.onnx(inputfeatures, outputscore). -
wakeword_classifier_metadata.json— shapes and validation metrics.
Useful options:
python3 train_wakeword.py --epochs 50 --batch-size 8 --layer-size 64 \
--dataset /path/to/my_dataset --output-dir /path/to/outputs
Notes
- CPU is enough; the dataset and the model are tiny.
- The feature extraction pipeline in
train_wakeword.pymirrors the C++ code in../src/wakeworddetector.cppstep by step, so a classifier exported here can be dropped into the application next to (or instead of) the bundled one.