Skip to main content

Hotword/Wake Word detection in python for all platforms(Windows/Linux/Mac).

Project description

lsHotword 🤖

Github

lsHotword detector is an easy-to-use module which is open-source and comes with a Free License. This module was created with the help of Deeplearning.ai 's Deep Learning Program. If you have any problems, you can contact me via my email, which is provided at the end of this document. For further assistance, we also have a YouTube channel - the link to which is also provided below.

Install lsHotword using pip ✌

To install lsHotword open cmd and type-

pip install lsHotword

make sure your python should be on path.

Training Your Own Model 😊

Create Dataset

To train your own Model you have to create your Dataset. Record 10 audio with voice Activate and place it under "Positives folder" and record 10 Non-Activate Word Which are not Activate and place it under negatives folder.Finally, record two or more background noises in different environments, each of 10 seconds duration. Ensure that these audio files are recorded in a sample rate of 44100 Hz; otherwise, you will have to change too many parameters. Examples are provided on Github (from Coursera's Deep Learning Program). Your directory structure should look like this:

  • data/
    • background/
      • file1.wav
      • file2.wav
      • file3.wav
    • positives/
      • file4.wav
      • file5.wav
      • file6.wav
      • .
      • .
    • negatives/
      • file7.wav
      • file8.wav
      • file9.wav
      • .
      • .

Audio files info-

positives/ -> 44100Hz, length may vary, but it should be under 10 seconds. Audio files should contain only the sound of the keyword (Hotword). See an example Here.

negetives/ -> 44100Hz, length may vary, but it should be under 10 seconds. Audio files should contain only the sound of the keyword opposite to the hotword. See an example here.

background/ -> 44100Hz, lenght should exactly be 10 second. e.g See here.

Then open command prompt here (eg. outside "data" folder) and type-.

lsHDatagen --input ./data --nsamp 32

Here data is the folder where both folders "positives and negatives" are located and nsamp are number of training examples you want to generate. After finishing this process you will see two files 'X.npy and Y.npy' outside data folder. Now its time to train our Hotword Model open cmd again here and type-

lsHTrainer --inX X.npy --inY Y.npy --epochs 600

and then after few minutes you will get your model with name model.h5, Hurray!! you just created your own hotword or wake word model. Now test it using this command-

lsHTestModel --model ./model.h5

and then you will see a text like << Waiting for Hotword >> when you see this text then try to speak your wake word and see a chime sound will beep!!

Using Trained Model 😎

After installing lsHotword and training your own model e.g model.h5 then you are ready to use it any program where you want to use it. Example-

from lsHotword.ls import Hotword

path_to_model = "./model.h5"          # path to model where it is located
hotword = Hotword(path_to_model)      # create object of Hotword

#Now call HotwordLoop function
if hotword.HotwordLoop():
    print('Wake word Detected!!')    # print when hotword is detected.

For More Information 😻

For more information or send your query at: iamhemantindia@protonmail.com

or Checkout Our Youtube Channel

youtube

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsHotword-1.1.2.tar.gz (167.1 kB view details)

Uploaded Source

Built Distribution

lsHotword-1.1.2-py3-none-any.whl (168.9 kB view details)

Uploaded Python 3

File details

Details for the file lsHotword-1.1.2.tar.gz.

File metadata

  • Download URL: lsHotword-1.1.2.tar.gz
  • Upload date:
  • Size: 167.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.13

File hashes

Hashes for lsHotword-1.1.2.tar.gz
Algorithm Hash digest
SHA256 ff7a12bdb295c85a15955919fb7588dbb30f68d8b5dd6fcdb4627ca35beefc5e
MD5 6c64d8d2cdb6c840df6f7d80cd33e61e
BLAKE2b-256 fc4361e7f02653a580bbee94ed2f7fb1ee3c973b76a631c6881f9eb7e5a247d8

See more details on using hashes here.

File details

Details for the file lsHotword-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: lsHotword-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 168.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.13

File hashes

Hashes for lsHotword-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6f34193b6d8c1e950cd635ce52b1d2e5b31c2002845c3052925c257c2a7bbac
MD5 79da558b7fd5fd01ed88e2eb2c3a598d
BLAKE2b-256 31486ace95433b0ff501b18acec37d1043f7a433609d1d685a5c184b3f3f03db

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page