{"id":18001187,"url":"https://github.com/chengtan9907/hyperspherical-consistency-regularization","last_synced_at":"2025-03-26T07:32:22.728Z","repository":{"id":45071466,"uuid":"498975142","full_name":"chengtan9907/Hyperspherical-Consistency-Regularization","owner":"chengtan9907","description":"The official implementation of the CVPR'2022 paper Hyperspherical Consistency Regularization.","archived":false,"fork":false,"pushed_at":"2022-06-22T04:19:53.000Z","size":375,"stargazers_count":27,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T11:50:31.095Z","etag":null,"topics":["deep-learning","representation-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chengtan9907.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-02T03:15:14.000Z","updated_at":"2024-10-22T09:19:44.000Z","dependencies_parsed_at":"2022-08-04T01:45:43.322Z","dependency_job_id":null,"html_url":"https://github.com/chengtan9907/Hyperspherical-Consistency-Regularization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengtan9907%2FHyperspherical-Consistency-Regularization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengtan9907%2FHyperspherical-Consistency-Regularization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengtan9907%2FHyperspherical-Consistency-Regularization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengtan9907%2FHyperspherical-Consistency-Regularization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chengtan9907","download_url":"https://codeload.github.com/chengtan9907/Hyperspherical-Consistency-Regularization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245612002,"owners_count":20643946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","representation-learning"],"created_at":"2024-10-29T23:16:27.974Z","updated_at":"2025-03-26T07:32:22.317Z","avatar_url":"https://github.com/chengtan9907.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hyperspherical Consistency Regularization\n\nThis repository contains the implementation code for paper:\n\n**Hyperspherical Consistency Regularization**  \n[Cheng Tan](https://westlake-drug-discovery.github.io/cheng_tan.html), [Zhangyang Gao](https://westlake-drug-discovery.github.io/zhangyang_gao.html), [Lirong Wu](https://lirongwu.github.io/), [Siyuan Li](https://scholar.google.com/citations?user=SKTQTXwAAAAJ\u0026hl), [Stan Z. Li](https://scholar.google.com/citations?user=Y-nyLGIAAAAJ\u0026hl). In [CVPR](https://arxiv.org/abs/2206.00845), 2022.\n\n## Brief introduction\n\n\u003cp float=\"center\"\u003e\n    \u003cimg src=\"./readme_figures/cl_on_hypersphere.png\" width=\"255\"/\u003e\n    \u003cimg src=\"./readme_figures/seperable_hypersphere.png\" width=\"400\"/\u003e\n\u003c/p\u003e\n\nIn this work, we explore the relationship between self-supervised\nlearning and supervised learning, and study how self-supervised learning helps\nrobust data-efficient deep learning. We propose hyperspherical consistency\nregularization (HCR), a simple yet effective plug-and-play method, to\nregularize the classifier using feature-dependent information and thus avoid\nbias from labels. Specifically, HCR first projects logits from the classifier\nand feature projections from the projection head on the respective hypersphere,\nthen it enforces data points on hyperspheres to have similar structures by\nminimizing binary cross entropy of pairwise distances' similarity metrics.\n\nWe consider the pairwise distance as the key geometry property, and force points on the classifier's hypersphere to have a similar structure as the projection head's, as follows:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./readme_figures/preserve_structure.png\" width=\"400\"\u003e \u003cbr\u003e\n\u003c/p\u003e\n\n## Dependencies\n* torch\n\n## Usage\n\nThe following Python code is all you need.\n\n```python\nfrom hcr import HCR\n\nhcr_reg = HCR(classifier_network, lr)\n\nfor epoch in epochs:\n    for batch in dataloader:\n        # get logits and projections as the input of HCR\n        hcr_reg.update(logits, projections)\n```\n\n## Citation\n\nIf you are interested in our repository and our paper, please cite the following paper:\n\n```\n@InProceedings{Tan_2022_CVPR,\n    author    = {Tan, Cheng and Gao, Zhangyang and Wu, Lirong and Li, Siyuan and Li, Stan Z.},\n    title     = {Hyperspherical Consistency Regularization},\n    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n    month     = {June},\n    year      = {2022},\n    pages     = {7244-7255}\n}\n```\nOr, \n```\n@article{tan2022hyperspherical,\n  title={Hyperspherical Consistency Regularization},\n  author={Tan, Cheng and Gao, Zhangyang and Wu, Lirong and Li, Siyuan and Li, Stan Z},\n  journal={arXiv preprint arXiv:2206.00845},\n  year={2022}\n}\n```\n\n## Contact\n\nIf you have any questions, feel free to contact me through email (tancheng@westlake.edu.cn). Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchengtan9907%2Fhyperspherical-consistency-regularization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchengtan9907%2Fhyperspherical-consistency-regularization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchengtan9907%2Fhyperspherical-consistency-regularization/lists"}