{"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/category-contrast-for-unsupervised-domain","title":"Category Contrast for Unsupervised Domain Adaptation in Visual Tasks","arxiv_id":"2106.02885","date":"2021-06-05","proceeding":"CVPR 2022 1","authors":["Jiaxing Huang","Dayan Guan","Aoran Xiao","Shijian Lu","Ling Shao"],"abstract":"Instance contrast for unsupervised representation learning has achieved great success in recent years. In this work, we explore the idea of instance contrastive learning in unsupervised domain adaptation (UDA) and propose a novel Category Contrast technique (CaCo) that introduces semantic priors on top of instance discrimination for visual UDA tasks. By considering instance contrastive learning as a dictionary look-up operation, we construct a semantics-aware dictionary with samples from both source and target domains where each target sample is assigned a (pseudo) category label based on the category priors of source samples. This allows category contrastive learning (between target queries and the category-level dictionary) for category-discriminative yet domain-invariant feature representations: samples of the same category (from either source or target domain) are pulled closer while those of different categories are pushed apart simultaneously. Extensive UDA experiments in multiple visual tasks (e.g., segmentation, classification and detection) show that CaCo achieves superior performance as compared with state-of-the-art methods. The experiments also demonstrate that CaCo is complementary to existing UDA methods and generalizable to other learning setups such as unsupervised model adaptation, open-/partial-set adaptation etc.","url_abs":"https://arxiv.org/abs/2106.02885v3","url_pdf":"https://arxiv.org/pdf/2106.02885v3.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":"category-contrast-for-unsupervised-domain","repo_url":"https://github.com/jxhuang0508/CaCo","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"domain-adaptation","task_name":"Domain Adaptation"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"unsupervised-domain-adaptation","task_name":"Unsupervised Domain Adaptation"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2106.02885","atlas_url":"https://app.syntology.ai/?focus=2106.02885","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.02885"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/jxhuang0508/CaCo","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":1,"ran_fixture":2,"ran_violates":1,"unverified":5},"by_repo_kind":{"official":{"samples":9,"ran":4,"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":"21ac171a17099011","entry":"colorize_mask","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_vanilla_finetune/evaluate_cityscapes.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_vanilla_finetune/evaluate_cityscapes.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"21ac171a17099011"}},{"code_sha256_prefix":"d86fb168246b16a4","entry":"fast_hist","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_vanilla_finetune/compute_iou.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_vanilla_finetune/compute_iou.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d86fb168246b16a4"}},{"code_sha256_prefix":"7b5ad493dd203454","entry":"fliplr","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_proda_finetune/utils.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_proda_finetune/utils.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7b5ad493dd203454"}},{"code_sha256_prefix":"b1c59751f8968e99","entry":"per_class_iu","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_vanilla_finetune/compute_iou.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_vanilla_finetune/compute_iou.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b1c59751f8968e99"}},{"code_sha256_prefix":"ac7a106d5297c790","entry":"get_logger","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_proda_finetune/calc_prototype.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_proda_finetune/calc_prototype.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":"ac7a106d5297c790"}},{"code_sha256_prefix":"aa26e15f4a19aa99","entry":"label2rgb","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_proda_finetune/generate_pseudo_label.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_proda_finetune/generate_pseudo_label.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":"aa26e15f4a19aa99"}},{"code_sha256_prefix":"bcfd47261d90f53e","entry":"label_mapping","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_vanilla_finetune/compute_iou.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_vanilla_finetune/compute_iou.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":"bcfd47261d90f53e"}},{"code_sha256_prefix":"a36dc031ef248c84","entry":"parser_","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_proda_finetune/parser_train.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_proda_finetune/parser_train.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":"a36dc031ef248c84"}},{"code_sha256_prefix":"b7a6065c4f4d02be","entry":"relative_path_to_absolute_path","repo":"jxhuang0508/CaCo","repo_kind":"official","path":"caco_proda_finetune/parser_train.py","file_url":"https://github.com/jxhuang0508/CaCo/blob/HEAD/caco_proda_finetune/parser_train.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":"b7a6065c4f4d02be"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}