Skip to content

HazekiahWon/audio_attack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the code corresponding to the paper
"Audio Adversarial Examples: Targeted Attacks on Speech-to-Text"
Nicholas Carlini and David Wagner

This release of the code is preliminary; it includes the CTC-based attack with a
batch size of 1. This means it requires a slightly larger distortion, and is
slower to run than the algorithm that is presented in the paper. Soon (TM) I
will add these two improvements to this codebase.

To generate adversarial examples for your own files, follow the below process
and modify the arguments to attack,py. Ensure that the file is sampled at
16KHz. You may want to modify the number of iterations that the attack algorithm
is allowed to run.


Instructions for basic use:

1. Install the dependencies

pip3 install --user numpy scipy tensorflow-gpu pandas python_speech_features

2. Clone the Mozilla DeepSpeech repository into a folder called DeepSpeech:

git clone https://github.com/mozilla/DeepSpeech.git

3. Download the DeepSpeech model

wget https://github.com/mozilla/DeepSpeech/releases/download/v0.1.0/deepspeech-0.1.0-models.tar.gz
tar -xzf deepspeech-0.1.0-models.tar.gz

4. Verify that you have a file models/output_graph.pb, it's MD5 sum should be
08a9e6e8dc450007a0df0a37956bc795.

5. Convert the .pb to a TensorFlow checkpoint file

python3 make_checkpoint.py
ERROR: The decoder library file does not exist. Make sure you have downloaded or built the native client binaries and pass the appropriate path to the binaries in the --decoder_library_path parameter.

session_dump under models/

6. Generate adversarial examples

python3 attack.py --in sample.wav --target "example" --out adversarial.wav

7. (optional) Install the deepseech utility:

pip3 install deepspeech-gpu

8. Classify the generated phrase

deepspeech models/output_graph.pb adversarial.wav models/alphabet.txt

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published