YamNet Example
This document explains how to use the QAI AppBuilder Python API to perform inference with the YamNet audio classification model using the Qualcomm® Hexagon™ Processor (NPU).
Supported devices
| Device | SoC |
|---|---|
| Fogwise® AIRbox Q900 | QCS9075 |
Install QAI AppBuilder
-
Install QAI AppBuilder by following the QAI AppBuilder installation guide.
-
Configure ADSP environment variables as described in Create ADSP environment variables.
Run the sample
Install dependencies
Install sample dependencies in the activated virtual environment:
pip3 install requests tqdm qai-hub py3-wget Pillow torch torchvision opencv-python-headless soxr soundfile resampy
Run the script
-
Enter the upstream samples directory
Devicecd qai-appbuilder/samples -
Prepare input data (use the sample input if provided, or pass script arguments)
input audio
-
Run inference
Devicepython3 audio/Audio_Classification/yamnet/yamnet.py --chipset 9075
The default input is the bundled input.wav. On success the terminal prints top-5 labels, for example:
Top 5 predictions:
Whistling | Alarm | Whistle | Field recording | Rattle (instrument)
The first run downloads the model via Qualcomm® AI Hub and needs audio libraries such as soxr. You can also use the launcher from samples:
python3 run_inference.py --list
python3 run_inference.py --model yamnet --args "--chipset 9075"