资源算法kaldi_spotter

kaldi_spotter

2020-04-07 | |  27 |   0 |   0

Kaldi Spotter

wake word spotting with kaldi

Usage

Config

Configuration is loaded from the following locations, with each location overriding values from the previous one

"/opt/kaldi_spotter/kaldi_spotter.conf"
"~/.kaldi_spotter/kaldi_spotter.conf"

Sample Config

{    "listener": {        "default_volume": 150,        "default_aggressiveness": 2,        "default_model_dir": "/opt/kaldi/model/kaldi-generic-en-tdnn_250",        "default_acoustic_scale": 1.0,        "default_beam": 7.0,        "default_frame_subsampling_factor": 3
    },    "hotwords": {
        # full sentences
        # CRITERIA
        # - fairly accurate,
        # - important enough to want offline functionality
        # - worth answering even if speech not directed at device        "lights on": {            "transcriptions": ["lights on"],            "intent": "turn on lights",            "rule": "equal"
        },        "lights off": {            "transcriptions": ["lights off"],            "intent": "turn off lights",            "rule": "equal"
        },        "time": {            "transcriptions": ["what time is it"],            "intent": "current time",            "active": false,            "rule": "equal"
        },
        # wake words
        # PROTIP: just run the live demo and see which transcriptions come up        "hey computer": {            "transcriptions": ["hey computer", "a computer", "they computer"],            "sound": "/home/pi/start_listening.wav",            "intent": "listen"
        }
    }
}

Python

see examples

from kaldi_spotter import KaldiWWSpotter    
def print_hotword(event):    print("HOTWORD:", event)def print_utterance(event):    print("LIVE TRANSCRIPTION:", event)


listener = KaldiWWSpotter()
listener.on("transcription", print_utterance)
listener.on("hotword", print_hotword)
listener.run()

CLI

Start kaldi spotter from cli

python -m kaldi_spotter

Sample Output

pi@raspberrypi:~ $ python -m kaldi_spotter
INFO:root:Loading model from /opt/kaldi/model/kaldi-generic-en-tdnn_250 ...
INFO:root:audio source: seeed-4mic-voicecard Multichannel
INFO:root:Listening
('LIVE TRANSCRIPTION:', '{"data": {"confidence": 0.7698909431952632, "utterance": "hey computer"}, "type": "transcription"}')
('HOTWORD:', '{"data": {"hotword": "hey computer", "utterance": "hey computer", "intent": "listen"}, "type": "hotword"}')
('LIVE TRANSCRIPTION:', '{"data": {"confidence": 0.7663563699360755, "utterance": "what time is it"}, "type": "transcription"}')
('HOTWORD:', '{"data": {"hotword": "time", "utterance": "what time is it", "intent": "current time"}, "type": "hotword"}')

Install

System Requirements

sudo apt-get install libatlas-dev pulseaudio-utils pulseaudio cython

Pre-trained models

You can install English model kaldi-chain-zamia-speech-en or german model kaldi-chain-zamia-speech-de

Refered as kaldi-chain-zamia-speech-XX bellow

Raspbian 9 (stretch) on a Raspberry Pi 2/3

echo "deb http://goofy.zamia.org/repo-ai/raspbian/stretch/armhf/ ./" >/etc/apt/sources.list.d/zamia-ai.list
wget -qO - http://goofy.zamia.org/repo-ai/raspbian/stretch/armhf/bofh.asc | sudo apt-key add -
apt-get update
apt-get install kaldi-chain-zamia-speech-XX

Debian 9 (stretch, amd64)

apt-get install apt-transport-httpsecho "deb http://goofy.zamia.org/repo-ai/debian/stretch/amd64/ ./" >/etc/apt/sources.list.d/zamia-ai.list
wget -qO - http://goofy.zamia.org/repo-ai/debian/stretch/amd64/bofh.asc | sudo apt-key add -
apt-get update
apt-get install kaldi-chain-zamia-speech-XX

CentOS 7 (amd64)

cd /etc/yum.repos.d
wget http://goofy.zamia.org/zamia-speech/misc/zamia-ai-centos.repo
yum install kaldi-chain-zamia-speech-XX

Pip Package

install from pip

pip install kaldi_spotter

or from source

pip install git+https://github.com/JarbasAl/kaldi_spotter

Credits

zamia-speech


上一篇:mxnet_kaldi

下一篇:kaldi-online2-gmm-decode

用户评价
全部评价

热门资源

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • shih-styletransfer

    shih-styletransfer Code from Style Transfer ...