{"id":13576298,"url":"https://github.com/amazon-science/semi-vit","last_synced_at":"2025-10-17T15:36:14.048Z","repository":{"id":73741219,"uuid":"581421914","full_name":"amazon-science/semi-vit","owner":"amazon-science","description":"PyTorch implementation of Semi-supervised Vision Transformers","archived":false,"fork":false,"pushed_at":"2022-12-23T06:52:27.000Z","size":68,"stargazers_count":51,"open_issues_count":4,"forks_count":9,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-05T12:33:19.412Z","etag":null,"topics":["machine-learning","semi-supervised-learning","vision-transformer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amazon-science.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-23T06:19:22.000Z","updated_at":"2024-10-19T03:17:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"139114cc-5aa0-4175-a19c-16bf6ae7f8e7","html_url":"https://github.com/amazon-science/semi-vit","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/amazon-science%2Fsemi-vit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fsemi-vit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fsemi-vit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fsemi-vit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amazon-science","download_url":"https://codeload.github.com/amazon-science/semi-vit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224360233,"owners_count":17298319,"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":["machine-learning","semi-supervised-learning","vision-transformer"],"created_at":"2024-08-01T15:01:08.943Z","updated_at":"2025-10-17T15:36:13.968Z","avatar_url":"https://github.com/amazon-science.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## Semi-ViT: Semi-supervised Vision Transformers at Scale\n\n\nThis is a PyTorch implementation of the paper [Semi-ViT](https://arxiv.org/abs/2208.05688). It is a state-of-the-art semi-supervised learning of vision transformers.\n\nIf you use the code/model/results of this repository please cite:\n```\n@inproceedings{cai2022semi,\n  author  = {Zhaowei Cai and Avinash Ravichandran and Paolo Favaro and Manchen Wang and Davide Modolo and Rahul Bhotika and Zhuowen Tu and Stefano Soatto},\n  title   = {Semi-supervised Vision Transformers at Scale},\n  booktitle = {NeurIPS},\n  Year  = {2022}\n}\n```\n\n### Install\n\nFirst, [install PyTorch](https://pytorch.org/get-started/locally/) and torchvision. We have tested on version of 1.7.1, but newer versions should also be working.\n\n```bash\n$ conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch\n``` \n\nAlso install other dependencies, e.g.,\n\n```bash\n$ pip install timm==0.4.5\n``` \n\n\n### Data Preparation\n\nAssume ImageNet folder is ``~/data/imagenet/``, install ImageNet dataset following the [official PyTorch ImageNet training code](https://github.com/pytorch/examples/tree/master/imagenet), with the standard data folder structure for the torchvision ``datasets.ImageFolder``. Please download the ImageNet [index files](https://eman-cvpr.s3.amazonaws.com/imagenet_indexes.zip) for semi-supervised learning experiments. The file structure should look like:\n\n  ```bash\n  $ tree data\n  imagenet\n  ├── train\n  │   ├── class1\n  │   │   └── *.jpeg\n  │   ├── class2\n  │   │   └── *.jpeg\n  │   └── ...\n  ├── val\n  │   ├── class1\n  │   │   └── *.jpeg\n  │   ├── class2\n  │   │   └── *.jpeg\n  │   └── ...\n  └── indexes\n      └── *_index.csv\n  ```\n\nPlease also download the [MAE self-pretrained weights](https://github.com/facebookresearch/mae), and move them to the folder of ``pretrain_weights``.\n\n### Supervised Finetuning\n\nThe supervised finetuning instruction is in [FINETUNE.md](FINETUNE.md).\n\n### Semi-supervised Finetuning\n\nThe semi-supervised finetuning instruction is in [SEMIVIT.md](SEMIVIT.md).\n\n### Results\n\nIf the model is self-pretrained, the results would be close to the following (with some minor variance):\n\n| model | method | acc@1% IN | acc@10% IN | acc@100% IN |\n| :---: | :---: | :---: | :---: | :---: |\n| ViT-Base | Finetune | 57.4 | 73.7 | 83.7 |\n| ViT-Base | Semi-ViT | 71.0 | 79.7 | - |\n| ViT-Large | Finetune | 67.1 | 79.2 | 86.0 |\n| ViT-Large | Semi-ViT | 77.3 | 83.3 | - |\n| ViT-Huge | Finetune | 71.5 | 81.4 | 86.9 |\n| ViT-Huge | Semi-ViT | 80.0 | 84.3 | - |\n\nIf the model is not self-pretrained, the results would be close to the following (with some minor variance):\n\n| model | method | acc@10% IN |\n| :---: | :---: | :---: |\n| ViT-Small | Finetune | 56.2 |\n| ViT-Small | Semi-ViT | 70.9 |\n| ViT-Base | Finetune | 57.0 |\n| ViT-Base | Semi-ViT | 73.5 |\n| ConvNeXT-Tiny | Finetune | 61.2 |\n| ConvNeXT-Tiny | Semi-ViT | 74.1 |\n| ConvNeXT-Small | Finetune | 64.1 |\n| ConvNeXT-Small | Semi-ViT | 75.1 |\n\n### License\n\nThis project is under the Apache-2.0 license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-science%2Fsemi-vit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famazon-science%2Fsemi-vit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-science%2Fsemi-vit/lists"}