Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add license
  • Loading branch information
AnirudhBHarish committed Jul 7, 2021
commit 7203332f0caaacdbb4c42ecd4cb849c5ec623c1e
5 changes: 5 additions & 0 deletions applications/KWS_Phoneme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Project Description
There are two major issues in the existing KWS systems (a) they are not robust to heavy background noise and random utterances, and (b) they require collecting a lot of data, hampering the ease of adding a new keyword. Tackling these issues from a different perspective, we propose a new two staged scheme with a model for predicting phonemes which are in turn used for phoneme based keyword classification.
Comment thread
ShikharJ marked this conversation as resolved.
Resolved

First we train a phoneme classification model which gives the phoneme transcription of the input speech snippet. For training this phoneme classifier, we use a large public speech dataset like LibreSpeech. The public dataset can be aligned (meaning get the phoneme labels for each speech snippet in the data) using Montreal Forced Aligner. We also add reverberations and additive noise to the speech samples from the public dataset to make the phoneme classifier training robust to various accents, background noise and varied environment. In this project, we predict phonemes at every 10ms which is the standard way. You can find the aligned LibreSpeech dataset we used for training here.

In the second part, we use the predicted phoneme outputs from the phoneme classifier for predicting the input keyword. We train a 1 layer FastGRNN classifier to predict the keyword based on the phoneme transcription as input. Since the phoneme classifier training has been done to account for diverse accent, background noise and environments, the keyword classifier can be trained using a small number of Text-To-Speech(TTS) samples generated using any standard TTS api from cloud services like Azure, Google Cloud or AWS.
Comment thread
ShikharJ marked this conversation as resolved.
Resolved

This gives two advantages: (a) The phoneme model is trained to account for diverse accents and background noise settings, thus the flexible keyword classifier training requires only a small number of keyword samples, and (b) Empirically this method was able to detect keywords from as far as 9ft of distance. Further, the phoneme model has a small size of around 250k parameters and can fit on a Cortex M7 microcontroller.

# Training the Phoneme Classifier
Expand All @@ -15,6 +19,7 @@ This gives two advantages: (a) The phoneme model is trained to account for diver
1) Our method takes as input the speech snippet and passes it through the phoneme classifier
2) Keywords are detected by training a keyword classifier over the detected phonemes
3) For training the keyword classifier, we use Azure and Google Text-To-Speech API to get the training data (keyword snippets)
4) For example, if you want to train a Keyword classifier for the keywords in the Google30 dataset, generate TTS samples from the Azure/Google-Cloud/AWS API for each of the 30 keywords. The TTS samples for each keyword must be stored in a separate folder named according to the keyword. More details about how the generated TTS data should be stored are mentioned below in sample use case for classifier model training.
Comment thread
ShikharJ marked this conversation as resolved.
Resolved

# Sample Use Cases

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

import os
import librosa
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

import csv
import os
import argparse
Expand Down
3 changes: 3 additions & 0 deletions applications/KWS_Phoneme/data_pipe.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

import torch
import argparse
import torch.utils.data
Expand Down
3 changes: 3 additions & 0 deletions applications/KWS_Phoneme/kwscnn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

import torch
import torch.nn as nn
from torch.autograd import Variable
Expand Down
3 changes: 3 additions & 0 deletions applications/KWS_Phoneme/train_classifier.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

import argparse
import os
import re
Expand Down
3 changes: 3 additions & 0 deletions applications/KWS_Phoneme/train_phoneme.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

import argparse
import os
import re
Expand Down
3 changes: 3 additions & 0 deletions applications/KWS_Phoneme/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

"""
Some Torch Functions required for overwriting
Convolutions to Low Rank Convolutions
Expand Down