Graph-weighted contrastive learning for semi-supervised hyperspectral image classification

Yuqing Zhang, Qi Han, Ligeng Wang, Kai Cheng, Bo Wang, Kun Zhan

Introduction

Hyperspectral Image (HSI) classification is a critical task in remote sensing, providing detailed spectral information across hundreds of bands for applications ranging from precision agriculture to environmental monitoring. However, the high dimensionality of HSI data presents a dual challenge: the "curse of dimensionality" and the high computational cost of processing large-scale spatial-spectral graphs.

Traditional semi-supervised methods often rely on superpixels—grouping adjacent pixels into homogeneous regions—to reduce graph size. While efficient, this approach introduces the "boundary problem," where pixels from different classes are erroneously grouped together, leading to misclassification. This paper introduces Graph-Weighted Contrastive Learning (GWCL), a framework designed to achieve pixel-level precision without the computational bottlenecks of traditional graph-based models.

Methodology

The GWCL framework addresses the limitations of existing HSI classification models through a four-stage pipeline that integrates spatial-spectral features and a novel contrastive loss function.

1. Feature Integration and Albedo Recovery

To handle the high spectral dimensionality, the model first employs an Albedo Recovery Model (ARM). This reduces the spectral bands while preserving essential material characteristics. To incorporate spatial context, the model concatenates these spectral features with the pixel’s normalized spatial coordinates $(m, n)$. This ensures that the resulting feature vector captures both the "what" (material) and the "where" (location) of each pixel.

2. Global Graph Construction

Instead of relying on local superpixel neighborhoods, GWCL constructs a global similarity graph using K-Nearest Neighbors (K-NN). A key innovation here is the use of Mahalanobis distance rather than standard Euclidean distance. Mahalanobis distance accounts for the correlations between different spectral features, providing a more accurate measure of similarity in the high-dimensional feature space.

3. Graph-Weighted Contrastive Loss

The core of the framework is the Graph-Weighted Contrastive Loss. Derived from the lower bound of Mutual Information, this loss function moves beyond binary adjacency (connected vs. disconnected). It uses continuous similarity scores ($s_{ij}$) from the graph to weight the contrastive loss. By applying "soft" weights, the model prioritizes high-confidence connections and becomes more robust against the noise typically found in HSI data.

4. Efficient Mini-batch Training

One of the primary hurdles for pixel-level graph models is memory consumption. GWCL overcomes this by decoupling the graph structure from the neural network architecture. By using the pre-calculated graph weights to guide a two-layer multilayer perceptron (MLP), the model supports standard mini-batch training. This allows the framework to scale to large datasets that would otherwise exceed GPU memory limits if processed as a single graph convolution.

Experimental Results

The GWCL model was evaluated on three standard HSI benchmarks using a challenging semi-supervised setup (only 30 labeled pixels per class):

  • Indian Pines: This dataset is known for its irregular field shapes, which often cause superpixel-based methods to fail. GWCL achieved an Overall Accuracy (OA) of 98.81%, significantly outperforming the next best method, ConGCN (96.5%).
  • Salinas Valley: The model reached a near-perfect 99.93% OA, demonstrating its ability to handle large-scale agricultural scenes with high precision.
  • University of Pavia: In this urban environment dataset, GWCL achieved 97.38% OA, highlighting its versatility across different land-cover types.

Qualitative analysis of the classification maps shows that GWCL produces significantly cleaner boundaries and fewer "salt-and-pepper" noise artifacts compared to traditional methods. By treating every pixel as an individual node, the model successfully avoids the label leakage inherent in superpixel partitioning.

Discussion and Future Work

The success of GWCL stems from its ability to bridge the gap between pixel-level accuracy and computational efficiency. By replacing hard superpixel boundaries with soft graph weights and leveraging contrastive learning, the model provides a more flexible and robust representation of HSI data.

While the current model uses a fixed pre-constructed graph, future research will explore dynamic graph learning, where the graph structure is updated iteratively as the model learns more discriminative features. Additionally, the authors plan to integrate more complex Graph Neural Network (GNN) encoders to further capture the intricate spatial-spectral dependencies within hyperspectral imagery.

Summary updated

BibTeX
@article{zhang2025graph,
  author = {Yuqing Zhang and Qi Han and Ligeng Wang and Kai Cheng and Bo Wang and Kun Zhan},
  title = {{Graph-weighted contrastive learning for semi-supervised hyperspectral image classification}},
  journal = {J. Electronic Imaging},
  year = {2025},
  doi = {10.1117/1.jei.34.2.023044},
}
Figure