{"id":19367725,"url":"https://github.com/hzzone/tcl","last_synced_at":"2025-04-23T14:31:47.966Z","repository":{"id":184451019,"uuid":"608111041","full_name":"Hzzone/TCL","owner":"Hzzone","description":"Twin Contrastive Learning with Noisy Labels (CVPR 2023)","archived":false,"fork":false,"pushed_at":"2023-08-04T03:28:55.000Z","size":854,"stargazers_count":70,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T18:56:19.914Z","etag":null,"topics":["noisy-label-learning","noisy-labels"],"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/Hzzone.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,"governance":null}},"created_at":"2023-03-01T10:46:14.000Z","updated_at":"2025-04-12T03:14:53.000Z","dependencies_parsed_at":"2023-07-28T13:58:31.690Z","dependency_job_id":null,"html_url":"https://github.com/Hzzone/TCL","commit_stats":null,"previous_names":["hzzone/tcl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hzzone%2FTCL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hzzone%2FTCL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hzzone%2FTCL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hzzone%2FTCL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hzzone","download_url":"https://codeload.github.com/Hzzone/TCL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250451820,"owners_count":21432910,"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":["noisy-label-learning","noisy-labels"],"created_at":"2024-11-10T08:04:30.210Z","updated_at":"2025-04-23T14:31:47.473Z","avatar_url":"https://github.com/Hzzone.png","language":"Python","readme":"## Twin Contrastive Learning with Noisy Labels\n\nThis repo provides the official PyTorch implementation of our [TCL](https://arxiv.org/abs/2303.06930) accepted by **CVPR 2023**.\n\nWe have built new state-of-the-art performance on several benchmarked datasets.\n\n\u003e Twin Contrastive Learning with Noisy Labels \u003cbr\u003e\n\u003e https://arxiv.org/abs/2303.06930 \u003cbr\u003e\n\u003e Abstract: Learning from noisy data is a challenging task that significantly degenerates the model performance. In this paper, we present TCL, a novel twin contrastive learning model to learn robust representations and handle noisy labels for classification. Specifically, we construct a Gaussian mixture model (GMM) over the representations by injecting the supervised model predictions into GMM to link label-free latent variables in GMM with label-noisy annotations. Then, TCL detects the examples with wrong labels as the out-of-distribution examples by another two-component GMM, taking into account the data distribution. We further propose a cross-supervision with an entropy regularization loss that bootstraps the true targets from model predictions to handle the noisy labels. As a result, TCL can learn discriminative representations aligned with estimated labels through mixup and contrastive learning. Extensive experimental results on several standard benchmarks and real-world datasets demonstrate the superior performance of TCL. In particular, TCL achieves 7.5% improvements on CIFAR-10 with 90% noisy label -- an extremely noisy scenario.\n\n**If you found this code helps your work, do not hesitate to cite my paper or star this repo!**\n\n### Introduction\n\nThe detail implementations and the results can be found in `models/tcl`, and in the following table 2, respectively.\n\n##### EM Framework\n\n![](imgs/framework.png)\n\n##### Main Results\n\n![](imgs/results.png)\n\n### Training\n\n#### Install requirements\n```shell\ngit clone --depth 1 https://github.com/Hzzone/torch_clustering tmp \u0026\u0026 mv tmp/torch_clustering . \u0026\u0026 rm -rf tmp\n```\n\n```shell\npip install -r requirements.txt\n```\n\n#### Training Commands\nThe config files are in `models/tcl/configs/`, just run the following command:\n```shell\nexport CUDA_VISIBLE_DEVICES=0,1,2,3 # use the first 4 GPUs\ntorchrun --master_port 17675 --nproc_per_node=4 main.py models/tcl/configs/cifar100_90_prer18.yml\n```\n\nWe can also enable the WANDB to visualize the training!\n\nSet the `wandb` parameters to true, and login to wandb.ai:\n```shell\nwandb login xxx\n```\n\n#### Download the pretrained models and training logs\n\nThe pretrained models can be saved by setting `save_checkpoints` to `true`.\n\nSome training logs can be found in:\n* [Google Drive](https://drive.google.com/drive/folders/1pOA5UPD4jiccW6ySDJqmJj3i6uph00nf?usp=sharing)\n* [Baidu Disk](https://pan.baidu.com/s/1_K1PdFue9FtFXO2wbCzuBg?pwd=uhpe)\n\n### Citation\n\nIf you found this code or our work useful please cite us:\n\n```bibtex\n@inproceedings{huang2023twin,\n  title={Twin Contrastive Learning with Noisy Labels},\n  author={Huang, Zhizhong and Zhang, Junping and Shan, Hongming},\n  booktitle={CVPR},\n  year={2023}\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzzone%2Ftcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhzzone%2Ftcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzzone%2Ftcl/lists"}