Giter Site home page Giter Site logo

mycroftai / mycroft-precise Goto Github PK

View Code? Open in Web Editor NEW
826.0 33.0 226.0 457 KB

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

License: Apache License 2.0

Python 94.27% Shell 4.85% Dockerfile 0.88%
wake-word-detection keyword-spotting hotword-detection voice-recognition voice-control speech-recognition embedded-systems raspberry-pi

mycroft-precise's Introduction

Mycroft Precise

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

Precise is a wake word listener. The software monitors an audio stream ( usually a microphone ) and when it recognizes a specific phrase it triggers an event. For example, at Mycroft AI the team has trained Precise to recognize the phrase "Hey, Mycroft". When the software recognizes this phrase it puts the rest of Mycroft's software into command mode and waits for a command from the person using the device. Mycroft Precise is fully open source and can be trined to recognize anything from a name to a cough.

In addition to Precise there are several proprietary wake word listeners out there. If you are looking to spot a wakeword Precise might be a great solution, but if it's too resource intensive or isn't accurate enough here are some alternative options.

Supported Operating Systems

Precise is designed to run on Linux. It is known to work on a variety of Linux distributions including Debian, Ubuntu and Raspbian. It probably operates on other *nx distributions.

Training Models

Communal models

Training takes lots of data. The Mycroft community is working together to jointly build datasets at: https://github.com/MycroftAI/precise-community-data.
These datasets are available for anyone to download, use and contribute to. A number of models trained from this data are also provided.

The official models selectable in your device settings at Home.mycroft.ai 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()

# Sleep forever
from time import sleep
while True:
    sleep(10)

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()

# Sleep forever
from time import sleep
while True:
    sleep(10)

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

mycroft-precise's People

Contributors

chrisveilleux avatar davidwagnerkc avatar dependabot[bot] avatar devs-mycroft avatar forslund avatar gcoon151 avatar joshua-montgomery avatar krisgesling avatar lzufalcon avatar matthewscholefield avatar mikhaildmitrienko avatar ysak-y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mycroft-precise's Issues

Tensorflow and Precise SHA256 Hashes - Does not match.

Hi there

I am getting the following error when building from source on a Pi.

_THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
tensorflow==1.8.0 from https://www.piwheels.org/simple/tensorflow/tensorflow-1.8.0-cp35-none-linux_armv7l.whl#sha256=6e0183984102fed758f52f11c7227ea9f11572c92dc2c78ee79965d62226fbed (from mycroft-precise==0.2.0):
Expected sha256 6e0183984102fed758f52f11c7227ea9f11572c92dc2c78ee79965d62226fbed
Got 86e6ac5e22ea171dc1cf13c2029399cd64dca7d34ad0bc777dca8803ba4bae59

keras from https://files.pythonhosted.org/packages/5e/10/aa32dad071ce52b5502266b5c659451cfd6ffcbf14e6c8c4f16c0ff5aaab/Keras-2.2.4-py2.py3-none-any.whl#sha256=794d0c92c6c4122f1f0fcf3a7bc2f49054c6a54ddbef8d8ffafca62795d760b6 (from mycroft-precise==0.2.0):
    Expected sha256 794d0c92c6c4122f1f0fcf3a7bc2f49054c6a54ddbef8d8ffafca62795d760b6
         Got        74779df1886fa8c0b18b652b6d230cff350a85a93551027e6cc43fc205294867

Binary Install?

Hi,
Binary Install
I try to write my program and run my program :
from precise_runner import PreciseEngine, PreciseRunner

engine = PreciseEngine('/home/yjzx/Downloads/wts/NLP/Picovoice_Porcupine/mycroft-precise/precise-data/precise-engine/precise-engine', 'my_model_file.pb')
runner = PreciseRunner(engine, on_activation=lambda: print('hello'))

I can't find 'my_model_file.pb'?

Thank you for your help!

How to change feature extraction parameters ?

Hello,
I would like to know if there a simple and proper way to change MFCC parameters such as window_length, hop, n_mfcc, etc as seen in the params.py file.
It appears that changing values in that file doesn't change the values used for the training (using precise-train).

