Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build your own personal models (using Docker) #14

Merged
merged 2 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:16.04

RUN apt update && apt --yes --force-yes install wget unzip build-essential python python-dev virtualenv portaudio19-dev
RUN wget https://github.com/seasalt-ai/snowboy/archive/master.zip && unzip master.zip

RUN cd snowboy-master/ && \
virtualenv -p python2 venv/snowboy && \
. venv/snowboy/bin/activate && \
cd examples/Python && \
pip install -r requirements.txt

RUN apt -y remove wget unzip build-essential portaudio19-dev && apt -y autoremove && apt clean && rm -rf /var/lib/apt/lists/*

CMD cd snowboy-master/ && \
. venv/snowboy/bin/activate && \
cd examples/Python && \
python generate_pmdl.py -r1=model/record1.wav -r2=model/record2.wav -r3=model/record3.wav -lang=en -n=model/hotword.pmdl
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ python generate_pmdl.py -r1=record1.wav -r2=record2.wav -r3=record3.wav -lang=en
python demo.py hotword.pmdl
```

### Build your own personal models (using Docker)
* Build a new docker image based on `Dockerfile` from this repo:
```
docker build -t snowboy-pmdl .
```

* This will create an image which you can run to train your personal model. In order for this to work you'll need to create a directory called model on your host machine (Ubuntu 18 or whatever) and place your three audio files in there. So the directory should look something like this (note: the wav files need the exact names as below or it won't work):
```
$ ls model/
record1.wav record2.wav record3.wav
```

* Finally you can call docker (note: need to be in the parent directory of model):
```
docker run -it -v $(pwd)/model:/snowboy-master/examples/Python/model snowboy-pmdl
```
_This command mounts the model directory in the docker container and runs a script which calls generate_pmdl.py_

* If everything went well, you should now have a file called hotword.pmdl in your model directory.

## Alexa support

Snowboy now brings hands-free experience to the [Alexa AVS sample app](https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide-with-Script) on Raspberry Pi! See more info below regarding the performance and how you can use other hotword models. The following instructions currently support AVS sdk Version 1.12.1.
Expand Down