Abstract
Loquat (Eriobotrya japonica) is a commercially important subtropical fruit, and its internal sweetness is an important indicator of market quality. Accurate and non-destructive determination of total soluble solids content (TSSC) is therefore essential for fruit grading and quality evaluation. In this study, short-wave infrared hyperspectral imaging (1000–2400 nm) was combined with a multi-scale spectral attention adaptive convolutional neural network (MSSA-ACNN) for rapid TSSC prediction. Spectral data were preprocessed using an SG-MSC-DT strategy to reduce noise and scattering effects, while conventional models (PLSR, Ridge, and SVM) were used for comparison. The proposed model combines multi-scale feature extraction with a dual-path attention mechanism, enabling adaptive enhancement of informative chemical wavebands while suppressing irrelevant variations. Experimental results, rigorously validated through a 5-fold cross-validation strategy, demonstrated that the proposed approach achieved the best predictive performance, with an Rp2 of 0.942, RMSEP of 0.505, and RPD of 3.091, outperforming traditional methods. In addition, attention weight analysis revealed that the model mainly focused on spectral regions associated with water and carbohydrate absorption, indicating consistency between the learned features and known chemical information. These results suggest that the proposed method provides an effective and interpretable approach for non-destructive evaluation of loquat quality and shows potential for application in intelligent fruit grading systems.
1. Introduction
Loquat (Eriobotrya japonica) is a commercially important subtropical fruit rich in vitamins, minerals, polyphenols, and antioxidant compounds. Total Soluble Solids Content (TSSC) is one of the most important indicators of internal fruit quality because it is closely related to sweetness, maturity, and consumer acceptance [1,2,3,4]. Conventional methods for TSSC determination mainly rely on destructive techniques, such as refractometry or physicochemical titration. These approaches are not only labor-intensive and prone to manual operational errors but also result in irreversible sample loss. Consequently, they fail to meet the urgent demands for high-throughput, real-time, and online quality grading in modern fruit and vegetable supply chains [5]. Therefore, exploring a rapid, precise, and non-destructive detection technology for loquat TSSC is of profound practical significance for enhancing the added value and automation level of the loquat industry.
In recent years, Near-Infrared Spectroscopy (NIRS) and Hyperspectral Imaging (HSI) have been widely applied in agricultural quality evaluation because of their non-destructive, efficient, and reagent-free characteristics [6,7]. By integrating spectral and spatial information, HSI facilitates the acquisition of characteristic signals correlated with chemical compositions across multiple wavebands, thereby enabling the non-invasive prediction of internal physicochemical parameters in fruits. Existing studies have demonstrated the promising potential of HSI in predicting TSSC across various horticultural crops. Successful applications have been reported for fruits such as kiwifruit, tomato, apple, citrus, and strawberry [8,9,10,11,12], further validating the robust correlation between spectral information and internal fruit quality.
Focusing on loquat, the academic community has conducted explorations across multiple dimensions. Regarding external quality monitoring, HSI has been employed to identify early mechanical damage, diseases, and the degree of lignification, successfully monitoring the patterns of firmness evolution and chilling injury during postharvest storage [13]. In terms of internal quality prediction, rapid estimation of loquat TSSC has been preliminarily achieved using NIRS combined with traditional chemometric methods [14].
However, further improvement in prediction accuracy and model generalization remains severely constrained by several factors. First, traditional machine learning methods rely heavily on manual feature engineering; such shallow extraction based on linear assumptions struggles to fully capture the complex nonlinear relationships between spectral signals and chemical compositions. Second, although Deep Learning (DL) represented by Convolutional Neural Networks (CNN)—has demonstrated a definitive advantage in end-to-end feature extraction [15], agricultural product detection frequently encounters the classic challenge of “high noise-small sample size [16]. The edge effects of hyperspectral instruments in the long-wave near-infrared region, coupled with the physical variations of individual loquats (e.g., baseline shifts and physical scattering), introduce substantial non-chemically related noise. Traditional 1D-CNNs, when processing such non-stationary signals, often struggle to distinguish authentic chemical absorption signals from background interference, thereby limiting the model’s robustness on unseen datasets.
With the aim of enhancing model robustness in high-noise environments, researchers have begun exploring the application of Attention Mechanisms in spectral analysis. These mechanisms facilitate the adaptive allocation of weights, enabling the model to focus on feature segments highly correlated with chemical components [17,18]. However, single-scale feature extraction often leads to the loss of critical information, thereby limiting further improvements in model performance.
Existing studies are still constrained by spectral redundancy, insufficient modeling of spatial–spectral interactions, and the limited interpretability of deep learning-based approaches, which jointly hinder further improvements in prediction accuracy and model generalization. To address these core challenges, this study proposes a Multi-Scale Spectral Attention Adaptive Convolutional Neural Network (MSSA-ACNN) for the non-destructive prediction of loquat TSSC. The model utilizes a multi-scale feature extraction module, employing parallel convolutional kernels of varying sizes to achieve the hierarchical modeling of spectral sequences. Building upon this foundation, an MSSA mechanism is explicitly introduced. Through a dynamic weight recalibration strategy, MSSA adaptively amplifies key informative wavebands while effectively suppressing background noise and redundant interference. Furthermore, the learned attention weights are visualized and systematically mapped to the characteristic absorption bands of organic functional groups. This not only enhances the interpretability of the deep learning architecture but also substantiates the physical credibility of the proposed model.
2. Materials and Methods
2.1. Sample Collection
The loquat specimens (Eriobotrya japonica cv. ‘Dawuxing’) used in this study were harvested from a commercial orchard in Miyi County, Sichuan Province, as illustrated in Figure 1. To establish a representative gradient of sugar content, fruit samples were collected at 10-day intervals beginning on 20 March 2026. For each harvest, 100 loquats characterized by uniform size, freshness, and intact pericarps were selected, resulting in a total experimental cohort of 300 specimens. The weight of individual fruits was controlled within the range of 20 to 30 g.
Figure 1.
Geographic location of Miyi County and the loquat orchard environment. (a) Map showing the sampling site (☆) in Miyi County, Panzhihua, Sichuan, China; (b) Representative view of the loquat orchard.
Following harvest, all samples were transported to the laboratory within 48 h. Prior to spectral acquisition, the fruits were equilibrated in a controlled environment at 25 °C for 8 h to minimize physiological variability and environmental interference, ensuring measurement consistency and repeatability.
2.2. HSI Acquisition and Calibration
The raw hyperspectral images of the samples were acquired using a Gaia Sorter hyperspectral screening system (Dualix Spectral Imaging, Wuxi, China). This system is equipped with dual imaging modules: a Visible and Near-Infrared (Vis-NIR, 400–1000 nm) sensor and a Short-Wave Infrared (SWIR, 1000–2500 nm) sensor (as illustrated in Figure 2). The device has a dark box, so the internal structure of the dark box is shown in Figure 2b. Given that this study focuses exclusively on the extraction of SWIR spectral data, only the SWIR camera was activated for data acquisition. For visual clarity, the inactive Vis-NIR module is indicated by a dashed box in Figure 2b.
Figure 2.
The HSI acquisition system. (a) External view of the system; (b) Schematic of the internal optical layout highlighting the active SWIR module and the inactive Vis-NIR module (dashed box).
System parameters, including exposure time and conveyor speed, are summarized in Table 1. To eliminate non-uniform illumination and sensor dark current, radiometric calibration was performed using black–white correction. A white reference image () was obtained using a standard Teflon board (Dualix Spectral Imaging, Wuxi, China), while a dark reference image () was captured by covering the lens under a closed light source. The calibrated reflectance image was computed as:
Table 1.
Main hardware specifications and acquisition parameters of the HSI system.
2.3. TSSC Measurement
TSSC was measured using a digital refractometer (PAL-1, ATAGO Co., Ltd., Tokyo, Japan) based on the principle of optical refraction, with a measurement accuracy of ±0.2 °Brix. TSSC measurements were conducted immediately after hyperspectral image acquisition to maintain consistency between the spectral data and physicochemical properties. The distribution of TSSC values for the 300 loquat samples is shown in Figure 3.
Figure 3.
Distribution of TSSC values for the 300 loquat samples. Blue bars represent the frequency distribution, the blue line indicates the kernel density estimate, and the red dashed line marks the mean TSSC value.
For TSSC determination, the fruits were peeled and deseeded, and the pulp was homogenized and filtered to obtain juice samples. The extracted juice was then placed on the refractometer sensor for measurement. Each sample was measured three times, and the average value was used as the final TSSC result. The measured TSSC values ranged from 5.2 to 15.0 °Brix.
2.4. Dataset Partitioning and Statistical Analysis
To ensure that the established predictive model possesses robust representativeness and generalization capability, the Sample set Partitioning based on joint X-Y distance (SPXY) algorithm [19] was employed to partition the 300 loquat specimens. Distinct from conventional random partitioning methods, the SPXY algorithm ensures the uniformity of the training set distribution by integrating the Euclidean distances within both the spectral feature space () and the physicochemical attribute space ().
The core computational logic involves calculating the characteristic distance () and the concentration distance () between samples:
Subsequently, the joint distance () is derived via maximum normalization:
Based on this algorithm, the 300 samples were partitioned into a training set (255 samples) and a test set (45 samples) at a ratio of 85:15. The statistical results for the TSSC within these datasets are summarized in Table 2. Furthermore, to ensure the statistical reliability of the model and to mitigate potential bias arising from the limited sample size, a 5-fold cross-validation strategy was implemented. This additional validation provides a more comprehensive assessment of the model’s stability and generalization capability.
Table 2.
Loquat samples TSSC distribution of the calibration set and prediction set.
2.5. Data Preprocessing Methods
In hyperspectral analysis, raw spectral signals are often affected by physical interferences, including baseline drift caused by the curved surface of loquat fruits and high-frequency noise introduced by detector fluctuations. To reduce the influence of these non-chemical factors, several spectral preprocessing methods were applied in this study [20]. Specifically, Savitzky–Golay (SG) smoothing was applied to filter random noise while preserving spectral morphology. Standard Normal Variate (SNV) or Multiplicative Scatter Correction (MSC) were utilized to eliminate scattering effects and optical path variations. Finally, De-trending (DT) was employed to rectify nonlinear baseline offsets. This integrated approach ensures a robust and purified data foundation for the subsequent feature extraction by the MSSA-ACNN model.
2.6. Feature Wavelength Selection Methods
To mitigate the high dimensionality and collinearity of hyperspectral data, four representative wavelength selection algorithms were applied. Successive Projections Algorithm (SPA) [21] minimized redundancy by identifying variables with the lowest collinearity through vector projection. Competitive Adaptive Reweighted Sampling (CARS) [22] prioritized wavebands with significant regression coefficients via a “survival of the fittest” strategy. Uninformative Variable Elimination (UVE) targeted noisy variables based on the stability of PLS coefficients, while Random Frog (R-Frog) [23] evaluated selection probabilities through a reversible jump Markov Chain Monte Carlo framework. By comparing these different wavelength selection strategies, traditional machine learning models with optimized feature subsets were established as benchmark models for evaluating the performance of the proposed MSSA-ACNN framework.
2.7. Machine Learning Modeling Methods
To evaluate the performance of the proposed MSSA-ACNN model, three representative chemometric methods, including Partial Least Squares Regression (PLSR), Support Vector Regression (SVR), and Ridge Regression (Ridge), were selected as benchmark models.
2.7.1. Partial Least Squares Regression (PLSR)
PLSR is the most established linear modeling method in hyperspectral quantitative analysis. It simultaneously decomposes the spectral matrix and the physicochemical matrix to extract Latent Variables (LVs) that maximize the covariance between them, thereby addressing the issue of multicollinearity among bands [24]. The fundamental linear model is defined as:
where denotes the matrix of regression coefficients and represents the residual matrix. By integrating the advantages of Principal Component Analysis (PCA) and Multiple Linear Regression (MLR), PLSR serves as the primary baseline for evaluating the precision of spectral models.
2.7.2. Support Vector Regression (SVR)
SVR is a robust modeling approach grounded in statistical learning theory. It maps low-dimensional spectral data into a high-dimensional feature space via a nonlinear mapping function, where an optimal hyperplane is constructed. The objective function is formulated as:
where is the penalty factor and , are slack variables. In this study, the Radial Basis Function (RBF) was employed as the kernel to effectively resolve the complex nonlinear mapping relationship between loquat spectra and TSSC [25].
2.7.3. Ridge Regression (Ridge)
Ridge is a regularized linear estimation technique specifically designed to mitigate the adverse effects of multicollinearity among spectral variables. By incorporating an penalty term into the Ordinary Least Squares (OLS) objective function, it effectively constrains the magnitude of regression coefficients to enhance model stability:
where is the regularization parameter controlling the penalty intensity. In high-dimensional hyperspectral analysis, Ridge trades a small amount of bias for a substantial reduction in variance, significantly suppressing overfitting caused by highly correlated adjacent bands. Consequently, it serves as a robust linear benchmark for evaluating the efficacy of feature selection strategies in this study.
For the traditional machine learning regression models, to prevent manual overfitting and maintain a fair baseline, standard configurations were adopted: PLSR utilized 10 latent variables, Ridge used a default regularization parameter (), and the SVR model employed an RBF kernel with default auto-scaled penalty () and kernel () parameters provided by the algorithmic libraries. These standardized settings ensure a reliable reference for evaluating the proposed deep learning framework.
2.8. Proposed MSSA-ACNN
This study proposes an end-to-end deep learning framework, designated as MSSA-ACNN, specifically engineered for the high-precision hyperspectral analysis of loquat TSSC (as illustrated in Figure 4). The model combines the nonlinear feature extraction capability of one-dimensional convolutional neural networks (1D-CNNs) with an attention mechanism to automatically learn informative spectral features from full-spectrum data.
Figure 4.
Schematic diagram of the MSSA-ACNN model. (a) The main network architecture for TSSC pre-diction. (b) Detailed design of the MSSA mechanism. (c) Components of the basic 1D-Conv block.
The front-end of the network functions as a multi-scale feature extractor. As illustrated in Figure 4a, it utilizes three parallel convolutional blocks with varying kernel sizes (k = 7, 5, 3) to adaptively capture chemical absorption characteristics across different spectral bandwidths. This multi-scale approach ensures a comprehensive representation of both broad and narrow spectral features [26]. Following this, an Adaptive Max Pooling (AMP) layer is implemented as a spatial bottleneck to reduce data dimensionality while effectively preserving the most discriminative spectral responses.
The primary innovation of the framework is the MSSA module (Figure 4b), which is fundamentally inspired by the Squeeze-and-Excitation (SE) strategy [27]. To address the high-noise and non-stationary nature of hyperspectral signals, the MSSA module integrates parallel Global Average Pooling (GAP) and Global Max Pooling (GMP) pathways. This dual-pathway approach allows the model to simultaneously perceive global profile trends and local characteristic absorption peaks. The synergy between these pathways, refined by a 1 × 1 convolutional excitation layer, generates dynamic weights that recalibrate the importance of each spectral band. Consequently, the model adaptively focuses on critical chemical wavebands while suppressing redundant background interference. This design significantly enhances the model’s sensitivity to subtle spectral perturbations, ultimately leading to superior predictive performance and enhanced robustness. The detailed model hyperparameters and training configurations are summarized in Table 3.
Table 3.
Main hyperparameters and training configurations for the MSSA-ACNN model.
Spectral preprocessing and ROI extraction were performed using HyperScan Pro 1.2.4 (Dualix Spectral Imaging, Wuxi, China). All machine-learning and deep-learning models were implemented in Python 3.10 using the Scikit-learn 1.7.2 and PyTorch 2.2.2 libraries. Model training and evaluation were conducted on a workstation equipped with an NVIDIA GeForce RTX 4090 GPU.
2.9. Performance Evaluation Metrics
To objectively evaluate the predictive performance of different models for loquat TSSC, this study selected the coefficient of determination for calibration (Rc2), the coefficient of determination for prediction (Rp2), the root mean square error of calibration (RMSEC), the root mean square error of prediction (RMSEP), and the residual predictive deviation (RPD) as core performance indicators.
The coefficient of determination (R2) measures the degree of correlation between the predicted and measured values; a value closer to 1 indicates a higher goodness-of-fit. The formula is as follows:
The RMSE quantifies the absolute deviation between predicted and measured values, where a smaller value signifies higher predictive accuracy. RMSEC evaluates the model’s fitting capability during the training phase, while RMSEP assesses the generalization performance on unknown samples. The formula is defined as:
The RPD is a critical metric for assessing model robustness, defined as the ratio of the standard deviation (SD) of the sample set to the RMSEP. It is calculated as:
Generally, a model is considered to have preliminary predictive capability when 1.4 < RPD < 2.0. An RPD value such that 2.0 < RPD < 3.0 indicates good predictive performance, while an RPD > 3.0 suggests that the model possesses excellent robustness and high practical application value.
3. Results and Discussion
3.1. Region of Interest (ROI) Extraction
The entire fruit surface was defined as the Region of Interest (ROI). The image at 1200 nm, which provided the highest contrast between the fruit and the background, was used for segmentation. After adaptive thresholding, a binary mask was generated, and individual fruits were identified automatically (Figure 5). To reduce edge effects and scattering interference caused by the curved fruit surface, a mask erosion operation was applied along the ROI boundaries. The spectral values of all valid pixels within each refined ROI were then averaged to obtain a representative spectrum for subsequent analysis.
Figure 5.
Workflow of ROI extraction from hyperspectral images. (a) Grayscale image at 1200 nm; (b) Binary mask after background segmentation; (c) Identification and labeling of individual loquat fruits with different colors representing different samples.
3.2. Spectral Preprocessing and Analysis
Initial hyperspectral data were collected in the 1000–2500 nm range. To reduce the influence of severe noise at the edges of the detector response, only the 1000–2400 nm region was retained for subsequent analysis and modeling. As shown in Figure 6a, the raw spectra of loquat samples exhibited similar overall trends, with several obvious absorption features appearing near 1200 nm, 1450 nm, and 1900 nm. These absorption bands are mainly associated with C–H overtones and O–H combination vibrations, which are closely related to sugar and moisture contents in the fruit [28]. However, the raw spectra also showed noticeable baseline drift and scattering effects caused by differences in fruit surface texture and internal tissue structure. Such physical interference can mask useful chemical information and reduce modeling accuracy.
Figure 6.
Reflectance spectra of the loquat samples in the 1000–2400 nm range. (a) Raw spectra; (b) Spectra after the combined SG-MSC-DT preprocessing.
To mitigate the impact of high-frequency noise and surface scattering on model precision, this study evaluated the efficacy of SG smoothing, SNV, MSC, DT, and their combined variants based on a PLSR benchmark (as shown in Table 4). The results indicate that the SG-MSC-DT combination outperformed individual preprocessing methods, yielding a correlation coefficient of prediction (Rp2) of 0.857, an RMSEP of 0.755, and an RPD of 1.973. Figure 6b presents the spectral profiles after the SG-MSC-DT treatment. The synergy of these three methods achieved a stepwise optimization of “denoising—calibration—purification.” This approach not only eliminated redundant variables and simplified the model but also significantly enhanced the goodness-of-fit and generalization capability, effectively highlighting the intrinsic spectral absorption characteristics of loquat sugar. Consequently, the SG-MSC-DT combined preprocessing was adopted for all subsequent modeling in this research.
Table 4.
Comparison of TSSC prediction results based on Partial Least Squares Regression (PLSR) combined with different spectral preprocessing strategies.
3.3. Machine Learning Modeling Based on Feature Wavelength Selection
Following the SG-MSC-DT integrated preprocessing, although the signal-to-noise ratio (SNR) was effectively enhanced, the full-spectrum data still comprised hundreds of wavelength variables. These high-dimensional variables are often laden with uninformative data and severe multicollinearity; utilizing them directly for modeling would not only exponentially increase computational complexity but also trigger the “curse of dimensionality,” potentially compromising model generalization [29]. To isolate the most representative feature bands, this study introduced four diverse algorithms for dimensionality reduction: Successive Projections Algorithm (SPA), Random Frog (R-Frog), Uninformative Variable Elimination (UVE), and Competitive Adaptive Reweighted Sampling (CARS). Following preliminary trials and algorithm-specific thresholding, the number of retained characteristic wavelengths was set to 15 for SPA, 25 for R-Frog, 45 for UVE, and 30 for CARS.
These feature-thinning strategies were coupled with three classical machine learning algorithms—PLSR, Ridge, and SVM—to establish a comprehensive suite of quantitative TSSC prediction models. This cross-experimental approach allows for a rigorous evaluation of how different feature selection logics interact with linear and nonlinear estimators. The comparative performance results for all algorithm combinations are detailed in Table 5.
Table 5.
Comprehensive comparison of TSSC prediction results using PLSR, Ridge, and SVM models coupled with various spectral dimensionality reduction algorithms.
The modeling results indicate that wavelength selection significantly improved the predictive performance of both linear and nonlinear models. When utilizing full-spectrum data for initial modeling, both linear and nonlinear regression models exhibited relatively low correlation coefficients for the prediction set, with the Residual Predictive Deviation (RPD) consistently falling below 2.0, indicating suboptimal predictive precision. However, after dimensionality reduction via band selection algorithms, the RPD of the majority of machine learning models successfully surpassed the 2.0 threshold. This significant leap in performance demonstrates that effectively eliminating redundant information and collinear variables not only alleviates the computational burden but also substantially bolsters the model’s predictive accuracy and anti-interference capability when encountering unknown samples.
Among all traditional machine learning models evaluated in this study, the SPA-PLSR combination emerged as the superior model in this comparative study of traditional machine learning. This combination achieved a coefficient of determination for calibration (Rc2) of 0.912 and an RMSEC of 0.581. When applied to the independent prediction set, the coefficient of determination (Rp2) remained high at 0.888, with the RMSEP controlled at 0.725 and a critical RPD of 2.235. By extracting a variable subset characterized by minimal redundancy and collinearity, the SPA effectively mitigated the inherent flaws of full-spectrum data, fully leveraging the strength of PLSR in processing linearly correlated data. The SPA-PLSR framework maximizes the quantitative analysis capability for internal loquat sugar content while simplifying the model structure. Serving as the high-performance benchmark for traditional chemometrics in this study, this model demonstrates significant potential for practical application and provides a reliable reference for the subsequent introduction of deep learning architectures.
3.4. Construction and Optimization of the Deep Learning Predictive Model
Although traditional machine learning models, such as SPA-PLSR and UVE-SVM, achieved satisfactory baseline results for loquat TSSC prediction, these methods rely heavily on manual feature engineering. Consequently, they struggle to fully extract the deep-seated, complex nonlinear mapping relationships inherent in high-dimensional spectral sequences. To overcome the existing bottlenecks in predictive accuracy, this study constructed a one-dimensional convolutional neural network integrated with a MSSA mechanism, designated as MSSA-ACNN. To maximize the preservation of various overtones and combination absorption information related to sugars and moisture in the NIR region, the preprocessed full-spectrum data (1000–2400 nm) were utilized directly as input. The internal attention mechanism facilitates adaptive feature focusing and automated filtering of peripheral background interference.
During the network training and structural optimization phase, considering the limited scale of the spectral dataset, a rigorous regularization strategy was implemented to prevent overfitting in the deep architecture. Specifically, a high-ratio Dropout was applied before the fully connected layers, and a weight decay parameter (L2 regularization) was incorporated into the Adam optimizer. These constraints effectively penalized excessive weight parameters, compelling the model to move beyond “memorizing” local sample-specific features or instrumental noise at the spectral extremities, and instead capture universally representative spectral absorption patterns [30,31].
The efficacy of the implemented regularization strategy is intuitively reflected in the dynamic training process. The convergence trajectory of the loss function for the MSSA-ACNN model is illustrated in Figure 7. During the nascent phase of training, both the Training Loss and Validation Loss exhibited a rapid and monotonic decline, indicating that the network was efficiently capturing the complex nonlinear mapping between the full-spectrum features and TSSC. As the iterations progressed, the two curves gradually stabilized and achieved synchronized convergence. Notably, the validation loss curve closely tracked the training loss throughout the cycle, without exhibiting significant divergence or the “rebound” effects typically associated with over-optimization. This favorable convergence dynamic demonstrates that the optimized architecture successfully suppressed overfitting—a pervasive challenge in deep networks processing small-sample spectral data—thereby ensuring superior generalization stability [32].
Figure 7.
Convergence curves of training and validation loss during the optimization process of the MSSA-ACNN model.
3.5. Performance Evaluation and Ablation Analysis of the Proposed Model
3.5.1. Comparison with Traditional Machine Learning Benchmarks
Following structural optimization, the MSSA-ACNN model demonstrated a clear performance improvement over the traditional machine learning benchmarks (SPA-PLSR, UVE-SVM, and CARS-Ridge). As illustrated in the prediction scatter plots (Figure 8), the prediction results of the traditional models displayed relatively large dispersion around the 1:1 reference line, whereas the MSSA-ACNN model exhibited a noticeably tighter distribution, indicating higher fitting accuracy and lower prediction error for complex full-spectrum data.
Figure 8.
Scatter plots of the measured versus predicted TSSC based on different modeling strategies. (a) UVE-SVM; (b) SPA-PLSR; (c) CARS-Ridge; (d) MSSA-ACNN.
Quantitative results further confirm this observation. The proposed MSSA-ACNN model achieved a Rc2 of 0.979 and an Rp2 of 0.942, with an RMSEP of 0.505. In comparison, the best-performing traditional model (SPA-PLSR) yielded an Rp2 of 0.888 and an RMSEP of 0.725. The improvement in prediction accuracy can be attributed to the end-to-end learning capability of deep architecture, which enables the extraction of complex nonlinear relationships that are difficult to capture using conventional regression models. Notably, the Residual Predictive Deviation (RPD) of the MSSA-ACNN model reached 3.091. This result indicates that the proposed model possesses strong robustness and reliability for practical applications in non-destructive evaluation of fruit internal quality.
The superior performance of the MSSA-ACNN model can be further explained by its multi-scale feature extraction and attention-based weighting strategy. The parallel convolutional kernels allow the model to capture both local and global spectral patterns, while the MSSA mechanism dynamically enhances informative wavelength regions and suppresses irrelevant or noisy signals. This is particularly important for hyperspectral data, where spectral redundancy and noise can significantly affect model stability.
3.5.2. Ablation Study of the MSSA-ACNN Architecture
To evaluate the contributions of the multi-scale feature extraction module and the MSSA attention mechanism, an ablation study was conducted by systematically removing these components. The results are summarized in Table 6.
Table 6.
Ablation study of the MSSA-ACNN model components for TSSC prediction.
The Plain 1D-CNN baseline achieved an Rp2 of 0.916, an RMSEP of 0.646, and an RPD of 2.726. When the multi-scale structure was introduced (w/o Attention), the Rp2 improved to 0.927 and the RMSEP decreased to 0.578. Similarly, incorporating the attention module (w/o Multi-Scale) also resulted in better performance than the baseline model. The proposed MSSA-ACNN, which combines both modules, achieved the best performance, with an Rp2 of 0.942, an RMSEP of 0.505, and an RPD of 3.091. Compared with the Plain 1D-CNN, the Rp2 increased by 3.35%, while the RMSEP decreased by 22.0%.
These results indicate that both the multi-scale feature extraction module and the MSSA attention mechanism contribute to improving prediction performance. The combination of the two modules yielded the highest accuracy, demonstrating the effectiveness of the proposed MSSA-ACNN architecture for loquat TSSC prediction.
3.6. Five-Fold Cross-Validation
To further evaluate the robustness and generalization ability of the proposed MSSA-ACNN model, five-fold cross-validation was performed. By incorporating spectral Mixup augmentation and a dynamic error-weighted ensemble strategy, the model achieved an average Rp2 of 0.876 and an RPD of 2.809 (Table 7).
Table 7.
Performance metrics of the proposed MSSA-ACNN model using a 5-fold cross-validation strategy.
The relatively small variations among folds indicate stable predictive performance under different sample partitions. Although the cross-validation results were slightly lower than those obtained using the SPXY-based independent prediction set, this is expected because random fold partitioning provides a more rigorous evaluation of model generalization. The consistently high RPD values (>2.5) demonstrate the robustness and practical applicability of the proposed model for TSSC prediction.
3.7. Interpretability Analysis and Chemical Significance
Elucidating the internal decision-making process of the MSSA-ACNN model and verifying its scientific reliability involved an interpretability analysis based on Saliency Mapping. As illustrated in Figure 9, the distribution of normalized attention weights (red shaded areas) superimposed on the mean absorbance spectrum of loquat specimens exhibits distinct feature selectivity, indicating that the model prioritizes specific spectral regions rather than processing the entire waveband uniformly. Key attention responses were concentrated within four critical spectral intervals.
Figure 9.
Visualization of attention weights generated by the MSSA-ACNN model. The black and red lines represent the mean spectrum and attention weights, respectively; blue dashed lines indicate representative absorption bands, and the orange shaded region denotes the carbohydrate-related spectral region.
The response observed in the 1050–1100 nm region is consistent with weak O–H overtones and spectral variations related to tissue structure and light scattering effects [33]. Although this region is not directly linked to strong sugar absorption, it still provides useful background information for spectral characterization. Furthermore, a discernible response within the 1430–1470 nm range was attributed to the first overtone of O–H stretching vibrations, potentially reflecting hydration state changes induced by sugar concentration fluctuations—a “water-sugar balance” information vital for NIR quantitative analysis [34]. Significant weights near 1900 nm correspond to O–H combination bands, which may reflect the fruit’s moisture state and the nonlinear hydrogen bonding coupling between water and carbohydrate molecules.
The long-wave NIR region (2100–2400 nm) exhibited the highest attention weights. This spectral window is widely recognized as an important region for carbohydrate characterization because it contains prominent combination bands associated with C–H and O–H vibrations of sugar molecules, which are closely related to the absorption behavior of carbohydrates in agricultural products [35,36,37]. Previous studies have demonstrated that major soluble sugars, including sucrose, glucose, and fructose, exhibit characteristic absorption features within this wavelength range [38]. Moreover, the spectral region around 2100–2400 nm has been repeatedly identified as highly informative for soluble solids and sugar-content prediction in fruits using near-infrared and HSI techniques [39]. Therefore, the pronounced attention concentration observed in this region suggests that the proposed model preferentially focused on chemically meaningful spectral information associated with soluble sugar variations, rather than relying solely on statistical correlations. This finding enhances the interpretability of the prediction process and provides spectroscopic support for the effectiveness of the proposed framework.
While these findings do not strictly establish a direct causal link, they demonstrate that the model’s decision-making process is largely in agreement with established spectroscopic assignments, providing a degree of empirical support for the framework’s reliability.
4. Conclusions
This study developed an interpretable deep learning framework, MSSA-ACNN, for the non-destructive prediction of TSSC in loquat using HSI. By integrating multi-scale convolutional feature extraction with a dual-path attention mechanism, the model effectively captures both global spectral trends and localized absorption features, which helps improve robustness against spectral variability and background noise.
Experimental results based on the SPXY partitioning demonstrate that the MSSA-ACNN outperforms traditional chemometric models (PLSR, Ridge, and SVM), achieving an Rp2 of 0.942, an RMSEP of 0.505, and an RPD of 3.091. Additionally, the robust stability of the proposed model was further independently verified through a 5-fold cross-validation strategy. These results suggest that the proposed model has good potential for practical applications in non-destructive fruit quality assessment.
Interpretability analysis reveals that the model focuses on spectral regions associated with carbohydrate and moisture absorption, which is consistent with known near-infrared characteristics. This finding supports the physical relevance and reliability of the proposed approach.
Additionally, while the proposed MSSA-ACNN is lightweight, its current performance is limited to a single cultivar under controlled laboratory conditions. Industrial implementation faces critical challenges, as the model requires further validation across diverse cultivars, varying harvest seasons, and different spectrometer instruments. Future research must address these gaps to ensure the model’s robustness and transferability, which are essential prerequisites for seamless integration into dynamic, online industrial sorting systems.
In summary, this study provides an accurate, robust, and lightweight solution for real-time loquat TSSC prediction, demonstrating the immense potential of combining HSI with interpretable deep learning for industrial agricultural quality evaluation.
Author Contributions
Conceptualization, S.Z. and K.T.; methodology, S.Z., K.T. and M.F.; software, S.Z. and C.Z.; validation, K.T., M.F. and S.Z.; formal analysis, S.Z. and K.T.; investigation, C.Z. and G.L.; resources, S.Z., M.F. and K.T.; data curation, M.F. and C.Z.; writing—original draft preparation, S.Z.; writing—review and editing, K.T. and G.L.; supervision, K.T.; project administration, S.Z.; funding acquisition, K.T. All authors have read and agreed to the published version of the manuscript.
Funding
The research was supported by the Natural Science Foundation of Heilongjiang Province, China (Grant No. JJ2024ZL0087).
Data Availability Statement
The data presented in this study are available on request from the corresponding author.
Acknowledgments
All authors thank Northeast Agricultural University for providing instrument support.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| AMP | Adaptive Max Pooling |
| CARS | Competitive Adaptive Reweighted Sampling |
| CNN | Convolutional Neural Networks |
| DL | Deep Learning |
| DT | De-trending |
| GAP | Global Average Pooling |
| GMP | Global Max Pooling |
| HSI | Hyperspectral Imaging |
| LVs | Latent Variables |
| MSC | Multiplicative Scatter Correction |
| MSSA | Multi-Scale Spectral Attention |
| NIRS | Near-Infrared Spectroscopy |
| PLSR | Partial Least Squares Regression |
| R-Frog | Random Frog |
| RMSE | Root Mean Square Error |
| ROI | Region of Interest |
| RPD | Residual Predictive Deviation |
| SD | Standard Deviation |
| SNV | Standard Normal Variate |
| SPA | Sample set Partitioning based on joint X-Y distance |
| SVM | Support Vector Machine |
| SVR | Support Vector Regression |
| TSSC | Total Soluble Solids Content |
| Vis-NIR | Visible and Near-Infrared |
| UVE | Uninformative Variable Elimination |
References
- Zhao, X. Comprehensive Review of Bioactive Compounds in Loquat and Their Pharmacological Mechanisms. Med. Plant Res. 2024, 14, 196–209. [Google Scholar] [CrossRef] [Scilit]
- Pawłowska, A.M.; Żurek, N.; Kapusta, I.; Leo, M.D.; Braca, A. Antioxidant and Antiproliferative Activities of Phenolic Extracts of Eriobotrya Japonica (Thunb.) Lindl. Fruits and Leaves. Plants 2023, 12, 3221. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Mokhtari, I.; Moumou, M.; Mokhtari, C.; Harnafi, M.; Milenkovic, D.; Amrani, S.; Harnafi, H. Nutritional Composition and Effect of Loquat Fruit (Eriobotrya japonica L. var. Navela) on Lipid Metabolism and Liver Steatosis in High-Fat High-Sucrose Diet-Fed Mice. Prev. Nutr. Food Sci. 2024, 29, 256–269. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Cai, J.; Chen, T.; Zhang, Z.; Li, B.; Qin, G.; Tian, S. Metabolic Dynamics During Loquat Fruit Ripening and Postharvest Technologies. Front. Plant Sci. 2019, 10, 619. [Google Scholar] [CrossRef] [Scilit]
- Shah, H.M.S.; Khan, A.S.; Singh, Z.; Ayyub, S. Postharvest Biology and Technology of Loquat (Eriobotrya japonica Lindl.). Foods 2023, 12, 1329. [Google Scholar] [CrossRef] [Scilit]
- Lu, B.; Dao, P.D.; Liu, J.; He, Y.; Shang, J. Recent Advances of Hyperspectral Imaging Technology and Applications in Agriculture. Remote Sens. 2020, 12, 2659. [Google Scholar] [CrossRef] [Scilit]
- Patel, D.; Bhise, S.; Kapdi, S.S.; Bhatt, T. Non-Destructive Hyperspectral Imaging Technology to Assess the Quality and Safety of Food: A Review. Food Prod. Process. Nutr. 2024, 6, 69. [Google Scholar] [CrossRef] [Scilit]
- Semyalo, D.; Kwon, O.; Wakholi, C.; Min, H.J.; Cho, B.-K. Nondestructive Online Measurement of Pineapple Maturity and Soluble Solids Content Using Visible and Near-Infrared Spectral Analysis. Postharvest Biol. Technol. 2024, 209, 112706. [Google Scholar] [CrossRef] [Scilit]
- Qi, H.; Li, H.; Chen, L.; Chen, F.; Luo, J.; Zhang, C. Hyperspectral Imaging Using a Convolutional Neural Network with Transformer for the Soluble Solid Content and pH Prediction of Cherry Tomatoes. Foods 2024, 13, 251. [Google Scholar] [CrossRef] [Scilit]
- Tian, Y.; Sun, J.; Zhou, X.; Yao, K.; Tang, N. Detection of Soluble Solid Content in Apples Based on Hyperspectral Technology Combined with Deep Learning Algorithm. J. Food Process. Preserv. 2022, 46, e16414. [Google Scholar] [CrossRef] [Scilit]
- Xiao, Y.; Zhai, Y.; Zhou, L.; Yin, Y.; Qi, H.; Zhang, C. Detection of Soluble Solid Content in Citrus Fruits Using Hyperspectral Imaging with Machine and Deep Learning: A Comparative Study of Two Citrus Cultivars. Foods 2025, 14, 2091. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Xu, W.; Wei, L.; Cheng, W.; Yi, X.; Lin, Y. Non-Destructive Assessment of Soluble Solids Content in Kiwifruit Using Hyperspectral Imaging Coupled with Feature Engineering. Front. Plant Sci. 2024, 15, 1292365. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Munera, S.; Gómez-Sanchís, J.; Aleixos, N.; Vila-Francés, J.; Colelli, G.; Cubero, S.; Soler, E.; Blasco, J. Discrimination of Common Defects in Loquat Fruit Cv.‘Algerie’ Using Hyperspectral Imaging and Machine Learning Techniques. Postharvest Biol. Technol. 2021, 171, 111356. [Google Scholar] [CrossRef] [Scilit]
- Luo, Y.; Jin, Q.; Lu, H.; Li, P.; Qiu, G.; Qi, H.; Li, B.; Zhou, X. Advancing Loquat Total Soluble Solids Content Determination by Near-Infrared Spectroscopy and Explainable AI. Agriculture 2025, 15, 281. [Google Scholar] [CrossRef] [Scilit]
- Khan, A.; Sohail, A.; Zahoora, U.; Qureshi, A.S. A Survey of the Recent Architectures of Deep Convolutional Neural Networks. Artif. Intell. Rev. 2020, 53, 5455–5516. [Google Scholar] [CrossRef] [Scilit]
- Acquarelli, J.; van Laarhoven, T.; Gerretzen, J.; Tran, T.N.; Buydens, L.M.; Marchiori, E. Convolutional Neural Networks for Vibrational Spectroscopic Data Analysis. Anal. Chim. Acta 2017, 954, 22–31. [Google Scholar] [CrossRef] [Scilit]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention Is All You Need. In Proceedings of the Advances in Neural Information Processing Systems; Guyon, I., Luxburg, U.V., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., Garnett, R., Eds.; Curran Associates, Inc.: Red Hook, NY, USA, 2017; Volume 30, pp. 5998–6008. [Google Scholar]
- Woo, S.; Park, J.; Lee, J.-Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar]
- Galvao, R.K.H.; Araujo, M.C.U.; José, G.E.; Pontes, M.J.C.; Silva, E.C.; Saldanha, T.C.B. A Method for Calibration and Validation Subset Partitioning. Talanta 2005, 67, 736–740. [Google Scholar] [CrossRef] [Scilit]
- Rinnan, Å.; Van Den Berg, F.; Engelsen, S.B. Review of the Most Common Pre-Processing Techniques for Near-Infrared Spectra. TrAC Trends Anal. Chem. 2009, 28, 1201–1222. [Google Scholar] [CrossRef] [Scilit]
- Araújo, M.C.U.; Saldanha, T.C.B.; Galvao, R.K.H.; Yoneyama, T.; Chame, H.C.; Visani, V. The Successive Projections Algorithm for Variable Selection in Spectroscopic Multicomponent Analysis. Chemom. Intell. Lab. Syst. 2001, 57, 65–73. [Google Scholar] [CrossRef] [Scilit]
- Li, H.; Liang, Y.; Xu, Q.; Cao, D. Key Wavelengths Screening Using Competitive Adaptive Reweighted Sampling Method for Multivariate Calibration. Anal. Chim. Acta 2009, 648, 77–84. [Google Scholar] [CrossRef] [Scilit]
- Li, H.-D.; Xu, Q.-S.; Liang, Y.-Z. Random Frog: An Efficient Reversible Jump Markov Chain Monte Carlo-like Approach for Variable Selection with Applications to Gene Selection and Disease Classification. Anal. Chim. Acta 2012, 740, 20–26. [Google Scholar] [CrossRef] [Scilit]
- Abdi, H. Partial Least Squares Regression and Projection on Latent Structure Regression (PLS Regression). WIREs Comput. Stat. 2010, 2, 97–106. [Google Scholar] [CrossRef] [Scilit]
- Smola, A.J.; Schölkopf, B. A Tutorial on Support Vector Regression. Stat. Comput. 2004, 14, 199–222. [Google Scholar] [CrossRef] [Scilit]
- Zhang, X.; Lin, T.; Xu, J.; Luo, X.; Ying, Y. DeepSpectra: An End-to-End Deep Learning Approach for Quantitative Spectral Analysis. Anal. Chim. Acta 2019, 1058, 48–57. [Google Scholar] [CrossRef] [Scilit]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-Excitation Networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar]
- Li, S.; Song, Q.; Liu, Y.; Zeng, T.; Liu, S.; Jie, D.; Wei, X. Hyperspectral Imaging-Based Detection of Soluble Solids Content of Loquat from a Small Sample. Postharvest Biol. Technol. 2023, 204, 112454. [Google Scholar] [CrossRef] [Scilit]
- Yang, C.; Guo, Z.; Fernandes Barbin, D.; Dai, Z.; Watson, N.; Povey, M.; Zou, X. Hyperspectral Imaging and Deep Learning for Quality and Safety Inspection of Fruits and Vegetables: A Review. J. Agric. Food Chem. 2025, 73, 10019–10035. [Google Scholar] [CrossRef] [Scilit]
- Mokari, A.; Guo, S.; Bocklitz, T. Exploring the Steps of Infrared (IR) Spectral Analysis: Pre-Processing, (Classical) Data Modelling, and Deep Learning. Molecules 2023, 28, 6886. [Google Scholar] [CrossRef] [Scilit]
- Wang, D.; Cao, W.; Zhang, F.; Li, Z.; Xu, S.; Wu, X. A Review of Deep Learning in Multiscale Agricultural Sensing. Remote Sens. 2022, 14, 559. [Google Scholar] [CrossRef] [Scilit]
- Maxwell, A.E.; Warner, T.A.; Guillen, L.A. Accuracy Assessment in Convolutional Neural Network-Based Deep Learning Remote Sensing Studies—Part 2: Recommendations and Best Practices. Remote Sens. 2021, 13, 2591. [Google Scholar] [CrossRef] [Scilit]
- Pandiselvam, R.; Prithviraj, V.; Manikantan, M.R.; Kothakota, A.; Rusu, A.V.; Trif, M.; Mousavi Khaneghah, A. Recent Advancements in NIR Spectroscopy for Assessing the Quality and Safety of Horticultural Products: A Comprehensive Review. Front. Nutr. 2022, 9, 973457. [Google Scholar] [CrossRef] [Scilit]
- Tsenkova, R.; Munćan, J.; Pollner, B.; Kovacs, Z. Essentials of Aquaphotomics and Its Chemometrics Approaches. Front. Chem. 2018, 6, 363. [Google Scholar] [CrossRef] [Scilit]
- Cen, H.; He, Y. Theory and Application of Near Infrared Reflectance Spectroscopy in Determination of Food Quality. Trends Food Sci. Technol. 2007, 18, 72–83. [Google Scholar] [CrossRef] [Scilit]
- Osborne, B.G.; Fearn, T.; Hindle, P.H. Practical NIR Spectroscopy with Applications in Food and Beverage Analysis, 2nd ed.; Longman Scientific & Technical: Harlow, UK, 1993. [Google Scholar]
- Workman, J.; Weyer, L. Practical Guide to Interpretive Near-Infrared Spectroscopy; CRC Press: Boca Raton, FL, USA, 2008. [Google Scholar]
- Omar, A.F.; Atan, H.; MatJafri, M.Z. Peak Response Identification through Near-Infrared Spectroscopy Analysis on Aqueous Sucrose, Glucose and Fructose Solution. Spectrosc. Lett. 2012, 45, 190–201. [Google Scholar] [CrossRef] [Scilit]
- Wang, H.; Peng, J.; Xie, C.; Bao, Y.; He, Y. Fruit Quality Evaluation Using Spectroscopy Technology: A Review. Sensors 2015, 15, 11889–11927. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.








