🧠 soundKIT Keyword Spotting (KWS) Tutorial¶
This tutorial walks you through using the soundKIT CLI for KWS tasks including data preparation, training, evaluation, TFLite export, and embedded deployment.
⚙️ Setup¶
In [ ]:
Copied!
# Set working directory to project root (one level up)
import os
os.chdir("..")
print("✅ Working directory set to project root:", os.getcwd())
# Set working directory to project root (one level up)
import os
os.chdir("..")
print("✅ Working directory set to project root:", os.getcwd())
In [ ]:
Copied!
# Clone the soundKIT repo
!git clone https://github.com/AmbiqAI/soundkit.git
%cd soundkit
# Clone the soundKIT repo
!git clone https://github.com/AmbiqAI/soundkit.git
%cd soundkit
In [ ]:
Copied!
# Install required dependencies
!pip install -e .
# Install required dependencies
!pip install -e .
🔧 Configuration¶
In [ ]:
Copied!
# Show editable KWS training config
config_path = "configs/kws.yaml"
with open(config_path, "r") as f:
print(f.read())
# Show editable KWS training config
config_path = "configs/kws.yaml"
with open(config_path, "r") as f:
print(f.read())
📁 Step 1: Prepare Data¶
In [ ]:
Copied!
!soundkit -t kws -m data -c configs/kws.yaml
!soundkit -t kws -m data -c configs/kws.yaml
🎯 Step 2: Train Model¶
In [ ]:
Copied!
!soundkit -t kws -m train -c configs/kws.yaml
!soundkit -t kws -m train -c configs/kws.yaml
To monitor training with TensorBoard:
In [ ]:
Copied!
!soundkit -t kws -m train --tensorboard -c configs/kws.yaml
!soundkit -t kws -m train --tensorboard -c configs/kws.yaml
In [ ]:
Copied!
# Run this in another terminal:
# tensorboard --logdir=soundkit/tasks/kws/tensorboard/your_run
# Run this in another terminal:
# tensorboard --logdir=soundkit/tasks/kws/tensorboard/your_run
📊 Step 3: Evaluate Model¶
In [ ]:
Copied!
!soundkit -t kws -m evaluate -c configs/kws.yaml
!soundkit -t kws -m evaluate -c configs/kws.yaml
📤 Step 4: Export Model to TFLite¶
In [ ]:
Copied!
!soundkit -t kws -m export -c configs/kws.yaml
!soundkit -t kws -m export -c configs/kws.yaml
🚀 Step 5: Deploy to Embedded EVB (e.g., Apollo)¶
In [ ]:
Copied!
!soundkit -t kws -m demo -c configs/kws.yaml demo.platform=evb # For EVB demo, ensure you have a microphone connected
!soundkit -t kws -m demo -c configs/kws.yaml demo.platform=pc # For PC demo, ensure you have a microphone connected
!soundkit -t kws -m demo -c configs/kws.yaml demo.platform=evb # For EVB demo, ensure you have a microphone connected
!soundkit -t kws -m demo -c configs/kws.yaml demo.platform=pc # For PC demo, ensure you have a microphone connected
✅ Notes¶
- Edit
kws.yamlto adjust model hyperparameters, features, and output paths - Log files and detection visualizations are saved under the configured test and training folders