Supervised contrastive loss helps uncover more robust features for photoacoustic prostate cancer identification

Front Oncol 2025 AI 6 Explanations View Original
Original Paper (PDF)

Unable to display PDF. Download it here or view on PMC.

Plain-English Explanations
Pages 1-2
Photoacoustic Spectral Analysis as a Non-Invasive Prostate Cancer Tool

Prostate cancer accounts for 29% of all new male cancer diagnoses and remains difficult to detect accurately using current clinical methods. Digital rectal examination has sensitivity below 40%, PSA testing is organ-specific rather than cancer-specific, and MRI provides high sensitivity but poor real-time performance and moderate specificity. There remains a clinical need for non-invasive, real-time diagnostic approaches that can complement or reduce dependence on invasive tissue biopsy.

Photoacoustic spectral analysis is a technique that combines the molecular specificity of optical absorption with the tissue-penetrating capability of ultrasound detection. When pulsed laser light is absorbed by biological tissue, it generates ultrasound waves that can be detected and analyzed. Unlike imaging-based photoacoustics, spectral analysis examines how the frequency content of these signals changes across multiple light wavelengths, capturing information about tissue chemical composition and structural heterogeneity.

Prostate cancer changes the chemical composition of tissue, particularly affecting collagen and lipid content, and alters structural heterogeneity at the cellular level. Multi-wavelength photoacoustic spectroscopy can capture these changes through variations in the power spectrum's slope and intercept across wavelengths from 690 to 950 nm and 1200 to 1690 nm. Prior work demonstrated that photoacoustic spectral analysis can distinguish prostate cancer from normal tissue in both needle biopsy specimens and intact ex vivo prostate tissue.

A fundamental challenge in applying deep learning to photoacoustic spectral analysis is the high dimensionality of the data combined with small sample sizes. Each measurement produces a 77 by 90 matrix of spectral features, yet collecting sufficient labeled tissue samples is inherently difficult. Additionally, individual patient variability and differences between photoacoustic acquisition systems create data heterogeneity that can reduce model performance. This study specifically addressed these challenges using supervised contrastive learning.

TL;DR: Photoacoustic spectral analysis can detect prostate cancer-related tissue changes non-invasively, but small datasets, patient variability, and system differences challenge reliable deep learning classification.
Pages 2-4
Supervised Contrastive Learning: Pulling Similar Samples Together

Contrastive learning is a machine learning approach that trains models to cluster similar samples close together and push dissimilar samples apart in a learned feature space, rather than directly learning classification boundaries. This encourages the model to extract features that are consistent across variations of the same class, making representations more robust to noise and distributional shifts. Supervised contrastive learning extends this by using class labels to prevent false groupings between samples from different classes.

Three model architectures were compared in this study. The CNN baseline model uses a two-layer convolutional neural network with 2D kernels trained with cross-entropy loss for direct classification. The SC model performs two-stage training: first learning compressed representations using only supervised contrastive loss, then training a classifier using cross-entropy loss on the frozen representations. The SCL-adjust model is architecturally identical to the CNN but adds supervised contrastive loss to the training objective as a weighted combination: SCL times the ratio plus cross-entropy loss times (1 minus the ratio).

Data were collected from 22 patients (12 from the first photoacoustic system, 10 from a second system with different laser energy calibration). Signals were acquired at 77 wavelengths per point, producing the 77 by 90 feature matrix. Critically, data were split by individual patient rather than randomly shuffled, ensuring no individual's data appears in both training and test sets. This patient-level splitting prevents leakage and provides a more realistic evaluation of performance on new patients.

All three models were optimized using stochastic gradient descent, with hyperparameters including learning rate, batch size, momentum, and loss weighting ratio determined through 500 rounds of random parameter search. The optimal SCL-to-cross-entropy ratio for the SCL-adjust model was 0.3:0.7, meaning 30% of the loss comes from contrastive learning and 70% from classification. This balance preserves the feature-clustering benefits of contrastive learning while maintaining strong classification performance.

