A Universal Knowledge Embedded Contrastive Learning Framework for Hyperspectral Image Classification

Quanwei Liu, Yanni Dong, Tao Huang, Lefei Zhang, Bo DuarXiv 2024 · DOI · arXiv

Introduction

Hyperspectral image (HSI) classification is a critical task in remote sensing, enabling the identification of materials based on their unique spectral signatures. However, the field has long been constrained by three primary challenges: the prevalence of small, custom-built "pocket models" that fail to leverage modern vision backbones; unrealistic evaluation protocols using random pixel-wise sampling that lead to spatial data leakage; and the high cost of expert labeling.

To address these issues, we present KnowCL (Knowledge Embedded Contrastive Learning), a unified framework that bridges the gap between specialized HSI models and standard vision architectures like Vision Transformers (ViT) and ResNets, while ensuring robust generalization through realistic data partitioning.

The KnowCL Framework

KnowCL integrates supervised, unsupervised, and semi-supervised learning into a single, scalable architecture. The framework is designed to extract invariant representations from unlabeled data while simultaneously utilizing task-specific knowledge from labeled samples.

The KnowCL framework architecture, illustrating the data processing pipeline, dual-head encoder, multi-task loss, and predictor modules.

Core Components

  1. Realistic Data Pipeline: KnowCL employs a disjoint sampling strategy to ensure training and test sets are spatially separated, preventing inflated accuracy scores. It also utilizes spectral grouping and PCA for efficient dimensionality reduction.
  2. Dual-Head Encoder: A shared backbone (e.g., ViT or ResNet) feeds into two distinct heads: a supervised head for classification and a contrastive head for learning robust features from augmented views of the data.
  3. Adaptive Multi-Task Loss: Instead of manual hyperparameter tuning, the framework uses a learnable weighting scheme to balance supervised and unsupervised losses dynamically during training.
  4. Domain-Specific Augmentation: Standard augmentations like cropping, flipping, and Gaussian blur are adapted for HSI to help the contrastive head learn features invariant to spatial and spectral noise.

Experimental Results and Discussion

The framework was evaluated on four major HSI benchmarks: University of Pavia (UP), Salinas, Dioni, and DFC2018. In all cases, KnowCL consistently outperformed state-of-the-art (SOTA) methods, particularly in semi-supervised settings where labeled data is scarce.

Scaling with Standard Backbones

A key insight from our study is that HSI classification does not require specialized "pocket" architectures. When trained within the KnowCL framework, standard vision backbones demonstrate superior performance and clear scalability.

Performance comparison (Overall Accuracy vs. Number of Parameters) showing KnowCL variants using standard backbones outperforming traditional HSI models.

As shown in the figure above, KnowCL-hsi (using a ViT backbone) achieves higher accuracy than traditional models like DFFN and SPNR while maintaining a competitive parameter count. Furthermore, the framework exhibits a positive scaling trend; as the backbone size increases (from ViT-tiny to ViT-hsi), the classification performance improves, a behavior often absent in custom HSI models.

Key Performance Metrics

  • Supervised Learning: On the UP dataset, KnowCL achieved 86.27% Overall Accuracy (OA) under disjoint sampling.
  • Semi-Supervised Learning: KnowCL reached 91.36% OA on UP and 93.62% OA on Salinas, significantly outperforming recent Graph Neural Network (GNN) approaches.
  • Efficiency: The framework is highly efficient, reaching SOTA performance on the Dioni dataset in under 18 seconds of training time.

Conclusion

KnowCL demonstrates that by embedding task-specific knowledge into a contrastive learning framework, we can move away from fragile, specialized HSI models toward robust, general-purpose vision backbones. This shift not only improves classification accuracy but also paves the way for the development of HSI foundation models pre-trained on massive, unlabeled satellite datasets.

Summary updated

Abstract

Hyperspectral image (HSI) classification techniques have been intensively studied and a variety of models have been developed. However, these HSI classification models are confined to pocket models and unrealistic ways of dataset partitioning. The former limits the generalization performance of the model and the latter is partitioned leading to inflated model evaluation metrics, which results in plummeting model performance in the real world. Therefore, we propose a universal knowledge embedded contrastive learning framework (KnowCL) for supervised, unsupervised, and semisupervised HSI classification, which largely closes the gap between HSI classification models between pocket models and standard vision backbones. We present a new HSI processing pipeline in conjunction with a range of data transformation and augmentation techniques that provide diverse data representations and realistic data partitioning. The proposed framework based on this pipeline is compatible with all kinds of backbones and can fully exploit labeled and unlabeled samples with the expected training time. Furthermore, we design a new loss function, which can adaptively fuse the supervised loss and unsupervised loss, enhancing the learning performance. This proposed new classification paradigm shows great potential in exploring for HSI classification technology. The code can be accessed at \url{https://github.com/quanweiliu/KnowCL}.
BibTeX
@misc{liu2024universal,
  author = {Quanwei Liu and Yanni Dong and Tao Huang and Lefei Zhang and Bo Du},
  title = {{A Universal Knowledge Embedded Contrastive Learning Framework for Hyperspectral Image Classification}},
  year = {2024},
  eprint = {2404.01673},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.01673},
}
Figure