carlini/audio_adversarial_examples源码安装方法

Nicholas Carlini是文章Audio Adversarial Examples: Targeted Attacks on Speech-to-Text的作者,他将自己的代码放在github上,地址为https://github.com/carlini/audio_adversarial_examples
本文介绍Nicholas Carlini的audio_adversarial_examples源码安装方法,写这篇文章的原因是因为其github库的readme安装有一些问题,不能完成安装,因此我安装自己的安装过程重新写下,亲测可用。
步骤如下:
1. 安装依赖:

安装git LFS,便于后期大文件下载:
$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
$ sudo apt-get install git-lfs
$ git lfs install
方法来自于https://blog.csdn.net/u014454538/article/details/81282369

安装ds-ctcdecoder:
pip install ds-ctcdecoder

安装其他依赖库:
pip3 install tensorflow-gpu==1.14 progressbar numpy scipy pandas python_speech_features tables attrdict pyxdg

  1. 准备源码:

下载Nicholas Carlini的代码到本地:
git clone https://github.com/carlini/audio_adversarial_examples.git

进入audio_adversarial_examples文件夹:
cd audio_adversarial_examples

下一步需要下载DeepSpeech代码,但是audio_adversarial_examples使用的是DeepSpeech0.4.1版本,不建议使用Nicholas Carlini提供的先下载github库后checkout版本的方法,我遇到了bug
建议直接打开https://github.com/mozilla/DeepSpeech/tree/v0.4.1,下载压缩包,解压后放到audio_adversarial_examples文件夹中
记得重命名为DeepSpeech!删除后面的-0.4.1方便代码引用

进入DeepSpeech文件夹中,注释掉DeepSpeech.py中的第21行代码:
from tensorflow.contrib.lite.python import tflite_convert

下载DeepSpeech模型,本步需要很长时间:
wget https://github.com/mozilla/DeepSpeech/releases/download/v0.4.1/deepspeech-0.4.1-checkpoint.tar.gz
tar -xzf deepspeech-0.4.1-checkpoint.tar.gz

此时,源代码安装完成,您可以开始测试:

[En]

At this point, the installation of the source code is complete, and you can start testing:

产生恶意样本:
python3 attack.py –in sample-000000.wav –target “this is a test” –out adv.wav –iterations 1000 –restore_path deepspeech-0.4.1-checkpoint/model.v0.4.1

输出很多warning,可忽略
最终输出如下:

without the datasete the article asusedless

Original: https://blog.csdn.net/weixin_39784804/article/details/108723530
Author: NEO_silen
Title: carlini/audio_adversarial_examples源码安装方法

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/526729/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球