A self-supervised learning method for Raman spectroscopy based on masked autoencoders

Pengju Ren, Ri-Gui Zhou, Yaochong Li

Introduction

Raman spectroscopy serves as a powerful "molecular fingerprinting" tool, enabling the identification of substances through light scattering patterns. It is particularly valuable in clinical settings for pathogen identification and tissue analysis. However, the application of deep learning to this field faces two significant challenges: the "data hunger" of supervised models, which require vast amounts of expertly labeled data, and the inherent weakness of Raman signals, which are often obscured by noise.

To address these issues, researchers have developed SMAE (Spectral Masked Autoencoder), a self-supervised learning framework. By shifting from supervised learning to a self-supervised approach, the model learns the underlying logic of spectral data using raw, unlabeled spectra, effectively mastering chemical feature extraction without the need for massive labeled datasets.

Methodology

The SMAE framework is based on the Masked Autoencoder architecture, adapted for one-dimensional spectral data. The workflow is divided into two primary phases:

  1. Self-Supervised Pre-training: The model is presented with a raw Raman spectrum where 50% of the data is randomly masked. A Transformer-based encoder processes only the visible patches, while a lightweight decoder attempts to reconstruct the entire original signal. This "fill-in-the-blanks" task forces the model to learn the correlations between different spectral peaks—essentially the "grammar" of chemical bonds.
  2. Downstream Fine-tuning: After pre-training, the decoder is removed. The encoder’s learned weights are then fine-tuned using a small amount of labeled data for specific tasks, such as bacterial strain identification.
The SMAE architecture: (a) Self-supervised pre-training via spectral masking and reconstruction; (b) Fine-tuning for downstream classification; (c) Detailed view of the Spectral Encoder and Decoder blocks.

Experimental Design and Datasets

The study utilized two primary public datasets to validate the framework:

  • Bacteria-ID: This dataset contains Raman spectra for 30 common pathogenic bacteria. It includes 60,000 spectra for unlabeled pre-training, and smaller sets (3,000 each) for fine-tuning and testing.
  • MDA-MB-231: A breast cancer cell dataset containing over 172,000 spectral pairs, used specifically to evaluate the model's signal denoising capabilities.

Key Results and Insights

Superior Feature Extraction

In unsupervised clustering tasks, SMAE achieved an accuracy of 80.56% for 30 bacterial species, significantly outperforming traditional methods like PCA (19.97%) and specialized deep clustering methods like RamanCluster (77.0%). When fine-tuned with limited labels, SMAE reached an identification accuracy of 83.90%, surpassing a standard supervised ResNet (83.40%) trained on the same data.

Accidental Denoising

A striking finding was the model's inherent denoising capability. Because the reconstruction process focuses on essential chemical features, it naturally filters out random electronic noise. This resulted in an improvement of the Signal-to-Noise Ratio (SNR) by more than twofold.

Comparison of original, masked, and reconstructed Raman spectra, demonstrating the model's ability to recover hidden chemical features through learned correlations.

Scalability and Robustness

As the complexity of the task increased (e.g., increasing the number of bacterial species from 4 to 10), SMAE maintained higher accuracy and Normalized Mutual Information (NMI) than its competitors, proving its robustness for real-world diagnostic applications.

Conclusion and Future Work

SMAE represents a significant advancement in Raman spectroscopy analysis, providing a label-efficient method for high-accuracy classification and signal enhancement. While highly effective, the model's performance is sensitive to hyperparameters like patch size and masking ratio. Future research will explore the generalization of SMAE to other one-dimensional data types, such as Near-Infrared (NIR) spectroscopy, and investigate the computational efficiency required for real-time clinical deployment.

Summary updated

BibTeX
@article{ren2025self,
  author = {Pengju Ren and Ri-Gui Zhou and Yaochong Li},
  title = {{A self-supervised learning method for Raman spectroscopy based on masked autoencoders}},
  journal = {Expert Systems with Applications},
  year = {2025},
  doi = {10.1016/j.eswa.2025.128576},
}
Figure