{"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/promptcal-contrastive-affinity-learning-via","title":"PromptCAL: Contrastive Affinity Learning via Auxiliary Prompts for Generalized Novel Category Discovery","arxiv_id":"2212.05590","date":"2022-12-11","proceeding":"CVPR 2023 1","authors":["Sheng Zhang","Salman Khan","Zhiqiang Shen","Muzammal Naseer","Guangyi Chen","Fahad Khan"],"abstract":"Although existing semi-supervised learning models achieve remarkable success in learning with unannotated in-distribution data, they mostly fail to learn on unlabeled data sampled from novel semantic classes due to their closed-set assumption. In this work, we target a pragmatic but under-explored Generalized Novel Category Discovery (GNCD) setting. The GNCD setting aims to categorize unlabeled training data coming from known and novel classes by leveraging the information of partially labeled known classes. We propose a two-stage Contrastive Affinity Learning method with auxiliary visual Prompts, dubbed PromptCAL, to address this challenging problem. Our approach discovers reliable pairwise sample affinities to learn better semantic clustering of both known and novel classes for the class token and visual prompts. First, we propose a discriminative prompt regularization loss to reinforce semantic discriminativeness of prompt-adapted pre-trained vision transformer for refined affinity relationships.Besides, we propose contrastive affinity learning to calibrate semantic representations based on our iterative semi-supervised affinity graph generation method for semantically-enhanced supervision. Extensive experimental evaluation demonstrates that our PromptCAL method is more effective in discovering novel classes even with limited annotations and surpasses the current state-of-the-art on generic and fine-grained benchmarks (e.g., with nearly 11% gain on CUB-200, and 9% on ImageNet-100) on overall accuracy. Our code is available at https://github.com/sheng-eatamath/PromptCAL.","url_abs":"https://arxiv.org/abs/2212.05590v2","url_pdf":"https://arxiv.org/pdf/2212.05590v2.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":"promptcal-contrastive-affinity-learning-via","repo_url":"https://github.com/sheng-eatamath/promptcal","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"graph-generation","task_name":"Graph Generation"}],"methods":[{"method_slug":"attention","method_name":"Attention"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"vision-transformer","method_name":"Vision Transformer"},{"method_slug":"fail","method_name":"fail"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2212.05590","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2212.05590"}},"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/sheng-eatamath/promptcal","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_fixture":1,"unverified":6},"by_repo_kind":{"official":{"samples":7,"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":"55120f2026b56aa2","entry":"drop_path","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"models/vision_transformer.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/models/vision_transformer.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"55120f2026b56aa2"}},{"code_sha256_prefix":"dc0abcd1891e7b21","entry":"create_backbone","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"models/model_create.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/models/model_create.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":"dc0abcd1891e7b21"}},{"code_sha256_prefix":"dc886b4755bb5e8c","entry":"create_model","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"models/model_create.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/models/model_create.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":"dc886b4755bb5e8c"}},{"code_sha256_prefix":"2eb3afb69533d6f0","entry":"create_projection_head","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"models/model_create.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/models/model_create.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":"2eb3afb69533d6f0"}},{"code_sha256_prefix":"980dd2e8fa24f9da","entry":"pairwise_distance","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"methods/clustering/faster_mix_k_means_pytorch.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/methods/clustering/faster_mix_k_means_pytorch.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":"980dd2e8fa24f9da"}},{"code_sha256_prefix":"a739d2b2347e02e6","entry":"vit_small","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"models/vision_transformer.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/models/vision_transformer.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":"a739d2b2347e02e6"}},{"code_sha256_prefix":"f332639fc00ac198","entry":"vit_tiny","repo":"sheng-eatamath/promptcal","repo_kind":"official","path":"models/vision_transformer.py","file_url":"https://github.com/sheng-eatamath/promptcal/blob/HEAD/models/vision_transformer.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":"f332639fc00ac198"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}