ARM-software / ML-zoo

Apache License 2.0
191 stars 51 forks source link

Model Validation Script #52

Open andreysher opened 1 year ago

andreysher commented 1 year ago

Hello and thanks for your work. I need to run model for Keyword Spotting from this zoo, but there is no any validation script with preprocessing for my .wav files. How should i prepare my data to apply models?

Burton2000 commented 1 year ago

Hey, Your best bet is to look into the code used for training and evaluating the keyword spotting models here

There is a script for testing the TFLite models themselves here on the whole test set.

For how to actually prepare .wavs for sending into the model this is covered in this file.

Unfortunately there isn't a function or script that shows how to perform inference on a single wav file but this shouldn't be a tricky thing to do (we might actually add this in the future). It should be a matter of just calling load_wav_file followed by calculate_mfcc and then sending this for inference. If using the quantized models you may need to quantize the input first like is done in the test_tflite.py file.

Note that the models work on 1 second mono audio clips, with a sample rate of 16000 samples per second. The window size, stride and number of mfcc features depends on the model and comes from here

Best regards, Richard