# Domain-Invariant Few-Shot Contrastive Learning for Hyperspectral Image Classification
###### Abstract  
In Hyperspectral Image (HSI) classification, acquiring large quantities of high-quality labeled samples is typically costly and impractical. Traditional deep learning methods are limited in such scenarios due to their dependence on sample quantities. To address this challenge, researchers have turned to Few-Shot Learning (FSL). Although existing FSL methods improve classification performance by enhancing domain invariance through domain adaptation, they often overlook the critical issue of high inter-class similarity and large intra-class variability. Moreover, during domain alignment, features of different categories within the same domain may become confused. To address these issues, this paper proposes a novel Domain-Invariant Few-Shot Contrastive Learning (DIFSCL) method, which combines domain adaptation and contrastive learning strategies to not only learn domain-invariant features but also significantly enhance inter-class discriminability. Based on this, we further design a multi-scale adaptive attention mechanism for a hyperspectral feature extraction network to more effectively extract and optimize generalized features within the DIFSCL framework, significantly improving intra-class consistency and inter-class discriminative capability of features. Experimental results on three widely used HSI datasets demonstrate that our method significantly outperforms existing techniques in few-shot classification tasks. few-shot learning; contrastive learning; attention mechanism; hyperspectral image classification; domain adaptation +
Footnote †: journal: applied sciences  
For example, the HybridSN network designed by [PERSON] et al. [10] significantly improved classification accuracy by combining 2D and 3D convolutional neural networks. Additionally, the Spectral-Spatial Residual Network (SSRN) developed by [PERSON] et al. [11] effectively enhanced classification efficiency by deepening the network structure through residual connections. However, while deep learning methods perform exceptionally well with adequate training labels, annotating hyperspectral data is both time-consuming and expensive, and practical applications are often constrained by insufficient labeled samples. Facing this challenge, researchers have begun exploring Few-Shot Learning (FSL) strategies. FSL aims to learn effectively from limited labeled samples by transferring knowledge from labeled categories to unlabeled ones, rapidly adapting to new classification tasks [12]. This approach shows promise in maintaining good model performance and adaptability even with scarce samples. In FSL-based HSI classification methods, [PERSON] et al. [13] proposed Deep Few-Shot Learning (DFSL), which uses a 3D CNN deep residual network for feature extraction and KNN [6] and SVM [5] methods for classification, achieving good classification performance with only five labeled samples as training data in the target domain. [PERSON] et al. [14] proposed Deep Cross-domain Few-Shot Learning (DCFSL), using conditional domain discriminators to address domain shift issues in few-shot learning. [PERSON] et al. [15] introduced a method called Graph Information Aggregation Cross-domain Few-Shot Learning (Gia-CFSL). This method improves traditional domain adaptation by using graph information. This helps move beyond just using local spatial data. ADAFSL [16] addresses the issue of different domain distributions. It does this by adjusting the weights it gives to losses in different categories. This helps line up the overall domain distributions. These methods are key in aligning domains, a specific approach in domain adaptation that aims to lessen the differences in feature distributions between source and target domains. This makes the algorithms more generalizable. In simple terms, domain adaptation trains models in one domain and then applies them effectively to different target domains [17].