Cheers

voice recognized or not, can't predicted

i run on our model with my own audio files,
precise-train -e 60 murugan.net murugan/
precise-convert murugan.net

and finally i tested my audio using this command,
precise-listen murugan.pb

2018-09-12 09:26:53.146783: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxx------------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX----------------------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--------------------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxx-------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx------

voice recognized or not, i can't predicted. in that instruction what denotes, Demoing the Model (It will listen to the microphone and keep outputting either . if it does not hear the wake word or ! if it does hear it.) but that kind of strategy not applied for this command.

help me sir. thank you

Using Runner Examply.py

Hi there

I have followed the instructions and completed my trained model.

When running precise-listen hey-jarvis.net my wake word is detected with no false positives. This also works for precise-listen hey-jarvis.pb

The below is output from precise-test hey-jarvis.net hey-jarvis/

`Loading wake-word...
Loading not-wake-word...
Using TensorFlow backend.
Data:
=== False Positives ===

=== False Negatives ===

=== Counts ===
False Positives: 0
True Negatives: 562
False Negatives: 0
True Positives: 6

=== Summary ===
568 out of 568
100.0 %

0.0 % false positives
0.0 % false negatives
`
However when I am using the example.py runner script provided in the repo, the wake word is not working.

I have converted my wake word to .pb. Herewith the command I am using for the example.py file:

python example.py precise-engine/precise-engine hey-jarvis.pb

The output when running the above:

ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map Warning: Failed to load parameters from ./hey-jarvis.pb.params ...........................................

Any help will be greatly appreciated.

Note: I am using the compiled precise engine from https://github.com/MycroftAI/precise-data/blob/dist/x86_64/latest and running Ubunto 18.

No . or ! in output from precise-listen

When I run precise-listen, I don't get any ! or .

I get X and -

(.venv) juyeon@juyeonubuntu:~/mycroft-precise$ .venv/bin/precise-listen korean.net
Using TensorFlow backend.
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx-----------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxx---------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx----------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX tXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

What do these mean?

Precise Custom Wake Word mic to be used and additional data set training

I trained model with 200 + dataset (about 15 sample from different individuals) usind method 2 to take out false negative. Now the model when tested works good with the mic i used to collect the dataset. When i use other mics then the result is different, when i use laptop mic there is lot of false positive when i use another mic then to get activation is very hard. I also exported the model to tensorflow and used it with 6 array mic and couldnt good activation.
There are 2 questions here,

  1. Is there any dependency on the mic used for capturing the dataset and what is the recommendation?
  2. How do I train the same model with new dataset?

USB speaker Device unavailable error

I am trying to use mycroft based wakeup hotword to talk with google speech recognition api using the same mic simultaneously ? I am using a Respeaker 4 mic array v2.0 with a Raspberry Pi3.i
Both applications (Google and mycroft ) are working fine independently.
Seems like both the APIs cannot access the speaker input at one time.So I tried to access it through dsnoop but I need a method which i can call to retrieve the dsnoop device name. By default it is always fetching the default mic.
I am getting this following error when i try to call some functions from the google speech recognition api.

with m as source: r.adjust_for_ambient_noise(source)
(Pdb) n
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904
Expression 'PaAlsaStreamComponent_Initialize( &self->capture, alsaApi, inParams, StreamDirection_In, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2171
Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840
OSError: [Errno -9985] Device unavailable

is there any reference paper for mycroft-precise ?

Hi , I want to try the model on android, but there are some question about the features that feed into net.
there are three features include mels、mfccs、speechpy_mfccs according to code in vectorization.py. what's difference between them ? how to calculate them ? is there any theory reference paper for mycroft-precise ?

Trained model doesn't trigger

I've trained a model with the phrase 'lamp on' following the guide here but then using the result I can't get any triggers when running precise-listen and saying the phrase 'lamp on'. Could I have done something wrong somewhere? How can I debug this? The generated model is zipped up here, can you see anything from that?

Instructions don't work, possibly missing a step

