Go to file
Matthew D. Scholefield 4cec9b0767 Overhaul of how scripts are written to allow programmatic access
This introduces a way for scripts to be easily called from within Python with command line arguments as function parameters
To support this, prettyparse has been upgraded to the latest version
2019-11-01 00:03:44 -05:00
data Refine .gitignores 2018-06-12 13:58:41 -05:00
precise Overhaul of how scripts are written to allow programmatic access 2019-11-01 00:03:44 -05:00
runner Increment runner version to 0.3.1 2019-05-15 02:33:26 -05:00
.gitignore Add pytest cache to .gitignore 2019-03-18 13:54:26 -05:00
LICENSE Change license to Apache 2.0 2018-02-28 20:49:34 -06:00
README.md Update README 2019-01-26 14:09:51 -06:00
build.sh Fixed build.sh for precise-engine package 2019-04-15 23:43:54 +00:00
export.sh Update copyright header to 2019 2019-03-20 10:53:24 -05:00
precise.template.spec Add h5py to hidden imports when running precise-all build 2019-05-01 02:15:43 -05:00
publish.sh Update copyright header to 2019 2019-03-20 10:53:24 -05:00
requirements.txt Update requirements.txt 2019-03-29 01:50:11 -05:00
setup.py Overhaul of how scripts are written to allow programmatic access 2019-11-01 00:03:44 -05:00
setup.sh Add curl to the dependencies 2019-03-20 14:42:17 -05:00

README.md

Mycroft Precise

A lightweight, simple-to-use, RNN wake word listener.

Precise is a wake word listener. Like its name suggests, a wake word listener's job is to continually listen to sounds and speech around the device, and activate when the sounds or speech match a wake word. Unlike other machine learning hotword detection tools, Mycroft Precise is fully open source. Take a look at a comparison here.

Training Models

Communal models

Training takes lots of data. The Mycroft community is working together to jointly build datasets at https://home.mycroft.ai/#/precise. These datasets are used to build the models used by the Mark 1 and other mycroft-core based voice assistants and can be found here. Please come and help make things better for everyone!

Train your own model

You can find info on training your own models here. It requires running through the Source Install instructions first.

Installation

If you just want to use Mycroft Precise for running models in your own application, you can use the binary install option. Note: This is only updated to the latest release, indicated by the latest commit on the master branch. If you want to train your own models or mess with the source code, you'll need to follow the Source Install instructions below.

Binary Install

First download precise-engine.tar.gz from the precise-data GitHub repo. This will get the latest stable version (the master branch). Note that this requires the models to be built the the same latest version in the master branch. Currently, we support both 64 bit Linux desktops (x86_64) and the Raspberry Pi (armv7l).

Next, extract the tar to the folder of your choice. The following commands will work for the pi:

ARCH=armv7l
wget https://github.com/MycroftAI/precise-data/raw/dist/$ARCH/precise-engine.tar.gz
tar xvf precise-engine.tar.gz

Now, the Precise binary exists at precise-engine/precise-engine.

Next, install the Python wrapper with pip3 (or pip if you are on Python 2):

sudo pip3 install precise-runner

Finally, you can write your program, passing the location of the precise binary like shown:

#!/usr/bin/env python3

from precise_runner import PreciseEngine, PreciseRunner

engine = PreciseEngine('precise-engine/precise-engine', 'my_model_file.pb')
runner = PreciseRunner(engine, on_activation=lambda: print('hello'))
runner.start()

Source Install

Start out by cloning the repository:

git clone https://github.com/mycroftai/mycroft-precise
cd mycroft-precise

If you would like your models to run on an older version of precise, like the stable version the binary install uses, check out the master branch.

Next, install the necessary system dependencies. If you are on Ubuntu, this will be done automatically in the next step. Otherwise, feel free to submit a PR to support other operating systems. The dependencies are:

  • python3-pip
  • libopenblas-dev
  • python3-scipy
  • cython
  • libhdf5-dev
  • python3-h5py
  • portaudio19-dev

After this, run the setup script:

./setup.sh

Finally, you can write your program and run it as follows:

source .venv/bin/activate  # Change the python environment to include precise library

Sample Python program:

#!/usr/bin/env python3

from precise_runner import PreciseEngine, PreciseRunner

engine = PreciseEngine('.venv/bin/precise-engine', 'my_model_file.pb')
runner = PreciseRunner(engine, on_activation=lambda: print('hello'))
runner.start()

In addition to the precise-engine executable, doing a Source Install gives you access to some other scripts. You can read more about them here. One of these executables, precise-listen, can be used to test a model using your microphone:

source .venv/bin/activate  # Gain access to precise-* executables
precise-listen my_model_file.pb

How it Works

At it's core, Precise uses just a single recurrent network, specifically a GRU. Everything else is just a matter of getting data into the right form.

Architecture Diagram