DOI: 10.3390/horticulturae12081009 ISSN: 2311-7524

Utilization of Two-Dimensional Spectrogram from Near-Infrared Spectroscopy Combined with Explainable Artificial Intelligence for Detection of Palmyrah Sap Adulteration

Ravipat Lapcharoensuk, Nunik Destria Arianti, Agustami Sitorus

Near-infrared (NIR) spectroscopy-based adulteration detection approaches are still dominated by one-dimensional (1D) spectral analysis, which inherently limits the exploration of complex patterns and nonlinear interactions in spectral data. Therefore, the objective of this study is to use a two-dimensional (2D) NIR spectrogram, combined with Explainable Artificial Intelligence (XAI), to predict the level of adulteration in palmyrah sap. The dataset matrix dimension is 110 × 1101, derived from the sample adulteration level (0–100%) and the NIR wavenumber (4000–12,500 cm−1). Following Kennard–Stone partitioning, the evaluated preprocessing methods were applied using parameters derived exclusively from the training set. For the 2D modeling branch, the resulting training and testing spectra were subsequently transformed separately using the Continuous Wavelet Transform (CWT). A total of six AI algorithms, three from machine learning (PLS, kNN, ANN) and three from deep learning (CNN, AlexNet, ResNet), were applied in this study. The best model AI was interpreted using Shapley Additive Explanations (SHAP) for 1D NIRs and the Gradient-weighted Class Activation Mapping (Grad-CAM) for 2D NIR spectrograms. The four best-performing model configurations can predict the level of palmyrah sap adulteration, with R2 values ranging from 0.969 to 0.994 and RMSE ranging from 2.333% to 5.547% in the training. In the testing, the model’s performance is in the R2 range of 0.959–0.990, RMSE of 3.093–6.396%, MAE of 2.358–4.252%, RPD of 5.06–10.46 and Bias of 0.03–0.93%. The SHAP and Grad-CAM XAI revealed that the wavenumber associated with this sap counterfeiting is critical to the level of adulteration of palmyrah sap. This approach provides a quantitative method that accounts for advanced dimensions and treats them as essential information to support large-scale data matrices in AI modeling. The application of this method is an alternative that is easy to interpret and implement, and can be applied to long- and short-wavelength data from continuous NIR or discrete multi-wavelength NIR.

More from our Archive