I downloaded precise and followed the instructions, but I get an error:

 1503  git clone https://github.com/mycroftai/mycroft-precise
 1504  ls
 1505  cd mycroft-precise/
 1506  ls
 1507  ./setup.sh

Error:

juyeon@juyeonubuntu:~/mycroft-precise$ python3 wakeword.py 
Traceback (most recent call last):
  File "wakeword.py", line 3, in <module>
    from precise_runner import PreciseEngine, PreciseRunner
ModuleNotFoundError: No module named 'precise_runner'

The setup seemed to complete fine:
https://paste2.org/UIvXhz3I

Windows compatibility

Can I use mycroft-precise on windows? How?

import time
from precise_runner import PreciseEngine, PreciseRunner
from precise.util import activate_notify

print('start')
def on_prediction(prob):
    print('!' if prob > 0.5 else '.', end='', flush=True)

def on_activation():
    activate_notify()
    print('Activation')

engine = PreciseEngine('C:\\Program Files\\Python36\\Lib\\site-packages\\precise', 'ok-computer.pb')
while 1:
    PreciseRunner(engine, on_prediction=on_prediction, on_activation=on_activation, trigger_level=0)#runner

#runner don't work but there are not error output too.

Failed to load parameters from <modelname>.pb.params

It potentially appears that the binary distribution of the precise engine is out of date with the dev branch here. I am not able to run my custom model, which fails on the message, "Warning: Failed to load parameters from .pb.params." The model parameter file contains the key "vectorizer" which seems to not be supported in the params.py file on the master branch. My issue seems related to issue #26

Is the binary distribution up to date with the dev branch?

How the false negatives percentages are calculated ?

Hello,

I am wondering how the percentages are calculated when I run the follow command:

  • precise-test my_model.net dataset/

=== Counts ===
False Positives: 0
True Negatives: 819
False Negatives: 6
True Positives: 43

=== Summary ===
862 out of 868
99.31 %

0.0 % false positives
12.24 % false negatives

Illegal instruction with tensorflow

I am installing mycroft-precise on ubuntu on ARCH=x86-64 machine. I followed all instructions for installing source. All seemed to install fine. I then followed the instruction to train and used precise-collect and put the samples the in directories described (except I used dif phrase then hey-computer). I then ran precise-train and I get "Using TensorFlow backend. Illegal instruction with tensorflow"

Any ideas?

False negative categorization and precise-test disagrees with precise-listen

Using v0.2.1

I have trained a model as per instructions on https://github.com/MycroftAI/mycroft-precise/wiki/Training-your-own-wake-word

precise-test gives the following output:

=== False Positives ===
/home/ben/software/mycroft-precise/hey-computer/test/not-wake-word/generated/train_complete_ride_between_two_stations-777.wav
/home/ben/software/mycroft-precise/hey-computer/test/not-wake-word/generated/train_complete_ride_between_two_stations-637.wav

=== False Negatives ===
/home/ben/software/mycroft-precise/hey-computer/test/not-wake-word/generated/train_complete_ride_between_two_stations-802.wav
/home/ben/software/mycroft-precise/hey-computer/test/not-wake-word/generated/train_complete_ride_between_two_stations-368.wav

=== Counts ===
False Positives: 2
True Negatives: 2238
False Negatives: 2
True Positives: 11

=== Summary ===
2249 out of 2253
99.82 %

0.09 % false positives
15.38 % false negatives
  1. False negatives are defined as "Was a wake word, but model incorrectly predicts it was not" but it seems to erroneously be finding false negatives from the subfolder "test/not-wake-word/", as can be seen from the above output. As I understand it, a false negative should only be found in the /wake-word/ subfolder. Do you know why this might be?

  2. I used pavucontrol to play the test data .wav files manually and route the audio back into into precise-listen as a microphone input. I find that of my test files, only about 3 of the 13 /hey-computer/test/wake-word/ will activate sufficiently to trigger "activate.wav" with many producing almost no "probability" on the "------XXXX" style visualization. Is there any pre-processing done in precise-test "validation" tests (e.g. setting volume, clipping of the file, changing formats etc.) which are different to the precise-listen? Also is the probability threshold for activation the same?

Thanks for any help

ValueError: No op named ClipByValue in defined operations.

device/vendor/mycroft-precise/.venv/bin/precise-listen", line 11, in
load_entry_point('mycroft-precise', 'console_scripts', 'precise-listen')()
File "/home/pi/device/vendor/mycroft-precise/precise/scripts/listen.py", line 66, in main
listener = Listener(args.model, args.chunk_size)
File "/home/pi/device/vendor/mycroft-precise/precise/network_runner.py", line 91, in init
self.runner = runner_cls(model_name)
File "/home/pi/device/vendor/mycroft-precise/precise/network_runner.py", line 42, in init
self.graph = self.load_graph(model_name)
File "/home/pi/device/vendor/mycroft-precise/precise/network_runner.py", line 56, in load_graph
self.tf.import_graph_def(graph_def)
File "/home/pi/device/vendor/mycroft-precise/.venv/lib/python3.5/site-packages/tensorflow/python/framework/importer.py", line 280, in import_graph_def
raise ValueError('No op named %s in defined operations.' % node.op)
ValueError: No op named ClipByValue in defined operations.

How to inference(transplant) my model into embedded DSP

The model I trained wanted to inference the operation of the DSP chip. My DSP chip is not Linux system, and DSP's programming language supports C. What do we need to do? Do you load model files directly? Do you need to write GRU neural network in C language?
How to inference(transplant) my model into embedded DSP?

Thank you for your help!

Mycroft precise is it only working wake word process or is it able to achieve voice authentication?

I working on that our Mycroft-precise,
i was tested( precise-listen )for my generated model, it was predicting correctly for wake word for me and my friends voices as well as( xxxxxx---------------------------------- ).
but i need voice authentication purpose wake-word mycroft-precise.
i have basic knowledge about this voice authentication.
how can i get audio features for particular person. and verify simultaneously?
sir help me. give your suggestions, ideas.
thank you for advance.

Warning: Failed to load parameters from modelname.params

Using Kubuntu v17 and the latest git repo's source.

I consistently get Warning: Failed to load parameters from test1.params when I run things such as precise-train -e 1 test1 hey-computer/

Debugging it slightly, I find the error that is being thrown is

Using TensorFlow backend.
Traceback (most recent call last):
  File "/home/ben/software/mycroft-precise/.venv/bin/precise-train", line 11, in <module>
    load_entry_point('mycroft-precise', 'console_scripts', 'precise-train')()
  File "/home/ben/software/mycroft-precise/precise/scripts/train.py", line 176, in main
    Trainer().run()
  File "/home/ben/software/mycroft-precise/precise/scripts/train.py", line 80, in __init__
    inject_params(args.model)
  File "/home/ben/software/mycroft-precise/precise/params.py", line 89, in inject_params
    pr.__dict__.update(**compatibility_params, **json.load(f))
TypeError: update() got multiple values for keyword argument 'vectorizer'

where compatibility_params == {'vectorizer': 3}

and

test1.params contains {"window_t": 0.1, "hop_t": 0.05, "buffer_t": 1.5, "sample_rate": 16000, "sample_depth": 2, "n_mfcc": 13, "n_filt": 20, "n_fft": 512, "use_delta": false, "vectorizer": 2}

how to envaluate SNR when using precise-add-noise?

look into code ,found { default noise_min is 0, and noise_max is 0.4}
after doing adjust_noise=audio_volume * noise_data / noise_volume
and here come my question: how to compute the average SNR among the whole generated noise-added dataset?

Error running precise-record on raspberry pi

Here is my error...
I tried to change my Microphone from my Rapsberry Pi 3 B.
I'm running on Raspbian Stretch.
I have tensorflow 1.1.0 installed, the right version.
Python 3.5

