Next Article in Journal
A Soft Robotic Gripper for Crop Harvesting: Prototyping, Imaging, and Model-Based Control
Previous Article in Journal
A Machine Learning Framework for Classifying Thermal Stress in Bean Plants Using Hyperspectral Data
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Computer Vision and AI-Based System for Real-Time Sizing and Grading of Thai Export Fruits

1
School of Mechanical Engineering, Institute of Engineering, Suranaree University of Technology, 111 University Ave., Nakhon Ratchasima 30000, Thailand
2
Faculty of Engineering and Agro Industry, Maejo University, 63 Moo 4, Nonghan Sub-District, Sansai District, Chiang Mai 50290, Thailand
3
Mechatronics Engineering Program, Institute of Engineering, Suranaree University of Technology, 111 University Ave., Nakhon Ratchasima 30000, Thailand
*
Author to whom correspondence should be addressed.
AgriEngineering 2025, 7(11), 377; https://doi.org/10.3390/agriengineering7110377
Submission received: 14 September 2025 / Revised: 1 November 2025 / Accepted: 5 November 2025 / Published: 7 November 2025

Abstract

Thailand’s mango export industry faces significant challenges in meeting stringent international quality standards, particularly the costly phytosanitary X-ray irradiation process. Current fixed-dose irradiation methods result in substantial energy waste due to variations in fruit size. This research presents a low-cost, real-time system that integrates computer vision and artificial intelligence (AI) to optimize this process. By capturing a single top-view 2D image, the system accurately estimates the three-dimensional characteristics (width, height, and depth) of ‘Nam Dok Mai Si Thong’ mangoes. This dimensional data is crucial for dynamically adjusting the radiation dose for each fruit, leading to significant reductions in energy consumption and operational costs. Our novel approach utilizes a Linear Regression combined with Co-Kriging (LR + CoK) model to precisely estimate fruit depth from 2D data, a key limitation in previous studies. The system demonstrated high efficacy, achieving a dimensional estimation error (RMSE) of less than 0.46 cm and a size grading accuracy of up to 93.33 percent. This technology not only enhances sorting and grading efficiency but also offers a practical solution to lower the economic and energy burden of phytosanitary treatments, directly improving the sustainability of fruit export operations.

1. Introduction

The Nam Dok Mai Si Thong Mango is one of Thailand’s most important agricultural products, playing a significant role in the nation’s economy as a high-value export commodity. According to available data, Thailand is the second-largest mango exporter in Asia and the seventh-largest in the world, with an export value reaching 3236.16 million baht in 2023. Key export markets include countries with high purchasing power and stringent import standards, such as China, Japan, South Korea, the United States, and the European Union.
Among the various mango cultivars, ‘Nam Dok Mai Si Thong’ is highly popular in the global market due to its unique sweet taste and attractive appearance. The success of Thai mango exports hinges on the ability to maintain product quality in accordance with the importing countries’ requirements. These standards are not limited to taste but also cover strict external physical attributes, including uniform skin color, standard shape, correct size grading, and, crucially, the absence of surface defects such as bruises, lesions, or insect damage.
Grading mangoes to a premium quality standard can increase profits for farmers and exporters by 30–50%. Therefore, having an effective and reliable quality control process is not just an option but a critical factor for accessing high-value markets and building consumer confidence on an international level [1,2,3,4].
Food irradiation is a processing technique used to enhance food safety and extend shelf life. The primary objectives of this process include eliminating pathogenic microorganisms, delaying the spoilage and ripening of fruits, inhibiting sprouting in vegetables during storage, and controlling insect and parasite contamination. This technology has gained international acceptance and is utilized in over 40 countries, including the United States, France, Canada, China, the Philippines, South Africa, Pakistan, and Thailand. Irradiated food products must be labeled with the purpose of the treatment and the date of irradiation. In Thailand, the Food and Drug Administration (FDA) is the regulatory body responsible for overseeing the use of food irradiation. The regulations stipulate that the radiation must originate from one of the following approved sources:
  • Gamma rays from Cobalt-60 or Cesium-137 sources.
  • X-rays generated from machines operating at or below an energy level of 5 million electron volts (MeV).
  • Electron beams generated from machines operating at or below an energy level of 10 million electron volts (MeV).
Current food irradiation laws focus on the intended purpose of the treatment rather than specifying the types of food that can be irradiated. A key principle is that the radiation dose applied must be the minimum required to achieve the desired objective while ensuring the maximum dose remains at a level safe for consumption. This process must preserve the food’s nutritional value and maintain desirable sensory characteristics, such as taste and texture. The radiation absorbed dose, measured in Grays (Gy), is defined as the amount of energy absorbed per unit weight of the food. The safety of food irradiation has been affirmed by international bodies and the U.S. FDA, which have concluded that fresh foods irradiated at doses up to 1 kGy, dried foods up to 30 kGy, and other foods at an average dose of up to 10 kGy pose no toxicological, nutritional, or microbiological risks to consumers [5,6,7]. The Synchrotron Light Research Institute (Public Organization) in Nakhon Ratchasima, Thailand, has been actively involved in the research and development of irradiation technology, including the construction of a 6 MeV irradiator for agricultural applications. This machine is used to delay the spoilage of fruits and vegetables by using X-rays to eliminate microorganisms. The X-rays are produced by accelerating high-energy electrons to strike a heavy metal target. However, a significant challenge with the current system is its operational method: the irradiator emits radiation continuously across its entire field, regardless of the size of the object being processed. This practice leads to substantial energy waste and, consequently, increases production costs [8,9].
Our research indicates that the dimensions (width, height, and depth) of the irradiated object are critical factors that directly influence the required dose and exposure time. Larger objects necessitate longer exposure times, which requires careful calibration of the conveyor belt speed to ensure thorough and uniform irradiation. The speed must be optimized—not too slow and not too fast—to prevent product damage. Proper calibration of both speed and time is essential for determining the precise energy required for the process. Since higher energy consumption directly translates to higher operational costs, optimizing these parameters is crucial for the economic viability of food irradiation. X-ray irradiation is an effective technology for controlling microbial contamination in food. Research has demonstrated its efficacy in reducing bacterial counts in both solid and liquid food matrices. Optimal radiation doses can be determined to eliminate pathogens without degrading key nutritional components such as sugars, proteins, fats, and vitamin C. For instance, doses of 1.5 and 2.0 kGy were found to completely inhibit the growth of tested bacteria [10]. This preservation method is particularly valuable for fresh produce. A study on Korean ‘Maehyang’ strawberries showed that X-ray doses below 1.0 kGy effectively reduced microbial, bacterial, and fungal populations in a dose-dependent manner throughout the storage period. This process slows down decay and physicochemical changes, making irradiation a viable hygienic option for the international trade of fresh fruits like strawberries [11]. In the context of fruit exports, irradiation is often complemented by other advanced technologies for quality control. For example, ‘Nam Dok Mai’ mangoes, which are irradiated for export, also undergo automated grading processes. In recent years, computer vision and machine learning have been widely applied to fruit image analysis for grading, sizing, and quality assessment, effectively replacing manual inspection with higher accuracy and non-destructive operation [12]. Deep learning models—particularly convolutional neural networks (CNNs)—have demonstrated excellent performance in detecting size, surface defects, and ripeness levels of mangoes and other fruits under controlled illumination, thereby reducing food waste and improving the efficiency of agricultural processing systems [13,14]. Transfer learning techniques have further enhanced these systems’ robustness and generalization capability for multi-class fruit classification [15], while artificial neural network (ANN) architectures have been successfully implemented for mango weight estimation from images captured by multiple cameras [16]. In parallel, several studies have explored real-time implementations using low-cost single 2D cameras combined with Canny edge detection and contour-based geometric modeling under the assumption of axisymmetric fruit shapes—applicable mainly to slender fruits such as bananas, cucumbers, and chilies [17]. Additionally, the use of stereo and depth cameras has been investigated, with various models now available and evaluated for their suitability in industrial-scale agricultural applications that require real-time, non-contact fruit measurement [18]. Collectively, these advances highlight the ongoing evolution from traditional 2D vision systems toward intelligent, low-cost, and real-time AI-driven solutions capable of supporting automation in post-harvest processing.
Therefore, the primary objective of this study is to develop and validate a low-cost, image-based system capable of accurately estimating the three-dimensional volume of mangoes to enable dynamic dose control in the X-ray irradiation process, thereby reducing energy consumption and operational costs. This study presents the design of an integrated framework that applies artificial intelligence (AI) and computer vision technologies to improve the efficiency of conventional irradiation systems. The proposed system can estimate the three-dimensional dimensions is width, height, and depth of ‘Nam Dok Mai Si Thong’ mangoes from a single 2D image in real time. The main challenge of this research lies in accurately estimating the three-dimensional geometric features width, height, depth, and weight of mangoes using only two-dimensional images captured by a single low-cost camera. The system must function in real time under cost constraints and within radiation-controlled environments, where human operation is not possible. To overcome this limitation, this study introduces a novel scientific approach that integrates Linear Regression with Co-Kriging (LR + CoK) to enhance depth estimation accuracy from 2D images. The LR + CoK method fuses low-fidelity image-based data with limited high-fidelity ground-truth samples, achieving near three-dimensional precision without requiring stereo cameras or additional sensors. Furthermore, Gaussian Process Regression is employed to predict the fruit’s weight and classify its size while providing predictive confidence, enabling real-time and energy-efficient X-ray dose control. This system also supports automatic fruit grading according to export standards and supplies the geometric parameters necessary for dynamic irradiation adjustment based on each fruit’s size. As a result, the proposed framework significantly reduces energy consumption and operational costs, enhances the economic value of Thailand’s fruit export industry, and demonstrates potential applicability to other agricultural products in the future.

