Skip to Content
HorticulturaeHorticulturae
  • Feature Paper
  • Article
  • Open Access

14 March 2026

22 Pages

Linking Cucumber Surface Color to Internal Hydration Level Using Deep Learning for Freshness Classification

,
,
,
,
and
1
Mechanical Engineering of Biosystems Department, Lorestan University, Khorramabad P.O. Box 465, Iran
2
Laboratory of Quality and Safety of Agricultural Products, Landscape and Environment, Department of Agriculture, School of Agricultural Sciences, Hellenic Mediterranean University, Estavromenos, 71004 Heraklion, Greece
3
Plant Production and Genetics Engineering Department, Lorestan University, Khorramabad 68151-44316, Iran
4
Institute of Olive Tree, Subtropical Plants and Viticulture, Hellenic Agricultural Organization ‘ELGO-Dimitra’ Kastorias 32A, 71307 Heraklion, Greece

Abstract

Postharvest dehydration is a major determinant of cucumber freshness and marketability, yet early reductions in internal water status are difficult to detect using conventional quality assessment methods. This study presents a non-destructive, physiology-informed deep learning approach that links cucumber surface color and texture patterns to internal hydration level for automated freshness classification. A time-resolved dataset comprising 4160 RGB images of cucumber fruits was paired with gravimetrically determined relative water content (RWC), used as an objective indicator of internal hydration status. Based on RWC, fruits were classified into four freshness categories: Very Fresh (≥98%), Moderately Fresh (95–98%), Low Freshness (90–95%), and Spoiled (<90%). A custom convolutional neural network (CNN) was trained using standardized RGB images and evaluated on an independent test set. The model achieved an overall classification accuracy of 91.35% and a Cohen’s Kappa coefficient of 0.875, indicating strong agreement between predicted and actual freshness classes. Classification performance was highest for the extreme freshness states, with F1-scores exceeding 0.94 for Very Fresh and Spoiled fruits, while intermediate classes showed greater overlap, reflecting the gradual nature of postharvest water loss. Model interpretability analyses revealed that the CNN consistently focused on physiologically meaningful surface color and texture features associated with dehydration. Overall, these findings highlight the potential of physiology-informed deep learning to advance non-destructive freshness assessment in cucumbers, offering a realistic pathway toward hydration-based sorting, improved shelf-life management, and intelligent quality monitoring in modern postharvest supply chains.

1. Introduction

Postharvest losses of fresh horticultural commodities remain a major global challenge, with dehydration being one of the primary drivers of quality deterioration during storage, transport, and marketing [1,2,3]. In cucumbers (Cucumis sativus L.), which consist of more than 95% water, even moderate reductions in internal hydration can rapidly lead to loss of firmness, surface shriveling, reduced visual appeal, and shortened shelf life [4,5,6]. These changes directly affect marketability and economic value, particularly in supply chains where fruits are exposed to fluctuating temperature and humidity conditions, a challenge that is further intensified by climate variability and inadequate pre- and postharvest environmental control [7,8].
Internal water status is a key physiological determinant of cucumber freshness [4,5,6]. Relative water content (RWC) integrates cellular hydration, membrane integrity, and tissue turgor and is therefore considered a reliable indicator of physiological freshness [9,10,11]. In cucumber fruit, cellular turgor pressure is the primary determinant of firmness, surface smoothness, and visual gloss—traits that directly shape perceived freshness and marketability. Declines in RWC reflect reductions in cellular hydration and turgor, leading to mechanical softening, cuticular deformation, surface wrinkling, and altered optical reflectance. Thus, RWC does not merely quantify water content, but functionally represents the structural and mechanical integrity of fruit tissues underlying commercial freshness perception. More broadly, internal hydration governs shelf-life dynamics and postharvest performance across greenhouse vegetables, reinforcing its relevance as a universal freshness determinant [12]. However, RWC is traditionally measured using destructive, labor-intensive gravimetric methods that are unsuitable for routine postharvest monitoring or large-scale quality control [9,10,11]. Conventional postharvest assessment methods, including visual grading and basic physical measurements, often fail to detect early stages of dehydration, when internal water loss has begun but external symptoms remain subtle [3,13,14]. Consequently, produce may enter distribution chains with compromised freshness that becomes apparent only at later stages.
Recent advances in computer vision and deep learning have opened new opportunities for non-destructive quality assessment in horticultural products. Convolutional neural networks (CNNs), in particular, are capable of extracting complex color and texture features from RGB images that are difficult to quantify using traditional image analysis techniques [10,11,15]. Recent work has demonstrated that deep learning can non-invasively infer internal plant hydration status from image-based surface information, highlighting that tissue water status is optically encoded in physiologically meaningful ways [11]. Deep learning has also been shown to successfully discriminate subtle plant surface traits from RGB images in a range of phenotyping applications, underscoring its capacity to capture biologically meaningful visual information [16]. In cucumbers, our previous study [17] demonstrated that visible-light color information can provide useful cues for non-destructive monitoring of postharvest hydration status when combined with machine learning (ML) models. However, while deep learning has been widely applied to fruit maturity assessment, defect detection, and external quality grading, relatively few studies have explicitly linked image-derived surface features to internal physiological variables such as hydration status. Bridging this gap is essential for developing biologically meaningful and practically relevant AI-based assessment tools. In this context, physiology-informed deep learning refers to the integration of biologically grounded measurements (e.g., RWC) as objective labels to guide model training, ensuring that image-based predictions are explicitly linked to underlying physiological processes rather than purely visual or empirical traits.
The objective of this study was to develop a physiology-informed deep learning framework that links cucumber surface color and fine-scale texture features to internal hydration level for freshness classification. In cucumber fruit, progressive dehydration reduces cellular turgor and alters epidermal mechanical stability, leading to cuticular micro-deformation, surface wrinkling, and changes in light reflectance properties [17]. Loss of tissue hydration also modifies internal light scattering and pigment optical expression, affecting perceived color uniformity and gloss. These hydration-driven structural and optical changes provide a physiological basis for linking external surface appearance to internal water status [17]. By pairing standardized RGB images with gravimetrically determined RWC measurements collected across postharvest storage stages, we aimed to train a CNN capable of non-destructively classifying cucumber freshness into discrete, physiologically meaningful categories based on internal water status. In addition, model interpretability analyses were employed to verify whether the network focused on physiologically relevant surface regions associated with dehydration. This approach represents a step toward robust, transparent, and scalable freshness assessment tools for postharvest quality control.

2. Materials and Methods

An overview of the complete experimental and analytical workflow, from fruit sampling and RWC determination to CNN-based freshness classification and model interpretability analysis, is presented in Figure 1.
Figure 1. Workflow for image-based cucumber freshness assessment using deep learning and relative water content (RWC). Schematic overview of the experimental and analytical pipeline employed in this study. Cucumber fruits were harvested under commercial greenhouse conditions and subjected to controlled postharvest storage to establish a hydration gradient. At predefined storage intervals, each fruit was weighed for determination of RWC and imaged under standardized RGB lighting conditions using a custom-built imaging station. Based on RWC values, fruits were assigned to four physiologically meaningful freshness categories (Very Fresh, Moderately Fresh, Low Freshness, and Spoiled), which served as ground-truth labels. The corresponding RGB images were preprocessed (resizing, normalization, and data augmentation) and used to train and evaluate a convolutional neural network (CNN) for freshness classification. Model performance was assessed using standard classification metrics, while interpretability analyses (Grad-CAM and saliency mapping) were applied to visualize image regions contributing to classification decisions, thereby linking surface color and texture traits to internal hydration status.

2.1. Plant Material and Postharvest Storage Conditions

