seasalt-ai / snowboy Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kitt-ai/snowboy
DNN based hotword and wake word detection toolkit (model generation included)
License: Other
This project forked from kitt-ai/snowboy
DNN based hotword and wake word detection toolkit (model generation included)
License: Other
How does the accuracy of the generate_pmdl.py script compare to the old hotword API which was recently shut down? Is the script using the same algorithm and will therefore be as good as the API?
I use Rhasspy and alexaAVS using the snowboy wakeword.
I have followed all steps on three different computers, amd64(debian 11) pi4(debian 10) virtualbox(ubuntu 16 and 18) I created all record.wav files successfully using all computers except virtualbox couldn't get the mic working.
All attempts create the final hotword without errors aside from the fact the filesize is very small.
For instance... I tried different hotwords using the mentioned command, rec -r 16000 -c 1 -b 16 -e signed-integer -t wav recordX.wav. So the recordX.wav files that were created varied in size from 144kb for "go george" and 212kb for "hey Mario" the final hotword.pmdl size was 16kb and 76kb.(same result on all computers)
I installed all dependencies and followed the letter exactly.
I couldn't create the recordX.wav files on the 2 ubuntu versions running on virtualbox, however i copied the recordX.wav files from the other computers to ubuntu, same result final hotword too small
Tested wakeword with Rhasspy,
Does not work.
STUMPED. (getting sick of the old hotword I created before shutdown)........Go Bills. Not the team just the name
Thanks for any advice.
I tried to bypass the version check in snowboy_pmdl.py
: elif platform.linux_distribution()[0] == "Ubuntu" and platform.linux_distribution()[1] in ("16.04", "18.04"):
.
When I try to run the generate_pmdl.py
, output (no error):
template cut
personal enroll
channels: 1, sample rate: 16000, bits: 16
processing xxx.wav
processing xxx.wav
processing xxx.wav
saving file to hotword.pmdl
finished
But when I try to use the hotword.pmdl with demo, it doesn't work:
terminate called after throwing an instance of 'std::runtime_error'
what(): ERROR (ReadToken():snowboy-io.cc:131) Fail to read token in ReadToken(), position -1
[stack trace: ]
/home/tdhttt/workspace/snowboy/examples/Python/_snowboydetect.so(_ZN7snowboy13GetStackTraceEv+0x35) [0x7f627ff5d1d5]
/home/tdhttt/workspace/snowboy/examples/Python/_snowboydetect.so(_ZN7snowboy13SnowboyLogMsgD1Ev+0x47a) [0x7f627ff5d7ba]
/home/tdhttt/workspace/snowboy/examples/Python/_snowboydetect.so(_ZN7snowboy9ReadTokenEbPSsPSi+0x270) [0x7f627ff69980]
/home/tdhttt/workspace/snowboy/examples/Python/_snowboydetect.so(_ZN7snowboy14PipelineDetect14ClassifyModelsERKSsPSsS3_+0x1f4) [0x7f627ff4b7d4]
/home/tdhttt/workspace/snowboy/examples/Python/_snowboydetect.so(_ZN7snowboy14PipelineDetect8SetModelERKSs+0x15a) [0x7f627ff4bd3a]
.
.
.
python(PyRun_FileExFlags+0x82) [0x56536f768222]
python(PyRun_SimpleFileExFlags+0x18d) [0x56536f767c4d]
python(Py_Main+0x616) [0x56536f716a86]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f6281fc3b97]
python(_start+0x2a) [0x56536f71637a]
Aborted (core dumped)
This issue makes me think that the pmdl is corrupted so it was not generated properly in the first place. May I ask how can I make it work in Ubuntu 18? What's the difference between Ubuntu 16 and 18? Maybe I can try Docker?
Sometimes we might want to include a lot of people in our model and just 3 files might not be enough. so I have made very slight change to the generate_pmdl.py to use all the files in the model directory instead of just three.
`
import argparse
import tempfile
import uuid
from scipy.io import wavfile
from pmdl import snowboy_pmdl_config
from pmdl.snowboy_pmdl import SnowboyPersonalEnroll, SnowboyTemplateCut
import glob
def check_enroll_output(enroll_ans):
if enroll_ans == -1:
raise Exception("Error initializing streams or reading audio data")
elif enroll_ans == 1:
raise Exception("Hotword is too long")
elif enroll_ans == 2:
raise Exception("Hotword is too short")
def main():
parser = argparse.ArgumentParser(description='Command line client for generating snowboy personal model')
parser.add_argument('-r1', '--record1', dest="record1", required=True, help="Record voice 1")
parser.add_argument('-r2', '--record2', dest="record2", required=True, help="Record voice 2")
parser.add_argument('-r3', '--record3', dest="record3", required=True, help="Record voice 3")
parser.add_argument('-n', '--name', dest="model_name", required=True, help="Personal model name")
parser.add_argument('-lang', '--language', default="en", dest="language", help="Language")
args = parser.parse_args()
print("template cut")
cut = SnowboyTemplateCut(
resource_filename=snowboy_pmdl_config.get_enroll_resource(args.language))
out = tempfile.NamedTemporaryFile()
model_path = str(out.name)
print("personal enroll")
enroll = SnowboyPersonalEnroll(
resource_filename=snowboy_pmdl_config.get_enroll_resource(args.language),
model_filename=model_path)
assert cut.NumChannels() == enroll.NumChannels()
assert cut.SampleRate() == enroll.SampleRate()
assert cut.BitsPerSample() == enroll.BitsPerSample()
print("channels: %d, sample rate: %d, bits: %d" % (cut.NumChannels(), cut.SampleRate(), cut.BitsPerSample()))
recording_set = glob.glob('model/*.wav')
if recording_set:
for rec in recording_set:
print("processing %s" % rec)
_, data = wavfile.read(rec)
data_cut = cut.CutTemplate(data.tobytes())
enroll_ans = enroll.RunEnrollment(data_cut)
check_enroll_output(enroll_ans)
filename = args.model_name
print("saving file to %s" % filename)
f = open(filename, "wb")
f.write(open(out.name).read())
f.close()
print("finished")
else:
print('No wav files in model directory')
if name == "main":
main()
`
if you are having troubles running it due to OS then you can use the docker method in #7
Hello I was just using your Dockerfile to able to make my 'hotword.pmdl' and went through some problems
First problem was that in the last version released for scipy in python2 depends on numpy and mkv to be built
I simply resolved this by adding pip install for numpy and mkv
. venv/snowboy/bin/activate && \
cd examples/Python && \
pip install numpy && \
pip install mkv && \
pip install -r requirements.txt
But then i built my docker image with
sudo docker build -t snowboy-pmdl .
And ran it
sudo docker run -it -v $(pwd)/model:/snowboy-master/examples/Python/model snowboy-pmdl
I got this import error for snowboy.so
Traceback (most recent call last):
File "generate_pmdl.py", line 7, in <module>
from pmdl.snowboy_pmdl import SnowboyPersonalEnroll, SnowboyTemplateCut
File "/snowboy-master/examples/Python/pmdl/snowboy_pmdl.py", line 10, in <module>
from snowboy import *
File "/snowboy-master/examples/Python/pmdl/lib/ubuntu64/pmdl/snowboy.py", line 28, in <module>
_snowboy = swig_import_helper()
File "/snowboy-master/examples/Python/pmdl/lib/ubuntu64/pmdl/snowboy.py", line 24, in swig_import_helper
_mod = imp.load_module('_snowboy', fp, pathname, description)
ImportError: /snowboy-master/examples/Python/pmdl/lib/ubuntu64/pmdl/_snowboy.so: cannot open shared object file: No such file or directory
I actually didnt get how to solve this problem, if anyone could help me I would be very grateful
Wouldn't it be nice record my own false activations and then train the model on that?
The official website has been closed.
Where can I see the detailed documentation?
First, thanks so much for releasing Snowboy's continuity after the shutdown! I'm very grateful.
Second, I tried executing the Android Alexa demo and I received the following errors:
File: src/ai/kitt/snowboy/audio/RecordingThread.java
Corresponding Errors:
cannot find symbol class Snowboy Detect
cannot find symbol class Snowboy Detect
cannot find symbol class Snowboy Detect
File: src/ai/kitt/snowboy/Demo.java
Corresponding Error:
uses or overrides a deprecated API
Thank you
The main advantage of Snowboy used to be the https://snowboy.kitt.ai/ website and especially its trained database.
Would it be possible to get a website up that is free to run (or runs off ads) that provides similar abilities?
Currently, I have a database-less website put up (https://snowboy.jolanrensen.nl/) based on https://github.com/rhasspy/snowboy-seasalt. This however requires the user to train about 100 hotwords before they get a usable model which is far from ideal.
will the hotword detection efficiency increase if we add more then 3 samples? if it does help, how to do it exactly? I tried modifying generate_pmdl.py
, but it isn't working.
Hello. Is it possible to make a universal model? Is there a cost? I'm interested in getting it to open source projects.
I'm using libsnowboy-detect.a in my project. In order to make the linker happy I need to run my linker command with -D_GLIBCXX_USE_CXX11_ABI=0
or it will not work. This option instructs the linker to use the the old ABI (see here for more info).
If I don't use other third party libraries, this would be fine. However, I also need to link against additional libraries that require the new ABI and won't work in combination with -D_GLIBCXX_USE_CXX11_ABI=0
.
Can you provide libraries that are compatible with the new ABI (GCC >= 5.1) please?
Edit:
I see there's already a discussion and workaround under Kitt-AI#99
I want to rebuild lib/ubuntu64/pmdl/_snowboy.so. Where are the swig scripts located for the same?
I have replaced alexa.umdl from the Android demo with the pmdl model and facing a crash now.
E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
E/Perf: Fail to get file list ai.kitt.snowboy.demo
getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
Fail to get file list ai.kitt.snowboy.demo
getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13983 (tt.snowboy.demo), pid 13983 (tt.snowboy.demo)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.