2. Methodology

This section outlines the research methodology and techniques used in the study, including the characteristics and cultivation of Nam Dok Mai Si Thong mangoes, the irradiation process in export handling, the application of computer vision for dimensional analysis, and the development of predictive models such as Linear Regression, Artificial Neural Networks, Gaussian Process Regression, and Co-Kriging. Evaluation metrics employed to assess model accuracy are also presented.

2.1. Nam Dok Mai Si Thong Mango

Mango is one of the most popular tropical fruits, valued for both its delicious flavor and high nutritional content, earning the title of “King of Tropical Fruits.” This study utilized Nam Dok Mai Si Thong mangoes (Mangifera indica L., cv. Nam Dok Mai Si Thong), a premium-grade cultivar selected for its economic importance in Thai exports. As illustrated in Figure 1, this cultivar is widely known for its role in dishes such as mango sticky rice.
Mango cultivation is widespread across Thailand, particularly in the northern and northeastern regions where soil and climatic conditions are highly favorable. Suitable soils are generally sandy loam to clay loam with good drainage, a pH of 5.5–7.5, and moderate to high fertility. The crop thrives in tropical to subtropical climates, requiring an average temperature of 24–30 °C and a prolonged dry season of 3–4 months to induce flowering.
Harvesting is carried out when the fruit reaches the mature-ripe stage for export. Export-grade mangoes must be certified under Good Agricultural Practices (GAP), and their size classification follows the Thai Agricultural Standard established by the National Bureau of Agricultural Commodity and Food Standards [19], which categorizes fruits according to weight as shown in Table 1.
Currently, the main postharvest processes for exporting mangoes, as shown in Figure 2, include quality grading, size classification, and disinfection by either hot-water immersion/steam treatment at 46–47 °C or irradiation [20]. However, these processes remain costly and time-consuming. Therefore, this research aims to develop improved approaches that enhance efficiency and suitability for industrial-scale applications.

2.2. Irradiation in Mango Export Processing

In Thailand, the Synchrotron Light Research Institute (Public Organization) has initiated a project to develop a 6 MeV linear accelerator for X-ray irradiation to sterilize fresh fruits [8,9]. This system operates at an electron beam energy of 6 MeV, capable of producing X-rays to deliver doses up to 1 kGy for fresh fruit sterilization, as shown in Figure 3. The RF Linac accelerates electrons by transferring high-power radiofrequency energy through an electric field, enabling precise control over beam energy and dose delivery [21]. The design and construction of this accelerator, carried out domestically in Thailand, represent a significant advancement in local expertise and related technologies. This achievement not only supports current agricultural applications but also lays the foundation for future developments in high-level irradiation technology. The principle of this system is to accelerate electron beams using a linear accelerator, directing them onto a heavy metal target to generate X-rays. These X-rays are then applied to sterilize fresh fruits and vegetables, thereby extending their postharvest shelf life. Importantly, the operating energy must remain below the international safety limits established by the World Health Organization (WHO) to prevent the induction of radioactivity in irradiated produce, ensuring both food safety and consumer confidence [22].
In the irradiation of Nam Dok Mai mangoes for export, a low radiation dose of 0.4–0.6 kGy is applied to control insect pests and delay ripening, without significantly affecting the fruit’s color, aroma, taste, or nutritional quality [24]. The X-rays used in this process are generated by accelerating high-energy electrons onto a heavy metal target, effectively sterilizing and controlling pests. However, X-ray generation is more costly than gamma irradiation. Therefore, efficient energy utilization and precise estimation of the mango’s geometric dimensions width, height, and depth are essential [25], enabling proper adjustment of conveyor speed and electron beam power to achieve the required dose. To determine the optimal operating conditions, the relationships among fruit geometry, delivered dose, irradiation time, and system power are considered, as described by the following equations.
D d = D sf exp μ m ρ D
Equation (1) describes Beer–Lambert attenuation of dose inside the product, where D d is the dose at depth D and D sf is the surface dose.
D sf = n c μ m P v W
Equation (2) aggregates the system factors into a single coefficient ( n c ), indicating that the surface dose increases with the beam power P and the mass absorption coefficient μ m , and decreases with the conveyor speed v and the width of the object W (irradiated span).
t = H v
Equation (3) gives the exposure time as a function of the height H or length that passes the scan head at conveyor speed v.
E = P × t
Equation (4) yields the total irradiation energy from the average beam power P and the exposure time t.
  • Symbols and units:
    D sf = surface dose [ kGy ] D d = dose at depth D ( depth dose ) [ kGy ] μ m = mass absorption coefficient of the product [ cm 2 kg 1 ] ρ = density of the product [ kg cm 3 ] D = depth inside the product [ cm ] P = electron-beam power ( average ) [ kW ] n c = X-ray conversion efficiency and system constant ( dimensionless ) v = conveyor speed [ cm s 1 ] W = object width along the scan direction [ cm ] H = object height or length along the motion direction [ cm ] t = irradiation time [ s ] E = total irradiation energy [ kJ ]
From these equations, when the target dose is held constant, increasing the conveyor speed (v) reduces D sf , which must be compensated by increasing P or reducing the irradiated width. Conversely, for a fixed conveyor speed, P directly controls the dose. The product geometry ( W , L , D ) therefore governs exposure time, internal dose, and total energy consumption, which are directly linked to production cost.

2.3. Computer Vision

