{"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/winclip-zero-few-shot-anomaly-classification","title":"WinCLIP: Zero-/Few-Shot Anomaly Classification and Segmentation","arxiv_id":"2303.14814","date":"2023-03-26","proceeding":"CVPR 2023 1","authors":["Jongheon Jeong","Yang Zou","Taewan Kim","Dongqing Zhang","Avinash Ravichandran","Onkar Dabeer"],"abstract":"Visual anomaly classification and segmentation are vital for automating industrial quality inspection. The focus of prior research in the field has been on training custom models for each quality inspection task, which requires task-specific images and annotation. In this paper we move away from this regime, addressing zero-shot and few-normal-shot anomaly classification and segmentation. Recently CLIP, a vision-language model, has shown revolutionary generality with competitive zero-/few-shot performance in comparison to full-supervision. But CLIP falls short on anomaly classification and segmentation tasks. Hence, we propose window-based CLIP (WinCLIP) with (1) a compositional ensemble on state words and prompt templates and (2) efficient extraction and aggregation of window/patch/image-level features aligned with text. We also propose its few-normal-shot extension WinCLIP+, which uses complementary information from normal images. In MVTec-AD (and VisA), without further tuning, WinCLIP achieves 91.8%/85.1% (78.1%/79.6%) AUROC in zero-shot anomaly classification and segmentation while WinCLIP+ does 93.1%/95.2% (83.8%/96.4%) in 1-normal-shot, surpassing state-of-the-art by large margins.","url_abs":"https://arxiv.org/abs/2303.14814v1","url_pdf":"https://arxiv.org/pdf/2303.14814v1.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":"winclip-zero-few-shot-anomaly-classification","repo_url":"https://github.com/SkiddieAhn/Code-WinCLIP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"winclip-zero-few-shot-anomaly-classification","repo_url":"https://github.com/zqhang/Accurate-WinCLIP-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"winclip-zero-few-shot-anomaly-classification","repo_url":"https://github.com/caoyunkang/WinClip","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"winclip-zero-few-shot-anomaly-classification","repo_url":"https://github.com/openvinotoolkit/anomalib","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"anomaly-classification","task_name":"Anomaly Classification"},{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"zero-shot-anomaly-detection","task_name":"zero-shot anomaly detection"}],"methods":[{"method_slug":"clip","method_name":"CLIP"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"WinCLIP+ (4-shot)","rank_in_archive_order":91,"of":148,"metrics":{"Detection AUROC":"95.2","Segmentation AUPRO":"89"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"WinCLIP+ (2-shot)","rank_in_archive_order":96,"of":148,"metrics":{"Detection AUROC":"94.4","Segmentation AUPRO":"88.4"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"WinCLIP+ (1-shot)","rank_in_archive_order":101,"of":148,"metrics":{"Detection AUROC":"93.1","Segmentation AUPRO":"87.1"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-mvtec-ad","task":"Anomaly Detection","dataset":"MVTec AD","model":"WinCLIP (0-shot)","rank_in_archive_order":107,"of":148,"metrics":{"Detection AUROC":"91.8","Segmentation AUPRO":"64.6"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-visa","task":"Anomaly Detection","dataset":"VisA","model":"WinCLIP+ (4-shot)","rank_in_archive_order":33,"of":50,"metrics":{"Detection AUROC":"87.3","Segmentation AUPRO":"87.6","Segmentation AUPRO (until 30% FPR)":"87.6"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-visa","task":"Anomaly Detection","dataset":"VisA","model":"WinCLIP+ (2-shot)","rank_in_archive_order":35,"of":50,"metrics":{"Detection AUROC":"84.6","Segmentation AUPRO":"86.2","Segmentation AUPRO (until 30% FPR)":"86.2"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-visa","task":"Anomaly Detection","dataset":"VisA","model":"WinCLIP+ (1-shot)","rank_in_archive_order":36,"of":50,"metrics":{"Detection AUROC":"83.8","Segmentation AUPRO":"85.1","Segmentation AUPRO (until 30% FPR)":"85.1"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-on-visa","task":"Anomaly Detection","dataset":"VisA","model":"WinCLIP (0-shot)","rank_in_archive_order":41,"of":50,"metrics":{"Detection AUROC":"78.1","Segmentation AUPRO":"56.8","Segmentation AUPRO (until 30% FPR)":"56.8"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2303.14814","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.14814"}},"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":"deterministic:regex_extraction","url":"https://github.com/mlfoundations/open_clip","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zqhang/Accurate-WinCLIP-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/caoyunkang/WinClip","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/SkiddieAhn/Code-WinCLIP","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/openvinotoolkit/anomalib","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_violates":2,"ran_draft_wrong":1,"ran":1,"ran_honours":1,"unverified":7},"by_repo_kind":{"listed":{"samples":12,"ran":5,"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":0,"samples":[{"code_sha256_prefix":"f19962ebb134b3d7","entry":"convert_to_custom_text_state_dict","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/model.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/model.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f19962ebb134b3d7"}},{"code_sha256_prefix":"dcd422d66b0581d8","entry":"get_cast_dtype","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/model.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/model.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dcd422d66b0581d8"}},{"code_sha256_prefix":"4b3a4d17e1df3140","entry":"load_state_dict","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/factory.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/factory.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4b3a4d17e1df3140"}},{"code_sha256_prefix":"0c3f9d9b0ac9f33d","entry":"normalize","repo":"zqhang/Accurate-WinCLIP-pytorch","repo_kind":"listed","path":"reproduce_WinCLIP.py","file_url":"https://github.com/zqhang/Accurate-WinCLIP-pytorch/blob/HEAD/reproduce_WinCLIP.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0c3f9d9b0ac9f33d"}},{"code_sha256_prefix":"25c7475539e39da4","entry":"str2bool","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"eval_WinCLIP.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/eval_WinCLIP.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"25c7475539e39da4"}},{"code_sha256_prefix":"e332828701fffe70","entry":"build_model_from_openai_state_dict","repo":"zqhang/Accurate-WinCLIP-pytorch","repo_kind":"listed","path":"src/open_clip/model.py","file_url":"https://github.com/zqhang/Accurate-WinCLIP-pytorch/blob/HEAD/src/open_clip/model.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":"e332828701fffe70"}},{"code_sha256_prefix":"c94ec43ef54519ef","entry":"build_model_from_openai_state_dict","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/model.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/model.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":"c94ec43ef54519ef"}},{"code_sha256_prefix":"ddcbd45e940484ee","entry":"gather_features","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/loss.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/loss.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":"ddcbd45e940484ee"}},{"code_sha256_prefix":"5c7cf820e99443ff","entry":"get_model_config","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/factory.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/factory.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":"5c7cf820e99443ff"}},{"code_sha256_prefix":"f34d8f34635af394","entry":"get_tokenizer","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/factory.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/factory.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":"f34d8f34635af394"}},{"code_sha256_prefix":"fb651d0a97fd4d3f","entry":"prepare_inputs_for_generation","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/coca_model.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/coca_model.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":"fb651d0a97fd4d3f"}},{"code_sha256_prefix":"2a377da4a76a2d44","entry":"register_pooler","repo":"caoyunkang/WinClip","repo_kind":"listed","path":"WinCLIP/CLIPAD/hf_model.py","file_url":"https://github.com/caoyunkang/WinClip/blob/HEAD/WinCLIP/CLIPAD/hf_model.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":"2a377da4a76a2d44"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}