{"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/zero-shot-open-set-detection-by-extending","title":"Zero-Shot Out-of-Distribution Detection Based on the Pre-trained Model CLIP","arxiv_id":"2109.02748","date":"2021-09-06","proceeding":null,"authors":["Sepideh Esmaeilpour","Bing Liu","Eric Robertson","Lei Shu"],"abstract":"In an out-of-distribution (OOD) detection problem, samples of known classes(also called in-distribution classes) are used to train a special classifier. In testing, the classifier can (1) classify the test samples of known classes to their respective classes and also (2) detect samples that do not belong to any of the known classes (i.e., they belong to some unknown or OOD classes). This paper studies the problem of zero-shot out-of-distribution(OOD) detection, which still performs the same two tasks in testing but has no training except using the given known class names. This paper proposes a novel yet simple method (called ZOC) to solve the problem. ZOC builds on top of the recent advances in zero-shot classification through multi-modal representation learning. It first extends the pre-trained language-vision model CLIP by training a text-based image description generator on top of CLIP. In testing, it uses the extended model to generate candidate unknown class names for each test sample and computes a confidence score based on both the known class names and candidate unknown class names for zero-shot OOD detection. Experimental results on 5 benchmark datasets for OOD detection demonstrate that ZOC outperforms the baselines by a large margin.","url_abs":"https://arxiv.org/abs/2109.02748v3","url_pdf":"https://arxiv.org/pdf/2109.02748v3.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":"zero-shot-open-set-detection-by-extending","repo_url":"https://github.com/sesmae/zoc","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"zero-shot-open-set-detection-by-extending","repo_url":"https://github.com/hy18284/mixdiff","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":null,"task_name":"Image Description"},{"task_slug":"ood-detection","task_name":"Out of Distribution (OOD) Detection"},{"task_slug":"out-of-distribution-detection","task_name":"Out-of-Distribution Detection"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"zero-shot-learning","task_name":"Zero-Shot Learning"},{"task_slug":null,"task_name":"zero-shot-classification"}],"methods":[{"method_slug":"clip","method_name":"CLIP"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2109.02748","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2109.02748"}},"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/hy18284/mixdiff","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sesmae/zoc","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":1,"unverified":10},"by_repo_kind":{"official":{"samples":11,"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":"586e23a21dc8d140","entry":"tokenize_for_clip","repo":"sesmae/zoc","repo_kind":"official","path":"tinyimagenet_eval.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/tinyimagenet_eval.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"586e23a21dc8d140"}},{"code_sha256_prefix":"1e88096b561d13b7","entry":"eval_decoder","repo":"sesmae/zoc","repo_kind":"official","path":"train_decoder.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/train_decoder.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":"1e88096b561d13b7"}},{"code_sha256_prefix":"ad6951f135361d60","entry":"get_bert_training_features","repo":"sesmae/zoc","repo_kind":"official","path":"dataloaders/coco_full_loader.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/dataloaders/coco_full_loader.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":"ad6951f135361d60"}},{"code_sha256_prefix":"f39b19abd2c9cd41","entry":"get_bos_sentence_eos","repo":"sesmae/zoc","repo_kind":"official","path":"dataloaders/coco_full_loader.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/dataloaders/coco_full_loader.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":"f39b19abd2c9cd41"}},{"code_sha256_prefix":"37742137dd850137","entry":"get_clip_image_features","repo":"sesmae/zoc","repo_kind":"official","path":"dataloaders/coco_full_loader.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/dataloaders/coco_full_loader.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":"37742137dd850137"}},{"code_sha256_prefix":"1eac11a38598f275","entry":"greedysearch_generation_topk","repo":"sesmae/zoc","repo_kind":"official","path":"tinyimagenet_eval.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/tinyimagenet_eval.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":"1eac11a38598f275"}},{"code_sha256_prefix":"27650a2ee702a0cb","entry":"greedysearch_generation_topk","repo":"sesmae/zoc","repo_kind":"official","path":"cifar100_eval.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/cifar100_eval.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":"27650a2ee702a0cb"}},{"code_sha256_prefix":"e96829e6d222df08","entry":"greedysearch_generation_topk","repo":"sesmae/zoc","repo_kind":"official","path":"cifar10_eval.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/cifar10_eval.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":"e96829e6d222df08"}},{"code_sha256_prefix":"1baaac6c70ab5a06","entry":"image_decoder","repo":"sesmae/zoc","repo_kind":"official","path":"tinyimagenet_eval.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/tinyimagenet_eval.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":"1baaac6c70ab5a06"}},{"code_sha256_prefix":"ea251c0ac6fabe91","entry":"image_decoder","repo":"sesmae/zoc","repo_kind":"official","path":"cifar100_eval.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/cifar100_eval.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":"ea251c0ac6fabe91"}},{"code_sha256_prefix":"9775c2c477077546","entry":"train_decoder","repo":"sesmae/zoc","repo_kind":"official","path":"train_decoder.py","file_url":"https://github.com/sesmae/zoc/blob/HEAD/train_decoder.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":"9775c2c477077546"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}