In this study, computer vision techniques were applied to extract the geometric characteristics of mangoes from two-dimensional images. The features of interest obtained from this process were the fruit’s width and height. The original images were captured using a digital camera with a resolution of 640 × 480 pixels and subsequently cropped to 480 × 280 pixels in order to eliminate unnecessary background and focus solely on the mango region. After preprocessing, the images were converted into grayscale using the standard ITU-R BT.601 [26] linear transformation, which accounts for the human visual system’s response to luminance. This grayscale conversion is expressed in an equation as follows:
I g r a y ( x , y ) = 0.299 R ( x , y ) + 0.587 G ( x , y ) + 0.114 B ( x , y )
where R ( x , y ) , G ( x , y ) , B ( x , y ) are the intensity values of each color channel. The ITU-R BT.601 standard is based on the human eye’s sensitivity to brightness, being most sensitive to green, followed by red, and least sensitive to blue. The weights 0.299, 0.587, and 0.114 are derived from the luminous efficiency function, which represents the spectral response of human vision. This produces a grayscale image that closely resembles human visual perception and has become a standard in computer vision and image processing [27,28]. Similar approaches in fruit classification have been demonstrated in mango grading and sorting systems, where external features such as width, height, and surface defects are extracted from images as the basis for quality classification [29,30] Subsequently, the images were processed using Canny edge detection, a highly popular edge detection algorithm in image processing, as it provides sharp edges and effectively reduces noise. The algorithm consists of four main steps as follows:
  • Noise Reduction (Gaussian Filtering); To reduce noise that may generate false edges before edge detection, Gaussian smoothing was applied:
    I s m o o t h ( x , y ) = I ( x , y ) G σ ( x , y )
  • Gradient Calculation (Edge Strength and Direction); To compute the edge strength by calculating gradients along the x and y axes using the Sobel operator:
    G x = I x , G y = I y
    Then, the magnitude and orientation of the gradient were determined as:
    G ( x , y ) = G x 2 + G y 2
    θ ( x , y ) = arctan G y G x
  • Non-Maximum Suppression; Retaining only the gradient values at each pixel that are local maxima along the direction perpendicular to the edge, thereby producing thin and sharp edges.
  • Hysteresis Thresholding. A process that makes Canny more stable than simple thresholding by applying two thresholds T h i g h and T l o w to decide whether a pixel is an edge or not. This ensures that the detected edges remain continuous while reducing false edges caused by noise:
E ( x , y ) = 1 , G ( x , y ) T h i g h Strong edge Edge zone , T l o w G ( x , y ) < T h i g h Hysteresis range 0 , G ( x , y ) < T l o w Non-edge
In this study, the threshold values were set to T l o w = 140 and T h i g h = 255 , as the dataset contained images captured under varying illumination conditions. Pixels with intensities below T l o w were classified as background, and those above T h i g h were identified as mango regions. The intermediate range between T l o w and T h i g h represented the hysteresis threshold zone, corresponding to boundary pixels that transition between the object and background. This three-range segmentation improved robustness by retaining valid edge information along fruit boundaries, which is essential for precise contour extraction. From the resulting edge map, contours were extracted using the function ‘cv2.findContours’, and the contour with the largest area was selected to represent the mango. Then, ‘cv2.minAreaRect’ was used to determine the minimum bounding rectangle, yielding the mango’s width and height in pixels as:
W p x = min ( w r e c t , h r e c t ) , H p x = max ( w r e c t , h r e c t )
where w r e c t , h r e c t represent the shorter and longer sides of the bounding rectangle around the mango. Pixel dimensions were then converted into physical units (Pixel-to-Physical Conversion) in centimeters. From camera calibration, the scale factors for pixel-to-centimeter conversion were obtained as:
W c m = W p x · S w , H c m = H p x · S l
where S w = 0.105 cm / px and S l = 0.110 cm / px were obtained from calibration tests using reference fruits with known physical dimensions.
The obtained width and height values from this step were used as input features for predicting the fruit depth using the Linear Regression model. The predicted depth, together with width and height, was then employed as input data for the subsequent size classification and weight prediction processes. Specifically, three approaches were compared: (1) ANN and (2) ANN + Optuna were used to directly predict the mango size categories 1L, 2L, 3L, while (3) GPR was used to predict the fruit weight, which was then mapped to the size classes according to the Thai Agricultural Standard.

2.4. Linear Regression

Since the use of a two-dimensional camera cannot directly measure the depth ( D c m ) of the mango, linear regression (LR) was employed to construct a predictive model [31]. The general form of the regression equation can be written as:
y = β 0 + β 1 x 1 + β 2 x 2 + + β n x n
where:
yis the dependent variable or predicted value
x n is independent variables where n { 1 , 2 , , n }
β 0 is intercept
β i is regression coefficients of each independent variable
In this study, the width ( W c m ) and height ( H c m ) were used as independent variables, while the depth ( D c m ) was the dependent variable. The regression model is expressed as:
D c m = f ( W c m , H c m )
where f ( W c m , H c m ) denotes the regression function learned from empirical data collected from 84 mango samples. The advantage of LR is that it provides straightforward interpretation and efficient computation. However, LR has limitations in capturing nonlinear relationships effectively. To overcome these limitations and improve prediction accuracy, a Co-Kriging enhanced model was subsequently introduced, combining the strengths of linear regression and spatial correlation modeling.

2.5. Artificial Neural Network

Artificial Neural Networks (ANNs) are mathematical models inspired by the information processing mechanism of the human brain. The basic architecture consists of an input layer, one or more hidden layers, and an output layer. Each node (neuron) computes a weighted linear summation of its inputs and then passes the result through an activation function to generate the output. The general formulation of a neuron in layer l can be expressed as:
z j ( l ) = i = 1 n w i j ( l ) a i ( l 1 ) + b j ( l )
a j ( l ) = ϕ z j ( l )
where W i j ( l ) denotes the weights, b j ( l ) the bias term, a i ( l 1 ) the output from the previous layer, and ϕ the activation function. For classification problems, such as mango size categorization, the Softmax function is applied at the output layer to transform the outputs into class probabilities, as shown below:
y ^ k = e z k j = 1 K e z j
where y ^ k represents the probability of the input belonging to class k, and K is the total number of classes (here, K = 3 is L, 2L, and 3L). The ANN model was trained using backpropagation and gradient descent to minimize the loss function. In this study, the Categorical Cross-Entropy loss was employed, as defined in:
L = i = 1 N k = 1 K y i k log y ^ i k
the input features consisted of the actual mango dimensions—width ( W c m ) , height ( H c m ) , and depth ( D c m ) measured from 84 mango samples. The output labels corresponded to the fruit size groups (L, 2L, 3L). To further enhance model performance, Optuna, an automated hyperparameter optimization framework based on Bayesian search and the Tree-structured Parzen Estimator (TPE) [32], was applied. The optimization problem was formulated as:
θ * = arg max θ Θ A ( θ )
where θ represents the set of hyperparameters (e.g., number of hidden layers, neurons per layer, dropout rate, learning rate, and number of epochs), and A ( θ ) is the objective function, here defined as the validation accuracy. Through multiple trials, Optuna identified the optimal hyperparameters, achieving the highest classification accuracy of 92.31% with hidden layers = [173, 95], dropout = 0.104, learning rate = 0.161, and epochs = 250. The optimized configuration was then retrained on the combined training and validation set and subsequently evaluated on the test set to assess the model’s generalization capability for mango size classification.

2.6. Gaussian Process Regression and Co-Kriging

Gaussian Process Regression (GPR) is a non-parametric Bayesian learning model that employs a Gaussian process (GP) to represent an unknown function f ( x ) . The fundamental assumption is that the function values follow a multivariate Gaussian distribution over all data points [33]. A Gaussian process is generally defined as:
f ( x ) 𝒢 𝒫 ( m ( x ) , k ( x , x ) )
where m ( x ) denotes the mean function and k ( x , x ) the covariance (kernel) function, with common choices including the Radial Basis Function (RBF) and the Matern kernel [34]. The predictive mean and variance of GPR are given by:
μ ( x * ) = k ( x , X ) [ K ( X , X ) + σ n 2 I ] 1 y
σ 2 ( x ) = k ( x , x ) k ( x , X ) [ K ( X , X ) + σ n 2 I ] 1 k ( X , x * )
where μ ( x * ) is the predictive mean and σ 2 ( x * ) is the predictive variance. This dual capability of providing both predictions and uncertainty has led to GPR being widely applied in fields such as time-series analysis [33], financial forecasting [34], and indoor positioning [35]. In this study, GPR was applied to high-fidelity (HF) data collected from 84 mango samples, using width ( W ) , height ( H ) , and depth ( D ) as independent variables to predict mango weight. However, since HF data are limited, the model was extended with Co-Kriging, which incorporates multi-fidelity data to improve prediction accuracy [36]. The two fidelity levels considered are:
  • Low-Fidelity (LF): Approximate data, including width and height extracted from 290 mango images, and depth estimated via Linear Regression.
  • High-Fidelity (HF): Ground-truth physical measurements from 84 mangoes.