TL;DR: The SCL-adjust model combines a CNN backbone with supervised contrastive loss at a 30/70 weighting ratio, training on patient-level split photoacoustic spectral data collected from two distinct acquisition systems.
Pages 10-11
SCL-Adjust Outperforms All Comparison Methods

Compared to conventional signal-processing methods using photoacoustic slope and median parameters at characteristic wavelengths, the deep learning models demonstrated substantially superior performance. Traditional single-parameter methods achieved accuracies of 0.40-0.60 and AUCs of 0.57-0.65. Machine learning methods including Linear Discriminant Analysis (LDA) and Quadratic Discriminant Analysis (QDA) improved to accuracies of 0.64-0.72 and AUCs of 0.70-0.78. The baseline CNN model achieved accuracy of 0.71 and AUC of 0.90.

The SCL-adjust model achieved the best overall performance with accuracy of 0.81, precision of 0.89, recall of 0.69, specificity of 0.88, and AUC of 0.91. This represents a greater than 10% improvement in accuracy over conventional signal-processing methods as stated in the study objectives. Compared to the CNN baseline, the SCL-adjust model's recall (sensitivity for detecting cancer) improved from 0.54 to 0.69, reducing the missed diagnosis rate. The composite score across all five metrics was 0.85 for SCL-adjust versus 0.78 for the CNN and 0.80 for LDA.

The SC model (two-stage contrastive training) showed slightly higher feature clustering scores but was more affected by noise perturbations than the SCL-adjust model. When samples from the test set were artificially perturbed with uniform or Gaussian noise at levels 10 times the signal amplitude, the CNN model showed marked accuracy degradation and many misclassifications. The SCL-adjust model maintained better stability under both noise types, confirming that its feature representations are more robust to the kind of variability encountered in real clinical settings.

Silhouette scores, which measure how well samples cluster by class in the feature space, confirmed that both contrastive learning models improved feature distribution compared to the CNN alone. Higher silhouette scores indicate tighter intra-class grouping and better inter-class separation, which corresponds directly to improved discrimination ability and noise resistance. The advantage of the SCL-adjust model over the SC model in noise conditions is attributed to its simultaneous optimization of both contrastive and classification objectives, rather than sequential independent training.

TL;DR: The SCL-adjust model achieved 81% accuracy and AUC of 0.91 for photoacoustic prostate cancer identification, improving over traditional methods by more than 10% and showing superior noise resistance to CNN-only baselines.
Pages 11, 13
Cross-System Transfer Performance

A key practical challenge for photoacoustic diagnostic tools is whether models trained on data from one acquisition system can generalize to data from a different system. The two systems in this study used different laser energy calibration approaches (blackbody calibration versus outgoing laser energy profile calibration), which produced substantially different raw data distributions even though the fundamental physics of tissue acquisition were identical.

When the CNN model was applied to data from the second system after training on the first system, its composite score dropped by 15.7% (from 0.826 to 0.696). The SCL-adjust model showed a smaller performance drop of 10.4% (from 0.882 to 0.790), a roughly 5 percentage point improvement in transfer robustness. This demonstrates that the contrastive learning-based feature representation is more system-agnostic than features learned through standard classification training alone.

UMAP dimensionality reduction visualizations of the raw data confirmed a pronounced distributional difference between the two systems even before any processing. The SCL-adjust model's improved cross-system transfer suggests it learned features tied to the underlying biology rather than to system-specific technical patterns in the data, which is the desired behavior for any diagnostic tool intended for multi-center clinical deployment.

The authors note that the transfer tested here is not formal transfer learning in the machine learning sense, but rather direct application of a model trained on system 1 to data from system 2 without any fine-tuning. Formal transfer learning through model fine-tuning or feature-domain adaptation on small amounts of target-system data represents the next development step and would likely reduce the transfer performance gap further.

