# Learning to Compare Relation: Semantic Alignment for Few-Shot Learning

arXiv: https://arxiv.org/abs/2003.00210 · HTML: https://mlsanity.com/paper/2003.00210/

## Key facts

- Cited by 8 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 29 Feb 2020.

## Built on by (most cited first, 8 of 8)

- [Object-aware Long-short-range Spatial Alignment for Few-Shot Fine-Grained Image Classification](https://mlsanity.com/paper/2108.13098/) (2021)
- [CROCODILE: Causality aids RObustness via COntrastive DIsentangled LEarning](https://mlsanity.com/paper/2408.04949/) (2024)
- [DiRaC-I: Identifying Diverse and Rare Training Classes for Zero-Shot Learning](https://mlsanity.com/paper/2301.00236/) (2022)
- [Metric Distribution to Vector: Constructing Data Representation via Broad-Scale Discrepancies](https://mlsanity.com/paper/2210.00415/) (2022)
- [Activating the Discriminability of Novel Classes for Few-shot Segmentation](https://mlsanity.com/paper/2212.01131/) (2022)
- [Video-to-Task Learning via Motion-Guided Attention for Few-Shot Action Recognition](https://mlsanity.com/paper/2411.11335/) (2024)
- [Task-Adapter++: Task-specific Adaptation with Order-aware Alignment for Few-shot Action Recognition](https://mlsanity.com/paper/2505.06002/) (2025)
- [Contrastive Domain Generalization for Cross-Instrument Molecular Identification in Mass Spectrometry](https://mlsanity.com/paper/2602.00547/) (2026)

## Abstract (arXiv)

Few-shot learning is a fundamental and challenging problem since it requires recognizing novel categories from only a few examples. The objects for recognition have multiple variants and can locate anywhere in images. Directly comparing query images with example images can not handle content misalignment. The representation and metric for comparison are critical but challenging to learn due to the scarcity and wide variation of the samples in few-shot learning. In this paper, we present a novel semantic alignment model to compare relations, which is robust to content misalignment. We propose to add two key ingredients to existing few-shot learning frameworks for better feature and metric learning ability. First, we introduce a semantic alignment loss to align the relation statistics of the features from samples that belong to the same category. And second, local and global mutual information maximization is introduced, allowing for representations that contain locally-consistent and intra-class shared information across structural locations in an image. Thirdly, we introduce a principled approach to weigh multiple loss functions by considering the homoscedastic uncertainty of each stream. We conduct extensive experiments on several few-shot learning datasets. Experimental results show that the proposed method is capable of comparing relations with semantic alignment strategies, and achieves state-of-the-art performance.
