Rapid Determination of Wine Grape Maturity Level from pH, Titratable Acidity, and Sugar Content Using Non-Destructive In Situ Infrared Spectroscopy and Multi-Head Attention Convolutional Neural Networks
Authors: Kalopesa Eleni , Gkrimpizis Theodoros , Samarinas Nikiforos , Tsakiridis Nikolaos L. , Zalidis George C. 
Published: November 2023

In the pursuit of enhancing the wine production process through the utilization of new technologies in viticulture, this study presents a novel approach for the rapid assessment of wine grape maturity levels using non-destructive, in situ infrared spectroscopy and artificial intelligence techniques. Building upon our previous work focused on estimating sugar content (∘Brix) from the visible and near-infrared (VNIR) and short-wave infrared (SWIR) regions, this research expands its scope to encompass pH and titratable acidity, critical parameters determining the grape maturity degree, and in turn, wine quality, offering a more representative estimation pathway. Data were collected from four grape varieties—Chardonnay, Malagouzia, Sauvignon Blanc, and Syrah—during the 2023 harvest and pre-harvest phenological stages in the vineyards of Ktima Gerovassiliou, northern Greece. A comprehensive spectral library was developed, covering the VNIR–SWIR spectrum (350–2500 nm), with measurements performed in situ. Ground truth data for pH, titratable acidity, and sugar content were obtained using conventional laboratory methods: total soluble solids (TSS) (∘Brix) by refractometry, titratable acidity by titration (expressed as mg tartaric acid per liter of must) and pH by a pH meter, analyzed at different maturation stages in the must samples. The maturity indicators were predicted from the point hyperspectral data by employing machine learning algorithms, including Partial Least Squares regression (PLS), Random Forest regression (RF), Support Vector Regression (SVR), and Convolutional Neural Networks (CNN), in conjunction with various pre-processing techniques. Multi-output models were also considered to simultaneously predict all three indicators to exploit their intercorrelations. A novel multi-input–multi-output CNN model was also proposed, incorporating a multi-head attention mechanism and enabling the identification of the spectral regions it focuses on, and thus having a higher interpretability degree. Our results indicate high accuracy in the estimation of sugar content, pH, and titratable acidity, with the best models yielding mean R2 values of 0.84, 0.76, and 0.79, respectively, across all properties. The multi-output models did not improve the prediction results compared to the best single-output models, and the proposed CNN model was on par with the next best model. The interpretability analysis highlighted that the CNN model focused on spectral regions associated with the presence of sugars (i.e., glucose and fructose) and of the carboxylic acid group. This study underscores the potential of portable spectrometry for real-time, non-destructive assessments of wine grape maturity, thereby providing valuable tools for informed decision making in the wine production industry. By integrating pH and titratable acidity into the analysis, our approach offers a holistic view of grape quality, facilitating more comprehensive and efficient viticultural practices.