Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Last active April 8, 2021 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyishaR/dc806be20d2730a1233b4e5e71961d1f to your computer and use it in GitHub Desktop.
Save AyishaR/dc806be20d2730a1233b4e5e71961d1f to your computer and use it in GitHub Desktop.
add_noise = False # add different words, null samples and random noise
n_classes = len(hotwords) + int(add_noise)
class_nSamples = 1000 # number of samples in the hotword classes
other_nSamples = float(class_nSamples)/(len(word_dirs) - n_classes) # number of samples to be picked from each of the non-hotword classes
def nLabel(word):
return n_classes-1 if ( word not in hotwords ) else hotwords.index(word)
def textLabel(index):
return hotwords[index] if index <len(hotwords) else "background"
def sampleBackGround():
return add_noise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment