{"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/hcsc-hierarchical-contrastive-selective","title":"HCSC: Hierarchical Contrastive Selective Coding","arxiv_id":"2202.00455","date":"2022-02-01","proceeding":"CVPR 2022 1","authors":["Yuanfan Guo","Minghao Xu","Jiawen Li","Bingbing Ni","Xuanyu Zhu","Zhenbang Sun","Yi Xu"],"abstract":"Hierarchical semantic structures naturally exist in an image dataset, in which several semantically relevant image clusters can be further integrated into a larger cluster with coarser-grained semantics. Capturing such structures with image representations can greatly benefit the semantic understanding on various downstream tasks. Existing contrastive representation learning methods lack such an important model capability. In addition, the negative pairs used in these methods are not guaranteed to be semantically distinct, which could further hamper the structural correctness of learned image representations. To tackle these limitations, we propose a novel contrastive learning framework called Hierarchical Contrastive Selective Coding (HCSC). In this framework, a set of hierarchical prototypes are constructed and also dynamically updated to represent the hierarchical semantic structures underlying the data in the latent space. To make image representations better fit such semantic structures, we employ and further improve conventional instance-wise and prototypical contrastive learning via an elaborate pair selection scheme. This scheme seeks to select more diverse positive pairs with similar semantics and more precise negative pairs with truly distinct semantics. On extensive downstream tasks, we verify the superior performance of HCSC over state-of-the-art contrastive methods, and the effectiveness of major model components is proved by plentiful analytical studies. We build a comprehensive model zoo in Sec. D. Our source code and model weights are available at https://github.com/gyfastas/HCSC","url_abs":"https://arxiv.org/abs/2202.00455v4","url_pdf":"https://arxiv.org/pdf/2202.00455v4.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":"hcsc-hierarchical-contrastive-selective","repo_url":"https://github.com/gyfastas/hcsc","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"hcsc-hierarchical-contrastive-selective","repo_url":"https://github.com/hirl-team/hcsc","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"representation-learning","task_name":"Representation Learning"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2202.00455","atlas_url":"https://app.syntology.ai/?focus=2202.00455","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2202.00455"}},"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/hirl-team/hcsc","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gyfastas/hcsc","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/gyfastas/HCSC","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"unverified":6},"by_repo_kind":{"official":{"samples":10,"ran":4,"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":"9010c3dc1ba6a609","entry":"HCSC","repo":"gyfastas/HCSC","repo_kind":"official","path":"hcsc/hcsc.py","file_url":"https://github.com/gyfastas/HCSC/blob/HEAD/hcsc/hcsc.py","link_basis":"first_harvest_node","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":"9010c3dc1ba6a609"}},{"code_sha256_prefix":"eab4f42136dd4c6e","entry":"build_augmentation","repo":"hirl-team/hcsc","repo_kind":"official","path":"hcsc/loader.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/hcsc/loader.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":"eab4f42136dd4c6e"}},{"code_sha256_prefix":"f8b64824ae02e7c2","entry":"read_object_labels","repo":"hirl-team/hcsc","repo_kind":"official","path":"eval_cls_voc.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/eval_cls_voc.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":"f8b64824ae02e7c2"}},{"code_sha256_prefix":"7a4a381127a3d05b","entry":"read_object_labels_csv","repo":"hirl-team/hcsc","repo_kind":"official","path":"eval_cls_voc.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/eval_cls_voc.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":"7a4a381127a3d05b"}},{"code_sha256_prefix":"65e7ca9c4ca143e3","entry":"build_optimizer","repo":"hirl-team/hcsc","repo_kind":"official","path":"pretrain.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/pretrain.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":"65e7ca9c4ca143e3"}},{"code_sha256_prefix":"361ad75f42c5ed05","entry":"cifar10","repo":"hirl-team/hcsc","repo_kind":"official","path":"hcsc/loader.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/hcsc/loader.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":"361ad75f42c5ed05"}},{"code_sha256_prefix":"4af58a90cc3abb60","entry":"cifar100","repo":"hirl-team/hcsc","repo_kind":"official","path":"hcsc/loader.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/hcsc/loader.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":"4af58a90cc3abb60"}},{"code_sha256_prefix":"73cecca9f3575f09","entry":"concat_all_gather","repo":"hirl-team/hcsc","repo_kind":"official","path":"hcsc/hcsc.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/hcsc/hcsc.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":"73cecca9f3575f09"}},{"code_sha256_prefix":"661c1e5b701aeb47","entry":"knn_classifier","repo":"hirl-team/hcsc","repo_kind":"official","path":"eval_knn.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/eval_knn.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":"661c1e5b701aeb47"}},{"code_sha256_prefix":"10a11520a355ee66","entry":"read_image_label","repo":"hirl-team/hcsc","repo_kind":"official","path":"eval_cls_voc.py","file_url":"https://github.com/hirl-team/hcsc/blob/HEAD/eval_cls_voc.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":"10a11520a355ee66"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}