Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
Yzx835 817508337d | 8 months ago | |
---|---|---|
checkpoints | 8 months ago | |
data | 8 months ago | |
source | 8 months ago | |
src | 8 months ago | |
.gitignore | 8 months ago | |
README.md | 8 months ago | |
attack.py | 8 months ago | |
dataset.py | 8 months ago | |
labels.json | 8 months ago | |
requirements.txt | 8 months ago | |
stft.py | 8 months ago |
本项目是基于MindSpore框架实现音频识别模型对抗噪声生成算法PAT,通过生成基于音素的通用对抗噪声来干扰音频识别模型的正常运行。
采用启智平台开源的基于MindSpore框架的DeepSpeech2模型,模型参数文件可以从 https://openi.pcl.ac.cn/Yzx835/speech_adversarial_attack/modelmanage/show_model 里面获取。
mindspore>=1.7,硬件平台为GPU、CPU、Ascend。
├── attack.py //对抗噪声生成代码
├── checkpoints
│ └── DeepSpeech2_model.ckpt //DeepSpeech模型参数文件
├── data //数据路径
│ ├── libri_val_manifest.csv
│ └── LibriSpeech_dataset
│ └── val
│ ├── txt
│ └── wav
├── dataset.py //数据加载相关代码
├── labels.json //音频相关标签
├── README.md
├── requirements.txt
├── source
│ └── 100_test_audio_list.npy //固定的测试数据
├── src //DeepSpeech模型相关代码
│ ├── config.py
│ ├── deepspeech2.py
│ ├── greedydecoder.py
│ ├── __init__.py
└── stft.py //音频处理代码
环境依赖:
numpy
easydict
librosa >= 0.8.1
soundfile >= 0.12.1
Levenshtein >= 0.20.9
g2p-en >= 2.1.0
g2p-en 可能需要 nltk 工具中的 cmudict
模型:
将模型参数文件放入checkpoints/
路径内,或修改attack.py
代码中的相关路径:
87: param_dict = load_checkpoint('./checkpoints/DeepSpeech2_model.ckpt')
数据:
将处理后的librispeech数据集存入data/
路径内,具体参考脚本说明
中的路径放置数据集,或修改src/config.py
相关的路径参数:
27: "train_manifest": 'data/libri_train_manifest.csv',
80: "test_manifest": 'data/libri_val_manifest.csv',
噪声生成:
python attack.py
sample_rate = 16000
window_size = 0.02
window_stride = 0.01
window = "hamming"
adv_len=3200
eps=0.01
step=2467
iteration=30
lr=2e-3
攻击前: 错误率很低
SR = 0.0
CER = 0.036993539852976084
攻击后: 错误率提升
SR = 0.01
CER = 0.16698271606143864
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》