The experiment was conducted in a commercial greenhouse (0.63 ha) located in Rethymno, Crete, Greece (35.3647° N, 24.4822° E). Sampling was performed under commercial production conditions to ensure realistic above- and below-ground environments and to enhance the transferability of results to practical postharvest systems. The parthenocarpic cucumber hybrid ‘Cretasun RZ’ (Rijk Zwaan, De Lier, The Netherlands) was selected due to its high uniformity in fruit shape, size, and surface color at harvest, thereby minimizing background variability and enabling a robust assessment of the relationship between external color traits and internal hydration status. ‘Cretasun RZ’ is a commercially cultivated greenhouse hybrid widely used in Mediterranean protected horticulture systems, particularly in winter production cycles. Its fruit morphology and epidermal characteristics are representative of smooth-skinned greenhouse cucumbers commonly marketed in Mediterranean and European retail chains. Importantly, dehydration-driven quality decline in this cultivar follows the typical physiological pattern observed in high-moisture cucumbers, characterized by progressive turgor loss, surface gloss reduction, and wrinkling development. Therefore, while fruit size and cuticular traits may vary among cultivars (e.g., short versus long types), the hydration-related physiological mechanisms examined here are broadly consistent across commercial greenhouse cucumber types.
Transplanting took place on 10 November 2024 and harvesting on 10 February 2025. Cultivation during the winter season was deliberately chosen to minimize evaporative demand and transpirational water loss, thereby promoting stable plant water status and maximizing fruit hydration at harvest. Winter conditions in Mediterranean greenhouses are characterized by lower radiation load, moderate vapor pressure deficit, and reduced atmospheric demand compared with spring or summer production, conditions that favor stable plant water relations and the development of fruits with high and uniform tissue hydration [12]. Plants were grown under well-watered conditions throughout the cultivation period to ensure high plant turgor and full fruit hydration, providing a clearly defined physiological baseline for subsequent postharvest water-loss monitoring.
Greenhouse climate was regulated using active heating, maintaining a minimum air temperature of 14 °C. The average daily light integral during cultivation ranged from 6 to 12 mol m−2 d−1, and relative air humidity was maintained between 65 and 80%, conditions that further limited excessive transpiration while supporting normal vegetative and reproductive development. Irrigation and fertigation were supplied via a closed hydroponic drip-irrigation system, scheduled according to radiation sum and substrate moisture. Nutrient solution electrical conductivity was maintained at 2.5–3.0 dS m−1 and pH at 5.5–6.0, with composition adjusted to plant developmental stage to avoid nutritional stress that could indirectly affect fruit water relations.
Crop management practices were implemented to standardize plant architecture and fruit load. Lateral shoots were pruned above the second leaf to limit excessive vegetative growth and enhance assimilate allocation to developing fruits. The first 7–8 fruits per plant were removed to maintain an adequate source–sink balance and prevent early sink limitation. Fruits selected for analysis were harvested at the node corresponding to the 20th leaf (cross-harvest), a position representing a stable mid-season developmental stage in which plant growth rate, assimilate supply, and source–sink relationships have largely equilibrated. This approach ensured high uniformity in fruit size, developmental stage, and physiological status among experimental samples.
Fruits were harvested exactly 1 h before the onset of the photoperiod to coincide with peak morning turgor and minimal transpirational water loss. At this time of day, xylem water potential is near its daily maximum and fruit tissues are closest to full hydration. Combined with the winter growing conditions, continuous adequate irrigation, and absence of water or nutritional stress, these factors support the assumption that fruits were fully hydrated at harvest and could be regarded as having maximal RWC [17].
All fruits were clipped using sterilized scissors, handled exclusively by the peduncle, immediately placed in pre-cooled perforated polyethylene containers lined with moist paper, and transported to the laboratory in insulated boxes at 10 °C. Transit time did not exceed 2 h. Upon arrival, surface moisture was gently removed and all subsequent analyses commenced immediately. Fruits received no surface treatments (e.g., washing, waxing, or coatings) to prevent modification of surface optical properties and ensure that image-based features reflected intrinsic hydration-related changes.
Fruits were stored at either 10 or 25 °C, with samples equally distributed between the two storage conditions. The lower temperature (10 °C) represents the recommended optimal storage temperature for cucumbers, whereas 25 °C reflects typical ambient conditions encountered during retail display or handling. Storage assessments were conducted at 7-day intervals over a 4-week period, a duration selected to capture the full progression from freshly harvested fruit to advanced dehydration and quality loss under both optimal and ambient conditions. Following image and weight measurements, fruits were returned to storage within 10 min after each assessment to minimize temperature fluctuations. All fruits were handled carefully throughout storage and evaluation to avoid mechanical injury, bruising, or surface damage that could confound image-based feature extraction. Each fruit was imaged repeatedly across storage time, resulting in a total of 4160 RGB images derived from 520 fruits.
Data from both storage temperatures (10, and 25 °C) were combined for model development and analysis. This decision was motivated by the objective of training a hydration-driven model that links surface appearance to internal water status, independent of the specific storage conditions that led to dehydration [17]. Storage temperature primarily influences the rate of water loss, whereas RWC reflects the underlying physiological hydration state of the fruit [4,5,10]. By pooling data across temperatures, the CNN was encouraged to learn visual features associated with hydration status itself rather than temperature-specific artifacts. This strategy enhances model robustness and generalization and reflects real postharvest supply chains, where fruits often experience variable and mixed temperature histories.

2.2. Relative Water Content Determination

Fruit hydration status was quantified using RWC, while acknowledging that other indicators [e.g., water potential, gravimetric water content or mass loss, dielectric or impedance measurements, and low-field nuclear magnetic resonance (LF-NMR) metrics] capture complementary aspects of the same physiological state. These measures are physically linked: pressure–volume theory relates RWC to water potential, while progressive water loss reduces tissue water content and simultaneously alters dielectric and LF-NMR signals [1,9,14,17]. Consequently, a monotonic relationship between RWC and these indicators is expected, although each reflects a distinct facet of hydration (water amount, energy status, or molecular mobility).
A hydration gradient was established by subjecting harvested fruits to controlled postharvest storage. Each fruit was weighed at 7-day intervals at the respective storage temperature, and immediately after each weighing, an RGB image of the entire fruit was acquired (see below). At the end of the storage period, fruits were oven-dried at 80 °C for 96 h to determine dry weight. Fruit RWC (also referred to as relative turgidity) was calculated according to the following equation:
R W C = f r e s h   w e i g h t − d r y   w e i g h t s a t u r a t e d   f r e s h   w e i g h t − d r y   w e i g h t × 100
In this equation, turgid weight corresponds to the initial fruit weight measured immediately upon arrival at the laboratory (representing the fully hydrated state at harvest), fresh weight refers to the fruit weight at each storage time point, and dry weight represents the mass after oven-drying. All mass measurements were determined using an analytical balance (±0.001 g; Mettler Toledo, Columbus, OH, USA). This calculation reflects whole-fruit hydration decline under commercial postharvest conditions rather than classical rehydration-based RWC.
Based on RWC values, fruits were classified into four freshness categories: Very Fresh (≥98%), Moderately Fresh (95–98%), Low Freshness (90–95%), and Spoiled (<90%). These classes were used as ground-truth labels for model training and evaluation. The selected thresholds reflect physiologically meaningful stages of postharvest hydration decline in cucumber fruit, ranging from fully turgid tissue to advanced dehydration associated with loss of firmness, surface shriveling, and marketability. RWC values above ~98% correspond to freshly harvested, fully hydrated fruit, whereas reductions below 95% indicate the onset of measurable water loss that precedes visible quality deterioration. RWC values below 90% represent severe dehydration, typically associated with irreversible quality loss and rejection in commercial grading [4,5,17]. The four-class scheme therefore captures distinct and progressive freshness states while maintaining sufficient class separation to support robust supervised learning.

2.3. Image Acquisition

