Silero VAD Model Documentation¶
1 Overview¶
1.1 Background Introduction¶
VAD (Voice Activity Detection) is an algorithm that detects speech segments in audio, serving as a preprocessing module for tasks like speech recognition and speaker identification. We employ the open-source Silero VAD model for deployment. For detailed information about the model, please visit:
GitHub - Silero VAD
The model can be downloaded from:
Model Download
2 Model Conversion¶
2.1 ONNX Model Conversion¶
Download the model file silero_vad_16k_op15.onnx from the model download link. To simplify the model, use the following command with onnx-simplifier:
onnx-simplifier silero_vad_16k_op15.onnx silero_vad_16k_op15_sim.onnx --input-shapes input:1,576 state:2,1,128
2.2 Offline Model Conversion¶
2.2.1 Offline Model Conversion Process¶
Note: 1) OpenDLAModel corresponds to the smodel files extracted from the compressed package image-dev_model_convert.tar. 2) The conversion commands must run in a Docker environment; please load the SGS Docker environment according to the Docker development environment tutorial.
-
A simplified model already exists in the directory
OpenDLAModel/vad/silero/onnx. -
Run the conversion command:
cd IPU_SDK_Release/docker bash run_docker.sh # Enter the OpenDLAModel directory in the Docker environment cd /work/SGS_XXX/OpenDLAModel bash convert.sh -a vad/silero -c config/vad_silero.cfg -p SGS_IPU_Toolchain (absolute path) -s false
-
The final generated model files will be located at:
output/{chip}_/vad.img output/{chip}_/vad_fixed.sim output/{chip}_/vad_float.sim
2.2.3 Parameter Explanation of Key Scripts¶
- input_config.ini
[INPUT_CONFIG]
inputs=input,state,sr; # ONNX input node names, separate multiple names with commas.
input_formats=RAWDATA_F32_NHWC,RAWDATA_F32_NHWC,RAWDATA_S16_NHWC; # Input formats on the board, choose according to ONNX input formats, e.g., float: RAWDATA_F32_NHWC, int32: RAWDATA_S16_NHWC.
quantizations=TRUE; # Enable input quantization, do not change this.
[OUTPUT_CONFIG]
outputs=output,stateN; # ONNX output node names, separate multiple names with commas.
dequantizations=TRUE,TRUE; # Whether to enable dequantization, set according to actual needs. It is recommended to set to TRUE. Set to FALSE to output int16; set to TRUE to output float32.
- vad_silero.cfg
[VAD]
CHIP_LIST=mhera # Platform names, must match the platform on the board, otherwise the model will not run.
Model_LIST=silero_vad_16k_op15_sim # Input ONNX model name.
INPUT_SIZE_LIST=0 # Model input resolution.
INPUT_INI_LIST=input_config.ini # Configuration file.
CLASS_NUM_LIST=0 # Just set this to 0.
SAVE_NAME_LIST=vad.img # Output model name.
QUANT_DATA_PATH=data.txt # Quantization data path.
3 Board Deployment¶
3.1 Program Compilation¶
Before compiling the example program, make sure to select the configuration (deconfig) according to the board type (nand/nor/emmc, ddr model, etc.) for SDK full package compilation. For specific details, refer to the "Development Environment Setup" document in the Alkaid SDK SIGDOC.
-
Compile the board-side Silero example:
cd sdk/verify/opendla make clean && make source/vad/silero -j8 -
The final executable file will be located at:
sdk/verify/opendla/out/${AARCH}/app/prog_vad_silero
3.2 Runtime Files¶
Before running the program, ensure the following files are copied to the board:
prog_vad_silerotest.wav(download the official test file from: test.wav)vad.img
3.3 Runtime Instructions¶
-
Usage:
./prog_vad_silero wav model(Command to execute the file)- wav: Audio file.
- model: Offline model.
-
Typical Output:
./prog_vad_silero test.wav models/vad.img client [699] connected, module:ipu Speech detected from 0.0 s to 2.0 s Speech detected from 2.7 s to 4.7 s Speech detected from 5.0 s to 6.9 s Speech detected from 9.3 s to 13.3 s Speech detected from 13.6 s to 15.1 s Speech detected from 15.4 s to 15.9 s Speech detected from 16.3 s to 17.9 s Speech detected from 18.4 s to 19.6 s Speech detected from 20.4 s to 28.5 s Speech detected from 28.7 s to 32.6 s Speech detected from 32.7 s to 35.5 s Speech detected from 35.8 s to 37.6 s Speech detected from 38.0 s to 39.0 s Speech detected from 39.9 s to 43.3 s Speech detected from 43.6 s to 44.6 s Speech detected from 45.1 s to 46.9 s Speech detected from 48.9 s to 50.0 s Speech detected from 51.1 s to 54.2 s Speech detected from 54.5 s to 57.4 s Speech detected from 57.5 s to 59.6 s Speech detected from 59.9 s to 60.0 s ------shutdown IPU1------ client [922] disconnected, module:ipu