{"id":15027592,"url":"https://github.com/floodsung/learningtocompare_fsl","last_synced_at":"2025-04-12T17:43:48.985Z","repository":{"id":69767672,"uuid":"127135121","full_name":"floodsung/LearningToCompare_FSL","owner":"floodsung","description":"PyTorch code for CVPR 2018 paper: Learning to Compare: Relation Network for Few-Shot Learning (Few-Shot Learning part)","archived":false,"fork":false,"pushed_at":"2019-10-22T03:19:44.000Z","size":8592,"stargazers_count":1062,"open_issues_count":33,"forks_count":264,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-03T19:16:27.353Z","etag":null,"topics":["few-shot-learning","meta-learning"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/floodsung.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,"governance":null}},"created_at":"2018-03-28T12:14:14.000Z","updated_at":"2025-04-03T03:05:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"b19be1f1-04c9-4ac4-9040-b8df01a9b931","html_url":"https://github.com/floodsung/LearningToCompare_FSL","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/floodsung%2FLearningToCompare_FSL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floodsung%2FLearningToCompare_FSL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floodsung%2FLearningToCompare_FSL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floodsung%2FLearningToCompare_FSL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floodsung","download_url":"https://codeload.github.com/floodsung/LearningToCompare_FSL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248609013,"owners_count":21132827,"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":["few-shot-learning","meta-learning"],"created_at":"2024-09-24T20:06:44.536Z","updated_at":"2025-04-12T17:43:48.959Z","avatar_url":"https://github.com/floodsung.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LearningToCompare_FSL\nPyTorch code for CVPR 2018 paper: [Learning to Compare: Relation Network for Few-Shot Learning](https://arxiv.org/abs/1711.06025) (Few-Shot Learning part)\n\nFor Zero-Shot Learning part, please visit [here](https://github.com/lzrobots/LearningToCompare_ZSL).\n\n# Requirements\n\nPython 2.7\n\nPytorch 0.3\n\n# Data\n\nFor Omniglot experiments, I directly attach omniglot 28x28 resized images in the git, which is created based on [omniglot](https://github.com/brendenlake/omniglot) and [maml](https://github.com/cbfinn/maml).\n\nFor mini-Imagenet experiments, please download [mini-Imagenet](https://drive.google.com/open?id=0B3Irx3uQNoBMQ1FlNXJsZUdYWEE) and put it in ./datas/mini-Imagenet and run proc_image.py to preprocess generate train/val/test datasets. (This process method is based on [maml](https://github.com/cbfinn/maml)).\n\n# Train\n\nomniglot 5way 1 shot:\n\n```\npython omniglot_train_one_shot.py -w 5 -s 1 -b 19 \n```\n\nomniglot 5way 5 shot:\n\n```\npython omniglot_train_few_shot.py -w 5 -s 5 -b 15 \n```\n\nomniglot 20way 1 shot:\n\n```\npython omniglot_train_one_shot.py -w 20 -s 1 -b 10\n```\n\nomniglot 20way 5 shot:\n\n```\npython omniglot_train_few_shot.py -w 20 -s 5 -b 5\n```\n\nmini-Imagenet 5 way 1 shot:\n\n```\npython miniimagenet_train_one_shot.py -w 5 -s 1 -b 15\n```\n\nmini-Imagenet 5 way 5 shot:\n\n```\npython miniimagenet_train_few_shot.py -w 5 -s 5 -b 10\n```\n\nyou can change -b parameter based on your GPU memory. Currently It will load my trained model, if you want to train from scratch, you can delete models by yourself.\n\n## Test\n\nomniglot 5way 1 shot:\n\n```\npython omniglot_test_one_shot.py -w 5 -s 1\n```\n\nOther experiments' testings are similar.\n\n\n## Citing\n\nIf you use this code in your research, please use the following BibTeX entry.\n\n```\n@inproceedings{sung2018learning,\n  title={Learning to Compare: Relation Network for Few-Shot Learning},\n  author={Sung, Flood and Yang, Yongxin and Zhang, Li and Xiang, Tao and Torr, Philip HS and Hospedales, Timothy M},\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},\n  year={2018}\n}\n```\n\n## Reference\n\n[MAML](https://github.com/cbfinn/maml)\n\n[MAML-pytorch](https://github.com/katerakelly/pytorch-maml)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloodsung%2Flearningtocompare_fsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloodsung%2Flearningtocompare_fsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloodsung%2Flearningtocompare_fsl/lists"}