Fruit imaging was performed using a custom-built imaging station (44 × 44 × 44 cm) designed to provide a stable, enclosed environment for standardized RGB color acquisition [18]. The enclosure minimized external light interference and ensured repeatable imaging conditions across all sessions. Illumination was provided by a 4000 K white light-emitting diode (LED) strip (Philips, Eindhoven, The Netherlands) mounted along the upper interior perimeter of the station. This correlated color temperature was selected as it approximates neutral daylight conditions, providing balanced spectral coverage across the visible range and minimizing color bias, thereby enabling reliable capture of surface color and texture features relevant to hydration-related optical changes [10,15,17].
All interior surfaces of the imaging station were coated with matte white paint to enhance diffuse reflectance and promote uniform illumination. Fruits were positioned on a non-reflective white platform aligned with the optical axis of the camera. Images were acquired through a circular aperture (8 cm diameter) located at the center of the top panel, surrounded by a light baffle to reduce glare and stray reflections. The camera-to-sample distance was fixed at 36 cm using a rigid mounting bracket, and the imaging area was marked to ensure consistent fruit positioning. This distance was selected to ensure that the entire fruit was consistently captured within the field of view at high spatial resolution while minimizing geometric distortion and perspective effects. Maintaining a fixed camera-to-sample distance also ensured stable image scale across all acquisitions, facilitating reliable extraction of color and texture features and preventing confounding effects related to variation in apparent fruit size. All imaging was conducted in a darkened laboratory environment (<1 µmol m−2 s−1 ambient light) to prevent light contamination.
Fruits were imaged against a uniform, non-glossy white background to facilitate subsequent image segmentation. Two-dimensional RGB images were captured using a CCD digital camera (PowerShot G15, 12 megapixels; Canon, Tokyo, Japan) equipped with a fixed focal-length lens. Camera settings were held constant across all image acquisitions (resolution: 12 megapixels; aperture: f/2.8; shutter speed: 1/100 s; ISO: 800; daylight white balance; no flash or digital zoom). Although more advanced and higher-resolution RGB cameras are currently available at relatively low cost, the selected device provided sufficient spatial resolution, color fidelity, and signal-to-noise ratio for the objectives of this study. The use of a widely available, consumer-grade device further demonstrates that the proposed approach does not rely on specialized or expensive imaging hardware, thereby enhancing its practical relevance and ease of adoption in commercial postharvest environments [10]. Images were stored in the RGB color space and saved in JPEG format (4000 × 3000 pixels) at maximum quality, ensuring negligible compression artifacts.
Laboratory environmental conditions during imaging were maintained at 25 ± 0.1 °C air temperature and 50 ± 5% relative air humidity. As an indication of air velocity, the evaporation rate of distilled water was recorded in the test room during measurements using three replicate 250 mL glass beakers (internal diameter ≈ 7 cm). The mean evaporation rate was 0.76 ± 0.01 mmol H2O m−2 s−1, indicating low-to-moderate air movement under the prevailing laboratory conditions. The imaging temperature (25 °C) was deliberately selected to match one of the storage regimes and to ensure thermally stable, condensation-free conditions during image acquisition. Although half of the fruits were stored at 10 °C, imaging was performed after a standardized stabilization period of approximately 8 min at 25 °C. This duration was determined based on preliminary pilot observations conducted prior to the main experiment, during which fruits were monitored after transfer from 10 °C to 25 °C and imaged at 2 min intervals. Stabilization was deemed sufficient when no visible condensation remained on the epidermis and successive images showed negligible changes in mean surface brightness and color metrics, indicating minimization of transient optical artifacts. The same standardized interval was subsequently applied to all 10 °C samples to ensure consistent imaging conditions.
Under this configuration, the manual imaging workflow required approximately 1 min per fruit, corresponding to a throughput of ~60 fruits h−1. Although imaging in this study was performed manually, the standardized geometry and illumination of the system are fully compatible with automation, indicating strong potential for high-throughput implementation in commercial postharvest grading environments.

2.4. Dataset Preparation and Preprocessing

Raw images contained non-informative background margins arising from acquisition on a matte white surface with occasional labels. To ensure consistent and objective isolation of the fruit, an automated cropping algorithm was applied as the first preprocessing step to isolate the cucumber body from the background. Residual background pixels were subsequently removed, producing standardized, foreground-only images suitable for reproducible feature learning. The cropping procedure was based on intensity thresholding and contour detection. Specifically, images were converted to grayscale and segmented using an adaptive threshold to separate fruit pixels from the uniform background. The largest connected component was identified as the fruit object, and a bounding box was automatically generated to crop the image while preserving the entire fruit area. To verify robustness, a random subset of images (n = 120) was visually inspected by two independent evaluators, confirming accurate fruit isolation without truncation or inclusion of background artifacts. No manual correction was required. The complete dataset was divided into training (70%), validation (15%), and test (15%) subsets using stratified random sampling across both freshness classes and storage temperatures to preserve their relative distributions across all subsets. No explicit class weighting or resampling strategy was applied, as stratified sampling preserved class proportions and imbalance-robust performance metrics were employed. This ensured balanced model training and unbiased performance evaluation. Prior to model input, all images were resized to a uniform spatial resolution of 256 × 64 pixels to standardize input dimensions while preserving sufficient spatial detail. Pixel intensity values were normalized to the range [0, 1] to improve numerical stability and accelerate convergence during network training.
To enhance model robustness and mitigate overfitting, an online data augmentation pipeline was applied exclusively to the training set. Augmentation operations included random rotations within ±10°, horizontal flipping with a probability of 0.5, random zooming within a range of ±10% of the original image size, horizontal and vertical translations of up to 10% of the image dimensions, and shear transformations with a shear factor of 0.1. These transformations were selected to reflect realistic variability in fruit orientation, positioning, and scale that may occur during image acquisition, thereby encouraging the CNN to learn invariant and generalizable visual features. Validation and test images were subjected only to resizing and normalization, without augmentation, to ensure an unbiased assessment of model generalization performance.

2.5. Convolutional Neural Network Architecture

A custom CNN was developed for four-class cucumber freshness classification based on RGB images. The architecture was designed to progressively extract hierarchical visual features related to surface color and texture while controlling model complexity to reduce overfitting. The input layer received resized RGB images of dimensions 256 × 64 × 3 (height × width × channels), where the three channels correspond to the red, green, and blue color components. The network comprised four sequential convolutional blocks with increasing filter depths (16, 64, 128 and 256 filters). The progressive increase in filter depth (16 → 64 → 128 → 256) follows established convolutional network design principles, whereby shallow layers capture low-level features (e.g., edges, color gradients, and fine textures), while deeper layers learn increasingly abstract and spatially complex representations. This hierarchical expansion enables the modeling of subtle surface variations associated with early dehydration as well as pronounced structural patterns characteristic of advanced water loss. Preliminary architecture testing confirmed that this depth progression provided a favorable balance between representational capacity and computational efficiency without evidence of overfitting.
Each convolutional block consisted of a 2D convolutional layer with 3 × 3 kernels and stride 1, followed by batch normalization to stabilize training and accelerate convergence, a rectified linear unit (ReLU) activation function to introduce non-linearity, and a 2 × 2 max-pooling layer to reduce spatial dimensionality and provide translational invariance. Dropout regularization was applied after each block, with progressively increasing dropout rates (0.2, 0.3, 0.4, and 0.5) to limit co-adaptation of neurons as network depth increased. L2 weight regularization (ridge regression) was applied to the convolutional kernels (λ = 1 × 10−5) to constrain model complexity and favor smooth, biologically plausible feature representations. This was combined with a low initial learning rate and adaptive learning-rate scheduling to stabilize optimization and enhance generalization to unseen cucumber images representing different hydration states.
Following convolutional feature extraction, the resulting feature maps were flattened and passed to a fully connected dense layer comprising 512 neurons with ReLU activation, enabling the integration of spatially distributed features into a compact representation. The network terminated in a four-neuron output layer with softmax activation, yielding class probabilities corresponding to the four RWC-based freshness categories. The architecture was implemented using the TensorFlow–Keras framework (TensorFlow v2.13; Keras API), with all architectural and training hyperparameters fixed across runs to ensure reproducibility, and was optimized to balance classification accuracy and computational efficiency.

2.6. Model Training and Optimization

The CNN was trained using the Adam optimizer, selected for its adaptive learning-rate capabilities and robust convergence behavior in deep learning applications. An initial learning rate of 1 × 10−5 was employed to ensure stable optimization given the depth of the network and the relatively fine-grained visual differences between freshness classes. Sparse categorical cross-entropy was used as the loss function, as it is well suited for multi-class classification problems with integer-encoded labels.
Model training was conducted for a maximum of 200 epochs with a batch size of 32, balancing computational efficiency with gradient stability. To further improve convergence and prevent stagnation in local minima, a learning rate reduction on plateau strategy was applied, whereby the learning rate was reduced by a factor of 0.5 when validation loss failed to improve for five consecutive epochs. Early stopping based on validation loss was monitored to prevent overfitting, and the model weights corresponding to the lowest validation loss were retained for final evaluation.
All training and validation procedures were performed with controlled random seeds for Python (v3.x), NumPy (v1.x), and TensorFlow (v2.13) to ensure reproducibility of data shuffling, weight initialization, and optimization behavior within each run. Model training was carried out on a workstation equipped with GPU acceleration, enabling efficient processing of the augmented image dataset. To assess model stability and robustness to random initialization, the CNN was trained three independent times using different random seeds while maintaining identical dataset splits and hyperparameters, and performance variability was quantified.

