This repository contains code accompanying the paper "Voting for the right answer: Adversarial defense for speaker verification".
- As shown in upper part of the following figure, for the conventional ASV system workflow, we can get the ASV score from a piece of single utterance.
- However, such conventional ASV is highly vulnerable to adversarial samples (you can refer to the adversarial audio samples) which are very similar to their original counterparts from human's perception, yet will manipulate the ASV render wrong prediction.
- In order to improve the adversarial robustness of such conventional ASV system, we propose the idea of "voting" to prevent risky decisions of ASV in blind spot areas, by employing random sampling neibours around the testing utterance and letting them vote for the right answer.
- For more information, please refer to our paper on arxiv
git clone https://github.com/thuhcsi/adsv_voting
cd adsv_voting
git clone https://github.com/thuhcsi/torch_speaker
cd torch_speaker
pip install -r requirements.txt
python setup.py develop
cd ..
cp -r torch_speaker/{tools,scripts} .
stage 1: data preparation
rm -rf data; mkdir data
wget -P data/ https://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/veri_test.txt
echo format trails
python3 scripts/format_trials.py \
--voxceleb1_root $voxceleb1_path \
--src_trials_path data/veri_test.txt \
--dst_trials_path data/vox1.txt
stage 2: ASV model evaluation in raw audio
python3 tools/evaluate.py \
--config config/voting.yaml \
--trial_path data/vox1.txt \
--checkpoint_path $checkpoint_path
stage 3: adversarial attack and examples generation
python3 local/attack.py \
--config config/voting.yaml \
--trial_path data/vox1.txt \
--checkpoint_path $checkpoint_path
stage 4: ASV model evaluation in adversarial examples
python3 tools/evaluate.py \
--config config/voting.yaml \
--trial_path data/vox1.txt \
--checkpoint_path $checkpoint_path
stage 5: voting for the defense
python3 local/defense.py \
--config config/voting.yaml \
--trial_path data/vox1.txt \
--checkpoint_path $checkpoint_path
If you think this work helps your research or use the code, please consider reference our paper. Thank you!
@article{wu2021voting,
title={Voting for the right answer: Adversarial defense for speaker verification},
author={Wu, Haibin and Zhang, Yang and Wu, Zhiyong and Wang, Dong and Lee, Hung-yi},
booktitle={Interspeech},
year={2021}
}