{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/defense-gan-protecting-classifiers-against","title":"Defense-GAN: Protecting Classifiers Against Adversarial Attacks Using Generative Models","arxiv_id":"1805.06605","date":"2018-05-17","proceeding":"ICLR 2018 1","authors":["Pouya Samangouei","Maya Kabkab","Rama Chellappa"],"abstract":"In recent years, deep neural network approaches have been widely adopted for\nmachine learning tasks, including classification. However, they were shown to\nbe vulnerable to adversarial perturbations: carefully crafted small\nperturbations can cause misclassification of legitimate images. We propose\nDefense-GAN, a new framework leveraging the expressive capability of generative\nmodels to defend deep neural networks against such attacks. Defense-GAN is\ntrained to model the distribution of unperturbed images. At inference time, it\nfinds a close output to a given image which does not contain the adversarial\nchanges. This output is then fed to the classifier. Our proposed method can be\nused with any classification model and does not modify the classifier structure\nor training procedure. It can also be used as a defense against any attack as\nit does not assume knowledge of the process for generating the adversarial\nexamples. We empirically show that Defense-GAN is consistently effective\nagainst different attack methods and improves on existing defense strategies.\nOur code has been made publicly available at\nhttps://github.com/kabkabm/defensegan","url_abs":"http://arxiv.org/abs/1805.06605v2","url_pdf":"http://arxiv.org/pdf/1805.06605v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"defense-gan-protecting-classifiers-against","repo_url":"https://github.com/kabkabm/defensegan","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"defense-gan-protecting-classifiers-against","repo_url":"https://github.com/RSMung/DefenseGAN-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"defense-gan-protecting-classifiers-against","repo_url":"https://github.com/bibin-sebastian/Physical_Adversarial_examples_GAN","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"defense-gan-protecting-classifiers-against","repo_url":"https://github.com/mnswdhw/DefenseGAN-and-Cowboy-Defense","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"defense-gan-protecting-classifiers-against","repo_url":"https://github.com/mnswdhw/InvGAN-Pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"adversarial-defense","task_name":"Adversarial Defense"},{"task_slug":"adversarial-defense-against-fgsm-attack","task_name":"Adversarial Defense against FGSM Attack"},{"task_slug":"classification","task_name":"General Classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/adversarial-defense-on-mnist","task":"Adversarial Defense","dataset":"MNIST","model":"Defense GAN","rank_in_archive_order":1,"of":2,"metrics":{"Accuracy":"0.8529","Inference speed":"14.80"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1805.06605","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1805.06605"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mnswdhw/DefenseGAN-and-Cowboy-Defense","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/RSMung/DefenseGAN-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kabkabm/defensegan","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mnswdhw/InvGAN-Pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/bibin-sebastian/Physical_Adversarial_examples_GAN","reach":{"status":"ok"}}],"summary":{"ran_fixture":1,"ran_draft_wrong":1,"unverified":3},"by_repo_kind":{"official":{"samples":1,"ran":1,"repositories":1},"listed":{"samples":4,"ran":1,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":4,"samples":[{"code_sha256_prefix":"a60a873e0950ea92","entry":"accuracy","repo":"RSMung/DefenseGAN-pytorch","repo_kind":"listed","path":"defense_gan.py","file_url":"https://github.com/RSMung/DefenseGAN-pytorch/blob/HEAD/defense_gan.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a60a873e0950ea92"}},{"code_sha256_prefix":"30d94d11f9899a82","entry":"convert_to_onehot","repo":"kabkabm/defensegan","repo_kind":"official","path":"blackbox.py","file_url":"https://github.com/kabkabm/defensegan/blob/HEAD/blackbox.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"30d94d11f9899a82"}},{"code_sha256_prefix":"935b793e4cc0fe67","entry":"reconstruct_batch","repo":"mnswdhw/InvGAN-Pytorch","repo_kind":"listed","path":"defense_gan.py","file_url":"https://github.com/mnswdhw/InvGAN-Pytorch/blob/HEAD/defense_gan.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"935b793e4cc0fe67"}},{"code_sha256_prefix":"93b0813c6d803c59","entry":"reconstruct_batch_own","repo":"mnswdhw/InvGAN-Pytorch","repo_kind":"listed","path":"invgan.py","file_url":"https://github.com/mnswdhw/InvGAN-Pytorch/blob/HEAD/invgan.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"93b0813c6d803c59"}},{"code_sha256_prefix":"b672efc648b0ced7","entry":"reconstruct_batch_repo","repo":"mnswdhw/InvGAN-Pytorch","repo_kind":"listed","path":"invgan.py","file_url":"https://github.com/mnswdhw/InvGAN-Pytorch/blob/HEAD/invgan.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b672efc648b0ced7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}