2.7. Model Evaluation and Interpretability Analysis

Model performance was comprehensively evaluated on the independent test dataset using multiple complementary metrics. Overall classification accuracy was calculated to provide a global measure of predictive performance, while precision, recall (sensitivity), specificity, and F1-score were computed on a class-wise basis to capture potential differences in model behavior across freshness categories. Cohen’s Kappa coefficient was used to assess the level of agreement between predicted and true labels beyond chance, providing a robust indicator of classification reliability. Confusion matrices were generated to visualize class-wise prediction outcomes and to identify systematic misclassification patterns between adjacent freshness classes.
To further assess the discriminative capacity of the model across decision thresholds, receiver operating characteristic (ROC) curves were constructed for each freshness class using a one-vs-rest strategy, and the corresponding area under the curve (AUC) values were calculated. These metrics provide threshold-independent evaluation of model performance and are particularly informative in multi-class classification settings.
To enhance transparency and interpretability of the deep learning model, Gradient-weighted Class Activation Mapping (Grad-CAM) and saliency map analyses were performed. Grad-CAM was used to identify spatial regions of the input images that contributed most strongly to class-specific predictions, while saliency maps highlighted pixel-level sensitivity to changes in input intensity. Together, these approaches enabled verification that the CNN focused on physiologically meaningful surface regions and color–texture patterns associated with progressive dehydration, thereby supporting the biological plausibility of the learned representations.
For quantitative validation of model interpretability, Grad-CAM activation maps were converted to normalized intensity matrices, and the mean activation value within the segmented fruit region was calculated for each image. Pearson correlation analysis was performed between mean activation intensity and measured RWC.

3. Results

3.1. Overall Model Performance

The dataset comprised Very Fresh (n = 1040), Moderately Fresh (n = 1040), Low Freshness (n = 1109), and Spoiled (n = 971) images, corresponding to a largest-to-smallest class ratio of 1.14:1, indicating only mild class imbalance.
The CNN demonstrated strong performance in classifying cucumber freshness based on RGB images. On the independent test dataset, the model achieved an overall classification accuracy of 91.35 ± 0.42% and a Cohen’s Kappa coefficient of 0.875 ± 0.008 (Table 1), indicating a high level of agreement between predicted and true freshness classes beyond chance. Weighted-average precision, recall, and F1-score values exceeded 0.97, with minimal variability between runs (weighted F1-score: 0.973 ± 0.004; macro F1-score: 0.959 ± 0.006), confirming stable performance despite this mild class imbalance. In single-label multiclass classification, micro-averaged precision, recall, and F1-score are mathematically equivalent to the overall accuracy.
Table 1. Overall, macro-averaged, and weighted-averaged performance metrics of the proposed convolutional neural network (CNN) model. Macro, weighted, and micro averages reflect unweighted, class-frequency–weighted, and sample-level performance, respectively.

3.2. Class-Wise Classification Performance

Class-wise performance metrics are summarized in Table 2. The strongest class-wise performance was observed for the Spoiled class (RWC < 90%), which achieved a recall of 0.966 and an F1-score of 0.956, indicating excellent sensitivity to advanced dehydration. Similarly, the Very Fresh class (RWC ≥ 98%) was reliably identified, with an F1-score of 0.943 and a specificity of 0.978, reflecting strong discrimination of fully hydrated fruit.
Table 2. Class-wise performance metrics of the convolutional neural network (CNN) model for cucumber freshness classification based on relative water content (RWC). Metrics are reported on a per-class basis. Precision reflects positive predictive value, recall (sensitivity) indicates the true positive rate, specificity indicates the true negative rate, and support denotes the number of samples per class. Class-wise accuracy reflects the proportion of correctly classified samples considering both positive and negative predictions for each class.
Performance for the intermediate freshness categories was comparatively lower. Moderately Fresh fruits (95–98% RWC) achieved an F1-score of 0.811, while Low Freshness fruits (90–95% RWC) reached an F1-score of 0.837. These classes exhibited increased overlap, consistent with the gradual nature of postharvest water loss and the absence of abrupt visual transitions between adjacent hydration states.
A post hoc boundary analysis was conducted to examine whether misclassifications were concentrated near predefined RWC thresholds (90, 95, and 98%). The majority of misclassified samples were located within a narrow RWC range around their respective class boundaries (±2% RWC), indicating that classification errors predominantly occurred in physiologically transitional states rather than in clearly distinct hydration extremes. This clustering near threshold regions supports the interpretation that reduced F1-scores in intermediate categories primarily reflect biological continuity rather than model instability.

3.3. Confusion Matrix Analysis

The confusion matrix (Figure 2) illustrates systematic misclassification patterns between neighboring freshness classes. Most classification errors occurred between Moderately Fresh and Very Fresh samples, as well as between Low Freshness and Spoiled samples. These misclassifications reflect physiological continuity in dehydration progression, where fruits near class boundaries exhibit overlapping surface color and texture features. Importantly, false-positive classifications between extreme classes (Very Fresh vs. Spoiled) were rare, highlighting the model’s robustness in distinguishing commercially relevant freshness extremes.
Figure 2. Confusion matrix illustrating the class-wise classification performance of the convolutional neural network (CNN) model for cucumber freshness assessment. Diagonal elements represent correct classifications, while off-diagonal elements indicate misclassifications among relative water content (RWC)–based freshness categories: Very Fresh (98–100%), Moderately Fresh (95–98%), Low Freshness (90–95%), and Spoiled (<90%).

3.4. Receiver Operating Characteristic Analysis

ROC curves constructed using an one-vs-rest approach are presented in Figure 3. High AUC values were obtained for all freshness classes, confirming strong separability between classes across decision thresholds. The Spoiled and Very Fresh classes exhibited the highest AUC values, consistent with their strong class-wise precision and recall. Intermediate classes showed slightly reduced AUC values, reflecting increased feature overlap but still demonstrating reliable discrimination performance.
Figure 3. One-vs-rest receiver operating characteristic (ROC) curves for the four-class cucumber freshness classification model, illustrating the trade-off between true positive rate and false positive rate across decision thresholds. Colored curves correspond to relative water content (RWC)–based freshness categories: Very Fresh (98–100%), Moderately Fresh (95–98%), Low Freshness (90–95%), and Spoiled (<90%).

3.5. Model Interpretability and Feature Attribution

Model interpretability was examined using Grad-CAM and saliency maps (Figure 4). For Very Fresh fruits, activation maps highlighted uniform surface regions characterized by smooth texture and consistent coloration. In contrast, Spoiled fruits exhibited strong activation in regions associated with surface wrinkling, color heterogeneity, and loss of gloss.
Figure 4. Visual interpretability analysis for cucumber freshness classification. Representative samples from each of the four freshness categories are shown using three complementary visualizations per row: (i) the original RGB image illustrating fruit appearance at different relative water content (RWC) stages (Very Fresh: ≥98%, Moderately Fresh: 95–98%, Low Freshness: 90–95%, Spoiled: <90%); (ii) Gradient-weighted Class Activation Mapping (Grad-CAM) heatmaps overlaid on the original images, indicating spatial regions prioritized by the convolutional neural network (CNN) during classification; and (iii) saliency maps highlighting pixel-level sensitivity to input variations. Together, these visualizations reveal that the CNN primarily relies on physiologically meaningful surface features associated with dehydration, including changes in surface texture, wrinkling patterns, and loss of gloss. Fresh cucumbers are characterized by smooth and uniform surface regions, whereas spoiled samples exhibit pronounced structural heterogeneity and reduced turgor. The interpretability results support the biological plausibility of the learned representations and provide insight into the visual cues linking surface appearance to internal hydration status.
Intermediate freshness classes displayed more spatially diffuse activation patterns, indicating reliance on subtle color gradients and localized texture variations. Quantitative analysis further revealed a significant negative correlation between mean Grad-CAM activation intensity and RWC (r = −0.62, p < 0.001), indicating increased localized activation as dehydration progressed. This statistical association confirms that CNN attention intensity systematically increased with declining tissue hydration, thereby reinforcing the physiological relevance of the highlighted regions. Saliency maps further confirmed that the CNN primarily responded to surface color and texture cues rather than background artifacts. Together, these analyses demonstrate that the model learned physiologically meaningful visual features linked to progressive dehydration, supporting the biological plausibility of the classification outcomes.

