Spatial-Aware Metric Network via Patchwise Feature Alignment for Few-Shot Learning

Published: 01 Jan 2025, Last Modified: 09 Oct 2025IEEE Trans. Instrum. Meas. 2025EveryoneRevisionsBibTeXCC BY-SA 4.0
Abstract: Few-shot learning focuses on recognizing novel classes by learning from extremely limited instances, offering solutions for industrial applications that lack sufficient training data, such as photovoltaic module microcrack recognition. An effective approach for few-shot classification is to learn discriminative features and measure the similarity between support and query instances. However, the inconsistent target locations and sizes in support-query pairs lead to spatial mismatch, adversely affecting similarity measurement. In this work, we propose a novel spatial-aware metric network (SAMNet) for few-shot classification, by which the features of support-query pairs are aligned based on patch-level spatial information interactions. Specifically, the patchwise feature alignment is performed via a bidirectional guided interaction structure. We first generate residual query features under the guidance of support patches and embed them into support features to enhance correlation. The support features are then reaggregated under the guidance of query patches to achieve patchwise feature alignment. Based on the aligned support-query pairs, the spatial-aware metric is proposed for few-shot classification by calculating the spatial importance weighted distance. We evaluate the classification ability of the SAMNet on general, fine-grained, and cross-domain benchmarks, including miniImageNet, tieredImageNet, Caltech-UCSD Birds-200-2011 (CUB), and miniImageNet $\rightarrow $ CUB few-shot datasets. Experimental results show that the proposed metric network outperforms other state-of-the-art methods on both one- and five-shot tasks. In addition, the proposed method is used to detect microcracks in photovoltaic modules across production lines. The excellent performance in practical scenarios proves the industrial value of the SAMNet.
Loading