Skip to Content
HorticulturaeHorticulturae
  • Article
  • Open Access

23 January 2026

41 Pages

Comparative Analysis of R-CNN and YOLOv8 Segmentation Features for Tomato Ripening Stage Classification and Quality Estimation

,
,
,
and
1
Instituto de Investigación para la Gestión Integrada de Zonas Costeras, Universitat Politècnica de València, C/Paranimf 1, 46730 Gandia, Spain
2
Department of Plant Science, The Pennsylvania State University, University Park, PA 16802, USA
3
Departamento de Produccioón Agraria, Escuela Técnica Superior de Ingeniería Agronómica, Alimentaria y de Biosistemas, Universidad Politécnica de Madrid, Avenida Puerta de Hierro 4, 28040 Madrid, Spain
*
Author to whom correspondence should be addressed.

Abstract

Accurate classification of tomato ripening stages and quality estimation is pivotal for optimizing post-harvest management and ensuring market value. This study presents a rigorous comparative analysis of morphological and colorimetric features extracted via two state-of-the-art deep learning-based instance segmentation frameworks—Mask R-CNN and YOLOv8n-seg—and their efficacy in machine learning-driven ripening stage classification and quality prediction. Using 216 fresh-market tomato fruits across four defined ripening stages, we extracted 27 image-derived features per model, alongside 12 laboratory-measured physio-morphological traits. Multivariate analyses revealed that R-CNN features capture nuanced colorimetric and structural variations, while YOLOv8 emphasizes morphological characteristics. Machine learning classifiers trained with stratified 10-fold cross-validation achieved up to 95.3% F1-score when combining both feature sets, with R-CNN and YOLOv8 alone attaining 96.9% and 90.8% accuracy, respectively. These findings highlight a trade-off between the superior precision of R-CNN and the real-time scalability of YOLOv8. Our results demonstrate the potential of integrating complementary segmentation-derived features with laboratory metrics to enable robust, non-destructive phenotyping. This work advances the application of vision-based machine learning in precision agriculture, facilitating automated, scalable, and accurate monitoring of fruit maturity and quality.

1. Introduction

Food production has been going through a significant transformation over the last decade, thereby integrating monitoring technologies aimed at enhancing productivity and reducing the impact of agriculture. Using the Internet of Things (IoT) and remote sensing has strongly modified how fruits and vegetables are produced and improved the profitability of farming systems [1]. In recent years, European initiatives have focused on the postharvest process to minimize food losses and waste. While some sectors are designing packaging to minimize food over-ripening and spoilage, the inclusion of monitoring systems in post-harvest and along the value chain has been critical. These monitoring systems can be destructive or non-destructive methods [2].
Tomato (Solanum lycopersicum L.) is among the most widely grown and consumed horticultural crops globally, and the second most important vegetable in terms of economic importance worldwide [3]. Tomato ripening is a climacteric process regulated by ethylene and characterized by distinct physiological and biochemical changes. According to USDA classification, tomato ripening progresses through six stages based on external color changes: Green, Breaker, Turning, Pink, Light Red, and Red [4]. In the Green stage, the fruit is fully green with no visible pigmentation and remains in this phase for approximately 20–30 days after pollination, depending on cultivar and environmental conditions. The Breaker stage, marked by the first appearance of color on less than 10% of the surface, typically lasts 2–3 days. The Turning stage, with 10–30% color development, also spans 2–3 days, followed by the Pink stage (30–60% color coverage) and Light Red stage (60–90%), each lasting 2–3 days. The final Red stage, where the fruit is fully colored and ripe, lasts 3–7 days before over-ripening begins [5]. These timelines are influenced by environmental factors such as temperature and light, which can accelerate or delay ripening. Understanding these stage-specific durations is essential for optimizing harvest timing and post-harvest handling in both commercial and research settings.
In the market, it has multiple destinations; it can be sold as a fresh-market product or be processed and marketed as a transformed product. In both cases, the ripening stage and pigmentation of the fruits are quite important from a market perspective. Thus, evaluating the tomato fruit ripening stages along the post-harvest processes is critical to maximize their quality and market value, and minimize decay and product waste. After tomatoes are harvested, a series of physiological and biochemical degenerative processes occur, altering their properties [6]. Transpiration leads to water loss, impacting weight and skin appearance. Biochemical compounds start degrading, ethylene is produced, and oxidative reactions occur, which impact the color and smoothness. In addition, mechanical damages and microbiological activity heavily impact tomato fruit’s appearance and, therefore, its market value. Even though most of these processes occur at a biochemical level, their direct impact on the tomato’s appearance and visual quality allows for evaluating its ripeness by visual methods.
Therefore, post-harvest management monitoring systems allow for the evaluation of the tomato fruits’ ripeness and can be used as input for accurately determining the market value and their potential destination. Focusing on non-destructive methods, there is a huge variety of methods for ripening determination in tomatoes: Delayed Luminescence [7], Raman [8] and VIS–NIR spectroscopy [9], acoustic impact [10] and ultrasonic signal [11], thermal imaging [12], contact methods with electrodes [13], and electronic nose [14]. Nevertheless, using cameras combined with different sorts of image processing methods is, without a doubt, the most promising solution currently. Despite its low cost and the potential for automation, cameras in post-harvest plants have been used in the past, and operators are familiarized with them, ensuring this technology’s adoption. Among the used cameras, some solutions used hyperspectral cameras [15] while others used multispectral cameras [16]. Traditional cameras, or RGB cameras, have also been described [17]. Regarding the methodologies for image processing, solutions range from simple methods such as color evaluation [18] to more complex methods using deep learning algorithms, such as Region-based Convolutional Neural Network (R-CNN) [19] and You Only Look Once (YOLO) [20]. These approaches employ image segmentations and object recognition algorithms to automatically estimate different features of the identified objects.
Despite significant progress in computer vision and deep learning for agricultural applications, limited studies have systematically investigated the integration of image-derived features from advanced instance segmentation models with laboratory-measured quality traits to assess tomato fruit ripening. Most prior work has focused on coarse visual classification or a narrow set of handcrafted features, often without rigorous comparison of segmentation architectures or alignment with standardized ripening benchmarks like those defined by the U.S. Department of Agriculture (USDA) [4]. A key strength of this study is the integration of detailed morphological and colorimetric features, extracted by two state-of-the-art instance segmentation models (Mask R-CNN and YOLOv8n-seg), along with 12 laboratory-measured traditional quality traits. This approach enables a fusion of image-derived features and laboratory-based quality parameters in a comparative and complementary manner to assess their predictive power for ripening stage classification and quality estimation. The resulting framework enhances both methodological robustness and practical applicability in fruit phenotyping, quality assessment, and post-harvest management, among others.
In addition to feature extraction and comparison, this research introduces a novel multivariate analysis framework combining unsupervised methods (PCA and correlation network analysis) with supervised machine learning classification to predict four USDA-defined ripening stages: green, turning, pink, and red. PCA was applied for unsupervised pattern discovery and visualization of multivariate relationships. The number of components retained was determined using Kaiser’s criterion (eigenvalues > 1). PCA facilitated the exploration of data structure, identification of ripening stage groupings, and interpretation of variable contributions. The study examines individual and combined feature sets (LAB, CNN, YOLO, CNN + YOLO, and LAB + CNN + YOLO), in a comparative and complementary manner, to evaluate model performance and complementarity, offering new insights into the interpretability and robustness of machine learning based ripeness estimation.
While numerous studies have benchmarked traditional image processing approaches—such as thresholding, color-space transformations, and handcrafted feature extraction—against modern computer vision techniques, the objective of the present work is not to revisit these classical comparisons. Instead, the focus is placed on evaluating two deep learning-based segmentation frameworks. Deep learning, a comparatively recent but rapidly expanding tool in agricultural imaging [21], enables end-to-end learning of hierarchical and discriminative features directly from raw pixels. These models simultaneously capture complex texture, color gradients, and shape cues without manual feature engineering, exhibit superior performance in multi-class ripening stage discrimination, and demonstrate strong adaptability to new environments, cultivars, and imaging conditions. In contrast, traditional image processing pipelines generally rely on domain-specific parameter tuning, struggle with the nonlinear and overlapping visual traits characteristic of progressive ripening stages, perform best in simple binary tasks (e.g., ripe vs. unripe), and require substantial re-engineering when transferred to new fruit types, limiting their scalability in real-world applications [22,23,24]. Readers seeking a detailed comparison between state-of-the-art deep learning models and classical image processing methods are referred to these prior works.
Although presented here as a proof of concept, the segmentation–classification framework has clear value in agri-food technology, especially in precision farming, post-harvest quality control, and autonomous fruit sorting. This technology could be adopted for monitoring purposes or integrated into robotic harvesters or smart sorting lines to assess fruit maturity in real time, improving harvest timing and reducing post-harvest losses. The extracted morphological and color traits are interpretable and adaptable, making the system suitable even in resource-limited settings where customized solutions and low-cost sensors are required. By spanning both field and industrial contexts, the approach could establish a pathway toward scalable, transparent, and sensor-independent tools for sustainable crop management. The inclusion of early ripening stages, often underrepresented in prior studies, further emphasizes the study’s potential applications in precision agriculture, harvest optimization, and quality control, establishing a methodological reference point for future multimodal phenotyping research.
The rest of the paper has been structured as follows: Section 2 describes the used materials and the methodology. The results are presented and analyzed in Section 3. Section 4 discusses the obtained results, contextualizing the data and evaluating the research’s limitations. Finally, conclusions are summarized in Section 5.

2. Materials and Methods

This study followed a structured framework comprising sample acquisition, imaging, and data analysis as summarized in Figure 1. Further details are provided in each sub-section.
Figure 1. Workflow for tomato phenotyping and data analysis. Fresh-market tomato fruits were harvested across four ripening stages and subjected to parallel image- and laboratory-based characterization. High-resolution images were processed using deep learning-based instance segmentation frameworks (Mask R-CNN and YOLOv8n-seg) to extract morphological and colorimetric descriptors. In parallel, physicochemical traits such as firmness, mass, and color coordinates were measured under controlled laboratory conditions. The combined datasets were analyzed through exploratory data analysis, multivariate statistics, and machine learning classifiers to evaluate feature discriminability and predictive performance for ripening stage classification and fruit quality estimation.

2.1. Tomato Sample Collection and Preparation

Fresh-market tomato fruits (Solanum lycopersicum L. cultivar Red Deuce F1) were harvested at four discrete ripening stages—green, turning, pink, and red—following the USDA color classification standards [4]. The reason for selecting these four stages was their representativeness as the key physiological and biochemical transitions during tomato ripening. They are also critical for harvest decisions: many growers harvest at the turning or pink stage to extend shelf life, while others market only fully red fruits as commercially ready [25]. The choice of stage is further important given that environmental factors influence the onset of physiological variation [26]. This four-stage classification provided a standardized basis for sample selection, ensuring consistency across imaging and laboratory analyses. By incorporating these stages, the study evaluated sensor and imaging performance across a biologically meaningful gradient, enabling robust feature extraction and classification relevant to postharvest handling, quality control, and precision agriculture.
To ensure representative sampling, fruits were selected based on uniformity of size and absence of physical damage or disease. Post-harvest, the samples were immediately transported to the laboratory and were stored under controlled ambient conditions (20 ± 1 °C, 85% relative humidity) to preserve physiological consistency before imaging and analytical procedures. Each fruit was uniquely labeled and catalogued for traceability throughout the data acquisition pipeline.

2.2. Image Acquisition and Segmentation Workflow