4. Discussion

This study demonstrates that cucumber surface color information captured using standardized RGB imaging can be effectively linked to internal hydration status through deep learning, enabling accurate, non-destructive freshness classification. By integrating physiologically grounded RWC measurements with CNN modeling and interpretability analyses, the proposed approach bridges the gap between external visual traits and internal water status, a longstanding challenge in postharvest quality assessment.

4.1. Linking Surface Color to Internal Hydration Status

Water loss is a primary driver of postharvest quality deterioration in cucumbers, directly influencing tissue turgor, surface texture, gloss, and firmness [12]. Although these effects eventually become visually apparent, early-stage dehydration often remains difficult to detect using conventional postharvest assessment methods, when internal water loss precedes obvious external symptoms [17]. The strong overall performance of the CNN, reflected by an overall classification accuracy of 91.35% and a Cohen’s Kappa coefficient of 0.875 (Table 1), demonstrates that RGB-based surface color and texture information contains sufficient latent cues to infer internal hydration status when analyzed using deep learning, even in the absence of explicit spectral or physicochemical measurements.
The highest classification accuracy was achieved for the Very Fresh (RWC ≥ 98%) and Spoiled (RWC < 90%) categories, which correspond to physiologically distinct and non-overlapping hydration states. As shown by class-wise performance metrics (Table 2) and the confusion matrix (Figure 2), fully hydrated fruits were consistently and reliably distinguished from severely dehydrated fruits, indicating that the CNN effectively captured large-scale, hydration-driven surface signatures associated with extreme turgor states. In contrast, intermediate freshness categories exhibited greater overlap and higher rates of mutual misclassification, reflecting the inherently continuous nature of postharvest water loss rather than abrupt physiological transitions. Such behavior is biologically expected, as progressive dehydration induces gradual and spatially heterogeneous changes in surface texture and optical properties, resulting in overlapping visual signatures near class boundaries [19,20]. Importantly, this structured uncertainty suggests that the model respected the underlying physiological continuum rather than imposing artificial class separation, thereby reinforcing the biological realism and interpretability of the classification outcomes.
In addition, combining data from both storage temperatures ensured that model predictions were driven by hydration-related visual cues rather than storage-specific conditions, strengthening the physiological relevance and practical applicability of the approach.

4.2. Class-Wise Performance and Misclassification Patterns

Analysis of the confusion matrix (Figure 2) revealed that most misclassifications occurred between neighboring freshness categories, particularly between Very Fresh and Moderately Fresh, and between Low Freshness and Spoiled fruits. This pattern is physiologically meaningful, as fruits near class boundaries differ only marginally in internal hydration status and therefore share overlapping surface characteristics, including gradual changes in color saturation, surface gloss, and the early development of localized textural irregularities. Such overlap reflects the continuous nature of postharvest dehydration, during which structural and optical changes emerge progressively rather than as discrete transitions [21,22,23]. This quantitative boundary clustering further supports the interpretation that misclassifications primarily arise from gradual physiological transitions rather than model instability. Importantly, direct misclassification between extreme freshness states was rare, indicating that the model consistently distinguished fully hydrated from severely dehydrated fruits. This robustness at the extremes is particularly relevant from a commercial perspective, as these categories correspond to clearly marketable versus non-marketable products.
ROC analysis further corroborated these findings. The ROC curves (Figure 3) exhibited high AUC values across all freshness classes, demonstrating strong overall discriminative ability of the model. The Very Fresh and Spoiled categories showed particularly high AUC values, consistent with their distinct physiological states and well-defined visual signatures. In contrast, slightly reduced AUC values for intermediate freshness categories reflect the inherently transitional nature of moderate dehydration, where heterogeneous and spatially variable surface changes give rise to partially overlapping visual patterns. Notably, this graded reduction in class separability indicates that the CNN captured a biologically realistic hydration continuum rather than enforcing artificial class boundaries. Such behavior enhances confidence in the physiological relevance of the learned representations and supports the suitability of the approach for real-world freshness assessment, where uncertainty is greatest precisely at intermediate quality stages.
Collectively, these results confirm that the CNN preserves physiological continuity while maintaining strong discriminative power at commercially relevant hydration extremes.
The relatively lower F1-scores observed for the intermediate freshness classes likely reflect both physiological continuity and visual ambiguity inherent to moderate dehydration stages. During early-to-intermediate water loss, structural and optical changes occur gradually and heterogeneously across the fruit surface, leading to partial overlap in color saturation, gloss reduction, and micro-textural irregularities. Unlike the extreme hydration states, which exhibit clearly distinguishable visual signatures, intermediate categories represent transitional physiological states without sharply defined boundaries. This overlap is further influenced by intra-fruit spatial variability and slight differences in dehydration kinetics across storage conditions. Future improvements in discriminative performance for adjacent classes may be achieved by incorporating multi-modal features (e.g., hyperspectral or thermal cues), integrating temporal progression modeling, or applying ordinal classification frameworks that explicitly account for the ordered nature of freshness decline. Additionally, higher-resolution imaging or refined texture feature extraction may enhance sensitivity to subtle dehydration signatures characteristic of transitional stages.

4.3. Comparison with Previous Image-Based Hydration Assessment Approaches

Earlier studies have demonstrated that visible-light color features combined with classical ML models can be used to monitor postharvest hydration in cucumber fruit [17]. These approaches provided important proof-of-concept evidence that surface color carries information related to internal water status. However, they relied on manually engineered features and shallow learning algorithms, which inherently limit the ability to capture complex, spatially heterogeneous visual patterns associated with progressive dehydration.
The present study extends this line of research by introducing a deep learning framework that directly learns hierarchical, non-linear representations of surface color and texture from raw RGB images, without the need for predefined feature extraction. This represents a key methodological advance, as CNNs can integrate both local and global visual cues (e.g., fine-scale wrinkling, spatial color gradients, and textural heterogeneity) that emerge during dehydration but are difficult to quantify explicitly [10,14,17]. In our previous study using handcrafted RGB color descriptors combined with Random Forest regression models to estimate RWC, the best-performing model achieved a coefficient of determination (R2) of 0.886 and a correlation coefficient (R) of 0.941, with an RMSE of approximately 5.76% RWC on the testing dataset [17]. While this demonstrated strong predictive capability for continuous hydration estimation, that framework did not perform discrete freshness classification. In contrast, the CNN framework developed in the present study directly classifies physiologically meaningful hydration categories and achieved an overall classification accuracy of 91.35% and a Cohen’s Kappa coefficient of 0.875 (Table 1). Moreover, discrimination of the extreme hydration classes (Very Fresh and Spoiled) yielded F1-scores exceeding 0.94 (Table 2), indicating robust identification of commercially critical freshness thresholds. These findings demonstrate that deep hierarchical feature learning not only preserves strong hydration-related predictive performance but also enhances practical applicability by enabling reliable categorical freshness discrimination. This improvement is particularly evident at the hydration extremes, where advanced dehydration induces pronounced structural and optical divergence from the fully hydrated state, enabling the CNN to capture complex spatial signatures that are difficult to represent using manually engineered descriptors [11,22,23].
Beyond performance metrics, a distinguishing feature of the present work is the integration of interpretability analyses [24,25] to validate the physiological relevance of learned features. The structured misclassification patterns (Figure 2) and the absence of widespread confusion between extreme freshness categories indicate that the CNN did not rely on spurious correlations or background artifacts, but instead responded to meaningful surface traits associated with water loss. This behavior contrasts with classical ML pipelines, where model decisions are often difficult to trace back to specific visual or physiological drivers [11,14,24].
This framework reduces reliance on handcrafted features, improves scalability across large datasets, and is readily transferable to automated, high-throughput grading systems [13,26,27]. At the same time, certain limitations should be acknowledged. Deep learning models typically require larger annotated datasets and greater computational resources than classical ML approaches, and their performance may be influenced by cultivar-specific traits or imaging conditions [13,26,27]. Nevertheless, the strong robustness observed across hydration extremes and the biologically realistic uncertainty at intermediate stages suggest that the proposed framework achieves a favorable balance between predictive power, interpretability, and practical applicability.
Overall, this study advances image-based hydration assessment beyond proof-of-concept, establishing a generalizable, physiology-informed, and deployment-ready framework for non-destructive freshness evaluation in postharvest horticulture.

