Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Using Docker to get Keyword Spotting in 40 seconds

Chris Lovett edited this page May 13, 2020 · 4 revisions

Hey everyone!

Shawn Callegari added an ell.Dockerfile under tools/docker, so I published an ELL docker image based on this which has everything setup in Ubuntu.

docker pull cjlovett/ell

Then run the following:

docker run -it cjlovett/ell

Now inside the docker container activate the Python 3.6 conda environment and run the following to compile and test a keyword spotting model:

conda activate py36
wget https://github.com/Microsoft/ELL-models/raw/master/models/speech_commands_v0.01/BluePaloVerde/GRU110KeywordSpotter.onnx.zip
wget https://github.com/Microsoft/ELL-models/raw/master/models/speech_commands_v0.01/BluePaloVerde/featurizer.ell.zip
unzip featurizer.ell.zip
unzip GRU110KeywordSpotter.onnx.zip
python /ELL/tools/importers/onnx/onnx_import.py GRU110KeywordSpotter.onnx
mv GRU110KeywordSpotter.ell classifier.ell
wget https://github.com/microsoft/ELL-models/raw/master/models/speech_commands_v0.01/BluePaloVerde/categories.txt
python /ELL/tools/wrap/wrap.py --model_file featurizer.ell --target host --outdir compiled_featurizer --module_name mfcc
python /ELL/tools/wrap/wrap.py --model_file classifier.ell --target host --outdir compiled_classifier --module_name model
cd compiled_featurizer
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release && make && cd ../..
cd compiled_classifier
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release && make && cd ../..
cp /ELL/tools/utilities/pythonlibs/audio/*.py .
mkdir wavs
cp /ELL/docs/tutorials/Getting-started-with-audio-keyword-spotting-on-the-Raspberry-Pi/seven.wav wavs
python run_classifier.py --featurizer compiled_featurizer/mfcc --classifier compiled_classifier/model --categories categories.txt --auto_scale --wav_files wavs

You can paste that whole blob into your terminal window and soon you should see the following output:

...
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
<<< DETECTED (19) 99% 'seven' >>>
Average processing time: 0.00018954575061798097
[(19, 0.9999125, 'seven', 0.00018954575061798097)]

Clone this wiki locally