Few-Shot-KWS
Few-Shot-KWS copied to clipboard
Few-Shot Keyword Spotting
Code Repository for the paper Few-Shot Keyword Spotting with Prototypical Networks.

Installation
-
Clone the repository:
git clone https://github.com/ArchitParnami/Few-Shot-KWS -
Create a conda environment:
conda create -n FS-KWS -
If pip not installed, install pip by:
conda install pip -
Install the required packages:
pip install -r requirements.text -
Install the protonets package:
cd Few-Shot-KWS python setup.py develop
Download & Prepare Few-Shot Keyword Spotting Dataset
cd Few-Shot-KWS/data/
python download_prepare_data.py
Train
To train a simple 2-way 1-shot experiment.
cd Few-Shot-KWS/scripts/train/few-shot/fewshotspeech
./train.sh 2 1 0 mymodel
Specify arguments to train.sh in the following manner
train.sh num_ways num_shots exp_type exp_id
- num_ways
- Number of classes
- Eg. 2 or 4
- num_shots
- Number of samples per class.
- Eg. 1,5
- exp_type
- Number indicating the type of experimental setup
- 0 = Simple N-Way K-Shot Setup. No background, silence or unknown keywords.
- 1 = Include Background
- 2 = Include Silence
- 3 = Include Unknown
- 4 = Background + Silence
- 5 = Background + Unkown
- 6 = Unknown + Silence
- 7 = Background + Silence + Unknown
- Number indicating the type of experimental setup
- exp_id
- identifier = directory name
- results are saved in
Few-Shot-KWS/scripts/train/few-shot/fewshotspeech/results/[exp_id]
Evaluate
cd Few-Shot-KWS/scripts/predict/few-shot
python eval_results.py ../../train/few_shot/fewshotspeech/results/
The evaluation can be found in:
cat Few-Shot-KWS/scripts/train/few-shot/fewshotspeech/results/[exp-id]/[timestamp]/eval.txt
Results
Comaring test accuracy of different embedding networks on 4-way FS-KWS as we increase the number of support examples. The results are presented for four different cases discussed in the paper.


References
The code in this repository has been adapted from:
- https://github.com/jakesnell/prototypical-networks
- https://github.com/hyperconnect/TC-ResNet
- https://github.com/tensorflow/docs/blob/master/site/en/r1/tutorials/sequences/audio_recognition.md
Citation
@misc{parnami2020fewshot,
title={Few-Shot Keyword Spotting With Prototypical Networks},
author={Archit Parnami and Minwoo Lee},
year={2020},
eprint={2007.14463},
archivePrefix={arXiv},
primaryClass={eess.AS}
}