4.4. Physiological Interpretability and Model Transparency

A key strength of this study lies in the integration of interpretability analyses to validate the physiological plausibility of the CNN’s predictions. The combined use of Grad-CAM and saliency maps (Figure 4) enabled direct visualization of the surface features that informed model decisions, providing insight into how external appearance reflects internal hydration status. By combining deep learning with Grad-CAM and saliency mapping, the study reveals that the CNN responds to surface wrinkling, gloss loss, and spatial heterogeneity associated with declining turgor, thereby providing mechanistic insight into the optical manifestation of dehydration. At the cellular level, declining RWC reduces vacuolar volume and turgor pressure in epidermal and sub-epidermal tissues, leading to partial cell wall relaxation and micro-scale shrinkage. This mechanical adjustment induces subtle cuticular deformation and surface undulation, which manifest macroscopically as wrinkling and reduced gloss. Simultaneously, dehydration alters intercellular air space distribution and refractive index contrasts within hydrated tissues, modifying internal light scattering and surface reflectance properties. These structural and optical changes collectively provide a physiological basis for the spatial activation patterns detected by the CNN. Across all freshness categories, the CNN consistently focused on surface regions associated with texture integrity, wrinkling development, and gloss loss, which are well-established macroscopic manifestations of declining cellular turgor and tissue hydration.
For Very Fresh fruits (RWC ≥ 98%), model attention was distributed relatively uniformly across the fruit surface, emphasizing smooth, continuous regions with homogeneous color and high reflectance. This pattern is indicative of intact epidermal structure and stable optical properties characteristic of fully hydrated tissues [1,28,29]. In contrast, Spoiled fruits (RWC < 90%) exhibited highly localized and intense activation in regions displaying pronounced surface wrinkling, structural discontinuities, and heterogeneous coloration (Figure 4), consistent with advanced dehydration and loss of turgor-driven mechanical stability [1,3,28]. These localized activation “hotspots” suggest that the CNN detected spatially heterogeneous dehydration signatures rather than relying on global color shifts alone.
Intermediate freshness classes showed more diffuse and spatially variable activation patterns, reflecting subtle, patchy surface changes that emerge during moderate water loss. Such patterns are physiologically meaningful, as dehydration initially affects tissue hydration and mechanical properties unevenly, leading to localized alterations in surface texture and reflectance before becoming globally apparent [1,3,28]. The presence of these graded activation patterns indicates that the CNN captured a continuum of hydration-related visual cues rather than imposing artificial categorical distinctions. This statistically supported association confirms that CNN attention regions correspond to physiologically meaningful dehydration patterns rather than arbitrary visual artifacts.
Importantly, the interpretability results demonstrate that the CNN relied on physiologically relevant surface traits intrinsic to the fruit, rather than background artifacts, imaging geometry, or illumination effects. The convergence of Grad-CAM and saliency map outputs further reinforces the robustness of the learned representations. Collectively, Figure 4 uniquely reveals that deep learning can disentangle fine-scale, spatially resolved visual signatures of dehydration from RGB images, offering a mechanistic link between surface appearance and internal water status. This level of transparency strengthens confidence in the biological validity of the model and supports its potential adoption in postharvest quality assessment systems where interpretability is essential. Although these visualizations suggest that both color- and texture-related cues contribute to classification, the present study did not quantitatively disentangle their relative contributions.

4.5. Practical Implications for Postharvest Quality Control

From an applied perspective, the high classification accuracy achieved by the CNN (Table 2), together with the clear physiological interpretability of model decisions (Figure 4), supports the suitability of this approach for commercial postharvest quality assessment. Internal hydration status is a central determinant of cucumber shelf life, as it directly reflects tissue turgor, mechanical integrity, and susceptibility to subsequent quality losses during storage and distribution [12]. Fruits entering the postharvest chain with reduced hydration potential are more prone to rapid deterioration, even under optimal storage conditions, whereas fully hydrated fruits retain firmness and visual quality for longer periods [17,30]. Consequently, early knowledge of hydration status provides critical information on shelf-life potential and downstream handling requirements [17].
At present, conventional postharvest sorting procedures for cucumbers and other vegetables do not explicitly account for internal hydration status, despite its central role in determining shelf-life potential [13,14,17]. As a result, batches with reduced hydration (and consequently limited postharvest performance) cannot be reliably identified at reception or early storage stages. The methodology proposed in this study provides a rigorous, knowledge-based framework for addressing this gap by enabling objective, non-destructive classification of fruit according to hydration-related freshness.
Although standardized illumination conditions are required for reliable image acquisition, these can be readily implemented in commercial environments through the integration of controlled light sources within grading or inspection units [27,31]. This requirement is compatible with postharvest logistics, where handling and storage areas are typically maintained under low or no ambient light. Importantly, the use of visible-light RGB imaging substantially facilitates commercial adoption, as it relies on low-cost, widely available hardware compared with sensing technologies operating in the extended near-infrared or hyperspectral range [10,32].
From a business perspective, initial capital investment is required for system deployment and crop-specific calibration [11]. However, hydration-based sorting enables targeted handling strategies, improved shelf-life management, and access to higher-value markets by safeguarding internal quality. By allowing fruits with superior postharvest performance to be preferentially selected for longer storage or extended distribution chains, the proposed approach has the potential to significantly reduce postharvest losses and enhance economic returns across the supply chain [3,7].
The ability to non-destructively assess freshness based on internal hydration status enables more informed and dynamic postharvest decision-making. For example, batches classified as Very Fresh may be allocated to longer storage or extended distribution routes, whereas fruits classified as Low Freshness or approaching Spoiled status could be prioritized for immediate marketing, short supply chains, or alternative uses. Such differentiation at the point of reception or early storage could substantially reduce postharvest losses, improve inventory management, and enhance overall supply-chain efficiency. In addition, hydration-based screening of incoming material allows rapid quality control of received batches, supporting acceptance, rejection, or differentiated handling strategies [3,7,14].
Importantly, the use of discrete freshness classes rather than continuous RWC values enhances the practical applicability of the system. While RWC provides a robust physiological metric [17], its direct interpretation requires expert knowledge and is not readily actionable in commercial environments [14,32]. In contrast, categorical freshness classes translate complex physiological information into intuitive decision-support outputs that can be immediately integrated into grading, sorting, and logistics workflows without additional interpretation [33,34]. This class-based framework aligns with existing commercial practices, which typically rely on categorical quality thresholds rather than continuous physiological measurements [34].
The proposed system is also inherently flexible. Class boundaries can be recalibrated or adjusted to accommodate different cultivars, storage conditions, market requirements, or risk tolerances, without modifying the core imaging or modeling framework. Such adaptability allows the approach to be tailored to specific supply chains or quality standards, further enhancing its robustness and scalability. Combined with the low cost, wide availability, and ease of integration of RGB imaging, these features position the proposed deep learning framework as a practical, deployable tool for real-time freshness assessment and loss reduction in commercial postharvest operations.

4.6. Limitations and Future Perspectives