The Co-Kriging model, as proposed by Kennedy and O’Hagan (2000) [37], is defined as:
f H ( x ) = ρ f L ( x ) + δ ( x )
where f H ( x ) represents the high-fidelity function, f L ( x ) is the low-fidelity function, ρ is a scaling parameter that captures the linear correlation between the two fidelity levels, δ ( x ) is a Gaussian Process that models the discrepancy between the scaled low-fidelity function and the high-fidelity function. By leveraging Co-Kriging, the model benefits from the abundance of low-fidelity LF data and the reliability of HF measurements, leading to more accurate HF predictions. In this study, GPR was first employed for mango weight prediction using HF data, while Co-Kriging combined with Linear Regression was introduced to estimate mango depth from LF image-based measurements in the initial stage. This strategy improves prediction accuracy, particularly for estimating mango depth, which cannot be directly captured from 2D imaging. Similar to applications in adaptive surface measurement [38], this approach balances efficiency (large LF dataset) and accuracy (smaller HF dataset), making it highly suitable for agricultural produce quality assessment.

2.7. Evaluation Metrics

To evaluate the predictive performance of the proposed models, three widely used error metrics were employed: Mean Absolute Percentage Error (MAPE), Mean Absolute Error (MAE), and Root Mean Squared Error (RMSE). These metrics are extensively applied in machine learning and modeling studies as they effectively quantify the discrepancy between predicted and observed values.
Mean Absolute Percentage Error measures the average error in percentage terms, which allows comparison across datasets with different units of measurement.
M A P E = 1 N i = 1 N y i y ^ i y i × 100 %
Mean Absolute Error represents the average of the absolute errors, expressed in the same unit as the target variable, making it intuitive and straightforward to interpret.
M A E = 1 N i = 1 N y i y ^ i
Root Mean Squared Error represents the square root of the mean squared error and gives higher weight to larger errors (outliers) compared to MAE, making it more sensitive to severe deviations.
R M S E = 1 N i = 1 N ( y i y ^ i ) 2
where y i = true value, y ^ i = predicted value and N= number of samples.

3. Experimental Setup and Data Acquisition

In this experiment, a total of 84 Nam Dok Mai Si Thong mangoes were selected from 3 sources: the Maejo University farm in northern Thailand, which operates under Good Agricultural Practices (GAP), the community market of Suranaree University of Technology, and the central wholesale market in Nakhon Ratchasima Province, representing cultivation in the northeastern region of Thailand. All samples were carefully transported under controlled conditions to minimize postharvest deterioration. Physical measurements, including width, height, depth, and weight, were recorded for each mango using digital calipers and a precision balance, as shown in Table 2. These measurements served as ground-truth data for calibrating and validating the computer vision and artificial intelligence models, as illustrated in Figure 4.
Although the sample size, which is n = 84, may appear limited, the Nam Dok Mai Si Thong mangoes used in this study were export-grade fruits that underwent a rigorous quality selection process. Fruits showing deformities, mutations, or irregular shapes were excluded to ensure consistency and representativeness. Moreover, Nam Dok Mai Si Thong is a clonally propagated cultivar, which naturally provides high genetic and morphological uniformity. Consequently, the collected dataset can be regarded as a statistically representative sample of export-grade mangoes.
To quantitatively confirm the homogeneity of the dataset, statistical parameters including the mean ( μ ), standard deviation ( S T D ), variance ( σ 2 ) and coefficient of variation ( C V ) were computed for the three primary geometric attributes width, height, and depth, across all size groups 1L, 2L, and 3L, as shown in Table 3.
Based on the statistical analysis, the mean values of Width, Height, and Depth increased consistently with fruit size, which logically corresponds to the physical size classification and confirms the correctness of the size grouping. The S T D values of all parameters were below 0.7 cm, and the variances were below 0.5 cm2, indicating low dispersion and high morphological uniformity within each size group. Furthermore, the CV of all dimensions was less than 5%, demonstrating that the 84 mango samples exhibit high statistical homogeneity. According to CV in the range of 10–15% is generally acceptable in crop performance trials, whereas values lower than 10% are considered indicative of superior data quality [39]. Similarly, the Michigan State University Extension [40] suggests that, in field-based research, a CV below 5% denotes very good consistency. These results justify that, despite the limited sample size, the dataset is sufficiently representative for the proof-of-concept study and accurately reflects the dimensional characteristics of export-grade Nam Dok Mai Si Thong mangoes.
The experimental setup employed a Logitech BRIO 4K Ultra HD camera for image acquisition and a UT383 mini light meter for illumination monitoring. Light intensity ranged from 330 to 1020 lux and was adjusted using a dimmable LED light, as shown in Figure 5. The camera was positioned at a distance of 55.5 cm from the conveyor surface, corresponding to the level of the scan horn of the irradiation machine. Images were captured at a resolution of 640 × 480 pixels. The system was designed to integrate image-based feature extraction (width and height) with predictive modeling for depth and weight estimation, forming the basis for mango size classification into export categories 1L, 2L and 3L. A total of 435 images were collected from 84 mango samples, consisting of size categories 1L, 2L, and 3L. Each fruit was photographed from both the front and back sides by flipping the mango over, and additional variations were obtained by repositioning each fruit within the image frame (center, left, right, top, and bottom) while ensuring that the entire mango remained fully visible within the frame. The number of images for each size category was kept approximately equal to maintain dataset balance. Among all images, 100 were used for training the computer vision model, 290 were used for generating the LF data, and 45 images of unseen data were divided into three sets of 15 images each. Each set of 15 unseen images contained five samples per size category 1L, 2L, and 3L to ensure uniform representation during testing and model validation.
The use of mangoes from multiple sources represents a significant advantage of this study, as it encompasses not only experimental plots but also real production and trade supply chains. However, in practice, it is difficult to control the quality of mangoes from each source due to factors such as harvest maturity and transportation duration. As mangoes advance in age, their ripening stage increases, leading to physical and chemical changes, including softening of the flesh, variations in sugar and acid content, changes in color, and alterations in size [41]. Although such diversity introduces additional complexity, it ultimately enhances the robustness of the computer vision and artificial intelligence models, enabling their practical application under diverse real-world conditions. Consequently, the developed results and models demonstrate strong practical utility and hold significant potential for deployment in industrial applications.

4. Results and Discussion

This section presents the results of dimensional analysis of Nam Dok Mai mangoes, including the estimation of width, height, and depth from image-based computer vision techniques. In addition, the outcomes of size classification and weight prediction using ANN and GPR models are discussed to evaluate the accuracy and effectiveness of the proposed approach.

4.1. Measurement of Nam Dok Mai Si Thong Mango Dimensions

