Papers › Learning to Compare: Relation Network for Few-Shot Learning

Learning to Compare: Relation Network for Few-Shot Learning

16 Nov 2017CVPR 2018 6arXiv:1711.06025archive 2025-07-28

Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip H. S. Torr, Timothy M. Hospedales

We present a conceptually simple, flexible, and general framework for few-shot learning, where a classifier must learn to recognise new classes given only few examples from each. Our method, called the Relation Network (RN), is trained end-to-end from scratch. During meta-learning, it learns to learn a deep distance metric to compare a small number of images within episodes, each of which is designed to simulate the few-shot setting. Once trained, a RN is able to classify images of new classes by computing relation scores between query images and the few examples of each new class without further updating the network. Besides providing improved performance on few-shot learning, our framework is easily extended to zero-shot learning. Extensive experiments on five benchmarks demonstrate that our simple approach provides a unified and effective approach for both of these two tasks.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1711.06025")

Code

Syntology Ran 1 of 2 code samples harvested from 2 repositories linked to this paper; 1 has no recorded run. Of those that ran: 1 ran · our draft was wrong.

By repository: community (archive-listed): 2 samples from 2 repositories, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

13 repositories listed; official and paper-mentioned ones first.

Atharva-Phatak/One-Shot-Art mentioned on GitHubpytorchMIT report
Mind23-2/MindCode-66 mentioned on GitHubmindspore report
floodsung/LearningToCompare_FSL mentioned on GitHubpytorch report
jiakangyuan/helixformer mentioned on GitHubpytorch report
knnaraghi/fewshot mentioned on GitHubtf report
laohur/LearnToCompareText mentioned on GitHubpytorch report
laohur/RelationNet mentioned on GitHubpytorch report
lzrobots/LearningToCompare_ZSL mentioned on GitHubpytorch report
prolearner/LearningToCompareTF mentioned on GitHubtf report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

2 samples harvested; 1 ran; 0 honoured the contract we drafted; 1 has no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
1unverified

Licence: 1 of the 2 samples is pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

mean_confidence_interval khoiucd/LearningToCompare-Tensorflow/miniimagenet/miniimagenet_test_few_shot.py community (archive-listed) ran · our draft was wrong MIT (permissive) · fbec209cee9a4df8 · report
convolutional_params prolearner/LearningToCompareTF/omniglot_test.py community (archive-listed) unverified no licence file found · pointer only · cff24de154ae5cd6 · report

Tasks

Few-Shot Image ClassificationFew-Shot LearningMeta-LearningRelation NetworkZero-Shot Learning

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Few-Shot Image Classification CIFAR-FS 5-way (5-shot) Relation Networks* Accuracy 69.3 #39 of 39 Archive leaderboard report
Few-Shot Image Classification CUB 200 5-way 1-shot Relation Net Accuracy 50.44 #36 of 36 Archive leaderboard report
Few-Shot Image Classification CUB 200 5-way 5-shot Relation Net Accuracy 65.32 #32 of 32 Archive leaderboard report
Few-Shot Image Classification Meta-Dataset Relation Networks Accuracy 53.315 #22 of 22 Archive leaderboard report
Few-Shot Image Classification Meta-Dataset Rank Relation Networks Mean Rank 11.8 #13 of 13 Archive leaderboard report
Few-Shot Image Classification Mini-ImageNet-CUB 5-way (1-shot) RelationNet (Sung et al., 2018) Accuracy 42.91 #7 of 12 Archive leaderboard report
Few-Shot Image Classification Mini-Imagenet 10-way (1-shot) Relation Networks Accuracy 34.9 #8 of 14 Archive leaderboard report
Few-Shot Image Classification Mini-Imagenet 10-way (5-shot) Relation Networks Accuracy 47.9 #11 of 14 Archive leaderboard report
Few-Shot Image Classification Mini-Imagenet 5-way (1-shot) Relation Net (Sung et al., 2018) Accuracy 50.4 #98 of 105 Archive leaderboard report
Few-Shot Image Classification OMNIGLOT - 1-Shot, 20-way Relation Net Accuracy 97.6% #7 of 20 Archive leaderboard report
Few-Shot Image Classification OMNIGLOT - 1-Shot, 5-way Relation Net Accuracy 99.6 #4 of 17 Archive leaderboard report
Few-Shot Image Classification OMNIGLOT - 5-Shot, 20-way Relation Net Accuracy 99.1% #9 of 19 Archive leaderboard report
Few-Shot Image Classification OMNIGLOT - 5-Shot, 5-way Relation Net Accuracy 99.8 #7 of 16 Archive leaderboard report
Few-Shot Image Classification Tiered ImageNet 10-way (1-shot) Relation Networks Accuracy 36.3 #9 of 13 Archive leaderboard report
Few-Shot Image Classification Tiered ImageNet 10-way (5-shot) Relation Networks Accuracy 58.0 #7 of 13 Archive leaderboard report
Image Classification Tiered ImageNet 5-way (5-shot) Relation Net Accuracy 71.31 #2 of 7 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections