Product

Use your own keyword spotting data in NengoEdge

March 10, 2023
Dr. Trevor Bekolay

If you want to train a model to detect custom keywords, you can upload your own labelled audio datasets to NengoEdge. Note that here we'll be specifically discussing the keyword spotting (KWS) application type; other applications have their own dataset formats, see the Dataset upload page for each application type for more details.

Preparing your data

Datasets in NengoEdge are split into three main folders named train, validation and test. Inside each of these main folders, labelled data is stored as .wav, .flac or .mp3 files organized into sub-folders, where the name of each sub-folder is the keyword label. Place all audio samples associated with that label into the corresponding sub-folder, then create a .tar.gz archive containing your train, validation and test folders.

Example

In this example, we will use some of the dataset collected for training the Loihi keyword spotter.

This dataset was originally organized into train, validation and test folders, with subfolders for each speaker. Each subfolder contains .wav files with structured filenames containing the speaker ID, keyword, and time at which the sample was recorded.

In order to make this dataset compatible with NengoEdge, we wrote a short Python script (organize-data.py) to copy files around into the NengoEdge format, and ensure that all wav files can be loaded correctly. Feel free to use this script as a starting point for organizing your data!

After running this script on the above data, we now have the directory structure that NengoEdge expects.

We then create a compressed archive of this directory structure. We can do this using the nengo-edge package-dataset command.

Example output from package-dataset command

We are now ready to upload this archive to NengoEdge.

Uploading your data

To upload your data, navigate to the Datasets page, accessible from the top navbar.

Click the Upload new data button and you will see a window pop up.

Give your data a name and select the file on your hard drive. Click the Upload button.

You will see a box with a progress bar in the bottom right of NengoEdge.

Uploading data progress bar

Once the upload is complete, your data will appear in the datasets list, though there is no dataset associated with it yet.

Creating new datasets from your data

Uploading raw data gives you the ability to create multiple datasets for use in training runs. To create a new dataset, click the New dataset button in the sections associated with your raw data on the Datasets page.

With the example dataset from above, we created a dataset to classify the "aloha" keyword. All keywords not selected are grouped under the "unknown" label. Notice that the sample rate and clip duration are filled in according to the data, but can be changed if desired. Similarly, you can change the percentages associated with the amount of silence or unknown samples.

The dataset you created can now be used in a run. See other tutorials like this one to see how your dataset can be used to train a model.

Dr. Trevor Bekolay, a Co-Founder at Applied Brain Research, has a deep-rooted passion for understanding learning and memory mechanisms, especially within the realm of spiking neurons. His academic pursuits have led him to explore the intricate world of linguistic sound processing. Beyond research, Dr. Bekolay has been instrumental in the collaborative development of the Nengo neural simulator, emphasizing the importance of reproducible science in the ever-evolving field of neural computation.

Similar content from the ABR blog