In estimating the width and height of mangoes from top-view images using Computer Vision and Image Processing techniques, 100 images were used for training, with controlled variations in illumination levels within the dataset as shown in Figure 6. The model was then tested with three sets of unseen data.
The optimal threshold values were found to be Tlow = 144 and Thigh = 255, which provided the most accurate results for estimating mango width and height under illumination conditions of 330–1020 lux. The results are summarized in Table 4 as follows:
The average MAPE was 2–3%, while MAE ranged from 0.19–0.32 cm, and RMSE ranged from 0.23–0.43 cm. This level of accuracy confirms that the dimensional estimates are reliable inputs for the subsequent weight prediction and size classification stages. For estimating the mango depth, the relationship between width and height was employed. Ground-truth data from 84 Nam Dok Mai Si Thong mangoes were used to train an LR model, resulting in the regression equation presented as Equation (27).
D e p t h = 1.0428 + ( 0.7514 × W i d t h ) ( 0.00593 × H e i g h t )
The method was further improved by combining Linear Regression with Co-Kriging (LR + CoK), which is particularly suitable in cases where high-fidelity (HF) data are limited. In this approach, low-fidelity (LF) data were generated from 290 images, and LR was applied to establish the regression relationship, as shown in Equation (28). These LF data were then combined with HF data to train a multi-fidelity Co-Kriging model.
D e p t h = 0.9442 + ( 0.7558 × W i d t h ) ( 0.0018 × H e i g h t )
The learning results showed that the LR + CoK method yielded the lowest average errors, with MAPE = 1.20%, MAE = 0.082 cm, and RMSE = 0.099 cm. The test graphs demonstrated that LF data could be effectively transferred to HF data, while the Gaussian process of the discrepancy term δ ( x ) generated a continuous predictive surface that captured the true trends accurately. The 1D slice plots further confirmed correct multi-fidelity behavior, as shown in Figure 7. Specifically, when HF data were dense, the Co-Kriging model corrected the discrepancies that LR alone could not capture, whereas in sparse HF regions, the model reverted to relying on LF estimates. This ensured safer and more stable predictions. The results of mango depth estimation using the Linear Regression (LR) method and the combined Linear Regression with Co-Kriging (LR + CoK) method are presented in the Table 5.
From the test results using three sets of unseen data, where the width and height obtained from the computer vision processing stage were used to estimate the height, it was found that both LR alone and LR + CoK achieved MAPE in the range of 2–4%, MAE between 0.10–0.33 cm, and RMSE between 0.13–0.38 cm. These values are considered acceptable for the evaluation of agricultural yields. However, in the case of Unseen Data Set 2, the LR + CoK method produced better results, demonstrating the effectiveness of CoK when the LF dataset exhibited shape, illumination, and placement characteristics close to the HF domain. According to Equation (23), the GPR of the discrepancy term δ ( x ) can accurately learn the deviation patterns between LF and HF. For Unseen Data Sets 1 and 3, some images contained specular highlights or edge fragments from the computer vision stage, causing errors in the extracted width and height values. When these were used in CoK, which relies on the parameters ρ and δ ( x ) estimated from a limited HF dataset, this led to overcorrection or extrapolation beyond the HF domain. As a result, RMSE increased, while MAPE and MAE significantly deteriorated. However, despite these limitations, the overall estimate of mango dimensions (width, height and depth) remained highly accurate and within acceptable limits, serving as reliable input for the subsequent steps of size classification using ANN and weight prediction using GPR.

4.2. Size-Based Sorting of Nam Dok Mai Si Thong Mangoes

In classifying the size of mangoes, this study employed both ANN and GPR for prediction. The ANN directly outputs the “size” of the mango, whereas GPR predicts the “weight” of the mango, which is then mapped to a size category based on the standard criteria. For ANN, since it is a highly flexible model (universal approximator), even with a shallow architecture, a small number of parameters, and proper feature scaling, it can still perform effectively on small datasets while reducing the risk of overfitting. In this work, ANN models were trained in two configurations: with default parameters and with hyperparameter tuning using Optuna (number of layers/neurons, dropout rate, learning rate, and number of epochs). The objective was to find a balance between flexible decision boundaries and robustness against unseen data. The training results are illustrated in Figure 8.
From the training process, the ANN model achieved an accuracy of 86.67%, while the Optuna-tuned ANN model achieved an improved accuracy of 93.33%. These models were then evaluated on three sets of unseen data, where each image was first processed to predict the width, height, and depth using the methods described above. The results of these evaluations are presented in Figure 9 and Figure 10.
Since size determination depends on numerical weight, and production lines require confidence in results near the boundary thresholds, GPR was employed to predict the weight. The advantage of GPR is that it provides both the predicted value and the predictive variance, which can be used to establish risk-based decision policies. The results obtained from training the GPR model are shown as follows:
From Figure 11, it can be observed that GPR exhibits very low uncertainty at each prediction point, indicating that the model achieves high accuracy. The model was then tested with unseen data, where GPR used W, H, and D as inputs to predict the weight, which was then mapped to a size category based on the Thai Agricultural Standard. The results are presented in Figure 12 and Table 6 as follows:
When the results of the size predictions from all three methods were summarized in terms of accuracy for clearer comparison, the outcomes are presented in Table 7 as follows:
The test results with the three unseen datasets showed that ANN (Default) exhibited high stability and achieved an immediate accuracy improvement when using the depth estimated from CoK, reaching 93.33% in two sets. This indicates that the quality of the depth variable plays a critical role in class separation, sharpening the width, height, and depth decision boundary and reducing misclassification between adjacent classes. The ANN+Optuna model performed better in certain cases, particularly in test Set 3. However, due to the limited number of real samples, it may have exhibited domain-specific tuning effects, leading to fluctuations in accuracy across test sets. Most misclassifications occurred near the class boundaries (weight thresholds), which aligns with the physical reality that fruits often vary slightly in shape despite having similar weights.
In contrast, GPR was employed for weight prediction. Its advantage lies in providing both the predicted value and the predictive variance, enabling the implementation of risk-aware decision-making in production lines. Across all three test sets, the mean absolute error MAE of weight prediction was approximately 20 g. While this error level is not negligible, it is well within the tolerance for accurate size classification. This is because the weight range for each size category spans several tens of grams, a margin much wider than the prediction error. Notably, when depth estimated from LR + CoK was used, it reduced bias near the size boundaries, resulting in size classification accuracy as high as 93.33% across all test sets. Therefore, if a system with consistent accuracy and confidence estimation is required, the combination of GPR (weight to size) with depth from LR + CoK is recommended. On the other hand, if a lightweight and straightforward system is preferred, ANN (Default) with Depth from LR + CoK also provides high and stable performance. These findings highlight that the key factor lies in obtaining high-quality depth information from LR + CoK, which enhances the performance of both ANN and GPR simultaneously—yielding sharper decision boundaries for ANN and more accurate weight predictions for GPR.
The results demonstrate a progression of innovation, beginning with the accurate image-based measurement of mango width and height. The main challenge, estimating the third dimension (depth), was effectively addressed by the LR + CoK model, which consistently outperformed the standard LR model by leveraging a combination of limited high-fidelity and abundant low-fidelity data. This improved depth estimation was the critical factor that subsequently enhanced the performance of both the ANN for direct size classification and the GPR for weight-based grading. A key finding is the trade-off between different modeling approaches. While the Optuna-tuned ANN showed high accuracy, its performance fluctuated across test sets, suggesting potential overfitting to specific training domains. In contrast, the GPR model, when paired with the superior depth data from LR + CoK, provided a consistently high accuracy of 93.33 percent across all unseen datasets. The practical advantage of GPR lies not only in its accuracy but also in its ability to provide a predictive variance. This is highly valuable in an industrial setting, as it allows for risk-based decision-making. For instance, mangoes with weights predicted near a size-grade boundary and high variance could be flagged for manual inspection, thereby minimizing costly grading errors.
Most importantly, the dimensional accuracy achieved directly supports the primary goal of this research—optimizing the phytosanitary irradiation process. The proposed system does not perform the irradiation itself but serves as the “vision module” of the X-ray irradiation line, providing essential three-dimensional parameters W, H, D that enable the irradiation machine to dynamically adjust the radiation dose in real time according to Equations (1)–(4). This integration allows the system to modify the conveyor speed or beam power based on each fruit’s volume, preventing energy waste from over-irradiating smaller mangoes while ensuring sufficient exposure for larger ones. Experimental analysis showed that the mean absolute error (MAE) of weight prediction was approximately 20 g, which is well within the acceptable tolerance for precise dose control. Therefore, the proposed AI-based framework effectively supports real-time and energy-efficient phytosanitary treatment, reducing both energy consumption and operational costs. Consequently, the combination of GPR with depth estimation from LR + CoK emerges as the most robust and industrially viable solution—offering high predictive accuracy, reliable confidence metrics, and practical applicability for real-world deployment in agri-food supply chains.
Although the LR model provided acceptable performance for depth estimation, it assumes a strictly linear relationship between input and output variables. The actual relationships among the mango’s geometric dimensions W, H, D and its physical weight are nonlinear and heteroscedastic, primarily due to variations in fruit curvature and density distribution. Therefore, ANN and GPR models were employed to capture these nonlinear dependencies more effectively. The ANN provides high flexibility for learning complex patterns and serves as a robust classification model, whereas the GPR offers both accurate predictions and uncertainty quantification—essential for real-time dose control in X-ray irradiation processes. Because the dataset size is relatively small (n = 84), the additional computational cost of ANN and GPR remains minimal and does not hinder real-time implementation.

5. Conclusions

This study developed and validated a low-cost, non-invasive system for the real-time, three-dimensional estimation of ‘Nam Dok Mai Si Thong’ mangoes using a single 2D camera. The proposed single-camera setup demonstrates the system’s practical feasibility by eliminating the need for stereo vision or additional sensors, significantly reducing both implementation cost and energy consumption. The key innovation was the implementation of the LR + CoK technique, which effectively overcame the inherent limitations of 2D imaging to produce highly accurate depth estimations. The achieved dimensional accuracy, with an RMSE of 0.46 cm and high classification rate 93.33% provide the essential geometric parameters (W, H, D) required for real-time dose calculation in X-ray irradiation systems. This enhanced dimensional data served as a robust foundation for subsequent AI models, enabling a GPR-based weight prediction model to achieve reliable performance across unseen datasets. Although minor deviations were observed in certain test sets where the standalone LR model yielded slightly lower depth estimation errors, the combined GPR with LR + CoK framework remains the most robust and industrially viable solution overall. This hybrid approach not only demonstrates superior generalization capability and predictive accuracy but also provides uncertainty quantification through predictive variance, enabling confidence-based and energy-efficient dose control in real-time applications. Moreover, the overall performance stability and reliability of the LR + CoK approach confirm its suitability for consistent operation and practical implementation in industrial environments.
Future work will focus on expanding the model’s robustness by incorporating a more diverse dataset of mango cultivars and integrating the system with a physical conveyor for a tangible evaluation of energy savings and throughput enhancement in a pilot-scale production line.

Author Contributions

Conceptualization, J.S. and I.W.; methodology, J.S., S.K. and I.W.; software, S.P., S.R. and I.W.; validation, J.S., T.S.-o. and I.W.; formal analysis, J.S. and I.W.; investigation, T.S.-o. and I.W.; resources, J.S. and S.K.; data curation, S.R. and I.W.; writing—original draft preparation, T.S.-o. and I.W.; writing—review and editing, J.S., T.S.-o., S.K. and I.W.; visualization, T.S.-o. and I.W.; supervision, J.S., T.S.-o. and S.K.; project administration, J.S.; funding acquisition, J.S. and S.K. All authors have read and agreed to the published version of the manuscript.

Funding

Suranaree University of Technology Research and Development Fund, Grant No. IRD7-707-68-12-09.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Dataset available on request from the authors.

Acknowledgments

The authors gratefully acknowledge the generous support from Suranaree University of Technology (SUT) and the Synchrotron Light Research Institute (Public Organization). The authors would like to acknowledge the use of Gemini (version 1.0 Pro) for language refinement and grammar checking during the preparation of this manuscript.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ANNArtificial Neural Network
CNNConvolutional Neural Network
CoKCo-Kriging
GPRGaussian Process Regression
HFHigh Fidelity
LFLow Fidelity
LRLinear Regression

References

  1. Dissayasakda, N. Thai Mango Guide. 2023. Available online: https://www.tridge.com/market-guides/TH-mango?utm_source (accessed on 12 September 2025).
  2. Chomchalow, N.; Na Songkhla, P. Thai Mango Export: A Slow-but-Sustainable Development. AU J. Technol. 2008, 12, 1–8. [Google Scholar]
  3. Kitagawa, H. The Potential of Thai Fruits and Vegetables in the Japanese Market. Kasetsart J. Soc. Sci. 1991, 12, 59–67. [Google Scholar]
  4. Tangpao, T.; Phuangsaujai, N.; Kittiwachana, S.; George, D.R.; Krutmuang, P.; Chuttong, B.; Sommano, S.R. Evaluation of Markers Associated with Physiological and Biochemical Traits during Storage of ‘Nam Dok Mai Si Thong’ Mango Fruits. Agriculture 2022, 12, 1407. [Google Scholar] [CrossRef]
  5. Ministry of Public Health. Notification of the Ministry of Public Health (No. 297) B.E. 2549 (2006): Re: Irradiated Food. R. Thai Gov. Gaz. 2006, 123, 23–26. [Google Scholar]
  6. CODEX STAN 106-1983; General Standard for Irradiated Foods. Codex Alimentarius Commission: Rome, Italy, 2003.
  7. U.S. Food and Drug Administration. CFR—Code of Federal Regulations Title 21, Part 179: Irradiation in the Production, Processing, and Handling of Food. Federal Register, Docket No. FDA-1999-F-2405 (Formerly 1999F-5522), 2014. Current Revision. Final Rule Published 25 February 2014. Available online: https://www.federalregister.gov/documents/2014/02/25/2014-03976/irradiation-in-the-production-processing-and-handling-of-food?utm_source (accessed on 12 September 2025).
  8. Chunjarean, S.; Manasatitpong, K.; Yachum, N.; Phacheerak, W.; Kokkrathoke, S.; Pongampai, S.; Kulthanasomboon, P.; Jummunt, S.; Klinkhieo, S. Development of a 6 MeV electron beam energy Linac for fruit sterilization. J. Phys. Conf. Ser. 2023, 2431, 012071. [Google Scholar] [CrossRef]
  9. Kokkrathoke, S.; Yachum, N.; Chunjarean, S.; Manasatitpong, K. Synchronisation of linear accelerator for fruit irradiation with FPGA-based system. J. Phys. Conf. Ser. 2023, 2653, 012028. [Google Scholar] [CrossRef]
  10. Alanazi, S.F. Evaluating the effect of X ray irradiation in the control of food bacterial pathogens. J. King Saud Univ.-Sci. 2023, 35, 102367. [Google Scholar] [CrossRef]
  11. Yoon, Y.S.; Ameer, K.; Song, B.S.; Kim, J.K.; Park, H.Y.; Lee, K.C.; Eun, J.B.; Park, J.H. Effects of X-ray irradiation on the postharvest quality characteristics of ‘Maehyang’ strawberry (Fragaria × ananassa). Food Chem. 2020, 325, 126817. [Google Scholar] [CrossRef] [PubMed]
  12. Vibhute, K. Artificial Intelligence Based Grading System for Mango Fruit—A Review. Int. J. Agric. Environ. Biotechnol. 2022, 15, 641–645. [Google Scholar] [CrossRef]
  13. Hayat, A.; Morgado-Dias, F.; Choudhury, T.; Singh, T.P.; Kotecha, K. FruitVision: A deep learning based automatic fruit grading system. Open Agric. 2024, 9, 20220276. [Google Scholar] [CrossRef]
  14. Wanthong, I.; Sri-On, T.; Seangsri, S.; Khaengkarn, S.; Srisertpol, J. Exploring Classification, Size, and Quality of Mangifera Indica L. Through Image Processing and AI Techniques. Stud. Appl. Electromagn. Mech. 2024, 47, 192–198. [Google Scholar] [CrossRef]
  15. 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]
  16. Utai, K.; Nagle, M.; Hämmerle, S.; Spreer, W.; Mahayothee, B.; Müller, J. Mass estimation of mango fruits (Mangifera indica L., cv. ‘Nam Dokmai’) by linking image processing and artificial neural network. Eng. Agric. Environ. Food 2019, 12, 103–110. [Google Scholar] [CrossRef]
  17. Huynh, T.; Tran, L.; Dao, S. Real-Time Size and Mass Estimation of Slender Axi-Symmetric Fruit/Vegetable Using a Single Top View Image. Sensors 2020, 20, 5406. [Google Scholar] [CrossRef]
  18. Neupane, C.; Koirala, A.; Wang, Z.; Walsh, K.B. Evaluation of Depth Cameras for Use in Fruit Localization and Sizing: Finding a Successor to Kinect v2. Agronomy 2021, 11, 1780. [Google Scholar] [CrossRef]
  19. TAS 5-2015; Thai Agricultural Standard: Mango. National Bureau of Agricultural Commodity and Food Standards (NB ACFS), Ministry of Agriculture and Cooperatives (Thailand): Bangkok, Thailand, 2015; Royal Thai Government Gazette, Volume 132, Section 179. 2015.
  20. Penchaiya, P.; Tijskens, P. Assessing the peel colour behaviour of mango ‘Nam Dok Mai See Thong’ during cool storage. Acta Hortic. 2017, 1154, 207–212. [Google Scholar] [CrossRef]
  21. Jitvisate, M.; Apiwattanakul, P.; Kangrang, N.; Saisut, J.; Thongbai, C.; Rimjaem, S. Compact RF linear accelerator for electron beam irradiation applications at PBP-CMU Electron Linac Laboratory. Nucl. Sci. Tech. 2025, 36, 60. [Google Scholar] [CrossRef]
  22. Princess Maha Chakri Sirindhorn the Information Technology Foundation, Under the Initiative of Her Royal Highness. Newsletter, Volume 1. 2023. Available online: https://www.princess-it.org/wp-content/uploads/2024/04/20230331_PSIT_NewsLetter2023_Q1-CT-M-2-Final.pdf (accessed on 12 September 2025).
  23. Princess Maha Chakri Sirindhorn the Information Technology Foundation, Under the Initiative of Her Royal Highness. Application of Linear Accelerator Technology in Research and Industry. Article by Dr. Suphat Klin-kiow, Synchrotron Light Research Institute (Public Organization). Available online: https://www.princess-it.org/project-cern/activity-cern/activity-cern-research/act-2565-02-2/ (accessed on 12 September 2025).
  24. Sultana, T.; Maraz, K.M.; Ahmed, A.; Shultana, S.; Khan, R. Effect of Irradiation process on mango. GSC Adv. Res. Rev. 2021, 9, 108–118. [Google Scholar] [CrossRef]
  25. Kim, J.; Moreira, R.G.; Castell-Perez, M.E. Improving phytosanitary irradiation treatment of mangoes using Monte Carlo simulation. J. Food Eng. 2015, 149, 137–143. [Google Scholar] [CrossRef]
  26. International Telecommunication Union. Recommendation ITU-R BT.601-7: Studio Encoding Parameters of Digital Television for Standard 4:3 and Wide-Screen 16:9 Aspect Ratios; Section 2.5.1; ITU: Geneva, Switzerland, 2011; p. 2. [Google Scholar]
  27. Gonzalez, R.C.; Woods, R.E. Digital Image Processing, 4th ed.; Pearson: London, UK, 2018. [Google Scholar]
  28. Pratt, W.K. Digital Image Processing: PIKS Scientific Inside, 4th ed.; Wiley-Interscience: Hoboken, NJ, USA, 2007. [Google Scholar]
  29. Thong, N.D.; Thinh, N.T.; Cong, H.T. Mango Classification System Uses Image Processing Technology and Artificial Intelligence. In Proceedings of the 2019 International Conference on System Science and Engineering (ICSSE), Dong Hoi, Vietnam, 20–21 July 2019; pp. 45–52. [Google Scholar] [CrossRef]
  30. Tai, N.D.; Lin, W.C.; Trieu, N.M.; Thinh, N.T. Development of a Mango-Grading and -Sorting System Based on External Features, Using Machine Learning Algorithms. Agronomy 2024, 14, 831. [Google Scholar] [CrossRef]
  31. Montgomery, D.C.; Peck, E.A.; Vining, G.G. Introduction to Linear Regression Analysis, 5th ed.; Wiley: Hoboken, NJ, USA, 2012. [Google Scholar]
  32. Akiba, T.; Sano, S.; Yanase, T.; Ohta, T.; Koyama, M. Optuna: A Next-generation Hyperparameter Optimization Framework. In Proceedings of the KDD’19: 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, Anchorage, AK, USA, 4–8 August 2019; pp. 2623–2631. [Google Scholar] [CrossRef]
  33. De Caro, D.; Ippolito, M.; Cannarozzo, M.; Provenzano, G.; Ciraolo, G. Assessing the performance of the Gaussian Process Regression algorithm to fill gaps in the time-series of daily actual evapotranspiration of different crops in temperate and continental zones using ground and remotely sensed data. Agric. Water Manag. 2023, 290, 108596. [Google Scholar] [CrossRef]
  34. Suphawan, K.; Kardkasem, R.; Chaisee, K. A Gaussian Process Regression Model for Forecasting Stock Exchange of Thailand. Trends Sci. 2022, 19, 3045. [Google Scholar] [CrossRef]
  35. Wu, J.; Xu, R.; Huang, R.; Hong, X. Data-Efficient Training of Gaussian Process Regression Models for Indoor Visible Light Positioning. Sensors 2024, 24, 8027. [Google Scholar] [CrossRef]
  36. Song, Z.; Liu, Z.; Zhang, H.; Zhu, P. An improved sufficient dimension reduction-based Kriging modeling method for high-dimensional evaluation-expensive problems. Comput. Methods Appl. Mech. Eng. 2024, 418, 116544. [Google Scholar] [CrossRef]
  37. Kennedy, M.C.; O’Hagan, A. Predicting the Output from a Complex Computer Code When Fast Approximations Are Available. Biometrika 2000, 87, 1–13. [Google Scholar] [CrossRef]
  38. Zhang, B.; Feng, P.; Sun, Z.; Cheng, X.; Zeng, L.; Fan, C. Efficient sampling method based on co-kriging for free-form surface measurement. Precis. Eng. 2023, 84, 136–147. [Google Scholar] [CrossRef]
  39. Bowman, D.T. Common Use of the CV: A Statistical Aberration in Crop Performance Trials. J. Cotton Sci. 2001, 5, 137–141. [Google Scholar]
  40. Battel, B. A Primer on Reading Field Research Results, Unpublished Manuscript. 2018.
  41. Chen, X.; Xue, J.; Chen, X.; Zhao, X.; Ali, S.; Huang, G. Gaussian process regression for prediction and confidence analysis of fruit traits by near-infrared spectroscopy. Food Qual. Saf. 2022, 7, fyac068. [Google Scholar] [CrossRef]