Despite its strong performance, several limitations of the present study should be acknowledged, which also point toward promising directions for future research. First, the analysis was conducted using a single greenhouse-grown cucumber cultivar (“Cretasun RZ”) during one production season. Although the fruits were obtained from commercial production, cultivation occurred under controlled greenhouse conditions, which reduced environmental variability. This choice was intentional, as cultivar uniformity and stable pre-harvest conditions minimized background variability and allowed a clear examination of the relationship between surface appearance and internal hydration status. Nevertheless, surface color, pigment composition, cuticle properties, and dehydration kinetics may differ among cultivars and growing environments [12], including differences in cuticle thickness, epidermal structure, surface gloss, skin pigmentation, and fruit texture, which may influence the visual expression of dehydration and thus affect model generalization. Future studies should therefore evaluate the robustness and external validity of the proposed framework across multiple cultivars, production systems (e.g., greenhouse vs. open-field cultivation), and seasons, and examine how cultivar-specific traits influence the learned visual representations and classification performance under more diverse commercial production environments, including open-field cultivation and varying climatic conditions.
From a physiological perspective, the CNN likely integrates multiple, interrelated visual cues associated with dehydration. Progressive water loss affects not only surface texture and wrinkling due to declining turgor, but also optical properties linked to pigment concentration, light scattering, and surface gloss [17,22]. These changes are not independent: reductions in cellular hydration alter tissue mechanics, which in turn modify surface microstructure and light reflectance [22,23]. Although the present study did not explicitly disentangle the relative contributions of color (pigment-related) versus texture (turgor-related) features, the interpretability analyses suggest that the CNN jointly exploited these coupled signals. An additional limitation is that the relative contributions of color-related cues (pigment- and gloss-associated changes) versus texture-related cues (wrinkling and turgor-loss-associated microstructure) were not quantitatively separated. While Grad-CAM and saliency maps indicate that the CNN exploits both chromatic and textural regions in a physiologically meaningful manner, dedicated ablation and feature-isolation analyses (e.g., training/evaluating models using grayscale images to emphasize texture, color-normalized images to suppress chromatic variation, or comparing texture-only vs. color-only representations) are needed to determine which visual modality dominates prediction across hydration stages. Future work combining RGB imaging with complementary modalities, such as hyperspectral imaging or 3D surface profiling, could help further resolve the physiological drivers underlying the learned features.
Additional experimental constraints include the use of two storage temperatures, unwaxed fruits, fixed illumination conditions, and standardized fruit orientation during image acquisition. While these controlled conditions were essential for establishing a reliable proof of concept, real-world postharvest environments involve greater variability in lighting, fruit positioning, surface treatments, and handling history. Extending the framework to more diverse storage regimes, incorporating waxed or coated fruits, and increasing robustness to variable illumination and orientation will be important steps toward commercial deployment [17]. Data augmentation and domain adaptation techniques, together with targeted retraining on representative industrial datasets, offer practical pathways to address these challenges.
Looking forward, the framework could be scaled to include multiple cultivars or even different high-moisture horticultural species by leveraging transfer learning strategies. Pretrained CNN models could be fine-tuned using relatively small, labeled datasets, reducing the data requirements associated with training from scratch. Such approaches would facilitate rapid adaptation to new crops while retaining the physiological interpretability demonstrated in this study.
Finally, integration into postharvest sorting and grading chains will require optimization of imaging speed and computational efficiency [17]. While the current workflow demonstrates feasibility at experimental scale, real-time deployment would benefit from automated fruit handling, inline imaging, and streamlined inference pipelines capable of delivering freshness classification outputs within fractions of a second. Advances in edge computing and hardware-accelerated inference make such real-time implementation increasingly feasible, positioning the proposed approach as a realistic candidate for next-generation postharvest quality control systems.

5. Conclusions

This study demonstrates that deep learning applied to standardized RGB imaging can robustly link cucumber surface color and texture to internal hydration status, enabling accurate, non-destructive, and physiologically meaningful freshness classification. By integrating RWC measurements with CNN modeling and interpretability analyses, the proposed framework moves beyond empirical image classification and establishes a mechanistic connection between external visual traits and internal water-related physiology.
The strong classification performance, particularly for commercially critical freshness extremes, together with biologically realistic uncertainty at intermediate hydration levels, underscores the validity of the approach. Importantly, model interpretability analyses revealed that classification decisions were driven by physiologically relevant surface features associated with turgor loss, texture degradation, and optical changes, reinforcing confidence in the transparency and reliability of the learned representations.
From a practical perspective, the combination of low-cost RGB imaging and class-based freshness outputs provides an actionable and scalable solution for postharvest quality control. Early identification of hydration-related quality decline can support informed handling decisions, optimized storage allocation, and reduced postharvest losses, while the flexibility of the classification framework allows recalibration to different cultivars, storage conditions, and market requirements.
Overall, this work highlights the potential of physiology-informed deep learning to advance non-destructive freshness assessment in cucumbers and other high-moisture horticultural commodities, offering a realistic pathway toward hydration-based sorting, improved shelf-life management, and intelligent, real-time quality monitoring in modern postharvest supply chains.

Author Contributions

A.T.-G.: Model Development, Formal Analysis, Validation, Visualization, Writing—Review and Editing. T.M.: Investigation, Methodology, Data Curation, Formal Analysis, Visualization, Writing—Review and Editing. O.A.: Model Development, Formal Analysis, Validation, Visualization, Writing—Review and Editing. A.S.: Investigation, Methodology, Writing—Review and Editing. G.T.: Supervision, Writing—Review and Editing. D.F.: Conceptualization, Investigation, Methodology, Data Curation, Validation, Visualization, Supervision, Writing—Original Draft, Writing—Review and Editing, Project Administration, Resources. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The data presented in this study are available from the corresponding author upon reasonable request.

Acknowledgments

We gratefully thank students Theodoros Michailellis, Aikaterini Oikonomou and Aikaterini Liouliaki for their valuable assistance with the measurements. We are also grateful to the Academic Editor and the three anonymous reviewers for their careful evaluation and valuable suggestions, which substantially strengthened the manuscript.

Conflicts of Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Abbreviations

AUC, area under the curve; CNN, convolutional Neural Network; Grad-CAM, gradient-weighted class activation mapping; ML, machine learning; RWC, relative water content; RGB, Red–Green–Blue; ROC, receiver operating characteristic.

