{"id":13708926,"url":"https://github.com/Lee-Gihun/MixCo-Mixup-Contrast","last_synced_at":"2025-05-06T15:31:31.957Z","repository":{"id":54999849,"uuid":"312954279","full_name":"Lee-Gihun/MixCo-Mixup-Contrast","owner":"Lee-Gihun","description":"(NeurIPS 2020 Workshop on SSL) Official Implementation of \"MixCo: Mix-up Contrastive Learning for Visual Representation\"","archived":false,"fork":false,"pushed_at":"2022-11-25T09:51:30.000Z","size":357,"stargazers_count":58,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-13T19:39:15.683Z","etag":null,"topics":["deep-learning","mix-up","pytorch","self-supervised-learning"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lee-Gihun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-15T04:01:38.000Z","updated_at":"2024-06-26T06:27:56.000Z","dependencies_parsed_at":"2023-01-23T14:16:06.630Z","dependency_job_id":null,"html_url":"https://github.com/Lee-Gihun/MixCo-Mixup-Contrast","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/Lee-Gihun%2FMixCo-Mixup-Contrast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lee-Gihun%2FMixCo-Mixup-Contrast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lee-Gihun%2FMixCo-Mixup-Contrast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lee-Gihun%2FMixCo-Mixup-Contrast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lee-Gihun","download_url":"https://codeload.github.com/Lee-Gihun/MixCo-Mixup-Contrast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252712918,"owners_count":21792392,"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","mix-up","pytorch","self-supervised-learning"],"created_at":"2024-08-02T23:00:34.223Z","updated_at":"2025-05-06T15:31:30.892Z","avatar_url":"https://github.com/Lee-Gihun.png","language":"Shell","funding_links":[],"categories":["Self-Supervised Learning"],"sub_categories":["**Contrastive Learning**"],"readme":"## How to Reproduce our Results\n\nThis repository contains PyTorch implementation code for the paper **MixCo: Mix-up Contrastive Learning for Visual Representation (https://arxiv.org/abs/2010.06300)** that is accepted in [NeurIPS 2020 Workshop on Self-Supervised Learning: Theory and Practice](https://nips.cc/Conferences/2020/ScheduleMultitrack?event=16146).\n\nThis is an instruction to reproduce our results, based on the source code we have provided.\n\n### Prerequisites\n\n1. You should download the Tiny-ImageNet dataset. To download the images, go to [https://tiny-imagenet.herokuapp.com/](https://tiny-imagenet.herokuapp.com/) and click 'Download Tiny ImageNet' button. Equivalently, try\n```sh\nwget http://cs231n.stanford.edu/tiny-imagenet-200.zip \n```\n2. Unzip the file and place the folder into `[your_data_path]`.\n3. Also, download the ImageNet train dataset.\n4. For linear classification, you may also need CIFAR10 and CIFAR100 dataset. If you do not have them, give the argument `--download` when running `lincls.py`. Then, it will download the dataset before training.\n\n### Structure\nThis repository contains python files that can train the model with mixup-based representaion learning.\n\n`pretrain.py` pretrains the model in unsupervised manner, and saves the encoder part (without classification layers). \n\n`lincls.py` loads and freezes the pretrained model, and then train the classifier part on the target dataset.\n\n### Experiments\n\n1. In `./moco/experiments/` and `./simclr/scripts/`, there are `.sh` files which include the commands that can reproduce our experimental results. Open and set the configs.\n```sh\ndata_path=\"[your_data_path]\"\nexp_name=\"[experiment_name]\"\n```\n2. Run the file. For example, if you want to pretrain the ResNet18 model with Tiny-ImageNet, and then see the linear classification results, run `exp_mix_res18_tinyimg.sh`.\n```sh\nbash experiments/exp_mix_res18_tinyimg.sh\n```\n3. You can find the pretraining and linear evaluation results in `results/results.json` file.\n\n## Model Checkpoints\nYou can also download the checkpoint of MixCo with ResNet-18 architecture. Link: [google drive](https://drive.google.com/file/d/1Dg_SNGBmpyPCRIvrt8EIfQrUEIvtWasW/view?usp=sharing)\n\n## Citing this work\n```\n@article{kim2020mixco,\n  title={Mixco: Mix-up contrastive learning for visual representation},\n  author={Kim, Sungnyun and Lee, Gihun and Bae, Sangmin and Yun, Se-Young},\n  journal={arXiv preprint arXiv:2010.06300},\n  year={2020}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLee-Gihun%2FMixCo-Mixup-Contrast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLee-Gihun%2FMixCo-Mixup-Contrast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLee-Gihun%2FMixCo-Mixup-Contrast/lists"}