TL;DR: The SCL-adjust model reduced cross-system performance decline from 15.7% to 10.4% compared to the CNN baseline, demonstrating more generalizable features that are less dependent on system-specific calibration differences.
Pages 14-16
Small Sample Challenges and Next Steps

The fundamental challenge throughout this work is the small sample problem. Although 107 measurement sites were collected from 22 patients, the photoacoustic spectrum at each site is a 77 by 90 dimensional data matrix. In high-dimensional space, this remains a small-sample problem where overfitting is a persistent risk. The two-layer CNN architecture was specifically chosen to limit model complexity relative to the available data, and all hyperparameters were carefully optimized through random search with validation-set evaluation.

Patient-level individual variability is a second major challenge. Different patients have different baseline tissue compositions, and the same tissue type from different patients can produce measurably different photoacoustic spectra. The supervised contrastive loss addresses this by training the model to find features that are invariant to within-class variability while remaining sensitive to between-class differences, which is precisely the kind of robustness needed for clinical deployment across diverse patient populations.

System-level variability compounds patient variability. The two acquisition systems in this study differed only in their energy calibration approach, yet this single difference produced statistically distinct data distributions visible in UMAP visualization. Clinical deployment across hospitals would involve even greater variation in laser systems, transducer responses, and experimental protocols. The improved cross-system transfer of the SCL-adjust model is therefore clinically significant, though further validation across more systems is needed.

The authors identify two primary directions for future work: feature reduction and data augmentation strategies appropriate for high-dimensional small-sample photoacoustic data, and formal transfer learning to facilitate model adaptation across acquisition systems. The multispectral nature of the data also makes it amenable to multimodal analysis approaches that could extract complementary information from different spectral ranges simultaneously.

TL;DR: Small sample sizes, patient variability, and system-level differences are the central challenges for photoacoustic prostate cancer diagnosis, all of which supervised contrastive learning partially addresses through more robust feature representations.
Page 16
Toward Robust Photoacoustic Prostate Cancer Diagnosis

This study demonstrated that incorporating supervised contrastive loss into photoacoustic spectral analysis improves prostate cancer classification accuracy by more than 10% over traditional signal-processing methods and reduces cross-system performance degradation by approximately 5% compared to conventional CNN training. The SCL-adjust architecture, which adds contrastive loss to the CNN training objective without increasing model complexity, was identified as the optimal approach for this small-sample high-dimensional diagnostic problem.

The clinical motivation for this work is compelling. Photoacoustic spectral analysis provides real-time, non-invasive tissue characterization with the sensitivity of 81.3% and specificity of 96.2% reported for photoacoustic imaging methods. If the diagnostic accuracy of deep learning-enhanced spectral analysis can approach that of MRI with better real-time performance, it could offer a clinically useful complement to existing prostate cancer diagnostic tools, particularly for intraoperative or biopsy-guidance applications.

The study was conducted on ex vivo prostate tissue samples from patients undergoing surgical resection, which represents a controlled but not fully in vivo clinical setting. Translation to in vivo transrectal or transperineal photoacoustic diagnosis would require adaptation of the methods to the different signal characteristics of in vivo tissue, additional validation in larger cohorts, and integration with clinical biopsy guidance workflows.

The availability of the model code in supplementary materials facilitates replication and extension by other research groups. The broader principle established here, that supervised contrastive learning improves robustness in high-dimensional small-sample biomedical classification problems, is likely transferable to other spectroscopic cancer diagnostics beyond prostate cancer where similar challenges of data scarcity and system variability apply.

TL;DR: Supervised contrastive learning integrated into photoacoustic spectral analysis achieves over 10% accuracy improvement for prostate cancer identification with improved noise resistance and cross-system generalizability, pointing toward a clinically deployable non-invasive diagnostic tool.
Citation: Open Access, . Available at: PMC12283269.