{"id":15028454,"url":"https://github.com/arm-software/ml-kws-for-mcu","last_synced_at":"2025-05-16T14:04:32.205Z","repository":{"id":41258162,"uuid":"114120727","full_name":"ARM-software/ML-KWS-for-MCU","owner":"ARM-software","description":"Keyword spotting on Arm Cortex-M Microcontrollers","archived":false,"fork":false,"pushed_at":"2019-04-10T15:17:43.000Z","size":19911,"stargazers_count":1175,"open_issues_count":53,"forks_count":423,"subscribers_count":85,"default_branch":"master","last_synced_at":"2025-05-16T14:03:07.741Z","etag":null,"topics":["arm","cmsis-nn","deep-neural-networks","machine-learning","microcontrollers","python"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ARM-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-13T12:55:15.000Z","updated_at":"2025-05-14T07:46:06.000Z","dependencies_parsed_at":"2022-09-02T23:30:45.091Z","dependency_job_id":null,"html_url":"https://github.com/ARM-software/ML-KWS-for-MCU","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2FML-KWS-for-MCU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2FML-KWS-for-MCU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2FML-KWS-for-MCU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2FML-KWS-for-MCU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARM-software","download_url":"https://codeload.github.com/ARM-software/ML-KWS-for-MCU/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","cmsis-nn","deep-neural-networks","machine-learning","microcontrollers","python"],"created_at":"2024-09-24T20:08:21.904Z","updated_at":"2025-05-16T14:04:32.188Z","avatar_url":"https://github.com/ARM-software.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keyword spotting for Microcontrollers \n\nThis repository consists of the tensorflow models and training scripts used \nin the paper: \n[Hello Edge: Keyword spotting on Microcontrollers](https://arxiv.org/pdf/1711.07128.pdf). \nThe scripts are adapted from [Tensorflow examples](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/speech_commands) \nand some are repeated here for the sake of making these scripts self-contained.\n\nTo train a DNN with 3 fully-connected layers with 128 neurons in each layer, run:\n\n```\npython train.py --model_architecture dnn --model_size_info 128 128 128 \n```\nThe command line argument *--model_size_info* is used to pass the neural network layer\ndimensions such as number of layers, convolution filter size/stride as a list to models.py, \nwhich builds the tensorflow graph based on the provided model architecture \nand layer dimensions. \nFor more info on *model_size_info* for each network architecture see \n[models.py](models.py).\nThe training commands with all the hyperparameters to reproduce the models shown in the \n[paper](https://arxiv.org/pdf/1711.07128.pdf) are given [here](train_commands.txt).\n\nTo run inference on the trained model from a checkpoint on train/val/test set, run:\n```\npython test.py --model_architecture dnn --model_size_info 128 128 128 --checkpoint \n\u003ccheckpoint path\u003e\n```\n\nTo freeze the trained model checkpoint into a .pb file, run:\n```\npython freeze.py --model_architecture dnn --model_size_info 128 128 128 --checkpoint \n\u003ccheckpoint path\u003e --output_file dnn.pb\n```\n\n## Pretrained models\n\nTrained models (.pb files) for different neural network architectures such as DNN,\nCNN, Basic LSTM, LSTM, GRU, CRNN and DS-CNN shown in \nthis [arXiv paper](https://arxiv.org/pdf/1711.07128.pdf) are added in \n[Pretrained_models](Pretrained_models). Accuracy of the models on validation set, \ntheir memory requirements and operations per inference are also summarized in the \nfollowing table.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/34459978/34018008-0451ef9a-e0dd-11e7-9661-59e4fb4a8347.png\"\u003e\n\nTo run an audio file through the trained model (e.g. a DNN) and get top prediction, \nrun:\n```\npython label_wav.py --wav \u003caudio file\u003e --graph Pretrained_models/DNN/DNN_S.pb \n--labels Pretrained_models/labels.txt --how_many_labels 1\n```\n\n## Quantization Guide and Deployment on Microcontrollers\n\nA quick guide on quantizing the KWS neural network models is [here](Deployment/Quant_guide.md). \nThe example code for running a DNN model on a Cortex-M development board is also provided [here](Deployment). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farm-software%2Fml-kws-for-mcu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farm-software%2Fml-kws-for-mcu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farm-software%2Fml-kws-for-mcu/lists"}