{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/simpleshot-revisiting-nearest-neighbor","title":"SimpleShot: Revisiting Nearest-Neighbor Classification for Few-Shot Learning","arxiv_id":"1911.04623","date":"2019-11-12","proceeding":null,"authors":["Yan Wang","Wei-Lun Chao","Kilian Q. Weinberger","Laurens van der Maaten"],"abstract":"Few-shot learners aim to recognize new object classes based on a small number of labeled training examples. To prevent overfitting, state-of-the-art few-shot learners use meta-learning on convolutional-network features and perform classification using a nearest-neighbor classifier. This paper studies the accuracy of nearest-neighbor baselines without meta-learning. Surprisingly, we find simple feature transformations suffice to obtain competitive few-shot learning accuracies. For example, we find that a nearest-neighbor classifier used in combination with mean-subtraction and L2-normalization outperforms prior results in three out of five settings on the miniImageNet dataset.","url_abs":"https://arxiv.org/abs/1911.04623v2","url_pdf":"https://arxiv.org/pdf/1911.04623v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"simpleshot-revisiting-nearest-neighbor","repo_url":"https://github.com/mileyan/simple_shot","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"simpleshot-revisiting-nearest-neighbor","repo_url":"https://github.com/mbonto/fewshot_generalization","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"simpleshot-revisiting-nearest-neighbor","repo_url":"https://github.com/mbonto/fewshot_neuroimaging_classification","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"simpleshot-revisiting-nearest-neighbor","repo_url":"https://github.com/yhu01/PT-MAP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"simpleshot-revisiting-nearest-neighbor","repo_url":"https://github.com/yhu01/bms","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"simpleshot-revisiting-nearest-neighbor","repo_url":"https://github.com/sicara/easy-few-shot-learning","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"few-shot-image-classification","task_name":"Few-Shot Image Classification"},{"task_slug":"few-shot-learning","task_name":"Few-Shot Learning"},{"task_slug":"classification","task_name":"General Classification"},{"task_slug":"meta-learning","task_name":"Meta-Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/few-shot-image-classification-on-dirichlet-4","task":"Few-Shot Image Classification","dataset":"Dirichlet CUB-200 (5-way, 1-shot)","model":"Simpleshot","rank_in_archive_order":5,"of":8,"metrics":{"1:1 Accuracy":"70.6"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-dirichlet-5","task":"Few-Shot Image Classification","dataset":"Dirichlet CUB-200 (5-way, 5-shot)","model":"Simpleshot","rank_in_archive_order":4,"of":8,"metrics":{"1:1 Accuracy":"87.5"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-dirichlet","task":"Few-Shot Image Classification","dataset":"Dirichlet Mini-Imagenet (5-way, 1-shot)","model":"Simpleshot","rank_in_archive_order":5,"of":12,"metrics":{"1:1 Accuracy":"63.0"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-dirichlet-1","task":"Few-Shot Image Classification","dataset":"Dirichlet Mini-Imagenet (5-way, 5-shot)","model":"Simpleshot","rank_in_archive_order":5,"of":12,"metrics":{"1:1 Accuracy":"80.1"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-dirichlet-2","task":"Few-Shot Image Classification","dataset":"Dirichlet Tiered-Imagenet (5-way, 1-shot)","model":"Simpleshot","rank_in_archive_order":6,"of":9,"metrics":{"1:1 Accuracy":"69.6"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-dirichlet-3","task":"Few-Shot Image Classification","dataset":"Dirichlet Tiered-Imagenet (5-way, 5-shot)","model":"Simpleshot","rank_in_archive_order":6,"of":9,"metrics":{"1:1 Accuracy":"84.7"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-mini-2","task":"Few-Shot Image Classification","dataset":"Mini-Imagenet 5-way (1-shot)","model":"SimpleShot (CL2N-DenseNet)","rank_in_archive_order":61,"of":105,"metrics":{"Accuracy":"64.29"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-mini-3","task":"Few-Shot Image Classification","dataset":"Mini-Imagenet 5-way (5-shot)","model":"SimpleShot (CL2N-DenseNet)","rank_in_archive_order":46,"of":95,"metrics":{"Accuracy":"81.5"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1911.04623","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1911.04623"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yhu01/PT-MAP","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sicara/easy-few-shot-learning","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yhu01/bms","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mbonto/fewshot_neuroimaging_classification","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mileyan/simple_shot","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mbonto/fewshot_generalization","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"unverified":6},"by_repo_kind":{"official":{"samples":9,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"d9def42110729a85","entry":"conv1x1","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/models/ResNet.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/models/ResNet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9def42110729a85"}},{"code_sha256_prefix":"fac5364e2f53c6db","entry":"conv3x3","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/models/ResNet.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/models/ResNet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fac5364e2f53c6db"}},{"code_sha256_prefix":"00e569acd6b45ef0","entry":"conv3x3","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/models/WideResNet.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/models/WideResNet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"00e569acd6b45ef0"}},{"code_sha256_prefix":"02652b1ac1a54dda","entry":"conv_block","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/models/Conv4.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/models/Conv4.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"02652b1ac1a54dda"}},{"code_sha256_prefix":"235da783eeb0573f","entry":"get_metric","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/models/ProtoNet.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/models/ProtoNet.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"235da783eeb0573f"}},{"code_sha256_prefix":"14c112d10e40fd97","entry":"walk_path","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/inatural_split.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/inatural_split.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"14c112d10e40fd97"}},{"code_sha256_prefix":"b02b9242b91ea987","entry":"wideres","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/models/WideResNet.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/models/WideResNet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b02b9242b91ea987"}},{"code_sha256_prefix":"19dc480a58b5070b","entry":"with_augment","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/datasets/transform.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/datasets/transform.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"19dc480a58b5070b"}},{"code_sha256_prefix":"e1f7a44f9ac823d7","entry":"without_augment","repo":"mileyan/simple_shot","repo_kind":"official","path":"src/datasets/transform.py","file_url":"https://github.com/mileyan/simple_shot/blob/HEAD/src/datasets/transform.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e1f7a44f9ac823d7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}