(.venv)  pi@raspberrypi  ~/mycroft-precise   dev ●  precise-record model.net
/home/pi/mycroft-precise/.venv/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
  File "/home/pi/mycroft-precise/.venv/bin/precise-record", line 11, in <module>
    load_entry_point('mycroft-precise', 'console_scripts', 'precise-record')()
  File "/home/pi/mycroft-precise/precise/scripts/record.py", line 78, in main
    runner.start()
  File "/home/pi/mycroft-precise/runner/precise_runner/runner.py", line 139, in start
    16000, 1, paInt16, True, frames_per_buffer=self.chunk_size
  File "/home/pi/mycroft-precise/.venv/lib/python3.5/site-packages/pyaudio.py", line 750, in open
    stream = Stream(self, *args, **kwargs)
  File "/home/pi/mycroft-precise/.venv/lib/python3.5/site-packages/pyaudio.py", line 441, in __init__
    self._stream = pa.open(**arguments)
OSError: [Errno -9997] Invalid sample rate
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/pi/mycroft-precise/runner/precise_runner/runner.py", line 159, in stop
    self.stream.stop_stream()
AttributeError: 'NoneType' object has no attribute 'stop_stream'

I tried to google every lines, the best result I had was to install pulseaudio but nothing changed.
If someone already have the same issue please tell me :)

Conversion Issue

For converting the Public Domain Sounds Backup dataset to wav, I keep getting this error:

"Output file #0 does not contain any stream."

Any idea why?

Test my model recognition is low with precise-train,and It would false recongition.

Hi,
How many examples model(hey-mycroft.pb or hey-mycroft.net)do you have in your precise-data-models? How many negative samples (not-wake-word)and how many positive samples(wake-word)?I training models and test for false recongition。The sample(wake-word) is 500M, the negative samples (not-wake-word) is your pdsounds_march2009.7z.

Thank you for your help

Sample hey-mycroft.pb model?

Is there any sample hey-mycroft.pb (or any other phrase) model available somewhere I can try this with to see how well it works before I go spend lots of time training my own model?

Thanks!

source code for precise-engine

Hi. Where I can find source code of precise-engine ? I have a android tv box but can run precise-engine binary file (@_@!).
Sorry for my English.

precise-runner broken

Hi,

I'm getting the following error when running the python precise-runner:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.5/dist-packages/precise_runner/runner.py", line 197, in _handle_predictions
prob = self.engine.get_prediction(chunk)
File "/usr/local/lib/python3.5/dist-packages/precise_runner/runner.py", line 65, in get_prediction
return float(self.proc.stdout.readline())
ValueError: could not convert string to float:

The error happens on both x86_64 on my desktop and on armv7 on my pi.

The error happens using the latest version of precise-engine as well as on 0.2.0. Any help would be greatly appreciated!

Thanks,
Lukas

How to run model use the binary install option ?

Hi ,when i finished binary install on x86_64 , I creat a new py file named test.py. The file content as bellow:
#!/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'))

Finially, I run the test.py ,there is nothing happen. how can i test the model ?

Error Input array error

I am seeing the following error when I try to add custom speech files for training in the data/random folder

mycroft-precise/precise/scripts/train_incremental.py", line 124, in train_on_audio
    self.audio_buffer = np.concatenate((self.audio_buffer[len(chunk):], chunk))
ValueError: all the input arrays must have same number of dimensions

Any pointers to how I can fix this?

Multiple Classification

If I was to want to consider a multiple classification keyword spotter, what would be the process? I would certainly need to expand the output layer and change to a "softmax" activation function but what about labeling and the back propagation?

After Precise-Train-Incremental wake word stops recognizing

Hi,
I followed the instruction given in wiki and tried training wake word with different data set. After the first training i.e. recording the wake word and then training it, wake word gets detected along with anything else i speak. This is expected.
After i do an incremental training using the dataset in method 2 the wake word stops detecting completely. How can get this resolved.

Documentation folders are wrong

In the "train your own model" the folder structure should be

hey-computer/
├── wake-word/
│   ├── hey-computer.00.wav
│   ├── hey-computer.01.wav
│   ├── hey-computer.02.wav
│   ├── hey-computer.03.wav
│   ├── hey-computer.04.wav
│   ├── hey-computer.05.wav
│   ├── hey-computer.06.wav
│   ├── hey-computer.07.wav
│   └── hey-computer.08.wav
├── not-wake-word/
└── test/
    ├── wake-word/
    │   ├── hey-computer.09.wav
    │   ├── hey-computer.10.wav
    │   ├── hey-computer.11.wav
    │   └── hey-computer.12.wav
    └── not-wake-word/

