{"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/arxiv-2509-23741","title":"ResAD++: Towards Class Agnostic Anomaly Detection via Residual Feature Learning","arxiv_id":"2509.23741","date":"2025-09-28","proceeding":"NeurIPS","authors":["Xincheng Yao","Chao Shi","Muming Zhao","Guangtao Zhai","Chongyang Zhang"],"abstract":"This paper explores the problem of class-agnostic anomaly detection (AD), where the objective is to train one class-agnostic AD model that can generalize to detect anomalies in diverse new classes from different domains without any retraining or fine-tuning on the target data. When applied for new classes, the performance of current single- and multi-class AD methods is still unsatisfactory. One fundamental reason is that representation learning in existing methods is still class-related, namely, feature correlation. To address this issue, we propose residual features and construct a simple but effective framework, termed ResAD. Our core insight is to learn the residual feature distribution rather than the initial feature distribution. Residual features are formed by matching and then subtracting normal reference features. In this way, we can effectively realize feature decorrelation. Even in new classes, the distribution of normal residual features would not remarkably shift from the learned distribution. In addition, we think that residual features still have one issue: scale correlation. To this end, we propose a feature hypersphere constraining approach, which learns to constrain initial normal residual features into a spatial hypersphere for enabling the feature scales of different classes as consistent as possible. Furthermore, we propose a novel logbarrier bidirectional contraction OCC loss and vector quantization based feature distribution matching module to enhance ResAD, leading to the improved version of ResAD (ResAD++). Comprehensive experiments on eight real-world AD datasets demonstrate that our ResAD++ can achieve remarkable AD results when directly used in new classes, outperforming state-of-the-art competing methods and also surpassing ResAD. The code is available at https://github.com/xcyao00/ResAD.","url_abs":"https://arxiv.org/abs/2509.23741","url_pdf":"https://arxiv.org/pdf/2509.23741","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2509.23741","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2509.23741"}},"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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/xcyao00/ResAD","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":12},"by_repo_kind":{"found_in_text":{"samples":12,"ran":0,"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":"09544c0c0a013039","entry":"calculate_log_barrier_occ_loss","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"losses/loss.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/losses/loss.py","link_basis":"first_harvest_node","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":"09544c0c0a013039"}},{"code_sha256_prefix":"5ac595999ee650c5","entry":"calculate_occ_loss","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"losses/loss.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/losses/loss.py","link_basis":"first_harvest_node","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":"5ac595999ee650c5"}},{"code_sha256_prefix":"4864e6c6c42523f8","entry":"get_logp_a","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"losses/utils.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/losses/utils.py","link_basis":"first_harvest_node","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":"4864e6c6c42523f8"}},{"code_sha256_prefix":"6871690b7d7c52ca","entry":"get_logp_boundary","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"losses/loss.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/losses/loss.py","link_basis":"first_harvest_node","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":"6871690b7d7c52ca"}},{"code_sha256_prefix":"97bb30729343aee3","entry":"get_normal_boundary","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"losses/utils.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/losses/utils.py","link_basis":"first_harvest_node","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":"97bb30729343aee3"}},{"code_sha256_prefix":"5461edac0e02cae6","entry":"get_position_encoding","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"models/modules.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/models/modules.py","link_basis":"first_harvest_node","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":"5461edac0e02cae6"}},{"code_sha256_prefix":"5697b41685ddd400","entry":"load_and_transform_vision_data","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"main_ib.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/main_ib.py","link_basis":"first_harvest_node","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":"5697b41685ddd400"}},{"code_sha256_prefix":"8724d875b88a147c","entry":"load_mc_reference_features","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"main_all.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/main_all.py","link_basis":"first_harvest_node","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":"8724d875b88a147c"}},{"code_sha256_prefix":"38f73e38d215dec7","entry":"load_mc_reference_features","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"main_ib.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/main_ib.py","link_basis":"first_harvest_node","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":"38f73e38d215dec7"}},{"code_sha256_prefix":"f7d1a342555346ba","entry":"load_mc_reference_features","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"main_ib_all.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/main_ib_all.py","link_basis":"first_harvest_node","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":"f7d1a342555346ba"}},{"code_sha256_prefix":"247b256eed3c80d3","entry":"load_reference_features","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"cpr.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/cpr.py","link_basis":"first_harvest_node","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":"247b256eed3c80d3"}},{"code_sha256_prefix":"3f068df64f534372","entry":"subnet_fc","repo":"xcyao00/ResAD","repo_kind":"found_in_text","path":"models/fc_flow.py","file_url":"https://github.com/xcyao00/ResAD/blob/HEAD/models/fc_flow.py","link_basis":"first_harvest_node","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":"3f068df64f534372"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.CV","source":"arxiv_api"},"syntology_extracted_results":null}