{"id":17601478,"url":"https://github.com/shehzeen/waveguard_defense","last_synced_at":"2025-04-30T09:04:53.890Z","repository":{"id":48477461,"uuid":"304422357","full_name":"shehzeen/waveguard_defense","owner":"shehzeen","description":"This is the codebase for defense framework described in USENIX '21 paper \"WaveGuard: Understanding and Mitigating Audio Adversarial Examples\"","archived":false,"fork":false,"pushed_at":"2021-10-20T05:22:18.000Z","size":457,"stargazers_count":17,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-25T06:23:34.983Z","etag":null,"topics":["adversarial-machine-learning","audio","defense-methods","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shehzeen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-15T19:00:24.000Z","updated_at":"2024-12-01T09:25:04.000Z","dependencies_parsed_at":"2022-08-24T14:39:05.104Z","dependency_job_id":null,"html_url":"https://github.com/shehzeen/waveguard_defense","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shehzeen%2Fwaveguard_defense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shehzeen%2Fwaveguard_defense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shehzeen%2Fwaveguard_defense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shehzeen%2Fwaveguard_defense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shehzeen","download_url":"https://codeload.github.com/shehzeen/waveguard_defense/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242623556,"owners_count":20159702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adversarial-machine-learning","audio","defense-methods","machine-learning"],"created_at":"2024-10-22T12:26:26.927Z","updated_at":"2025-03-08T23:30:24.298Z","avatar_url":"https://github.com/shehzeen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WaveGuard Defense\n\nCode for our USENIX 21 paper [WaveGuard: Understanding and Mitigating Audio Adversarial Examples\n](https://www.usenix.org/system/files/sec21fall-hussain.pdf).\n\nAudio Examples from paper [Audio Examples](https://waveguard.herokuapp.com/)\n\n## Requirements\n\n``pip install -r requirements.txt``\n\nAlso install Deepspeech following the same instructions as in [https://github.com/carlini/audio_adversarial_examples](https://github.com/carlini/audio_adversarial_examples) to evaluate the defense. \n\n## Running the defense\n\nRunning the defense on a directory of wav files (sampled at 16KHz): \n\n```\npython Defender/defender_multiple.py --in_dir \u003cPATH TO DIR WITH WAV FILES\u003e --out_base \u003cPATH TO OUTPUT DIR\u003e --defender_type DEFENDER_TYPE --defender_hp DEFENDER_HYPERPARAMETER;\n```\n\nDefender type can be ``lpc, mel_heuristic, filter_power, quant, downsample_upsample``. defender_hp corresponds to number of lpc coeffecients, mel bins, quantization bits, downsampling rare for ``lpc, mel_heuristic, quant, downsample_upsample`` respectively.\n\n\n## Evaluating the AUC\n\nThe contents of ``--in_adv`` can be generated using past works on audio adversairal examples( [1](https://github.com/carlini/audio_adversarial_examples), [2](https://github.com/cleverhans-lab/cleverhans/tree/ae4264f4d80abe3ad45628d88faa011ee13f0841/examples/adversarial_asr) ) by applying these attacks on the directory of benign audio examples ``--in_orig``. The contents defended directories ``--in_orig_def``, ``--in_adv_def`` need to be generated using one of our defenses described above. Then use ``transcribe_deepspeech.py`` to generate transcriptions from the deepspeech model for each directory. Then run below command to evaluate the AUC:\n\n```python evaluate_detector.py --in_orig \u003cDIR CONTAINING ORIGINAL UNDEFENDED AUDIO\u003e --in_orig_def \u003cDIR CONTAINING ORIGINAL DEFENDED AUDIO\u003e --in_adv \u003cDIR CONTAINING ADVERSARIAL UNDEFENDED AUDIO\u003e --in_orig \u003cDIR CONTAINING ADVERSARIAL DEFENDED AUDIO\u003e```\n\n\n\n## Citing our work\n\n```\n@inproceedings{hussain2021waveguard,\n  title={WaveGuard: Understanding and Mitigating Audio Adversarial Examples},\n  author={Hussain, Shehzeen and Neekhara, Paarth and Dubnov, Shlomo and McAuley, Julian and Koushanfar, Farinaz},\n  booktitle={USENIX Security 21},\n  year={2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshehzeen%2Fwaveguard_defense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshehzeen%2Fwaveguard_defense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshehzeen%2Fwaveguard_defense/lists"}