instead of

hey-computer/
├── keyword/
│   ├── hey-computer.00.wav
│   ├── hey-computer.01.wav
│   ├── hey-computer.02.wav
│   ├── hey-computer.03.wav
│   ├── hey-computer.04.wav
│   ├── hey-computer.05.wav
│   ├── hey-computer.06.wav
│   ├── hey-computer.07.wav
│   └── hey-computer.08.wav
├── not-keyword/
└── test/
    ├── keyword/
    │   ├── hey-computer.09.wav
    │   ├── hey-computer.10.wav
    │   ├── hey-computer.11.wav
    │   └── hey-computer.12.wav
    └── not-keyword/

how to convert keras model end with ".net" into h5?

in Matlab 2018b, there is a function :
Layers = importKerasLayers(ModelFile) imports a Keras network architecture from ModelFile. ModelFile - Name of a Keras model file, specified as a string or a char array. The file must be HDF5 (.h5) or JSON (.json) format.
and it only accept .h5 and .json file
I am confused with your precise.net ,what is the diffrence between .net and .h5?

can't run hey-mycroft.pb. speechpy error?

can't run hey-mycroft.pb. speechpy error?

precise-listen hey-mycroft.pb
2018-11-10 17:05:20.248968: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
Exception in thread Thread-1:

Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/dell/Pictures/dp-0.1.1/12-09-2018/voice_reg/mycroft-precise/runner/precise_runner/runner.py", line 227, in handle_predictions
prob = self.engine.get_prediction(chunk)
File "/home/dell/Pictures/dp-0.1.1/12-09-2018/voice_reg/mycroft-precise/precise/scripts/listen.py", line 85, in get_prediction
return listener.update(chunk)
File "/home/dell/Pictures/dp-0.1.1/12-09-2018/voice_reg/mycroft-precise/precise/network_runner.py", line 125, in update
new_features = vectorize_raw(self.window_audio)
File "/home/dell/Pictures/dp-0.1.1/12-09-2018/voice_reg/mycroft-precise/precise/vectorization.py", line 46, in vectorize_raw
return vectorizerspr.vectorizer
File "/home/dell/Pictures/dp-0.1.1/12-09-2018/voice_reg/mycroft-precise/precise/vectorization.py", line 36, in
Vectorizer.speechpy_mfccs: lambda x: import('speechpy').feature.mfcc(
ModuleNotFoundError: No module named 'speechpy'

Run on a Raspberry Pi Zero?

Hi, does mycroft-precise run on a Raspberry Pi Zero? Or if not do you think it would be possible to make it?

Mac: FileNotFoundError: [Errno 2] No such file or directory: 'aplay': 'aplay'

There is no 'aplay' in Mac OS X system, but there is a 'play', have tried a symbol link to 'play' or simply a new copy, both of them not work for 'play' can not work with the name 'aplay'.

But this works:

diff --git a/precise/scripts/listen.py b/precise/scripts/listen.py
index b95a7f5..be3b3f3 100755
--- a/precise/scripts/listen.py
+++ b/precise/scripts/listen.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+import os
 from os.path import join
 from random import randint
 from subprocess import Popen
@@ -51,7 +52,7 @@ def main():
     args = create_parser(usage).parse_args()
 
     def on_activation():
-        Popen(['aplay', '-q', 'data/activate.wav'])
+        Popen(['play', '-q', os.environ['VIRTUAL_ENV'] + '/../data/activate.wav'])
         if args.save_dir:
             global chunk_num
             nm = join(args.save_dir, args.save_prefix + session_id + '.' + str(chunk_num) + '.wav')  

The above change also make sure precise-listen work in any directory, to fix up this issue, we'd better get the player based on system type. 'play' for Mac, 'aplay' for Linux.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.