{"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/badhash-invisible-backdoor-attacks-against","title":"BadHash: Invisible Backdoor Attacks against Deep Hashing with Clean Label","arxiv_id":"2207.00278","date":"2022-07-01","proceeding":null,"authors":["Shengshan Hu","Ziqi Zhou","Yechao Zhang","Leo Yu Zhang","Yifeng Zheng","Yuanyuan HE","Hai Jin"],"abstract":"Due to its powerful feature learning capability and high efficiency, deep hashing has achieved great success in large-scale image retrieval. Meanwhile, extensive works have demonstrated that deep neural networks (DNNs) are susceptible to adversarial examples, and exploring adversarial attack against deep hashing has attracted many research efforts. Nevertheless, backdoor attack, another famous threat to DNNs, has not been studied for deep hashing yet. Although various backdoor attacks have been proposed in the field of image classification, existing approaches failed to realize a truly imperceptive backdoor attack that enjoys invisible triggers and clean label setting simultaneously, and they also cannot meet the intrinsic demand of image retrieval backdoor. In this paper, we propose BadHash, the first generative-based imperceptible backdoor attack against deep hashing, which can effectively generate invisible and input-specific poisoned images with clean label. Specifically, we first propose a new conditional generative adversarial network (cGAN) pipeline to effectively generate poisoned samples. For any given benign image, it seeks to generate a natural-looking poisoned counterpart with a unique invisible trigger. In order to improve the attack effectiveness, we introduce a label-based contrastive learning network LabCLN to exploit the semantic characteristics of different labels, which are subsequently used for confusing and misleading the target model to learn the embedded trigger. We finally explore the mechanism of backdoor attacks on image retrieval in the hash space. Extensive experiments on multiple benchmark datasets verify that BadHash can generate imperceptible poisoned samples with strong attack ability and transferability over state-of-the-art deep hashing schemes.","url_abs":"https://arxiv.org/abs/2207.00278v3","url_pdf":"https://arxiv.org/pdf/2207.00278v3.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":"badhash-invisible-backdoor-attacks-against","repo_url":"https://github.com/cgcl-codes/badhash","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"adversarial-attack","task_name":"Adversarial Attack"},{"task_slug":"backdoor-attack","task_name":"Backdoor Attack"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"deep-hashing","task_name":"Deep Hashing"},{"task_slug":null,"task_name":"Generative Adversarial Network"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2207.00278","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.00278"}},"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/cgcl-codes/badhash","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":1,"unverified":11},"by_repo_kind":{"official":{"samples":12,"ran":1,"repositories":1}},"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":0,"samples":[{"code_sha256_prefix":"bedff51745d2cf84","entry":"l2normalize","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/spectral_norm.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/spectral_norm.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bedff51745d2cf84"}},{"code_sha256_prefix":"fec8bc71986e9775","entry":"CalcHammingDist","repo":"cgcl-codes/badhash","repo_kind":"official","path":"utils/hamming_matching.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/utils/hamming_matching.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fec8bc71986e9775"}},{"code_sha256_prefix":"0d0f5f9ab369ac01","entry":"CalcMap","repo":"cgcl-codes/badhash","repo_kind":"official","path":"utils/hamming_matching.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/utils/hamming_matching.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0d0f5f9ab369ac01"}},{"code_sha256_prefix":"a1703482ab911f6a","entry":"CalcSim","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/utils.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a1703482ab911f6a"}},{"code_sha256_prefix":"e41e957d5b40db30","entry":"compute_result","repo":"cgcl-codes/badhash","repo_kind":"official","path":"utils/hamming_matching.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/utils/hamming_matching.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e41e957d5b40db30"}},{"code_sha256_prefix":"a3c3e950fd3ba00c","entry":"get_data","repo":"cgcl-codes/badhash","repo_kind":"official","path":"utils/data_provider.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/utils/data_provider.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a3c3e950fd3ba00c"}},{"code_sha256_prefix":"0427d9736d5128bb","entry":"get_scheduler","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/module.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/module.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0427d9736d5128bb"}},{"code_sha256_prefix":"8edd0019ee4ece92","entry":"load_label","repo":"cgcl-codes/badhash","repo_kind":"official","path":"utils/data_provider.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/utils/data_provider.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8edd0019ee4ece92"}},{"code_sha256_prefix":"62659c288a716208","entry":"log_trick","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/utils.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"62659c288a716208"}},{"code_sha256_prefix":"b68aa157100e24b9","entry":"remove_spectral_norm","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/spectral_norm.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/spectral_norm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b68aa157100e24b9"}},{"code_sha256_prefix":"52dca59d4bef58a4","entry":"smooth_one_hot","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/utils.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"52dca59d4bef58a4"}},{"code_sha256_prefix":"80dbe040cd85c98b","entry":"spectral_norm","repo":"cgcl-codes/badhash","repo_kind":"official","path":"model/spectral_norm.py","file_url":"https://github.com/cgcl-codes/badhash/blob/HEAD/model/spectral_norm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"80dbe040cd85c98b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}