{"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/r-lpips-an-adversarially-robust-perceptual","title":"R-LPIPS: An Adversarially Robust Perceptual Similarity Metric","arxiv_id":"2307.15157","date":"2023-07-27","proceeding":null,"authors":["Sara Ghazanfari","Siddharth Garg","Prashanth Krishnamurthy","Farshad Khorrami","Alexandre Araujo"],"abstract":"Similarity metrics have played a significant role in computer vision to capture the underlying semantics of images. In recent years, advanced similarity metrics, such as the Learned Perceptual Image Patch Similarity (LPIPS), have emerged. These metrics leverage deep features extracted from trained neural networks and have demonstrated a remarkable ability to closely align with human perception when evaluating relative image similarity. However, it is now well-known that neural networks are susceptible to adversarial examples, i.e., small perturbations invisible to humans crafted to deliberately mislead the model. Consequently, the LPIPS metric is also sensitive to such adversarial examples. This susceptibility introduces significant security concerns, especially considering the widespread adoption of LPIPS in large-scale applications. In this paper, we propose the Robust Learned Perceptual Image Patch Similarity (R-LPIPS) metric, a new metric that leverages adversarially trained deep features. Through a comprehensive set of experiments, we demonstrate the superiority of R-LPIPS compared to the classical LPIPS metric. The code is available at https://github.com/SaraGhazanfari/R-LPIPS.","url_abs":"https://arxiv.org/abs/2307.15157v2","url_pdf":"https://arxiv.org/pdf/2307.15157v2.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":"r-lpips-an-adversarially-robust-perceptual","repo_url":"https://github.com/saraghazanfari/r-lpips","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"BSD-2-Clause"}}],"tasks":[],"methods":[{"method_slug":"align","method_name":"ALIGN"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2307.15157","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.15157"}},"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/saraghazanfari/r-lpips","reach":{"status":"ok","spdx":"BSD-2-Clause"}}],"summary":{"ran":10,"ran_draft_wrong":1,"ran_fixture":1,"unverified":2},"by_repo_kind":{"official":{"samples":14,"ran":12,"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":"98f56a2103d5a1ce","entry":"elementwise_margin","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"advertorch/loss.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/advertorch/loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"98f56a2103d5a1ce"}},{"code_sha256_prefix":"3f70b5d0ae386e75","entry":"get_dataset","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"util/imagenet_dataset.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/util/imagenet_dataset.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"3f70b5d0ae386e75"}},{"code_sha256_prefix":"d4345f2b46b25d5b","entry":"hsv_to_rgb","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"util/byol_augmentation.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/util/byol_augmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"d4345f2b46b25d5b"}},{"code_sha256_prefix":"583362dae5655ad5","entry":"logit_margin_loss","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"advertorch/loss.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/advertorch/loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"583362dae5655ad5"}},{"code_sha256_prefix":"2e1473bfe12e6376","entry":"rgb_to_hsv","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"util/byol_augmentation.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/util/byol_augmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"2e1473bfe12e6376"}},{"code_sha256_prefix":"913ca4bcb2170ff7","entry":"score_2afc_dataset","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"lpips/trainer.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/lpips/trainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"913ca4bcb2170ff7"}},{"code_sha256_prefix":"990f761c0dedcc27","entry":"score_jnd_dataset","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"lpips/trainer.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/lpips/trainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"990f761c0dedcc27"}},{"code_sha256_prefix":"adf16a24fde1a1a2","entry":"single_dim_flip","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"advertorch/utils.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/advertorch/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"adf16a24fde1a1a2"}},{"code_sha256_prefix":"29e5e72bcd006dcd","entry":"spatial_average","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"lpips/lpips.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/lpips/lpips.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"29e5e72bcd006dcd"}},{"code_sha256_prefix":"d8da4c966b934936","entry":"torch_allclose","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"advertorch/utils.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/advertorch/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"d8da4c966b934936"}},{"code_sha256_prefix":"dc96569e5f40c282","entry":"torch_flip","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"advertorch/utils.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/advertorch/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"dc96569e5f40c282"}},{"code_sha256_prefix":"8cafd18b57a4d171","entry":"upsample","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"lpips/lpips.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/lpips/lpips.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"8cafd18b57a4d171"}},{"code_sha256_prefix":"14cab6547eefa04c","entry":"postprocess","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"util/byol_augmentation.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/util/byol_augmentation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"14cab6547eefa04c"}},{"code_sha256_prefix":"15c400f6071b6c02","entry":"zero_one_loss","repo":"saraghazanfari/r-lpips","repo_kind":"official","path":"advertorch/loss.py","file_url":"https://github.com/saraghazanfari/r-lpips/blob/HEAD/advertorch/loss.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"15c400f6071b6c02"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}