{"id":21029585,"url":"https://github.com/aiboy996/simple-clr","last_synced_at":"2025-10-12T10:32:45.540Z","repository":{"id":246672835,"uuid":"819773632","full_name":"AIboy996/simple-CLR","owner":"AIboy996","description":"神经网络和深度学习（DATA620004）期末作业，任务一","archived":false,"fork":false,"pushed_at":"2024-08-15T17:10:57.000Z","size":580,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T15:17:34.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/AIboy996.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-25T07:14:32.000Z","updated_at":"2024-08-15T17:11:01.000Z","dependencies_parsed_at":"2024-08-17T01:34:00.158Z","dependency_job_id":null,"html_url":"https://github.com/AIboy996/simple-CLR","commit_stats":null,"previous_names":["aiboy996/simple-clr"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIboy996%2Fsimple-CLR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIboy996%2Fsimple-CLR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIboy996%2Fsimple-CLR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIboy996%2Fsimple-CLR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AIboy996","download_url":"https://codeload.github.com/AIboy996/simple-CLR/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243466986,"owners_count":20295310,"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":[],"created_at":"2024-11-19T12:13:18.075Z","updated_at":"2025-10-12T10:32:40.497Z","avatar_url":"https://github.com/AIboy996.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-clr\n\n神经网络和深度学习（DATA620004）期末作业，任务1：对比**监督学习**和**自监督学习**在图像分类任务上的性能表现.\n\n## 要求\n- 实现任一自监督学习算法并使用该算法在自选的数据集上训练ResNet-18，随后在CIFAR-100数据集中使用Linear Classification Protocol对其性能进行评测；\n- 将上述结果与在ImageNet数据集上采用监督学习训练得到的表征在相同的协议下进行对比，并比较二者相对于在CIFAR-100数据集上从零开始以监督学习方式进行训练所带来的提升；\n- 尝试不同的超参数组合，探索自监督预训练数据集规模对性能的影响；\n\n## 实现\n\n- 模型：[ResNet-18](https://pytorch.org/vision/master/models/generated/torchvision.models.resnet18.html)（输出的特征纬度：512x512）\n- 使用的自监督学习算法：[SimCLR - A Simple Framework for Contrastive Learning of Visual Representations](https://github.com/google-research/simclr)\n- 代码实现参考：\u003chttps://github.com/sthalles/SimCLR\u003e\n- 预训练数据集：[Tiny ImageNet 200](https://www.image-net.org/)\n    - **200 classes, 600(=500+50+50) 64×64 colored images for each class**\n- 评测数据集：[CIFAR-100](https://www.cs.toronto.edu/~kriz/cifar.html)\n    - **100 classes, 600(=500+100) 32x32 colored images for each class**\n\n## 模型训练\n\n简称|训练算法|预训练数据集|评测方式|评测数据集\n--|--|--|--|--\nsuper-transfer|有监督|ImageNet|Linear Classification Protocol, transfer learning|CIFAR-100\nselfsuper-transfer|自监督|ImageNet|Linear Classification Protocol, transfer learning|CIFAR-100\nselfsuper|自监督|CIFAR-100|Linear Classification Protocol|CIFAR-100\nsuper|有监督|CIFAR-100|直接评测|CIFAR-100\n\n运行[data/get_dataset.sh](data/get_dataset.sh)自动下载、解压缩数据集。\n\n运行[run_train.sh](run_train.sh)可以训练上述的四个模型。\n\n运行[test.py](test.py)可以评测训练好的四个模型：\n```python\nPREATRAINED_MODELS = {\n    \"super-transfer\": [\n        f\"runs/Jun25_15-00-{13}_user-AS-4124GS-TNR/checkpoint_0099.pth.tar\",\n        ResNet,\n    ],\n    \"selfsuper-transfer\": [\n        f\"runs/Jun25_15-00-{14}_user-AS-4124GS-TNR/checkpoint_0099.pth.tar\",\n        ResNetSimCLR,\n    ],\n    \"selfsuper\": [\n        f\"runs/Jun25_15-00-{16}_user-AS-4124GS-TNR/checkpoint_0099.pth.tar\",\n        ResNetSimCLR,\n    ],\n    \"super\": [\n        f\"runs/Jun25_15-00-{15}_user-AS-4124GS-TNR/checkpoint_0099.pth.tar\",\n        ResNet,\n    ],\n}\n```\n\n评测结果如下：\n简称|评测方式|TOP1 accuracy| TOP5 accuracy\n--|--|--|--\nselfsuper-transfer|Linear Classification Protocol, transfer learning|32.93|61.08\nsuper-transfer|Linear Classification Protocol, transfer learning|38.15|66.66\nselfsuper|Linear Classification Protocol|35.77|63.55\nsuper|直接评测|50.80|76.95\n\n\u003e TOP1 accuracy意为测试集中模型输出的概率中**最大的即为正确标签**的比例。\n\u003e \n\u003e TOP5 accuracy意为测试集中模型输出的概率中**最大的前五个包含正确标签**的比例。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiboy996%2Fsimple-clr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiboy996%2Fsimple-clr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiboy996%2Fsimple-clr/lists"}