Digital images of individual tomato fruits were captured using the rear camera of a Samsung Galaxy S22 smartphone, mounted at a fixed height and position to ensure consistent imaging geometry. The imaging setup was established under controlled ambient lighting conditions to minimize the influence of external light variability. The primary wide-angle lens (50 MP, f/1.8 aperture, 1/1.56″ sensor size, 1.0 µm pixel width) was used, with autofocus and optical image stabilization enabled. Camera settings were manually adjusted to maintain consistency across sessions: ISO was fixed at 100, shutter speed at 1/100 s, and white balance was set to daylight mode. HDR and scene optimization features were disabled to avoid automatic post-processing that could distort color fidelity.
Fruits were placed on a matte black non-reflective background with a ruler on one side to maintain a standardized orientation and pixel to cm reference (Figure 2). The smartphone was positioned at a distance of 30 cm above the fruit, and all images were captured in a laboratory setting (Figure 1). Images were saved in high-resolution JPEG format and archived with unique identifiers for downstream analysis.
Figure 2. Images of tomato fruits at different ripening stages.
To enable automated feature extraction, instance segmentation of the tomato fruits was performed using two deep learning models: a R-CNN and the YOLOv8n-seg model. Prior to training, image annotations were manually carried out using the Roboflow platform. Annotators segmented individual fruit boundaries with pixel-level precision, and annotation quality was ensured through manual inspection and iterative refinement. The annotated datasets were then exported in COCO JSON format for compatibility with deep learning frameworks.
Both models were trained locally on a workstation running a Windows operating system, equipped with a 12th-generation Intel Core i7 processor and 16 GB of RAM. The region-based convolutional neural network (R-CNN) was implemented using the Detectron2 library, developed by Facebook AI Research (FAIR). Fine-tuning was performed on the annotated tomato ripening dataset, leveraging pretrained weights originally optimized on the COCO dataset to accelerate convergence and enhance generalization. The YOLOv8n-seg model, a lightweight variant of the YOLOv8 segmentation architecture, was deployed using the Ultralytics YOLOv8 framework in Python (v.10). For both models, training protocols incorporated standard data augmentation techniques—including random scaling, horizontal flipping, and brightness modulation—to improve robustness and reduce overfitting. Early stopping was applied based on validation loss to prevent unnecessary training iterations and model degradation. Performance evaluation was conducted using the mean Average Precision (mAP) metric, computed at intersection-over-union (IoU) thresholds of 0.50 (mAP@0.5) and 0.75 (mAP@0.75), providing a comprehensive measure of detection accuracy across varying localization stringency.
Following successful segmentation, binary masks were generated for each fruit instance. The masked images were processed alongside their corresponding binary masks to extract morphological, colorimetric, and vegetation index features. A total of 27 image-derived features were computed using Python libraries (OpenCV, scikit-image, NumPy), encompassing morphological descriptors (e.g., area, perimeter, eccentricity, aspect ratio, solidity, extent) and colorimetric features (e.g., mean and standard deviation of RGB and CIELAB color channels, Excess Red (ExR), Excess Green (ExG), Excess Green minus Excess Red (ExGR), and Normalized Difference Index (NDI) (Table 1). The resulting feature set from each model are hereafter referred to as CV-RCNN and CV-YOLO, respectively.
Table 1. Image-derived features from deep learning-based segmentation pipelines.
In this study, advanced computer vision techniques were employed because classical thresholding, watershed segmentation, and other low-level image processing methods are not appropriate baselines for ripeness estimation. The objective of this work is not object detection or counting, but the extraction and evaluation of deep-learning-derived feature representations and their complementarity with laboratory-measured quality traits. Prior research has consistently shown that traditional pipelines struggle to discriminate intermediate maturity stages, where visual cues are nonlinear and cannot be captured by simple thresholds or edge-based heuristics [27,28,29,30]. Moreover, watershed and circular-object algorithms rely on assumptions of strong local gradients and homogeneous intensity regions—conditions rarely met in tomatoes exhibiting mottled pigmentation and heterogeneous ripening patterns [31]. Importantly, segmentation alone does not provide the multiscale, discriminative features needed for quality prediction or class-level maturity assessment [32,33].

Traditional Color-Based Image Analysis

A conventional color-based image analysis pipeline was implemented as a reference to assess the comparative advantages of deep learning based instance segmentation. For example, hue saturation value (HSV) thresholding has been extensively employed for tomato fruit segmentation and ripeness assessment under controlled imaging conditions, particularly for color-driven maturity classification [34,35]. Our initial segmentation relied on literature guided HSV thresholds, where hue intervals were selected according to reported tomato color evolution, and saturation and value constraints were applied to suppress background pixels. Green fruits were segmented using hue values between 35 and 85 degrees, with saturation and value constrained between 40 and 255. Turning fruits were defined using hue values between 20 and 35 degrees under identical saturation and value constraints. Pink fruits were segmented using hue values between 10 and 20 degrees, while red fruits were segmented using two hue intervals between 0 and 10 degrees and between 170 and 180 degrees, with saturation and value restricted to the range of 40 to 255 [34,36].
Segmentation performance remained inconsistent across ripening stages despite careful threshold selection. Acceptable fruit isolation was achieved primarily for fully red tomatoes, whereas turning and pink fruits were frequently under segmented or fragmented. Additional global HSV thresholds were therefore evaluated using a broad hue range between 0 and 180 degrees, combined with saturation values greater than 20 and value values greater than 40, as well as alternative literature reported ranges for semi mature fruits. These configurations similarly failed to provide reliable and stage independent segmentation. Given the inability of HSV based methods to consistently delineate tomato fruits across all maturity stages, no quantitative results derived from these segmentation outputs are reported.
As an alternative traditional baseline, color and vegetation related features were extracted directly from the full images without reliance on explicit segmentation, hereafter referred to as whole image color processing. For each image, 256 bin histograms were computed independently for the red, green, and blue channels to characterize global color distributions. Mean HSV descriptors were also calculated, including the circular mean of hue expressed in degrees and the arithmetic means of saturation and value, together with the vegetation indices reported in Table 2. All features were paired at the image level with the corresponding ripening stage labels.
Table 2. Summary of extracted features per fruit instance from deep learning models.
Laboratory measured quality parameters of the tomatoes were subsequently merged with the image derived features prior to classification. This integration enabled evaluation of multimodal information and ensured alignment with the objective of quality driven maturity assessment. The resulting dataset was subjected to the same machine learning framework and ten-fold cross validation protocol applied to the deep learning-based feature sets, ensuring methodological consistency across all comparative analyses.

2.3. Laboratory-Based Physicochemical Measurements

A set of 12 laboratory-based physicochemical traits (referred to as the LAB) was measured for each fruit (Table 3) in order to complement and compare the image-derived descriptors. Color was evaluated in the CIELAB space, a perceptually uniform color model defined by the International Commission on Illumination (CIE, 1976), where numerical differences correspond closely to human visual perception. Values of L* (lightness), a* (green–red), and b* (blue–yellow) were recorded at the equator of each fruit using a portable Chroma Meter (Model CR-400, Konica Minolta, Tokyo, Japan), calibrated against a white reference tile before each session.
Table 3. Laboratory based qualitative assessments of tomato fruits.
Firmness was determined with a digital penetrometer (FT 327) through puncture tests at five equidistant locations (base and four sides of the fruit). Dimensional traits, including fruit height and maximum and minimum diameters, were recorded with a high-precision digital caliper (±0.01 mm accuracy), while fruit weight was measured with a calibrated analytical balance. Maximum diameter was defined as the widest cross-sectional span of the fruit, and minimum diameter as the narrowest span. All parameters in the LAB group were obtained through direct laboratory measurements using standard quality evaluation procedures, and no image-derived data were included.

2.4. Data Integration and Feature Normalization

All extracted features corresponding to individual fruit instances were consolidated into a structured dataset, wherein each image identifier was linked to its respective morphological, colorimetric, and vegetation-related descriptors. Some features, such as area and perimeter, were measured in both pixels and physical units to ensure interpretability across both computational and physical domains, especially when comparing image-derived traits with laboratory measurements. This unified feature matrix facilitates subsequent analytical tasks, including fruit classification, quality evaluation, and growth stage monitoring. A comprehensive overview of the extracted features (Equations (1)–(14)), along with the criteria and methodologies employed for their computation, is presented in Table 3. Morphological descriptors were calculated from the binary masks of the segmented fruits and were used to quantify fruit size, shape, and geometric structure. Area and perimeter describe the overall size of the fruit by measuring the number of pixels enclosed within the fruit region and the length of its boundary, respectively. Major and minor axis lengths were obtained from an ellipse fitted to the fruit region and represent the maximum and minimum dimensions of the fruit, providing information on elongation and size variability. Aspect ratio expresses the proportional relationship between these axes and serves as a dimensionless indicator of fruit shape. Eccentricity quantifies the deviation of the fruit shape from circularity, while solidity measures shape compactness by relating the fruit area to the area of its convex hull. Extent describes the proportion of the bounding box occupied by the fruit and reflects spatial distribution within the enclosing rectangle. Color based indices were derived from RGB channel intensities to characterize surface chromatic properties related to maturity, including excess green (ExG), excess red (ExR), excess green minus excess red (ExRG), and the normalized difference index (NDI). These formulas collectively provide a quantitative representation of fruit shape and color attributes relevant to maturity assessment.
For consistency and fair comparison, the same set of 27 morphological and colorimetric features was extracted from the segmentation outputs of both deep learning models, namely YOLOv8n-seg and Mask R-CNN. High resolution images were first processed using these instance segmentation frameworks to generate binary fruit masks. Morphological descriptors and colorimetric features were then computed from the segmented regions using standard image analysis techniques.
No features were excluded or dropped for either model. The combined group merges the measurements from both models without removing or altering any features. This approach ensures that differences in classification or prediction performance reflect model capability rather than variations in the feature set. Five structured feature groups were constructed for analysis (Table 4). The CV-RCNN and CV-YOLO feature groups comprised 27 similar features, extracted independently from their respective models. The ALL dataset consisted of the 54 CV features with the 12 LAB traits, yielding a comprehensive 66-feature profile per fruit (Table 5). Prior to downstream analysis, all features were standardized using standard scaling to ensure scale invariance and comparability. Normalization and dataset merging were performed using pandas and scikit-learn in Python 3.10.
Table 4. Nomenclature of feature groups used in tomato ripening classification.
Table 5. Summary of feature groups, types, and counts across datasets used in the study. Features are categorized into size/shape, weight/firmness, color, and vegetation indices. Combined datasets include features from both laboratory measurements and computer vision (CV) models.

2.5. Multivariate Statistical Analysis

Exploratory multivariate analyses were conducted separately on the following data combinations: CV-RCNN + LAB, CV-YOLO + LAB, and ALL. Principal Component Analysis (PCA) was employed to reduce data dimensionality and reveal latent structures [40]. To clarify, PCA in our study was not used for feature extraction. Instead, it was employed for unsupervised pattern discovery and visualization of multivariate relationships. The PCA function from scikit-learn was used to identify the components explaining the majority of variance. Colored convex hulls were drawn around the samples of each stage using the scipy.spatial.ConvexHull function, providing a visual representation of the grouping in reduced dimensional space. These boundaries were therefore illustrative and not the outcome of clustering. Eigenvalues and loading scores were analyzed to interpret feature contributions to principal axes.
To further elucidate the relationships among variables, correlation network analysis was applied to each dataset using the NetworkX and matplotlib libraries [40]. Edges between nodes were drawn where Pearson correlation coefficients exceeded |r| > 0.6 (p < 0.05), providing a systems-level view of feature interdependencies.

2.6. Classification of Ripening Stages Using Machine Learning

To investigate the predictive capacity of distinct feature sets in classifying tomato ripening stages, a supervised ML framework was employed. The classification task was formulated as a four-class problem corresponding to the discrete ripening categories: green, turning, pink, and red. Five feature groups were utilized in this study: LAB, CV-RCNN, CV-YOLO, Combined CV, and ALL, each representing different combinations of laboratory and computer vision-derived features.
Each dataset was partitioned into training (70%) and testing (30%) subsets using stratified random sampling to preserve the original class distribution [41]. The training data was further subjected to 10-fold cross-validation to ensure model robustness and to mitigate overfitting [42]. Five classification algorithms were selected for evaluation based on their established performance in multi-class settings and varying capacity to model linear and non-linear relationships. These included Random Forest, Support Vector Machine (SVM) with a radial basis function (RBF) kernel, k-Nearest Neighbors (KNN), Gradient Boosting (using the XGBoost implementation), and Logistic Regression. Model development and training were implemented using the scikit-learn and xgboost Python libraries.
Hyperparameter optimization for each classifier was conducted through exhaustive grid search combined with cross-validation, using the GridSearchCV function. This process enabled the identification of optimal model configurations based on validation performance within the training set. The resulting models were then evaluated on the held-out test set.
Model performance was assessed using a comprehensive set of metrics. These included overall test accuracy, weighted precision, recall, and F1-score, as well as the macro-averaged F1-score to provide a class-balanced performance indicator [42]. Confusion matrix analysis was also conducted to explore misclassification patterns across ripening stages. Model selection emphasized balanced performance across classes, with particular weight given to the F1-score and confusion matrix interpretation rather than accuracy alone. A detailed overview of the classification pipeline, including data preprocessing, feature extraction, model training, and evaluation, is illustrated in Figure 3.
Figure 3. Flow-chart diagram of the data analysis pipeline.

2.7. Field Validation Using Preliminary Real-World Data

In order to assess the transferability of the proposed tomato maturity grading and quality assessment framework beyond controlled laboratory settings, a preliminary field-level validation was conducted using raw images acquired under real-world conditions. A total of more than 87 field images, each containing multiple tomato fruits at varying ripening stages, were analyzed. These images reflect the inherent complexity of agricultural environments, including variable illumination, heterogeneous backgrounds, occlusions, and fruit overlap (Figure S26). Field images were sourced from two origins: a publicly available dataset hosted on Kaggle [43] and tomato crops cultivated at the Russell E. Larson Agricultural Research Center (40.705357°, −77.961105°). This mixed provenance further increased variability in cultivar type, imaging distance, and acquisition conditions, providing a realistic testbed for preliminary field deployment.
The proposed segmentation pipelines based on CV-RCNN and CV-YOLO were applied without any architectural modification or parameter tuning, followed by the same supervised ML classifiers used in the laboratory evaluation. This strict parameter consistency was maintained to ensure a fair assessment of generalization capability rather than performance optimization.

2.8. Computational Environment

All image processing, statistical analysis, and ML tasks were executed in Python 3.10. Core libraries included pandas, NumPy, OpenCV, scikit-image, scikit-learn, xgboost, matplotlib, seaborn, plotly, and NetworkX. Deep learning segmentation models were trained locally using the Detectron2 and Ultralytics YOLOv8 frameworks, with training acceleration provided by CUDA 11.8 on an Intel i7 12th Gen CPU. Source code and data processing scripts were managed using Git and Jupyter Notebooks (v 7.4.4) for reproducibility.

3. Results

This section presents the outcomes of image segmentation, feature extraction, and subsequent multivariate and ML analyses, emphasizing comparative performance between R-CNN and YOLOv8n-seg in characterizing tomato fruit ripening stages and quality traits.

3.1. Image Segmentation

Image segmentation based on careful selection of HSV thresholds exhibited inconsistent performance across tomato maturity stages. Reliable fruit isolation was achieved primarily for fully red tomatoes, whereas green and turning fruits were frequently under segmented or fragmented. Intermediate stages showed substantial overlap in hue distributions, pronounced within fruit color gradients, and spatial heterogeneity, which collectively led to incomplete masks and loss of biologically relevant regions. Representative examples illustrating these segmentation failures are provided in Figure 4. For comparison, representative color histograms derived from the traditional whole image color processing baseline are shown in Figure S25, illustrating the substantial overlap in global color distributions across maturity stages.
Figure 4. Representative image segmentation masks employing HSV thresholding. Whereas labels (a) green; (b) turning; (c) pink, and (d) red represent corresponding maturity stages of the fruits.
On the other hand, both R-CNN and YOLOv8n-seg successfully performed instance segmentation on smartphone-acquired images, enabling precise isolation of individual tomato fruits. The R-CNN model exhibited finer boundary adherence, whereas YOLOv8 favored faster, more generalized object delineation. Binary and instance masks were generated (Figure 5), providing the foundation for downstream trait quantification.
Figure 5. Masks created using YOLOv8n-seg (a) and R-CNN (b) models for segmentation.
A comparative analysis of CNN and YOLOv8 training over five epochs revealed distinct convergence behaviors (Figure 6). The CNN, with a lightweight architecture, started with a lower initial loss (1.34) and exhibited rapid, smooth convergence to 0.45, indicating stable gradient flow and efficient feature learning. YOLOv8, by contrast, began with a higher loss (4.75) due to its complex multi-task design, but steadily decreased to 2.05 after 5 epochs while reaching a maximum of 1.23 after 50 epochs (Figure 7), reflecting effective optimization despite slower convergence. These differences highlight the impact of architectural complexity, task scope, and parameter capacity on training dynamics.
Figure 6. Training loss for Mask R-CNN and Yolov8-nseg models.
Figure 7. Trining loss for Yolov8-nseg model for up to 50 Epochs.
The comparative evaluation on CPU showed substantial differences in computational efficiency (Table 6). YOLOv8n-seg achieved an inference time of 142.94 ms per image compared to 2327.42 ms for Mask R-CNN, representing a 16.28-fold speed advantage and a latency reduction of 2.18 s per image. This translated to approximately 7 frames per second for YOLOv8n-seg versus 0.43 frames per second for Mask R-CNN. YOLOv8n-seg contains 3.26 million parameters, whereas Mask R-CNN relies on 43.9 million, making YOLOv8n-seg 13.48 times smaller. FP32 weight memory followed the same trend (12.43 MB versus 167.55 MB). Normalized by model size, YOLOv8n-seg achieved 2.15 frames per second per million parameters, outperforming Mask R-CNN’s 0.0098 frames per second per million parameters, representing a 219.5-fold gain in parameter efficiency. These results indicate that YOLOv8n-seg is a highly efficient architecture for CPU-based or edge deployments, while Mask R-CNN remains heavier and slower due to its two-stage design.
Table 6. Computational efficiency of YOLO and CNN models.

3.2. Feature Extraction

This section outlines the phenotypic features extracted from tomato fruit across three distinct datasets—LAB, CV-RCNN, and CV-YOLO—each representing a different modality of trait acquisition. Collectively, these datasets establish a comprehensive framework for quantifying fruit characteristics using both conventional laboratory assays and deep learning-based computer vision techniques.
The LAB dataset encompassed a wide phenotypic range across physical and biochemical traits (Figure S1). Fruit weight varied markedly (21.79–605.4 g), indicating high morphological diversity. Chromaticity channels (L*, a*, b*) captured ripening gradients, with a* showing the broadest variability (−14.36 to 32.66), suggestive of transitions from green to red maturity stages. Firmness values were consistent across replicates, except at the fruit base (Firmness_e), which exhibited higher dispersion. Dimensional traits (D_max, D_min, height) displayed moderate variability, reinforcing their utility for morphometric classification.
Features extracted via R-CNN segmentation demonstrated high geometric precision (Figure S2). Morphological traits (e.g., solidity mean ≈ 0.995, eccentricity ≈ 0.36) suggested compact and elliptical object forms, while colorimetric features showed strong red dominance (mean R ≈ 195.3), consistent with mature fruit. The Lab* color space and vegetation indices (e.g., ExGR, NDI) captured a broad spectral range, enabling discrimination across ripening stages. The trait distributions, with considerable variation and minimal skewness, highlighted the robustness of the CV-RCNN dataset for phenotypic modeling.
Compared to CV-RCNN, YOLOv8n-seg produced larger segmented areas (mean area ≈ 4857.79 cm2) with exceptionally high solidity (≈0.999) and near-perfect circularity (eccentricity ≈ 0.005). RGB features retained red dominance, albeit with reduced intensity and elevated intra-object variability (e.g., R_std ≈ 65.43), likely due to segmentation spillover. Color indices exhibited broader and more negative ranges, suggesting potential background inclusion or spectral dilution (Figure S3).
Both R-CNN and YOLOv8n-seg captured biologically meaningful morphological and spectral traits. R-CNN offered superior boundary refinement and spectral consistency, beneficial for correlating image-derived features with lab-based traits. In contrast, YOLOv8 favored segmentation efficiency and object completeness, albeit at the cost of increased chromatic noise and reduced trait specificity. These trade-offs have implications for downstream classification, with R-CNN-derived features resulting in higher yield fidelity in ripening stage discrimination and quality prediction, during validation through supervised ML modeling.

3.3. Multivariate Analysis

Principal Component Analysis (PCA) and correlation network analysis were conducted on all datasets to explore latent structures and identify dominant sources of variation relevant to tomato ripening and quality assessment.

3.3.1. Principal Component Analysis (PCA) Results

The PCA was conducted separately for qualitative traits, R-CNN-derived features, YOLO-derived features, their combination, and the full feature set integrating laboratory and computer vision descriptors. Components with eigenvalues greater than one were retained according to Kaiser’s criterion as reported in previous studies [44]. Across datasets, the first two principal components consistently explained the majority of variance, with distinct contributions from firmness and color attributes. As the first two principal components (PC1 and PC2) captured the majority of variance, only their biplots are presented in the main text. Comprehensive biplots for all components retained according to Kaiser’s criterion are provided in the Supplementary Materials (Figures S4–S8).
PCA Results for LAB Features
The PCA of laboratory-measured traits (Figure 8) revealed three principal components. PC1 accounted for the largest share of variance and was driven primarily by firmness (Firmness_a–Firmness_d) and fruit weight, indicating that mechanical properties and mass jointly define the dominant axis of variability. PC2 was shaped by geometric descriptors such as D_max, D_min, and height, reflecting morphological influences.
Figure 8. Principal component analysis (PCA) of laboratory-measured physicochemical traits (LAB features). PCA biplot showing separation of tomato fruits across ripening stages based on laboratory-derived measurements, including firmness, fruit mass, and colorimetric coordinates. The analysis highlights stage-dependent clustering and the relative contribution of each trait to physiological differentiation.
PC3 was associated with color traits, with high positive loadings from L* and strong negative contributions from a* and b* (Figure S4), indicating color transitions during ripening. The separation of ripening stages along PC1–PC2 was consistent with these trait groupings: firmness and size characterized early stages, whereas color variation became increasingly important at later maturity. The presence of a red-stage sample within the green cluster may reflect atypical trait expression, such as retained firmness, highlighting the biological variability and transitional nature of fruit ripening. Likewise, similar pattern is also observed in “Turning” class, where one fruit is slightly different than the rest, possibly in firmness.
PCA Results for CV-RCNN Features
The PCA of R-CNN-derived descriptors yielded six principal components. PC1 (41.6%) was dominated by size-related variables, including area, perimeter, and axis lengths, indicating that fruit morphology was found to be differing among the fruits at different ripening stages (Figure 9).
Figure 9. Principal component analysis (PCA) of features extracted via Mask R-CNN (CV-RCNN). PCA biplot illustrating the separation of tomato ripening stages based on morphological and colorimetric descriptors derived from segmentation. The PCA highlights distinct clustering patterns, with feature loadings indicating the contribution of shape- and color-related traits to stage discrimination.
PC2 (24.7%) combined morphological traits with color information from G, B, and L_model channels, suggesting interactions between morphology and color changes. These features are closely tied to the biochemical processes of ripening, particularly the degradation of chlorophyll and the concurrent synthesis of carotenoids such as lycopene, which manifest as a spectral shift from green to red. Subsequent components (PC3–PC6) captured finer distinctions, including eccentricity, aspect ratio, spectral indices (e.g., ExR, NDI), and color variability metrics (Figure S5).
The clear delineation between colorimetric and morphological contributions to phenotypic variance supports a biologically meaningful dual-axis model of ripening, wherein fruit maturity and pigment transitions proceed along distinct but complementary pathways. The R-CNN segmentation framework captures these patterns with high resolution and consistency, providing a robust basis for dimensionality reduction, trait integration, and downstream classification of ripening stages in high-throughput phenotyping workflows.
PCA Results for CV-YOLO Features
The PCA of YOLO-derived descriptors retained five components. PC1 and PC2, together explaining most of the variance (72.3%), were shaped primarily by area, perimeter, axis lengths, and solidity, indicating a dominant influence of fruit morphology and compactness (Figure 10). PC3 reflected elongation and contour complexity through strong contributions from eccentricity and aspect ratio. Whereas PC4 and PC5 incorporated color variability, particularly from the blue channel (B), R_std, b_model, and b_std (Figure S6).
Figure 10. Principal component analysis (PCA) of features extracted via YOLOv8n-seg (CV-YOLO). PCA biplot depicting the separation of tomato ripening stages based on morphological and colorimetric descriptors obtained from object detection. The analysis captures the contribution of geometric and chromatic traits to stage differentiation and highlights patterns of phenotypic variability across fruits.
This structure demonstrates that YOLO features capture integrative information, with morphological traits driving the main axes and color differences contributing at higher-order dimensions. Consequently, the separation of morphological traits and spectral diversity aligns with the YOLO model’s broader segmentation boundaries and highlights its tendency to blend object and background pixels.
PCA Results for Combined-CV Features
When CV-RCNN and CV-YOLO features were combined, eight components were retained. PC1 and PC2 were strongly influenced by morphological descriptors (area, perimeter, axis lengths) from both pipelines, reinforcing fruit size and shape as the dominant drivers of variance across the ripening stages (Figure 11).
Figure 11. Principal component analysis (PCA) of the combined CV feature set. PCA biplot showing the separation of tomato ripening stages based on the integration of morphological and colorimetric descriptors extracted from Mask R-CNN and YOLOv8n-seg. The analysis highlights how the fusion of complementary image-derived features enhances discrimination of fruit maturity and captures phenotypic variability across stages.
PC3 and PC4 reflected shape complexity and color variability, with contributions from eccentricity, aspect ratio, and blue channel statistics (B, B_std). These components likely reflect intra-fruit or inter-sample variation in maturation and segmentation quality. Higher-order components (PC5–PC8) integrated finer indices (e.g., ExGR, NDI) and variability measures (a_std, b_std), reflecting more subtle differences in pigmentation and texture (Figure S7). The combined dataset thus enriched the multivariate space, providing a broader representation of ripening-related phenotypes. Consequently, these findings confirm that integrating CV-RCNN and CV-YOLO features preserves both structural precision and spectral diversity, supporting their complementary use in image-based trait modeling.
PCA Results for ALL Features
The PCA of the complete feature set, which merged laboratory measurements with R-CNN and YOLO descriptors, also retained eight components. PC1, explaining the largest proportion of variance (50.3%), was dominated by fruit morphology-related features such as area, perimeter, and axis lengths across all modalities, indicating morphological features as the most consistent source of observed phenotypic variation (Figure 12). PC2 integrated firmness with spectral traits (B, G channels) and shape descriptors, highlighting the interplay between morphological and visual characteristics. PC3–PC5 captured color variation (e.g., R_std, b_std, ExGR), structural complexity (eccentricity, aspect ratio), and firmness variability, while later components (PC6–PC8) reflected subtle trait interactions (Figure S8). By consolidating sensor-based and image-derived metrics, this dataset offered the most comprehensive representation of tomato maturity and quality attributes, supporting robust classification across ripening stages.
Figure 12. Principal component analysis (PCA) of the full feature set (ALL features). PCA biplot illustrating the separation of tomato ripening stages using combined laboratory measurements and image-derived descriptors from Mask R-CNN and YOLOv8n-seg. The PCA captures the majority of observed variance, integrating morphological, colorimetric, and physicochemical traits, and highlights how multimodal features collectively discriminate fruit maturity and phenotypic variability.
Across all features, PCA consistently separated (i) fruit morphological and (ii) spectral-chromatic sources of variance. While the LAB features anchored physical traits such as firmness and weight, CV-RCNN retained fine-grained shape and color cues with high biological relevance. In contrast, CV-YOLO, despite efficient segmentation, introduced spectral noise—likely from background inclusion—limiting its standalone interpretability.
The integrated PCA frameworks (Combined-CV and ALL) reaffirm the advantage of R-CNN-based features for trait fidelity and classification robustness. These results highlight the value of multimodal data fusion for accurate phenotypic modeling in horticultural imaging.

3.3.2. Network Analysis Results

The correlation network analysis across all features revealed well-organized phenotypic architectures, characterized by modular trait interdependencies that reflect biologically plausible groupings. These networks not only confirmed internal measurement consistency but also offered insight into trait redundancy, ripening-related spectral dynamics, and the predictive power of image-derived features relative to laboratory measurements.
LAB Features
In the LAB features, the correlation structure delineated three distinct clusters (Figure 13). A tightly connected module comprising the firmness variables (Firmness_a through Firmness_d) exhibited exceptionally high pairwise correlations (r > 0.89), with the strongest link between Firmness_c and Firmness_d (r = 0.94) (Figure 10 and Figure S9). This level of interdependence suggests that these measures are effectively capturing a shared mechanical construct, likely associated with cell wall rigidity or tissue integrity, as is known about the texture degradation during postharvest. A second structural cluster was defined by fruit mass and dimensional traits (Weight, D_max, D_min), where correlation coefficients reached up to 0.91, suggesting a consistent scaling of fruit size and biomass. Interestingly, height displayed a more moderate relationship (r = 0.60), indicating that longitudinal growth may be partially decoupled from diameter in this germplasm. The third major axis of interaction was observed between the chromaticity coordinate a* (red-green) and lightness L*, which showed a strong negative correlation (r = −0.89), reflecting the physiological transition from chlorophyll-rich green tissues to anthocyanin- and lycopene-dominated red pigmentation during ripening. Such an antagonistic relationship is consistent with prior studies on colorimetric maturity indices in Solanaceae, supporting the use of L* and a* as reliable, non-destructive maturity indicators.
Figure 13. Heatmap of laboratory-measured (LAB) features. Hierarchical clustering reveals distinct groups of tomato fruits across ripening stages based on qualitative and morphological traits, including firmness, weight, and color coordinates, highlighting correlated patterns and stage-dependent phenotypic variation.
CV-RCNN Features
The CV-RCNN feature set exhibited a structurally similar network, but with notably sharper modular separation and reduced cross-cluster noise (Figure 14 and Figures S1–S10). The morphometric traits—again including area, perimeter, diameter, and axis lengths—showed near-perfect correlations (r > 0.99), affirming the segmentation model’s geometric fidelity. These features, whether computed in pixel or physical units, demonstrated internal consistency and measurement robustness.
Figure 14. Heatmap of features extracted via Mask R-CNN (CV-RCNN). Clustering of morphological and colorimetric descriptors illustrates phenotypic grouping among ripening stages, capturing correlations among shape and chromatic traits derived from deep learning-based segmentation.
The spectral module paralleled the YOLO pattern but exhibited clearer boundaries. The green channel (G), L_model, ExG, and NDI were again positively associated (r > 0.92) and strongly antagonistic to red-pigmented traits like a_model and ExR (r < −0.95). This spectral dichotomy not only captures physiological ripening transitions but also points to the CV-RCNN model’s superior ability to isolate object surfaces from background interference, minimizing color dilution. Such fidelity is crucial for capturing subtle chromatic cues linked to carotenoid and chlorophyll dynamics.
CV-YOLO Features
In the CV-YOLO segmentation, the network was organized into two dominant and coherent clusters (Figure 15 and Figure S11). The morphometric cluster was defined by near-perfect correlations (r > 0.99) among area, perimeter, major and minor axis lengths, and diameter_model, indicating high internal redundancy among features describing object scale. Solidity and extent were also strongly linked (r ≈ 0.96 and 0.77, respectively), confirming that spatial compactness and boundary fidelity are consistently preserved across segmented objects. Shape elongation metrics such as eccentricity and aspect ratio were highly correlated (r = 0.91), reinforcing the utility of shape descriptors in distinguishing form within otherwise symmetrical objects.
Figure 15. Heatmap of features extracted via YOLOv8n-seg (CV-YOLO). Hierarchical clustering highlights patterns of morphological and colorimetric variability across ripening stages, indicating how object detection-derived features capture stage-specific phenotypic relationships.
The spectral cluster was anchored by the green channel (G), which was positively correlated with brightness (L_model), ExG, ExGR, and NDI (r > 0.91), and negatively associated with red-shifted traits such as a_model and ExR (r < −0.95). These results mirror classical vegetation signals, with higher green reflectance and brightness indicating immature or vegetative tissue, while increased red chromaticity marks the onset of ripening. Variability measures (e.g., G_std, L_std, a_std) also clustered tightly, suggesting that chromatic heterogeneity is structured and not random, potentially reflecting physiological or environmental variability during image acquisition.
Combined CV Features
When features from both segmentation models were merged into the Combined-CV feature set, the resulting network preserved the dual-cluster structure (Figure 16 and Figure S12). The morphometric module remained tightly interlinked, with the expected redundancy among size-related features. Importantly, cross-model consistency in trait definitions (e.g., area from YOLO vs. R-CNN) was validated by high correlation coefficients, indicating robust feature harmonization. The shape cluster revealed moderate negative associations between solidity and elongation-related metrics (eccentricity, extent, aspect ratio; r ≈ −0.82 to −0.69), suggesting that elongated or irregular fruits tend to occupy a less compact spatial envelope. The spectral cluster maintained the antagonistic relationship between vegetation and ripening signals, with green indices (ExG, NDI) strongly negatively correlated with red chromaticity (a_model, ExR). These patterns highlight the biological validity and internal agreement between the two segmentation models.
Figure 16. Heatmap of the combined CV feature set. Integration of CV-RCNN and CV-YOLO descriptors produces distinct clusters reflecting complementary shape and color traits, enhancing separation of ripening stages relative to individual model outputs.
ALL Features
The most comprehensive structure emerged from the ALL features, which integrated lab-based and image-derived traits across models. Here, three dominant clusters emerged (Figure 17 and Figure S13). The morphometric module, comprising area, perimeter, and axis lengths, exhibited strong intercorrelation (r > 0.98), confirming cross-platform consistency. These features were positively associated with weight and firmness traits (r ≈ 0.60–0.70), demonstrating that image-derived size metrics are predictive of physical quality parameters. The spectral-colorimetric module, anchored by G and vegetation indices, retained its canonical structure, with strong negative associations with red chromaticity (a_model, ExR), consistent with physiological color transitions. Finally, a mechanical-physiological cluster formed around the firmness traits and lab-based dimensions, with internal coherence among firmness measures (r > 0.91), and moderate correlations with fruit size, reinforcing the biomechanical scaling of texture with fruit volume. The inverse relationship between L* and a* (r = −0.89), previously observed in the LAB dataset, persisted, reaffirming the generalizability of this chromatic maturity signal across image and sensor modalities.
Figure 17. Heatmap of the full feature set (ALL features). Clustering across laboratory and image-derived descriptors capture both morphological and physicochemical variation, revealing robust grouping of tomato fruits according to ripening stage.
Collectively, these results highlight a consistent and biologically interpretable network topology across datasets. All image-derived networks shared a fundamental modularity—structured along morphometric and spectral axes—with CV-RCNN exhibiting greater spectral precision and segmentation consistency than YOLO. The integration of lab measurements further anchored these networks in physiological relevance, revealing robust trait–trait associations that span mechanical, spectral, and structural domains. These findings support the use of R-CNN-based segmentation for applications requiring phenotypic fidelity and highlight the value of modular network structures for feature selection and integrative trait modeling in high-throughput fruit phenotyping.

3.4. Supervised ML-Based Classification Results

The supervised classification of tomato ripening stages, formulated as a four-class problem (green, turning, pink, red), revealed clear performance stratification across datasets and algorithms, reflecting the differential discriminatory power of laboratory and computer vision-derived features. Overall, laboratory-derived traits provided the most reliable foundation for classification, while image-based features contributed complementary information, particularly when integrated across pipelines.
Confusion matrices for the best-performing model are presented in the main text for each feature group, while matrices for the remaining four models are provided in Supplementary Figures S14–S18. Likewise, feature importance plots for all models are provided in the Supplementary Materials (Figures S20–S24).

3.4.1. Classification Results for Traditional Image Analysis

Classification results obtained using whole image colorimetric features combined with laboratory measured quality traits are summarized in Table 7. Among all evaluated models, single decision tree classifiers clearly outperformed the remaining approaches. Fine, Medium, and Coarse Tree configurations achieved the highest accuracy of 90.48%, together with balanced macro precision, recall, and F1 scores of approximately 85%. These models also exhibited low computational cost, with training times below 10 s and high inference throughput. The Coarse Tree achieved the fastest prediction speed at 109.79 observations per second, indicating strong potential for near real time applications.
Table 7. Performance metrics of machine learning models for features extracted through traditional image analysis.
RUSBoosted Trees showed slightly lower overall accuracy at 83.33% but achieved the highest macro recall of 89.25%, reflecting improved sensitivity to minority maturity stages. This behavior highlights the effectiveness of boosting under class imbalance conditions, while maintaining competitive prediction speed.
Other models showed limited advantages. Bagged Trees provided no accuracy improvement over RUSBoosted Trees and exhibited reduced recall, suggesting a more conservative classification strategy. Kernel Naive Bayes demonstrated the weakest performance and incurred substantial computational overhead, making it unsuitable for this feature configuration. Likewise, ensemble, SVM and neural network models could not acquire classification accuracy of more than 55%.

3.4.2. Classification Results for LAB Features

The LAB dataset, which consisted solely of physicochemical measurements, yielded the highest stand-alone classification accuracy, highlighting the inherent discriminability of laboratory traits in capturing physiological maturity (Figure 18 and Figure S14). Gradient Boosting achieved the best performance (92.31% test accuracy; weighted F1 = 0.92), likely due to its capacity to model high-order non-linear interactions among traits such as firmness, color coordinates (L, a), and fruit mass (Figure 18). The superior predictive power of this model can be attributed to the strong internal coherence among key quality traits, as previously evidenced by correlation network analysis. Random Forest followed closely (86.15%) (Figure S14a), reinforcing the strength of tree-based ensembles in capturing both main effects and interactions.
Figure 18. Confusion matrices for laboratory-measured (LAB) features using Gradient Boosting classification model. Validation and test sets show stage-specific classification performance based on LAB features.
In contrast, both SVM (Figure S14b) and Logistic Regression (Figure S14c) exhibited strong validation performance but a pronounced drop in test accuracy (81.54% and 78.46%, respectively), suggesting that while the classes are relatively separable in the training space, they may not conform to strictly linear or kernel-induced boundaries in unseen data. This discrepancy implies the presence of class-overlapping or heteroskedastic variance in the LAB dataset, particularly at transitional stages such as “turning.” KNN achieved the better performance (86.15% test accuracy) (Figure S14d) as compared to CVM and Logistic Regression models, indicating its capability to feature scaling and robustness in high-dimensional, continuous-valued biological data.

3.4.3. Classification Results for CV-RCNN Features

When classification was based on CV-RCNN features—derived from high-resolution segmentation of fruit morphology and color—the models maintained excellent predictive accuracy, although with slight variability (Figure 19 and Figure S15). Particularly, Logistic Regression outperformed more complex classifiers (96.92% accuracy; F1 = 0.969) (Figure 19), suggesting that RCNN-derived features were highly structured and linearly separable. This observation aligns with earlier PCA findings, where clear morpho-spectral gradients were preserved along orthogonal axes. Random Forest and Gradient Boosting performed comparably (93.85% and 92.31%, respectively) (Figure S15a,b), though their slight decline relative to LAB models may reflect the increased variability introduced by imaging conditions or segmentation artifacts. SVM and KNN models poorly performed with test accuracies of 87.69% and 84.62%, respectively (Figure S15c,d). Notably, this outcome demonstrates that carefully extracted computer vision features can rival traditional laboratory metrics in predictive utility, particularly when derived from high-fidelity segmentation models.
Figure 19. Confusion matrices for CV-RCNN features using Logistic Regression classification model. Validation and test datasets demonstrate the ability of Mask R-CNN-derived morphological and colorimetric descriptors to discriminate tomato ripening stages.

3.4.4. Classification Results for CV-YOLO Features

In the CV-YOLO feature set, classification accuracy declined modestly across all models, with both Logistic Regression and Random Forest achieving the highest performance (90.77%) (Figure 20 and Figure S16a), followed by KNN model (89.23%) (Figure S16b). This trend likely stems from YOLO’s architectural emphasis on speed and object-level detection rather than pixel-level precision, resulting in coarser segmentations that may dilute subtle morphological or chromatic cues necessary for fine-grained stage differentiation. Particularly, SVM and Gradient Boosting—previously dominant in the LAB features—performed worse here (87.69%), indicating its diminished ability to model noisy or weakly informative features (Figure S16c,d). This highlights the trade-off between segmentation complexity and computational scalability in operational pipelines.
Figure 20. Confusion matrices for CV-YOLO features using Logistic Regression classification model. Stage-specific classification performance based on YOLOv8n-seg features, highlighting validation and test data performance in distinguishing tomato ripening stages.

3.4.5. Classification Results for Combined-CV Features

To evaluate the hypothesis that complementary feature sources may improve classification robustness, we constructed the Combined-CV feature set by integrating traits from both CV-RCNN and CV-YOLO. The resulting composite feature set led to marked performance gains across all algorithms. Logistic Regression achieved the highest test accuracy (95.4%) and F1-score (0.953) (Figure 21), confirming that the fused feature space exhibits enhanced linear separability. Likewise, Random Forest (93.9%) and Gradient Boosting (92.3%) also performed strongly, although both showed modest recall loss for “Turning” ripening class (Figure S17a,b). SVM (86.2%) and K-Nearest Neighbors (90.8%) delivered intermediate results; performing poorly as compared to other models (Figure S17c,d). These outcomes suggest that feature fusion creates a richer and more separable multivariate space, allowing simpler, well-regularized models to outperform more complex ones.
Figure 21. Confusion matrices for the combined CV feature set using Logistic Regression classification model. Integration of CV-RCNN and CV-YOLO descriptors for stage-wise discrimination, across validation and test datasets.

3.4.6. Classification Results for ALL Features

The highest and most consistent performance was observed in the ALL feature group, which combined laboratory traits with both CV-RCNN and CV-YOLO features. Here, three models—Logistic Regression (Figure 22), Random Forest (Figure S18a), and SVM (Figure S18b)—each reached 93.9% accuracy with high precision and recall across all stages, including transitional classes. K-Nearest Neighbors achieved 92.3%, while Gradient Boosting performed slightly lower (89.2%) due to reduced recall for “Turning” and “Pink.” (Figure S18c,d).
Figure 22. Confusion matrices for the full feature set (ALL) using Logistic Regression classification model. Validation and test results illustrate the effectiveness of integrating laboratory and image-derived descriptors for accurate classification across all ripening stages.
Across feature groups, classification accuracy was shaped primarily by the richness and structure of the input variables. Fruits morphological and qualitative traits offered the strongest predictive signal, particularly when modeled with ensemble learners, whereas CV-RCNN features provided highly discriminative image-based descriptors that performed well even with linear models. While CV-YOLO features were more limited in resolving transitional ripening stages, yet contributed to complementary morphological information. Integrating features, whether across computer vision pipelines or between sensor and image modalities, consistently improved separability and robustness.
These results demonstrate that multimodal phenotyping anchored by laboratory measurements, offers an optimal path forward for precision classification of tomato ripening stages. Such an approach not only maximizes classification accuracy but also supports scalable, field-deployable solutions for non-destructive and automated fruit quality monitoring.

3.4.7. Comparative Evaluation of ML-Based Classification Performance

A cross-dataset comparison of ML classifiers revealed systematic differences in performance shaped by the origin and integration of features (Table 8). While test accuracy has been discussed in detail above, the comparative analysis highlights the additional value of weighted F1-score, recall, and validation variance as indicators of classification quality and model stability.
Table 8. Summary of machine learning performance metrics.
Among computer vision-derived datasets, features extracted with R-CNN consistently outperformed those from YOLO across nearly all classifiers. Logistic Regression and Random Forest trained on R-CNN features achieved weighted F1-scores of 0.969 and 0.939, respectively, compared with 0.907 and 0.903 for YOLO. The gap was most evident in recall, underscoring the importance of segmentation fidelity for preserving morphological and color descriptors critical to ripening-stage discrimination. It was observed that the higher intra-class variability and reduced spectral granularity of YOLO features, likely impaired boundary resolution, particularly in transitional ripening stages such as “Turning” and “Pink.”
Integration of CNN- and YOLO-derived features into a combined dataset further improved separability. Particularly, Logistic Regression achieved 94.8% mean validation accuracy with a weighted F1-score of 0.953, outperforming more complex models and demonstrating that feature fusion enhances robustness even in the absence of laboratory traits. This pattern suggests that complementary image descriptors provide a richer representation of maturity transitions when considered together.
The most comprehensive performance was observed with the ALL-feature set, which merged laboratory measurements with deep learning-derived image features. Logistic Regression, Random Forest, and SVM all achieved high mean validation accuracy (>95%) with weighted F1-scores exceeding 0.937, indicating balanced performance across stages and strong generalization. The inclusion of laboratory-measured traits added orthogonal information to image descriptors, producing a discriminative multimodal feature space capable of resolving both early and transitional maturity classes.
In contrast, models trained solely on laboratory traits exhibited more variability. Gradient Boosting, Logistic Regression, and SVM performed well (>93% validation accuracy), but lagged in their test accuracy (92.3%, 78.5%, and 81.5%, respectively), reflecting the limitations of relying exclusively on physicochemical measurements to capture the complexity of ripening dynamics. While such traits remain highly informative, they appear insufficient on their own for stable classification across all maturity stages.
Taken together, the comparative evaluation demonstrates that feature integration markedly enhances classification accuracy and reliability. Well-regularized models such as Logistic Regression and ensemble methods like Random Forest consistently outperformed more complex algorithms when provided with rich, multimodal inputs. These findings emphasize that in practical phenotyping pipelines, robust and interpretable models can achieve high accuracy when trained on thoughtfully integrated laboratory and image-based descriptors, thereby advancing non-invasive fruit quality estimation in precision agriculture.

3.4.8. Field Validation Results

Field-based validation revealed distinct performance trends across classifiers and feature representations (Table 9), demonstrating the influence of both segmentation strategy and feature composition under non-controlled conditions. When using CV-RCNN-derived features, the SVM achieved the highest classification accuracy (0.8246), outperforming ensemble-based approaches and indicating strong robustness to moderate feature noise. Random Forest and Gradient Boosting yielded comparable but slightly lower accuracies (0.8070), while Logistic Regression and K-Nearest Neighbors exhibited reduced generalization.
Table 9. Summary of performance metrics of machine learning models on real-world data.
In contrast, CV-YOLO features favored linear decision boundaries, with Logistic Regression attaining the highest accuracy (0.8286). This suggests that YOLO-derived descriptors formed a more linearly separable feature space under field conditions. Tree-based models and KNN showed diminished performance, reflecting sensitivity to intra-class variability and segmentation inconsistencies inherent to complex backgrounds.
Feature-level fusion through the Combined CV representation led to improved stability, with Random Forest and Gradient Boosting jointly achieving the highest accuracy (0.8152). These results demonstrated that complementary information from both segmentation pipelines mitigated individual weaknesses and enhanced the robustness under environmental variability, as observed in case of the laboratory dataset. Across all feature sets, KNN consistently underperformed, likely due to its susceptibility to local noise and feature distribution shifts. Confusion matrices illustrating class-wise performance are provided in Figures S27–S29, while feature importance analyses for all models are shown in Figures S30–S32.

4. Discussion

This study compared the segmentation feature outputs of two state-of-the-art instance segmentation models, Mask R-CNN and YOLOv8n-seg, to assess their capacity to extract morphological and colorimetric traits relevant to ML-based tomato ripeness classification and quality estimation. The superior performance of Mask R-CNN arises from its more precise pixel-level segmentation compared to YOLOv8. For example, Figure 23, which contains tomato fruits at the turning stage, illustrates a representative case showing how segmentation quality affects the extraction of colorimetric features. In panel (a), YOLOv8 produces a near-circular mask that extends beyond the fruit boundary onto the dark background and partially includes a neighboring fruit. The inclusion of background pixels introduces low-value, low-saturation samples, which dilute chromaticity, lower vegetation index values, and increase variability between images. In contrast, panel (b) shows the Mask R-CNN segmentation, which closely follows the tomato interior while slightly eroding the pericarp margins—a likely consequence of heterogeneous coloration characteristic of ripening tomatoes. Despite minor edge omissions, the Mask R-CNN mask avoids background inclusion, yielding more accurate color and vegetation index summaries that better represent fruit maturity. Consequently, Mask R-CNN segmentation produced higher quality features and more reliable maturity stage estimation than YOLOv8.
Figure 23. Representative examples of R-CNN and YOLOv8 segmentation mask overlays on tomato fruits showing how scene content can introduce noise into image-extracted features.
The findings not only reinforce the potential of RGB-based deep learning pipelines for accurate, non-destructive ripeness assessment, but also accentuate important differences in how each model encodes phenotypic variation (Table 10 and Table 11).
Unlike end-to-end CNN classifiers, which directly map image inputs to class labels through highly abstract feature representations, the proposed segmentation-driven pipeline explicitly separates visual perception from phenotypic interpretation. Instance segmentation isolates individual tomato fruits at the pixel level, enabling the extraction of well-defined morphological and colorimetric descriptors that have direct biological meaning, such as fruit size, shape, firmness, and surface chromaticity. These features can be quantitatively analyzed, validated against laboratory-measured quality traits, and interpreted in relation to known physiological processes during ripening. In contrast, end-to-end CNN models typically operate as black-box predictors, where classification decisions are based on latent features that are difficult to interpret or relate to specific plant traits. While such models may achieve comparable classification accuracy under controlled conditions, they provide limited insight into the underlying phenotypic drivers of maturity. The segmentation plus feature extraction framework, therefore, offers a more transparent and biologically grounded approach for plant phenotyping, facilitating reproducibility, cross-study comparability, and integration with established quality assessment protocols.

4.1. Results Comparison

As observed, Mask R-CNN exhibited finer boundary adherence and more consistent spatial localization of fruit contours, whereas YOLOv8n-seg favored faster, more generalized object delineation, a trend also reported in YOLO variants by Chen, et al. [45]. The feature set extracted, 27 traits per model, including shape descriptors, color indices, and vegetation reflectance parameters, showed strong correlations with 12 laboratory-measured traits, particularly firmness, diameter, and color indicators such as a* and ExR.
The PCA revealed a biologically meaningful pattern: PC1 captured a trade-off between object size and red pigmentation, where larger, circular segments were associated with higher green/blue reflectance and vegetation indices—suggesting the presence of less mature or vegetative tissue. This is consistent with findings from Ayuso-Yuste, et al. [46] and the physiological patterns in ripening described by Sherafati, et al. [47]. The orthogonality between color and firmness axes in PCA supports previous reports that ripening-related texture and color features evolve along partially independent trajectories.
Model-specific trait emphasis was evident: Mask R-CNN provided a more balanced representation of both color and structural features, while YOLOv8n-seg emphasized morphology. This observation also echoes the hybrid CNN–Transformer approach reported by [48], where the spatial encoding of high-level features led to substantial performance gains (+66%) in maturity classification.
In terms of classification accuracy, the combined feature set achieved the highest performance, with Logistic Regression reaching 95.38% (F1 = 0.953), while Mask R-CNN and YOLOv8n-seg alone attained 96.92% (F1 = 0.969) and 90.77% (F1 = 0.907), respectively. However, our study suggests that R-CNN’s detailed spatial segmentation makes it better suited for downstream trait prediction, especially for distinguishing fine-grained ripening stages. Further supporting this interpretation, Li, et al. [49] reported improved fruit detection under occlusion using YOLOX-SE with attention and GIoU loss, achieving gains of +9–22% mAP over YOLOv7. While our YOLOv8n-seg results showed high throughput and compact model size, the slightly reduced classification accuracy (89%) suggests that YOLO-derived traits may lack sufficient resolution under subtle or occluded ripeness transitions.
From a trait relevance perspective, colorimetric variables such as a (redness) and ExR (excess red) were consistently among the top predictors of ripeness stage: aligning with findings from Shao, et al. [50], who reported R2 > 0.96 for a* and hue in hyperspectral color coordinate prediction.
Table 10. Summary of related studies to image analysis and fruit monitoring based on RCNN and YOLO models.
Regarding practical deployment, YOLOv8n-seg offers a significant advantage in speed and model compactness, aligning with FEW-YOLO by Chen, et al. [45], which achieved real-time detection in complex field environments. However, YOLOv8’s slightly lower classification accuracy in our setup points to the need for task-specific architectural tuning (e.g., incorporating attention or C2f modules) to fully leverage its speed for nuanced trait prediction. Prior works such as Lawal [51] demonstrated that lightweight YOLO variants maintain robustness across noisy conditions, achieving classification accuracy of up to 93.78%, while precision, recall, and F1 96.4%, 99.6% and 97.9%, respectively. Similarly, Sharma, et al. [53] showed ensemble CNN architectures can achieve near-perfect disease classification (>99.9%); highlighting the flexibility of deep networks for agricultural tasks.
In contrast to deep hybrid models, our pipeline used only image-derived segmentation features, yet outperformed more complex approaches such as the ensemble system by Goyal, et al. [41], which required both manual and deep features. Our approach thus demonstrates that instance segmentation alone can yield highly discriminative features for downstream classification and shelf-life estimation. Interestingly, our results also parallel those from non-visual sensing modalities. For example, Reissig, et al. [42] used image-based classification for tomato ripening stages, achieving 90.80% accuracy.
Altogether, this work establishes that feature-rich instance segmentation models like Mask R-CNN can serve as robust, generalizable tools for phenotyping applications, especially when integrated with classical machine learning classifiers. This approach offers a scalable framework for postharvest ripeness grading, quality assessment, and shelf-life prediction using simple RGB inputs.
Table 11. Summary of related studies to image analysis and fruit monitoring not relying on RCNN and YOLO models.

4.2. Field Validation

The observed performance levels were significant given the substantial increase in environmental complexity introduced by field imagery, including diverse lighting conditions, tomato cultivars, acquisition distances, and background clutter. Importantly, the proposed segmentation and classification framework was not retrained or fine-tuned using field data, yet it achieved classification precision approaching 83%, compared with 92% and 94% obtained under controlled laboratory conditions for individual CV-RCNN and CV-YOLO feature sets, respectively.
The performance degradation observed during field validation could be primarily attributed to domain shift and dataset bias, which remain central challenges in agricultural computer vision [54]. Laboratory images were acquired under standardized illumination, uniform backgrounds, and limited varietal diversity, whereas field images exhibit pronounced variability in fruit morphology, partial occlusion, shadowing, and environmental noise. These factors adversely affect segmentation fidelity, leading to imperfect masks and, consequently, perturbed morphological and colorimetric feature extraction. Such distortions propagate through the supervised learning pipeline, reducing classification confidence.
Additionally, the statistical distributions of extracted features in field conditions diverge from those of the controlled dataset, diminishing the effectiveness of classifiers trained on a single domain. Despite these challenges, the consistent performance of SVM, Logistic Regression, and ensemble models demonstrates the intrinsic robustness of interpretable feature-based pipelines when compared to purely end-to-end approaches. These findings emphasize the necessity of domain adaptation strategies, mixed-environment training, and adaptive feature normalization to further enhance real-world generalization, which constitute a clear direction for future work.

4.3. Limitations and Future Prospects

While the present study establishes a robust framework for ripening stage classification using multimodal phenotyping and supervised machine learning, several limitations merit consideration.
First, although the integration of laboratory and image-derived features yielded near-perfect classification performance, models’ generalizability under heterogeneous real-world conditions and across different tomato varieties resulted in a modest reduction in accuracy. In future work, we will address this limitation by implementing a robustness program, including multi-site image collection across indoor and field conditions, photometric normalization, domain-randomized augmentations (brightness, contrast, color temperature, shadows, blur, background variation), cross-domain evaluation of mAP/IoU and macro-F1, small-sample fine-tuning, unsupervised domain adaptation, and edge device validation under natural illumination. These steps will systematically characterize the impact of lighting and background, enhancing applicability beyond controlled laboratory settings.
Second, the segmentation models employed—RCNN and YOLOv8n-seg—while effective in extracting morpho-spectral traits, are inherently limited by 2D imaging and RGB spectral resolution. This may obscure phenotypic nuances such as internal structural changes or subtle biochemical gradients that manifest during ripening. The inclusion of hyperspectral, thermal, or X-ray imaging could provide a richer feature space for detecting latent physiological transitions. Likewise, in this study, collinear features such as area expressed in pixels and in cm2 were initially included. Re-analysis with only one of these features showed no difference in model performance. Nevertheless, the exclusion of collinear variables is generally advisable in ML workflows to reduce redundancy and ensure model robustness.
Third, future investigations may explore the use of R-CNN and YOLOv8 architectures as standalone classifiers via transfer learning to benchmark end-to-end performance against the modular segmentation-classification pipeline. Such comparisons could yield valuable insights into trade-offs between interpretability, computational efficiency, and classification accuracy across different deployment scenarios.
Fourth, the sample size (216 fruits) and restriction to four ripening stages may limit the generalizability of the findings. However, datasets of comparable size (220 tomato fruits) have been employed in similar studies [47]. It would certainly be useful to employ larger and more diverse datasets for scalability, robustness, and external validity.
Furthermore, beyond the immediate utility of this study in tomato ripening stage classification and quality estimation, the integration of deep learning segmentation with ML prediction offers broad potential in agri-food and biological research. For example, the demonstrated efficacy of Mask R-CNN and YOLOv8n-seg in extracting discriminative morphological and colorimetric features suggests a scalable framework adaptable to other horticultural crops, enabling automated phenotyping and precision harvesting. Based on the computational ease and preference, either of the two models could be selected. Moreover, this approach could be instrumental in post-harvest quality control systems, where real-time assessment of produce ripeness and defect localization is critical for sorting, grading, and shelf-life optimization. In the context of smart agriculture, coupling segmentation-derived features with environmental metadata may facilitate robust models for yield forecasting and climate-resilient crop management. The methodology also lends itself to the integration with other imaging systems, paving the way for autonomous field monitoring and selective harvesting. In summary, these potential applications indicate the broader relevance of the proposed framework and their capacity to foster innovation based on computer vision, plant science, and sustainable food systems.
Looking ahead, future research should focus on (i) expanding the phenotypic library across cultivars, environments, and growing seasons; (ii) integrating temporal imaging to monitor dynamic ripening trajectories; and (iii) embedding the proposed system within autonomous phenotyping platforms for real-time, in-field deployment. While laboratory-based measurements offer high accuracy and a reliable benchmark for validating image-derived features, they are labor-intensive and limit scalability in large-scale or automated systems. Building on the benchmark established in this study, future work will focus on using image-derived descriptors alone to enable high-throughput phenotyping and real-time monitoring without reliance on extensive laboratory measurements. Similarly, incorporating an industrial-grade camera for comparison with the smartphone-based imaging would help validate the effectiveness and potential of this approach under resource-limited conditions. Such advances will be critical to realizing the full potential of AI-driven phenotyping in supporting sustainable production, reducing food loss, and optimizing harvest logistics in tomato and other fruit-bearing crops.

5. Conclusions

This study presents a comprehensive and integrative framework for classifying tomato ripening stages using a combination of laboratory-based measurements and computer vision-derived traits, evaluated through a suite of supervised ML models. By systematically benchmarking five classification algorithms across distinct feature domains—ranging from morphological and qualitative traits (LAB) to deep learning-based morphological and spectral descriptors (CV-RCNN and CV-YOLO)—we provide critical insights into the interplay between feature quality, model architecture, and classification performance.
The results demonstrate that segmentation fidelity is a primary determinant of predictive accuracy in image-based phenotyping. Features extracted from the RCNN-based pipeline consistently outperformed those derived from YOLOv8n-seg, indicating a superior capacity to preserve fine-grained morphological and colorimetric information critical for differentiating intermediate ripening stages. These findings suggest that, for applications requiring high phenotypic resolution, model selection should prioritize segmentation accuracy over real-time processing speed.
Importantly, the combination of laboratory and computer vision-derived traits (ALL) produced high classification outcomes across all algorithms, pointing out the synergistic value of multimodal phenotyping. This integrative approach leverages the complementary strengths of structured lab assays and non-invasive image analytics, enabling robust, scalable, and biologically interpretable classification of fruit maturity. The high performance of even linear classifiers on fused datasets highlights the intrinsic separability and quality of the combined feature space, suggesting that optimal outcomes may be achieved through principled feature engineering rather than algorithmic complexity alone.
Taken together, these findings advocate for the adoption of multimodal, segmentation-aware pipelines in high-throughput phenotyping and digital agriculture. This framework has clear value in agri-food technology, especially in precision farming, post-harvest quality control, and autonomous fruit sorting. This technology could be adopted for monitoring purposes or integrated into robotic harvesters or smart sorting lines to assess fruit maturity in real time, improving harvest timing and reducing post-harvest losses. By spanning both field and industrial contexts, the approach could establish a pathway toward scalable, transparent, and sensor-independent tools for sustainable crop management. Future work should explore the integration of temporal imaging, hyperspectral data, or genotype-specific modeling to further enhance predictive granularity and extend applicability across diverse agroecological contexts.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/horticulturae12020127/s1, Figure S1: Distribution of laboratory-measured morphological and quality traits of tomato fruits; Figure S2: Distribution of features extracted via Mask R-CNN segmentation; Figure S3: Distribution of features extracted via YOLOv8n-seg segmentation; Figure S4: Principal component analysis (PCA) of laboratory-measured features (LAB); Figure S5: Principal component analysis (PCA) of features extracted via Mask R-CNN (CV-RCNN); Figure S6: PCA Principal component analysis (PCA) of features extracted via YOLOv8n-seg (CV-YOLO); Figure S7: Principal component analysis (PCA) of the combined CV feature set (CV-RCNN + CV-YOLO); Figure S8: Principal component analysis (PCA) of all features (laboratory and image-derived); Figure S9: Network analysis of laboratory-measured features (LAB); Figure S10: Network analysis of CV-RCNN-derived features; Figure S11: Network analysis of CV-YOLO-derived features; Figure S12: Network analysis of Combined CV features (CV-RCNN + CV-YOLO); Figure S13: Network analysis of ALL features (laboratory and CV-derived); Figure S14: Confusion matrices for laboratory-measured (LAB) features across machine learning models; Figure S15: Confusion matrices for CV-RCNN-derived features across machine learning models; Figure S16: Confusion matrices for CV-YOLO-derived features across machine learning models; Figure S17: Confusion matrices for Combined-CV (CV-RCNN + CV-YOLO) features across machine learning models; Figure S18: Confusion matrices for ALL features across machine learning models; Figure S19: Comparative heatmap of machine learning model performance across feature groups; Figure S20: Feature importance for LAB features across machine learning models; Figure S21: Feature importance for CV-RCNN features across machine learning models; Figure S22: Feature importance for CV-YOLO features across machine learning models; Figure S23: Feature importance for Combined-CV features across machine learning models; Figure S24: Feature importance for ALL features across machine learning models; Figure S25: Representation of global color distributions across four maturity stages of tomato fruits; Figure S26: A few representative images of cultivated tomatoes in real-world scenarios that were used for field validation; Figure S27: Confusion matrices for field data for CV-RCNN feature set across machine learning models; Figure S28: Confusion matrices for field data for CV-YOLO feature set across machine learning models; Figure S29: Confusion matrices for field data for Combined-CV feature set across machine learning models; Figure S30: Feature importance for field data using CV-RCNN feature set across machine learning models; Figure S31: Feature importance for field data using CV-YOLO feature set across machine learning models; Figure S32: Feature importance for field data using Combined-CV feature set across machine learning models.

Author Contributions

Conceptualization, A.A., S.S., F.D.G. and J.L.; methodology, A.A. and F.D.G.; software, A.A.; validation, L.P., S.S., J.L. and F.D.G.; formal analysis, A.A.; investigation, A.A.; resources, F.D.G., S.S. and J.L.; data curation, A.A.; writing—original draft preparation, A.A. and L.P.; writing—review and editing, A.A., L.P. and F.D.G.; visualization, A.A.; supervision, J.L., S.S. and F.D.G.; project administration, J.L., S.S. and F.D.G.; funding acquisition, L.P., J.L., S.S. and F.D.G. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Pennsylvania Department of Agriculture Specialty Crop Block Grant No. C940001528, the USDA-ARS Penn State Cooperative Agreement: 58-6034-3-016, and by the Grant PRE2021-100809 funded by MICIU/AEI/10.13039/501100011033 and by European Social Fund Plus (ESF+). F. Di Gioia’s contribution was supported by the USDA National Institute of Food and Agriculture and Hatch Appropriations under Project No. PEN05002 and Accession No. 7007517.

Data Availability Statement

The original contributions presented in this study are included in the article/Supplementary Materials. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
AIArtificial Intelligence
ALL-FULLIntegrated dataset combining LAB, CV-RCNN, and CV-YOLO features
a_modelCIELAB a* component (red–green chromaticity)
b_modelCIELAB b* component (yellow–blue chromaticity)
CNNConvolutional Neural Network
CVComputer Vision
CV-ALLCombined dataset of CV-RCNN and CV-YOLO features
CV-RCNNComputer Vision features extracted using Region-based CNN segmentation
CV-YOLOComputer Vision features extracted using YOLOv8n-seg segmentation
D_maxMaximum diameter of fruit (from LAB dataset)
D_minMinimum diameter of fruit (from LAB dataset)
ExGExcess Green Index
ExGRExcess Green minus Red Index
ExRExcess Red Index
F1-scoreHarmonic mean of precision and recall
GGreen channel intensity
G_stdStandard deviation of the green channel
KNNk-Nearest Neighbors
LABLaboratory-derived dataset (physicochemical traits)
L_modelCIELAB L* component (lightness)
L_stdStandard deviation of L* (lightness)
MLMachine Learning
NDINormalized Difference Index
PCAPrincipal Component Analysis
PC1, PC2Principal Components 1 and 2
RRed channel intensity
R_stdStandard deviation of the red channel
RCNNRegion-based Convolutional Neural Network
RGBRed–Green–Blue color space
SVMSupport Vector Machine
YOLOYou Only Look Once (real-time object detection algorithm)
YOLOv8n-segYOLO version 8 (nano), segmentation variant
XGBoostExtreme Gradient Boosting

References

  1. García, L.; Parra, L.; Jimenez, J.M.; Lloret, J.; Lorenz, P. IoT-based smart irrigation systems: An overview on the recent trends on sensors and IoT systems for irrigation in precision agriculture. Sensors 2020, 20, 1042. [Google Scholar] [CrossRef] [Scilit]
  2. Pateraki, A.; Psillakis, E. Vacuum-assisted headspace solid phase microextraction for monitoring ripening-induced changes in tomato volatile profile. J. Chromatogr. A 2025, 1740, 465556. [Google Scholar] [CrossRef] [Scilit]
  3. Distefano, M.; Mauro, R.P.; Page, D.; Giuffrida, F.; Bertin, N.; Leonardi, C. Aroma volatiles in tomato fruits: The role of genetic, preharvest and postharvest factors. Agronomy 2022, 12, 376. [Google Scholar] [CrossRef] [Scilit]
  4. U.S. Department of Agriculture. Tomato Grades and Standards. Available online: https://www.ams.usda.gov/grades-standards/tomato-grades-and-standards#:~:text=U.S.No.1consistsoftomatoeswhichmeetthefollowingrequirements (accessed on 27 July 2025).
  5. Dorairaj, D.; Sharma, S.; Mawale, K.S.; Puthusseri, B.; Parvatam, G.; Shetty, N.P. Determining the function of ripening associated genes and biochemical changes during tomato (Solanum lycopersicum L.) fruit maturation. Biotechnol. Lett. 2025, 47, 22. [Google Scholar] [CrossRef] [Scilit]
  6. Alonso-Salinas, R.; López-Miranda, S.; Pérez-López, A.J.; Acosta-Motos, J.R. Strategies to delay ethylene-mediated ripening in climacteric fruits: Implications for shelf life extension and postharvest quality. Horticulturae 2024, 10, 840. [Google Scholar] [CrossRef] [Scilit]
  7. Panebianco, S.; Van Wijk, E.; Yan, Y.; Cirvilleri, G.; Musumarra, A.; Pellegriti, M.G.; Scordino, A. Delayed luminescence in monitoring the postharvest ripening of tomato fruit and classifying according to their maturity stage at harvest. Food Bioprocess Technol. 2024, 17, 5119–5133. [Google Scholar] [CrossRef] [Scilit]
  8. Yin, W.; He, C.; Wu, Q. A tomato quality identification method based on raman spectroscopy and convolutional neural network. J. Phys. Conf. Ser. 2020, 1438, 012029. [Google Scholar] [CrossRef] [Scilit]
  9. Nakashima, S.; Nagasawa, A.; Yokokura, K.; Shukuin, Y.; Takeda, N.; Yamamoto, K. Daily monitoring of ripening processes of a tomato using an original handheld visible–near-infrared spectrometer. Appl. Spectrosc. Pract. 2023, 1, 27551857231181923. [Google Scholar] [CrossRef] [Scilit]
  10. Baltazar, A.; Aranda, J.I.; González-Aguilar, G. Bayesian classification of ripening stages of tomato fruit using acoustic impact and colorimeter sensor data. Comput. Electron. Agric. 2008, 60, 113–121. [Google Scholar] [CrossRef] [Scilit]
  11. Mizrach, A. Nondestructive ultrasonic monitoring of tomato quality during shelf-life storage. Postharvest Biol. Technol. 2007, 46, 271–274. [Google Scholar] [CrossRef] [Scilit]
  12. Xie, J.; Hsieh, S.-J.; Tan, Z.; Wang, H.; Zhang, J. Prediction of tomato freshness using infrared thermal imaging and transient step heating. In Proceedings of the Thermosense: Thermal Infrared Applications XXXVIII, Baltimore, MD, USA, 18–21 April 2016; pp. 62–71. [Google Scholar]
  13. Kim, W.; Han, S.; Lee, H.J.; Joyce, R.; Kim, G.; Lee, J. Real-time measurement and monitoring system for the fruit ripening process with a wireless, low-power and long-distance communication. J. Food Meas. Charact. 2023, 17, 2821–2829. [Google Scholar] [CrossRef] [Scilit]
  14. Khorramifar, A.; Sharabiani, V.R.; Karami, H.; Kisalaei, A.; Lozano, J.; Rusinek, R.; Gancarz, M. Investigating changes in pH and soluble solids content of potato during the storage by electronic nose and Vis/NIR spectroscopy. Foods 2022, 11, 4077. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  15. Fass, E.; Shlomi, E.; Ziv, C.; Glickman, O.; Helman, D. Machine learning models based on hyperspectral imaging for pre-harvest tomato fruit quality monitoring. Comput. Electron. Agric. 2025, 229, 109788. [Google Scholar] [CrossRef] [Scilit]
  16. Liu, C.; Liu, W.; Chen, W.; Yang, J.; Zheng, L. Feasibility in multispectral imaging for predicting the content of bioactive compounds in intact tomato fruit. Food Chem. 2015, 173, 482–488. [Google Scholar] [CrossRef] [Scilit]
  17. Huang, Y.; Xiong, J.; Jiang, X.; Yang, J.; Zhang, M. Research on postharvest tomato freshness recognition method based on RGB-S and ResNet34. J. Food Sci. 2025, 90, e70063. [Google Scholar] [CrossRef] [Scilit]
  18. Hashimoto, A.; Suehara, K.-I.; Kameoka, T. Quantitative evaluation of surface color of tomato fruits cultivated in remote farm using digital camera images. SICE J. Control Meas. Syst. Integr. 2012, 5, 18–23. [Google Scholar] [CrossRef] [Scilit]
  19. Wang, Z.; Ling, Y.; Wang, X.; Meng, D.; Nie, L.; An, G.; Wang, X. An improved Faster R-CNN model for multi-object tomato maturity detection in complex scenarios. Ecol. Inform. 2022, 72, 101886. [Google Scholar] [CrossRef] [Scilit]
  20. Sun, H.; Zheng, Q.; Yao, W.; Wang, J.; Liu, C.; Yu, H.; Chen, C. An Improved YOLOv8 Model for Detecting Four Stages of Tomato Ripening and Its Application Deployment in a Greenhouse Environment. Agriculture 2025, 15, 936. [Google Scholar] [CrossRef] [Scilit]
  21. Santos, L.; Santos, F.N.; Oliveira, P.M.; Shinde, P. Deep learning applications in agriculture: A short review. In Proceedings of the Iberian Robotics conference, Porto, Portugal, 20–22 November 2019; pp. 139–151. [Google Scholar]
  22. Joshi, A.; Pradhan, B.; Gite, S.; Chakraborty, S. Remote-sensing data and deep-learning techniques in crop mapping and yield prediction: A systematic review. Remote Sens. 2023, 15, 2014. [Google Scholar] [CrossRef] [Scilit]
  23. Kamilaris, A.; Prenafeta-Boldú, F.X. Deep learning in agriculture: A survey. Comput. Electron. Agric. 2018, 147, 70–90. [Google Scholar] [CrossRef] [Scilit]
  24. Akkem, Y.; Biswas, S.K.; Varanasi, A. Smart farming using artificial intelligence: A review. Eng. Appl. Artif. Intell. 2023, 120, 105899. [Google Scholar] [CrossRef] [Scilit]
  25. Arah, I.K.; Amaglo, H.; Kumah, E.K.; Ofori, H. Preharvest and postharvest factors affecting the quality and shelf life of harvested tomatoes: A mini review. Int. J. Agron. 2015, 2015, 478041. [Google Scholar] [CrossRef] [Scilit]
  26. Delgado-Vargas, V.A.; Ayala-Garay, O.J.; Arévalo-Galarza, M.d.L.; Gautier, H. Increased temperature affects tomato fruit physicochemical traits at harvest depending on fruit developmental stage and genotype. Horticulturae 2023, 9, 212. [Google Scholar] [CrossRef] [Scilit]
  27. Ma, J.; Li, M.; Fan, W.; Liu, J. State-of-the-Art Techniques for Fruit Maturity Detection. Agronomy 2024, 14, 2783. [Google Scholar] [CrossRef] [Scilit]
  28. Aherwadi, N.; Mittal, U.; Singla, J.; Jhanjhi, N.; Yassine, A.; Hossain, M.S. Prediction of fruit maturity, quality, and its life using deep learning algorithms. Electronics 2022, 11, 4100. [Google Scholar] [CrossRef] [Scilit]
  29. Faisal, M.; Albogamy, F.; Elgibreen, H.; Algabri, M.; Alqershi, F.A. Deep learning and computer vision for estimating date fruits type, maturity level, and weight. IEEE Access 2020, 8, 206770–206782. [Google Scholar] [CrossRef] [Scilit]
  30. MacEachern, C.B.; Esau, T.J.; Schumann, A.W.; Hennessy, P.J.; Zaman, Q.U. Detection of fruit maturity stage and yield estimation in wild blueberry using deep learning convolutional neural networks. Smart Agric. Technol. 2023, 3, 100099. [Google Scholar] [CrossRef] [Scilit]
  31. Wang, C.; Han, Q.; Li, C.; Zou, T.; Zou, X. Fusion of fruit image processing and deep learning: A study on identification of citrus ripeness based on R-LBP algorithm and YOLO-CIT model. Front. Plant Sci. 2024, 15, 1397816. [Google Scholar] [CrossRef] [Scilit]
  32. Rizzo, M.; Marcuzzo, M.; Zangari, A.; Gasparetto, A.; Albarelli, A. Fruit ripeness classification: A survey. Artif. Intell. Agric. 2023, 7, 44–57. [Google Scholar] [CrossRef] [Scilit]
  33. Tapia-Mendez, E.; Cruz-Albarran, I.A.; Tovar-Arriaga, S.; Morales-Hernandez, L.A. Deep learning-based method for classification and ripeness assessment of fruits and vegetables. Appl. Sci. 2023, 13, 12504. [Google Scholar] [CrossRef] [Scilit]
  34. Zhu, Y.; Gu, Q.; Zhao, Y.; Wan, H.; Wang, R.; Zhang, X.; Cheng, Y. Quantitative extraction and evaluation of tomato fruit phenotypes based on image recognition. Front. Plant Sci. 2022, 13, 859290. [Google Scholar] [CrossRef] [Scilit]
  35. Ambrus, B.; Nyéki, A.; Teschner, G.; Moldvai, L. The Effect of Illumination on HSV Colour Segmentation for Ripe Tomatoes based on Machine Vision. Chem. Eng. Trans. 2024, 114, 829–834. [Google Scholar]
  36. Fawzia Rahim, U.; Mineno, H. Highly accurate tomato maturity recognition: Combining deep instance segmentation, data synthesis and color analysis. In Proceedings of the 2021 4th Artificial Intelligence and Cloud Computing Conference, Kyoto, Japan, 17–19 December 2021; pp. 16–23. [Google Scholar]
  37. Bhargava, A.; Bansal, A. Fruits and vegetables quality evaluation using computer vision: A review. J. King Saud Univ. Comput. Inf. Sci. 2021, 33, 243–257. [Google Scholar] [CrossRef] [Scilit]
  38. Kim, J.; Chung, Y.S. A short review of RGB sensor applications for accessible high-throughput phenotyping. J. Crop Sci. Biotechnol. 2021, 24, 495–499. [Google Scholar] [CrossRef] [Scilit]
  39. Archana, R.; Jeevaraj, P.E. Deep learning models for digital image processing: A review. Artif. Intell. Rev. 2024, 57, 11. [Google Scholar] [CrossRef] [Scilit]
  40. Burdett, H.; Wellen, C. Statistical and machine learning methods for crop yield prediction in the context of precision agriculture. Precis. Agric. 2022, 23, 1553–1574. [Google Scholar] [CrossRef] [Scilit]
  41. Goyal, K.; Kumar, P.; Verma, K. Tomato ripeness and shelf-life prediction system using machine learning. J. Food Meas. Charact. 2024, 18, 2715–2730. [Google Scholar] [CrossRef] [Scilit]
  42. Reissig, G.N.; Oliveira, T.F.d.C.; Costa, Á.V.L.; Parise, A.G.; Pereira, D.R.; Souza, G.M. Machine learning for automatic classification of tomato ripening stages using electrophysiological recordings. Front. Sustain. Food Syst. 2021, 5, 696829. [Google Scholar] [CrossRef] [Scilit]
  43. Trigubenko, R.; Laboroai. Laboro Tomato Annotated Image Dataset of Growing Tomatoes at Different Stages. 2024. Available online: https://www.kaggle.com/datasets/nexuswho/laboro-tomato (accessed on 14 January 2026).
  44. Di Gioia, F.; Hong, J.C.; Pisani, C.; Petropoulos, S.A.; Bai, J.; Rosskopf, E.N. Yield performance, mineral profile, and nitrate content in a selection of seventeen microgreen species. Front. Plant Sci. 2023, 14, 1220691. [Google Scholar] [CrossRef] [Scilit]
  45. Chen, Y.; Liu, Q.; Jiang, X.; Wei, Y.; Zhou, X.; Zhou, J.; Wang, F.; Yan, L.; Fan, S.; Xing, H. FEW-YOLO: A lightweight ripe fruit detection algorithm in wolfberry based on improved YOLOv8: Chen et al. J. Food Meas. Charact. 2025, 19, 4783–4795. [Google Scholar] [CrossRef] [Scilit]
  46. Ayuso-Yuste, M.C.; González-Cebrino, F.; Lozano-Ruiz, M.; Fernández-León, A.M.; Bernalte-García, M.J. Influence of ripening stage on quality parameters of five traditional tomato varieties grown under organic conditions. Horticulturae 2022, 8, 313. [Google Scholar] [CrossRef] [Scilit]
  47. Sherafati, A.; Mollazade, K.; Saba, M.K.; Vesali, F. TomatoScan: An Android-based application for quality evaluation and ripening determination of tomato fruit. Comput. Electron. Agric. 2022, 200, 107214. [Google Scholar] [CrossRef] [Scilit]
  48. Khan, A.; Hassan, T.; Shafay, M.; Fahmy, I.; Werghi, N.; Mudigansalage, S.; Hussain, I. Tomato maturity recognition with convolutional transformers. Sci. Rep. 2023, 13, 22885. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  49. Li, Y.; Li, J.; Luo, L.; Wang, L.; Zhi, Q. Tomato ripeness and stem recognition based on improved YOLOX. Sci. Rep. 2025, 15, 1924. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  50. Shao, Y.; Ji, S.; Shi, Y.; Xuan, G.; Jia, H.; Guan, X.; Chen, L. Growth period determination and color coordinates visual analysis of tomato using hyperspectral imaging technology. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2024, 319, 124538. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  51. Lawal, M.O. Tomato detection based on modified YOLOv3 framework. Sci. Rep. 2021, 11, 1447. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  52. Lu, T.; Han, B.; Chen, L.; Yu, F.; Xue, C. A generic intelligent tomato classification system for practical applications using DenseNet-201 with transfer learning. Sci. Rep. 2021, 11, 15824. [Google Scholar] [CrossRef] [Scilit]
  53. Sharma, J.; Al-Huqail, A.A.; Almogren, A.; Doshi, H.; Jayaprakash, B.; Bharathi, B.; Ur Rehman, A.; Hussen, S. Deep learning based ensemble model for accurate tomato leaf disease classification by leveraging ResNet50 and MobileNetV2 architectures. Sci. Rep. 2025, 15, 13904. [Google Scholar] [CrossRef] [Scilit]
  54. Sharma, A.; Patel, R.K.; Pranjal, P.; Panchal, B.; Chouhan, S.S. Computer vision-based smart monitoring and control system for crop. In Applications of Computer Vision and Drone Technology in Agriculture 4.0; Springer: Berlin/Heidelberg, Germany, 2024; pp. 65–82. [Google Scholar]
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.