lsHotword


NamelsHotword JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/HemantKArya/lsHotword
SummaryHotword/Wake Word detection in python for all platforms(Windows/Linux/Mac).
upload_time2023-04-09 06:32:39
maintainer
docs_urlNone
authorHemant Kumar
requires_python
licenseMIT
keywords hotword detector lshotword windows python wake word wake-word detection
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lsHotword
![lshotword-banner](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/lshotword_banner.png)

[![Github](	https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://www.github.com/HemantKArya/lsHotword)   [![pypi](https://img.shields.io/badge/pypi-3775A9?style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/lsHotword/)     [![linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/in/iamhemantindia)  

**lsHotword** is Wake Word detector and Easy to use Module Which is open-Source and **Free License**.If you face any problem you can contact me on my E-mail at the last of this Document. For any Help we also have YouTube channel link is at the last of this file.

# Install lsHotword using pip
 To install lsHotword open cmd and type-
 ```
 pip install lsHotword --upgrade
 ```
 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. And like that record 2 or more than 2 background noises in different environments of 10 seconds. Make sure to record these audios in 44100 Hz sample rate, either will you have to change too many parameters.You can use free software and tools like-

1. [Audacity](https://www.audacityteam.org/download/) Edit audio clips to select only 10 sec of background noise or exact part where you said you hotword in audio.
2. [FFMpeg](https://ffmpeg.org/) for converting the sample rate to 44100Hz

 [Examples are provided on Github for audio](https://github.com/HemantKArya/lsHotword/tree/main/Examples/data) (from deeplearning.ai's deep learning program).
Your Directory 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
        - .
        - .
        

![audioexample](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/Q4tnfi3E.png)

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

```
lshUITrainer
```
Press enter and you will see this window-
![lshotwordtrainerwindow](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/UsGpiupQt1.png)

1. Import **positives** audio folder.
2. Import **negative** audio folder.
3. Import **background** noise samples folder.
4. Import Output directory where you want to save model after training.
5. No. of training examples to generate keep it 30 and increase it if you have more data and for more better accuracy in result.
6. No. of **Epochs** (How much times you want to train your model eg 100-400).
7. Batch size increase it if you have more GPU power or keep it same.
![after-t-step](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/3AwBBo2nOR.png)
8. When 1-7 all steps are done then start training by clicking on this button.

And you will see something like that-
![starttraining](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/0mySroWeGr.png)
When training finishes  you see the output directory where wake word model is saved.
![training-complete](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/q34bpEOMao.png)

## Without GUI (Optional)
This is an alternative way, if GUI Trainer is not working or you want to do it step by step.

Type this commmand to generate training examples from raw data-
```
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. 

## Test Hotword Model live
Now test it using this command-

'lsHTestModel --model < path to model >'
```
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.

```
And thats all you are ready to go use it in any program you want to make. If you want to contribute to this little project then feel free to make push request on dev branch.

*This module is created with the help of **Deeplearning.ai 's Deep Learning Program**.*
# For More Information

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

Or

 [![](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/in/iamhemantindia)

Or Checkout Our Youtube Channel Logical Spot (Hemant Kumar)

[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/c/LogicalSpot)

Feel free to **Contribute** at - 

[![Github](	https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://www.github.com/HemantKArya/lsHotword)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/HemantKArya/lsHotword",
    "name": "lsHotword",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "hotword,detector,lshotword,windows,python,wake word,wake-word,detection",
    "author": "Hemant Kumar",
    "author_email": "iamhemantindia@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/6b/89c28d0624a2b34b4f5d2ba1edffa12e9c41a1d27517ae7dce070aae5d44/lsHotword-1.2.4.tar.gz",
    "platform": null,
    "description": "# lsHotword\r\n![lshotword-banner](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/lshotword_banner.png)\r\n\r\n[![Github](\thttps://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://www.github.com/HemantKArya/lsHotword)   [![pypi](https://img.shields.io/badge/pypi-3775A9?style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/lsHotword/)     [![linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/in/iamhemantindia)  \r\n\r\n**lsHotword** is Wake Word detector and Easy to use Module Which is open-Source and **Free License**.If you face any problem you can contact me on my E-mail at the last of this Document. For any Help we also have YouTube channel link is at the last of this file.\r\n\r\n# Install lsHotword using pip\r\n To install lsHotword open cmd and type-\r\n ```\r\n pip install lsHotword --upgrade\r\n ```\r\n Make sure your python should be on path.\r\n\r\n# Training Your Own Model\r\n## Create Dataset\r\nTo train your own Model you have to create your Dataset.\r\nRecord 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. And like that record 2 or more than 2 background noises in different environments of 10 seconds. Make sure to record these audios in 44100 Hz sample rate, either will you have to change too many parameters.You can use free software and tools like-\r\n\r\n1. [Audacity](https://www.audacityteam.org/download/) Edit audio clips to select only 10 sec of background noise or exact part where you said you hotword in audio.\r\n2. [FFMpeg](https://ffmpeg.org/) for converting the sample rate to 44100Hz\r\n\r\n [Examples are provided on Github for audio](https://github.com/HemantKArya/lsHotword/tree/main/Examples/data) (from deeplearning.ai's deep learning program).\r\nYour Directory should look like this-\r\n- data/\r\n    - background/\r\n        - file1.wav\r\n        - file2.wav\r\n        - file3.wav\r\n    - positives/\r\n        - file4.wav\r\n        - file5.wav\r\n        - file6.wav\r\n        - .\r\n        - .\r\n    - negatives/\r\n        - file7.wav\r\n        - file8.wav\r\n        - file9.wav\r\n        - .\r\n        - .\r\n        \r\n\r\n![audioexample](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/Q4tnfi3E.png)\r\n\r\nThen open command prompt here (eg. outside \"data\" folder) and type-.\r\n\r\n```\r\nlshUITrainer\r\n```\r\nPress enter and you will see this window-\r\n![lshotwordtrainerwindow](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/UsGpiupQt1.png)\r\n\r\n1. Import **positives** audio folder.\r\n2. Import **negative** audio folder.\r\n3. Import **background** noise samples folder.\r\n4. Import Output directory where you want to save model after training.\r\n5. No. of training examples to generate keep it 30 and increase it if you have more data and for more better accuracy in result.\r\n6. No. of **Epochs** (How much times you want to train your model eg 100-400).\r\n7. Batch size increase it if you have more GPU power or keep it same.\r\n![after-t-step](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/3AwBBo2nOR.png)\r\n8. When 1-7 all steps are done then start training by clicking on this button.\r\n\r\nAnd you will see something like that-\r\n![starttraining](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/0mySroWeGr.png)\r\nWhen training finishes  you see the output directory where wake word model is saved.\r\n![training-complete](https://github.com/HemantKArya/lsHotword/raw/main/docfiles/q34bpEOMao.png)\r\n\r\n## Without GUI (Optional)\r\nThis is an alternative way, if GUI Trainer is not working or you want to do it step by step.\r\n\r\nType this commmand to generate training examples from raw data-\r\n```\r\nlsHDatagen --input ./data --nsamp 32\r\n```\r\nHere **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.\r\nNow its time to train our Hotword Model open cmd again here and type-\r\n```\r\nlsHTrainer --inX X.npy --inY Y.npy --epochs 600\r\n```\r\nand then after few minutes you will get your model  with name **model.h5**, Hurray!! you just created your own hotword or wake word model. \r\n\r\n## Test Hotword Model live\r\nNow test it using this command-\r\n\r\n'lsHTestModel --model < path to model >'\r\n```\r\nlsHTestModel --model ./model.h5\r\n```\r\nand 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!!\r\n\r\n# Using Trained Model\r\n\r\nAfter 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-\r\n\r\n```\r\nfrom lsHotword.ls import Hotword\r\n\r\npath_to_model = \"./model.h5\"          # path to model where it is located\r\nhotword = Hotword(path_to_model)      # create object of Hotword\r\n\r\n#Now call HotwordLoop function\r\nif hotword.HotwordLoop():\r\n    print('Wake word Detected!!')    # print when hotword is detected.\r\n\r\n```\r\nAnd thats all you are ready to go use it in any program you want to make. If you want to contribute to this little project then feel free to make push request on dev branch.\r\n\r\n*This module is created with the help of **Deeplearning.ai 's Deep Learning Program**.*\r\n# For More Information\r\n\r\nFor more information or send your query at:\r\niamhemantindia@protonmail.com\r\n\r\nOr\r\n\r\n [![](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/in/iamhemantindia)\r\n\r\nOr Checkout Our Youtube Channel Logical Spot (Hemant Kumar)\r\n\r\n[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/c/LogicalSpot)\r\n\r\nFeel free to **Contribute** at - \r\n\r\n[![Github](\thttps://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://www.github.com/HemantKArya/lsHotword)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Hotword/Wake Word detection in python for all platforms(Windows/Linux/Mac).",
    "version": "1.2.4",
    "split_keywords": [
        "hotword",
        "detector",
        "lshotword",
        "windows",
        "python",
        "wake word",
        "wake-word",
        "detection"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3933c653bfc262cb5c590537b78b3acad1bcfffa039676a2b9bb2a4205e424f9",
                "md5": "22dd434b8723560958a305afb6bad141",
                "sha256": "925835ae4b8648b7d0aa5bede2bfd2a7d17dce786aedfd331da754c5e79438f3"
            },
            "downloads": -1,
            "filename": "lsHotword-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "22dd434b8723560958a305afb6bad141",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2449576,
            "upload_time": "2023-04-09T06:32:27",
            "upload_time_iso_8601": "2023-04-09T06:32:27.888648Z",
            "url": "https://files.pythonhosted.org/packages/39/33/c653bfc262cb5c590537b78b3acad1bcfffa039676a2b9bb2a4205e424f9/lsHotword-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e46b89c28d0624a2b34b4f5d2ba1edffa12e9c41a1d27517ae7dce070aae5d44",
                "md5": "9553244676935ad7613459f2cdfa385f",
                "sha256": "7e94cef3fcfdeba172332e0d00ae559d39d93eeecf4075f4b5a46197f73dbf58"
            },
            "downloads": -1,
            "filename": "lsHotword-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9553244676935ad7613459f2cdfa385f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2340906,
            "upload_time": "2023-04-09T06:32:39",
            "upload_time_iso_8601": "2023-04-09T06:32:39.578475Z",
            "url": "https://files.pythonhosted.org/packages/e4/6b/89c28d0624a2b34b4f5d2ba1edffa12e9c41a1d27517ae7dce070aae5d44/lsHotword-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-09 06:32:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "HemantKArya",
    "github_project": "lsHotword",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lshotword"
}
        
Elapsed time: 0.05391s