Figure 1. Export-grade Nam Dok Mai Si Thong mangoes purchased from Maejo University Farm (photographed by the authors).
Figure 1. Export-grade Nam Dok Mai Si Thong mangoes purchased from Maejo University Farm (photographed by the authors).
Agriengineering 07 00377 g001
Figure 2. Postharvest management system of Nam Dok Mai mangoes: current practices, identified problems, and AI-Based improvements.
Figure 2. Postharvest management system of Nam Dok Mai mangoes: current practices, identified problems, and AI-Based improvements.
Agriengineering 07 00377 g002
Figure 3. Schematics and installation of the 6 MeV linear accelerator (Linac) system for X-ray irradiation at the Synchrotron Light Research Institute (Thailand): (a) Three-dimensional schematic of the Linac developed for fruit sterilization [23]. (b) Installation of the 6 MeV Linac system adapted from Chunjarean et al., 2023 [8].
Figure 3. Schematics and installation of the 6 MeV linear accelerator (Linac) system for X-ray irradiation at the Synchrotron Light Research Institute (Thailand): (a) Three-dimensional schematic of the Linac developed for fruit sterilization [23]. (b) Installation of the 6 MeV Linac system adapted from Chunjarean et al., 2023 [8].
Agriengineering 07 00377 g003
Figure 4. Measurement of mango physical attributes: width, height, depth, and weight.
Figure 4. Measurement of mango physical attributes: width, height, depth, and weight.
Agriengineering 07 00377 g004
Figure 5. Experimental setup for mango image acquisition.
Figure 5. Experimental setup for mango image acquisition.
Agriengineering 07 00377 g005
Figure 6. Examples of edge detection and dimension estimation (width and height) of Nam Dok Mai Si Thong mangoes from top-view images using computer vision techniques under different illumination conditions.
Figure 6. Examples of edge detection and dimension estimation (width and height) of Nam Dok Mai Si Thong mangoes from top-view images using computer vision techniques under different illumination conditions.
Agriengineering 07 00377 g006
Figure 7. Depth estimation results using LR + CoK (a) 1D slice analysis with LF and HF data. (b) Comparison of true versus predicted depth values.
Figure 7. Depth estimation results using LR + CoK (a) 1D slice analysis with LF and HF data. (b) Comparison of true versus predicted depth values.
Agriengineering 07 00377 g007
Figure 8. Training results of ANN for mango size classification: (a) ANN with default parameters. (b) ANN with optimized hyperparameters tuned by Optuna.
Figure 8. Training results of ANN for mango size classification: (a) ANN with default parameters. (b) ANN with optimized hyperparameters tuned by Optuna.
Agriengineering 07 00377 g008
Figure 9. Test results of mango size classification using ANN with default parameters: (a) Using depth estimated from LR. (b) Using depth estimated from LR + Co-Kriging.
Figure 9. Test results of mango size classification using ANN with default parameters: (a) Using depth estimated from LR. (b) Using depth estimated from LR + Co-Kriging.
Agriengineering 07 00377 g009
Figure 10. Test results of mango size classification using ANN with Optuna parameters: (a) Using depth estimated from LR. (b) Using depth estimated from LR + CoK.
Figure 10. Test results of mango size classification using ANN with Optuna parameters: (a) Using depth estimated from LR. (b) Using depth estimated from LR + CoK.
Agriengineering 07 00377 g010
Figure 11. Training results of Gaussian Process Regression (GPR) for mango weight prediction.
Figure 11. Training results of Gaussian Process Regression (GPR) for mango weight prediction.
Agriengineering 07 00377 g011
Figure 12. Test results of mango weight prediction using GPR with depth estimated from LR and LR + Co-Kriging on unseen test datasets.
Figure 12. Test results of mango weight prediction using GPR with depth estimated from LR and LR + Co-Kriging on unseen test datasets.
Agriengineering 07 00377 g012
Table 1. Size grading of mangoes by fruit weight with Thai Agricultural Standard.
Table 1. Size grading of mangoes by fruit weight with Thai Agricultural Standard.
Size of MangoWeight (g)
2S225–249
S250–279
M280–329
L330–379
2L380–449
3LMore than 450
Table 2. Number of fruits and dimensional ranges of 84 Nam Dok Mai Si Thong mangoes by size category.
Table 2. Number of fruits and dimensional ranges of 84 Nam Dok Mai Si Thong mangoes by size category.
SizeNumber of
Mango Fruits
Range (Min–Max)
Width (cm)Height (cm)Depth (cm)Weight (g)
1L317.08–7.9013.50–15.636.15–7.06330–379
2L297.39–8.4514.64–17.206.30–7.26380–445
3L247.87–9.3415.26–17.906.85–8.34452–650
Table 3. Statistical characteristics of mango dimensions.
Table 3. Statistical characteristics of mango dimensions.
ParametersSizeWidthHeightDepth
Mean (cm)1L7.45914.7606.519
2L7.90015.9846.808
3L8.35216.5287.366
STD (cm)1L0.2250.6190.212
2L0.2830.6590.233
3L0.3460.6590.334
Variance (cm2)1L0.0500.3400.043
2L0.0800.4210.053
3L0.1110.3520.108
CV (%)1L3.0114.1923.249
2L3.5864.1233.419
3L4.1403.9874.534
Table 4. Results of mango width and height measurement using computer vision.
Table 4. Results of mango width and height measurement using computer vision.
Evaluation
Metrics
Width (cm)Height (cm)
TrainTestTrainTest
Set 1Set 2Set 3Set 1Set 2Set 3
MAPE (%)2.6222.3282.4392.5431.7972.0581.2711.604
RSME (cm)0.2470.2340.2340.2660.3670.3710.3240.427
MAE (cm)0.2060.1860.1930.1980.2800.3190.2050.255
Table 5. Evaluation results of mango depth estimation using LR and LR + CoK.
Table 5. Evaluation results of mango depth estimation using LR and LR + CoK.
Evaluation
Metrics
Test ( LR ) Test ( LR + CoK )
Set 1Set 2Set 3Set 1Set 2Set 3
MAPE (%)2.3843.5521.5282.5302.8504.760
RSME (cm)0.2060.2890.1320.2230.2260.385
MAE (cm)0.1630.2410.1060.1730.1940.329
Table 6. Evaluation results of mango size (Weight) classification using GPR with depth estimated from LR and LR + CoK.
Table 6. Evaluation results of mango size (Weight) classification using GPR with depth estimated from LR and LR + CoK.
Evaluation
Metrics
TrainTest ( D LR )Test ( D LR + CoK )
Set 1 Set 2 Set 3 Set 1 Set 2 Set 3
MAPE (%)1.8644.0105.2504.7503.9904.4004.690
RSME (g)7.67121.91429.66229.48422.25225.05528.680
MAE (g)10.35017.62423.16021.59917.48819.64321.270
Table 7. Model performance comparison in terms of accuracy for mango size classification across different depth estimation methods.
Table 7. Model performance comparison in terms of accuracy for mango size classification across different depth estimation methods.
TestANNANN + OptunaGPR
D LR D LR + CoK D LR D LR + CoK D LR D LR + CoK
Set 186.6793.3380.0080.0073.0093.33
Set 280.0086.6786.6780.0086.6793.33
Set 386.6793.3386.6793.3386.6793.33
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.

Share and Cite

MDPI and ACS Style

Wanthong, I.; Sri-on, T.; Rodporn, S.; Pawako, S.; Khaengkarn, S.; Srisertpol, J. A Computer Vision and AI-Based System for Real-Time Sizing and Grading of Thai Export Fruits. AgriEngineering 2025, 7, 377. https://doi.org/10.3390/agriengineering7110377

AMA Style

Wanthong I, Sri-on T, Rodporn S, Pawako S, Khaengkarn S, Srisertpol J. A Computer Vision and AI-Based System for Real-Time Sizing and Grading of Thai Export Fruits. AgriEngineering. 2025; 7(11):377. https://doi.org/10.3390/agriengineering7110377

Chicago/Turabian Style

Wanthong, Irin, Theeraphat Sri-on, Somboonsup Rodporn, Siripong Pawako, Sorada Khaengkarn, and Jiraphon Srisertpol. 2025. "A Computer Vision and AI-Based System for Real-Time Sizing and Grading of Thai Export Fruits" AgriEngineering 7, no. 11: 377. https://doi.org/10.3390/agriengineering7110377

APA Style

Wanthong, I., Sri-on, T., Rodporn, S., Pawako, S., Khaengkarn, S., & Srisertpol, J. (2025). A Computer Vision and AI-Based System for Real-Time Sizing and Grading of Thai Export Fruits. AgriEngineering, 7(11), 377. https://doi.org/10.3390/agriengineering7110377

Article Metrics

Back to TopTop