{"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/practical-region-level-attack-against-segment","title":"Practical Region-level Attack against Segment Anything Models","arxiv_id":"2404.08255","date":"2024-04-12","proceeding":null,"authors":["Yifan Shen","Zhengyuan Li","Gang Wang"],"abstract":"Segment Anything Models (SAM) have made significant advancements in image segmentation, allowing users to segment target portions of an image with a single click (i.e., user prompt). Given its broad applications, the robustness of SAM against adversarial attacks is a critical concern. While recent works have explored adversarial attacks against a pre-defined prompt/click, their threat model is not yet realistic: (1) they often assume the user-click position is known to the attacker (point-based attack), and (2) they often operate under a white-box setting with limited transferability. In this paper, we propose a more practical region-level attack where attackers do not need to know the precise user prompt. The attack remains effective as the user clicks on any point on the target object in the image, hiding the object from SAM. Also, by adapting a spectrum transformation method, we make the attack more transferable under a black-box setting. Both control experiments and testing against real-world SAM services confirm its effectiveness.","url_abs":"https://arxiv.org/abs/2404.08255v2","url_pdf":"https://arxiv.org/pdf/2404.08255v2.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":"practical-region-level-attack-against-segment","repo_url":"https://github.com/ShenYifanS/S-RA_T-RA","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"image-segmentation","task_name":"Image Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[{"method_slug":"sam","method_name":"SAM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.08255","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.08255"}},"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/ShenYifanS/S-RA_T-RA","reach":{"status":"ok"}}],"summary":{"ran":4,"ran_draft_wrong":2,"unverified":6},"by_repo_kind":{"official":{"samples":12,"ran":6,"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":12,"samples":[{"code_sha256_prefix":"b5ed93bdff965ec9","entry":"box_to_samples","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/attack.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/attack.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b5ed93bdff965ec9"}},{"code_sha256_prefix":"29752e3b56992005","entry":"box_to_samples","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/example_multi.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/example_multi.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"29752e3b56992005"}},{"code_sha256_prefix":"96576a8896d0dc6b","entry":"box_to_samples","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"quick_test/attack_sample.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/quick_test/attack_sample.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"96576a8896d0dc6b"}},{"code_sha256_prefix":"ba2f0dfe43e66054","entry":"calculate_iou","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/viewComplete.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/viewComplete.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ba2f0dfe43e66054"}},{"code_sha256_prefix":"4c3d07280a79397a","entry":"dct","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/ssa.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/ssa.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4c3d07280a79397a"}},{"code_sha256_prefix":"a8051baeec435042","entry":"get_amg_kwargs","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/amg.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/amg.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a8051baeec435042"}},{"code_sha256_prefix":"997a65deb3a03f4b","entry":"dct1","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/ssa.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/ssa.py","link_basis":"harvester_set","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":"997a65deb3a03f4b"}},{"code_sha256_prefix":"44faf6b5be901c53","entry":"idct1","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/ssa.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/ssa.py","link_basis":"harvester_set","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":"44faf6b5be901c53"}},{"code_sha256_prefix":"84fb1b3ab0aca327","entry":"minimal_pgd","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/example.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/example.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":"84fb1b3ab0aca327"}},{"code_sha256_prefix":"c5b53102876c27dc","entry":"minimal_pgd","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/example_multi.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/example_multi.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":"c5b53102876c27dc"}},{"code_sha256_prefix":"83995d3bc2efe6df","entry":"pgd","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/example.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/example.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":"83995d3bc2efe6df"}},{"code_sha256_prefix":"93ebcf9c9ccea222","entry":"pgd","repo":"ShenYifanS/S-RA_T-RA","repo_kind":"official","path":"SSAscripts/example_multi.py","file_url":"https://github.com/ShenYifanS/S-RA_T-RA/blob/HEAD/SSAscripts/example_multi.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":"93ebcf9c9ccea222"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}