References

  1. Galindo, F.G.; Herppich, W.; Gekas, V.; Sjöholm, I. Factors Affecting Quality and Postharvest Properties of Vegetables: Integration of Water Relations and Metabolism. Crit. Rev. Food Sci. Nutr. 2004, 44, 139–154. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  2. Lufu, R.; Ambaw, A.; Opara, U.L. Water Loss of Fresh Fruit: Influencing Pre-Harvest, Harvest and Postharvest Factors. Sci. Hortic. 2020, 272, 109519. [Google Scholar] [CrossRef] [Scilit]
  3. Gidado, M.J.; Gunny, A.A.N.; Gopinath, S.C.B.; Ali, A.; Wongs-Aree, C.; Salleh, N.H.M. Challenges of Postharvest Water Loss in Fruits: Mechanisms, Influencing Factors, and Effective Control Strategies—A Comprehensive Review. J. Agric. Food Res. 2024, 17, 101249. [Google Scholar] [CrossRef] [Scilit]
  4. Moalemiyan, M.; Ramaswamy, H.S. Quality Retention and Shelf-Life Extension in Mediterranean Cucumbers Coated with a Pectin-Based Film. J. Food Res. 2012, 1, 159. [Google Scholar] [CrossRef] [Scilit]
  5. Manjunatha, M.; Anurag, R.K. Effect of Modified Atmosphere Packaging and Storage Conditions on Quality Characteristics of Cucumber. J. Food Sci. Technol. 2014, 51, 3470–3475. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  6. Sui, X.; Shan, N.; Hu, L.; Zhang, C.; Yu, C.; Ren, H.; Turgeon, R.; Zhang, Z. The Complex Character of Photosynthesis in Cucumber Fruit. J. Exp. Bot. 2017, 68, 1625–1637. [Google Scholar] [CrossRef] [Scilit]
  7. Onwude, D.I.; Chen, G.; Eke-emezie, N.; Kabutey, A.; Khaled, A.Y.; Sturm, B. Recent Advances in Reducing Food Losses in the Supply Chain of Fresh Agricultural Produce. Processes 2020, 8, 1431. [Google Scholar] [CrossRef] [Scilit]
  8. Fanourakis, D.; Tsaniklidis, G.; Makraki, T.; Nikoloudakis, N.; Bartzanas, T.; Sabatino, L.; Fatnassi, H.; Ntatsi, G. Climate Change Impacts on Greenhouse Horticulture in the Mediterranean Basin: Challenges and Adaptation Strategies. Plants 2025, 14, 3390. [Google Scholar] [CrossRef] [Scilit]
  9. Poorter, H.; Fiorani, F.; Pieruschka, R.; Wojciechowski, T.; Van Der Putten, W.H.; Kleyer, M.; Schurr, U.; Postma, J. Pampered inside, Pestered Outside? Differences and Similarities between Plants Growing in Controlled Conditions and in the Field. New Phytol. 2016, 212, 838–855. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  10. Taheri-Garavand, A.; Rezaei Nejad, A.; Fanourakis, D.; Fatahi, S.; Ahmadi Majd, M. Employment of Artificial Neural Networks for Non-Invasive Estimation of Leaf Water Status Using Color Features: A Case Study in Spathiphyllum wallisii. Acta Physiol. Plant. 2021, 43, 78. [Google Scholar] [CrossRef] [Scilit]
  11. Fanourakis, D.; Papadakis, V.M.; Machado, M.; Psyllakis, E.; Nektarios, P.A. Non-invasive Leaf Hydration Status Determination through Convolutional Neural Networks Based on Multispectral Images in Chrysanthemum. Plant Growth Regul. 2024, 102, 485–496. [Google Scholar] [CrossRef] [Scilit]
  12. Fanourakis, D.; Makraki, T.; Spyrou, G.P.; Karavidas, I.; Tsaniklidis, G.; Ntatsi, G. Environmental Drivers of Fruit Quality and Shelf Life in Greenhouse Vegetables: Species-Specific Insights. Agronomy 2025, 16, 48. [Google Scholar] [CrossRef] [Scilit]
  13. Cubero, S.; Aleixos, N.; Moltó, E.; Gómez-Sanchis, J.; Blasco, J. Advances in Machine Vision Applications for Automatic Inspection and Quality Evaluation of Fruits and Vegetables. Food Bioprocess Technol. 2011, 4, 487–504. [Google Scholar] [CrossRef] [Scilit]
  14. Nicolaï, B.M.; Defraeye, T.; De Ketelaere, B.; Herremans, E.; Hertog, M.L.A.T.M.; Saeys, W.; Torricelli, A.; Vandendriessche, T.; Verboven, P. Nondestructive Measurement of Fruit and Vegetable Quality. Annu. Rev. Food Sci. Technol. 2014, 5, 285–312. [Google Scholar] [CrossRef] [Scilit]
  15. Tovar, J.C.; Hoyer, J.S.; Lin, A.; Tielking, A.; Callen, S.T.; Elizabeth Castillo, S.; Miller, M.; Tessman, M.; Fahlgren, N.; Carrington, J.C.; et al. Raspberry Pi–Powered Imaging for Plant Phenotyping. Appl. Plant Sci. 2018, 6, e1031. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  16. Akbarpour, O.; Akbari, S.; Fanourakis, D.; Taheri-Garavand, A. Deep Learning-Based Seed Variety Classification: A Case Study in Maize. BMC Plant Biol. 2025, 26, 105. [Google Scholar] [CrossRef] [Scilit]
  17. Makraki, T.; Tsaniklidis, G.; Papadimitriou, D.M.; Taheri-Garavand, A.; Fanourakis, D. Non-Destructive Monitoring of Postharvest Hydration in Cucumber Fruit Using Visible-Light Color Analysis and Machine-Learning Models. Horticulturae 2025, 11, 1283. [Google Scholar] [CrossRef] [Scilit]
  18. Tsaniklidis, G.; Makraki, T.; Papadimitriou, D.; Nikoloudakis, N.; Taheri-Garavand, A.; Fanourakis, D. Non-Destructive Estimation of Area and Greenness in Leaf and Seedling Scales: A Case Study in Cucumber. Agronomy 2025, 15, 2294. [Google Scholar] [CrossRef] [Scilit]
  19. Landim, A.P.M.; Barbosa, M.I.M.J.; Júnior, J.L.B. Influence of Osmotic Dehydration on Bioactive Compounds, Antioxidant Capacity, Color and Texture of Fruits and Vegetables: A Review. Ciênc. Rural 2016, 46, 1714–1722. [Google Scholar] [CrossRef] [Scilit]
  20. Radojčin, M.; Pavkov, I.; Bursać Kovačević, D.; Putnik, P.; Wiktor, A.; Stamenković, Z.; Kešelj, K.; Gere, A. Effect of Selected Drying Methods and Emerging Drying Intensification Technologies on the Quality of Dried Fruit: A Review. Processes 2021, 9, 132. [Google Scholar] [CrossRef] [Scilit]
  21. Kays, S.J.; Paull, R.E. Postharvest Biology, 2nd ed.; Exon Press: Athens, Greece, 2004; ISBN 978-1-888186-54-3. [Google Scholar]
  22. Vicente, A.R.; Saladié, M.; Rose, J.K.; Labavitch, J.M. The Linkage between Cell Wall Metabolism and Fruit Softening: Looking to the Future. J. Sci. Food Agric. 2007, 87, 1435–1448. [Google Scholar] [CrossRef] [Scilit]
  23. Barrett, D.M.; Beaulieu, J.C.; Shewfelt, R. Color, Flavor, Texture, and Nutritional Quality of Fresh-Cut Fruits and Vegetables: Desirable Levels, Instrumental and Sensory Measurement, and the Effects of Processing. Crit. Rev. Food Sci. Nutr. 2010, 50, 369–389. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  24. Liu, D.; Liu, Y.; Li, S.; Li, W.; Wang, L. Fusion of Handcrafted and Deep Features for Medical Image Classification. J. Phys. Conf. Ser. 2019, 1345, 022052. [Google Scholar] [CrossRef] [Scilit]
  25. Selvaraju, R.R.; Das, A.; Vedantam, R.; Cogswell, M.; Parikh, D.; Batra, D. Grad-CAM: Why Did You Say That? arXiv 2017, arXiv:1611.07450. [Google Scholar] [CrossRef] [Scilit]
  26. LeCun, Y.; Bengio, Y.; Hinton, G. Deep Learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef] [Scilit]
  27. 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]
  28. Lara, I.; Heredia, A.; Domínguez, E. Shelf Life Potential and the Fruit Cuticle: The Unexpected Player. Front. Plant Sci. 2019, 10, 770. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  29. Fernández-Muñoz, R.; Heredia, A.; Domínguez, E. The Role of Cuticle in Fruit Shelf-Life. Curr. Opin. Biotechnol. 2022, 78, 102802. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  30. Jahan, S.E.; Hassan, M.K.; Roy, S.; Ahmed, Q.M.; Hasan, G.N.; Muna, A.Y.; Sarkar, M.N. Effects of Different Postharvest Treatments on Nutritional Quality and Shelf Life of Cucumber. Asian J. Crop Soil Sci. Plant Nutr. 2020, 2, 51–61. [Google Scholar] [CrossRef] [Scilit]
  31. Rojas Santelices, I.; Cano, S.; Moreira, F.; Peña Fritz, Á. Artificial Vision Systems for Fruit Inspection and Classification: Systematic Literature Review. Sensors 2025, 25, 1524. [Google Scholar] [CrossRef] [Scilit]
  32. Feng, Y.-Z.; Sun, D.-W. Application of Hyperspectral Imaging in Food Safety Inspection and Control: A Review. Crit. Rev. Food Sci. Nutr. 2012, 52, 1039–1058. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  33. Blasco, J.; Aleixos, N.; Moltó, E. Machine Vision System for Automatic Quality Grading of Fruit. Biosyst. Eng. 2003, 85, 415–423. [Google Scholar] [CrossRef] [Scilit]
  34. Mahajan, P.V.; Caleb, O.J.; Singh, Z.; Watkins, C.B.; Geyer, M. Postharvest Treatments of Fresh Produce. Philos. Trans. R. Soc. Math. Phys. Eng. Sci. 2014, 372, 20130309. [Google Scholar] [CrossRef] [Scilit] [PubMed]
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.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.