Fruit quality comprehensive detection method based on machine vision and X rays
By combining machine vision and X-ray methods, a multi-level feature matrix and multi-criteria decision fusion model were constructed, which solved the problem of incomplete fruit quality detection in existing technologies. This enabled efficient detection of fruit appearance, internal defects, and sugar content, improving the accuracy and comprehensiveness of the detection.
Patent Information
- Application Number
- CN202511316399.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-16
- Publication Date
- 2025-12-30
AI Technical Summary
Existing fruit quality testing methods mainly focus on detecting appearance and internal defects, failing to fully reflect the overall quality of fruit, especially sugar content. Furthermore, manual testing is inefficient and inaccurate.
A comprehensive detection method based on machine vision and X-rays is adopted. By constructing a multi-level feature matrix and a multi-criteria decision fusion model, combined with BPNN, SVM and DenseNet-121 models, the detection of fruit shape, color, surface defects and internal defects is realized. A sugar content prediction model is also constructed to extract the features of the pulp area for sugar content prediction.
It enables comprehensive testing of the appearance and internal quality of fruits, improving the accuracy and efficiency of testing and providing a more complete reflection of the overall quality of fruits.
Smart Images

Figure CN121236748A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of comprehensive detection technology for fruit appearance and internal defects, specifically a comprehensive fruit quality detection method based on machine vision and X-rays. Background Technology
[0002] Comprehensive quality testing and grading of fruits are crucial for improving their market competitiveness and profitability; therefore, quality testing is essential. Currently, pear quality is primarily assessed manually, a method that consumes significant human resources, results in highly subjective grading, and suffers from low accuracy and efficiency. Furthermore, manual inspection is incapable of detecting internal defects. Machine vision inspection, with its advantages of being non-contact, non-destructive, highly automated, and safe, has been successfully applied to the appearance inspection of fruits such as apples, and non-destructive testing has also been successfully applied to the detection of internal defects in fruits such as citrus. Existing fruit quality testing mainly includes appearance and internal defect detection, while sugar content also reflects fruit quality, and X-rays provide technical support for sugar content detection.
[0003] The invention patent with application number 202210098250.8 discloses a method and device for comprehensive grading of fruit quality based on machine vision and X-rays. It achieves appearance defect detection by acquiring an image of the fruit's appearance, extracting the area of appearance defects, and calculating the feature values of three features: fruit surface defects, fruit size, and color. It achieves internal defect detection by acquiring X-ray images and extracting HOG and LBP features. However, this method only detects the appearance and internal defects of the fruit, extracts fewer features, does not consider sugar content, and cannot comprehensively reflect the overall quality of the fruit. Summary of the Invention
[0004] In view of the shortcomings of the existing technology, the technical problem to be solved by the present invention is to propose a comprehensive fruit quality detection method based on machine vision and X-ray.
[0005] The present invention solves the aforementioned technical problem by adopting the following technical solution:
[0006] A comprehensive fruit quality detection method based on machine vision and X-rays, characterized by the following steps:
[0007] The first step is to construct a dataset of fruit appearance images, a dataset of fruit appearance defects images, and a dataset of X-ray images;
[0008] The second step is to construct the fruit surface defect feature matrix, fruit shape feature matrix, and color feature matrix. The fruit surface defect feature matrix consists of the total area of fruit surface defects, the second moment of the gray-level co-occurrence matrix, contrast, inverse difference matrix, and entropy. The fruit shape feature matrix includes two features: fruit shape symmetry and fruit shape rectangularity. The color feature matrix consists of the mean and variance of the R channel, the mean and variance of the G channel, and the ratio of the mean of the R channel to the mean of the G channel.
[0009] Fruit surface defect feature matrix is input into a BPNN network to achieve fruit surface defect detection; fruit shape feature matrix is input into another BPNN network to achieve fruit shape detection; color feature matrix is input into an SVM model to achieve color detection.
[0010] The third step is to establish multiple different internal defect detection models, and then fuse the results of each internal defect detection model based on multi-criteria decision-making to obtain the internal defect detection results.
[0011] Step 4: Segment the X-ray image and extract the region of interest from the segmented image to obtain the pulp region; first, calculate the centroid of the pulp region:
[0012]
[0013] In the formula, (x c ,y c ) indicates the centroid of the fruit pulp region, M flesh I represents the set of pixels in the pulp region; pre (x,y) represents the probability that pixel (x,y) is fruit pulp;
[0014] Then, taking the centroid of the pulp region as the origin, the segmented image is divided into concentric rings, and the average density of each ring is calculated.
[0015]
[0016] In the formula, D(r) represents the average density of the annulus, r represents the radius of the annulus, Δr represents the step size of the annulus radius, and N... r This indicates the number of pixels contained in the ring;
[0017] Finally, the density gradient of the rings is calculated, and the ring with the largest density gradient is regarded as the pulp region.
[0018] Morphological optimization of the fruit pulp region is performed to extract its morphological features. Gray-level statistical features of the fruit pulp region are also extracted, including the mean gray level, gray-level variance, gray-level distribution skewness, and gray-level entropy. The morphological and gray-level statistical features of the fruit pulp region are combined to form a multi-dimensional feature vector. This multi-dimensional feature vector is then input into a sugar content prediction model to predict the sugar content of the fruit. Based on the predicted sugar content, the fruit is graded according to its sugar content.
[0019] Furthermore, the internal defect detection model includes the HOG-SVM model, the LBP-SVM model, and the DenseNet-121 model; HOG and LBP features are extracted from the X-ray image, and the HOG and LBP features are respectively input into the SVM model to predict internal defects, thus obtaining the HOG-SVM model and the LBP-SVM model; the DenseNet-121 model inputs the X-ray image into the DenseNet-121 model to predict internal defects.
[0020] Furthermore, the sugar content prediction model is based on the DenseNet-121 model, but the fully connected layers of the DenseNet-121 model are replaced with the SVR model.
[0021] Furthermore, the fruit appearance image dataset includes several preprocessed fruit appearance images, the fruit appearance defect image dataset includes several fruit appearance defect images, and the X-ray image dataset includes several preprocessed X-ray images.
[0022] The process involves acquiring fruit appearance images, converting them into grayscale images, and binarizing the grayscale images. Fruit contours are then segmented on the binarized images to obtain fruit contour images. Morphological processing of the fruit contour images yields surface region masks. Boolean operations are then performed between the surface region masks and the fruit appearance images to obtain the fruit surface regions, thus resulting in a preprocessed fruit appearance image.
[0023] The fruit outline image is thresholded to obtain the surface defect outline image; the surface defect outline image is then subjected to morphological operations and contour filtering to obtain the surface defect region mask; the surface defect mask is then subjected to Boolean operations with the fruit appearance image to obtain the fruit surface defect region, and thus obtain the fruit appearance defect image.
[0024] Preprocessing of X-ray images includes at least noise reduction and data augmentation.
[0025] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0026] 1. This method assesses fruit appearance quality from three aspects: shape, color, and surface defects. For shape, symmetry and rectangularity are used to distinguish standard, protruding, and off-center shapes, and a Backpropagation Neural Network (BPNN) is employed for classification. For color, the mean and variance of the G and R channels of the fruit appearance image are used as features, and a Support Vector Machine (SVM) is used to classify standard and off-center colors. For surface defects, threshold segmentation is used to obtain defect areas, which are then classified into no defects, minor defects, moderate defects, and severe defects based on their area. A Gray Level Co-occurrence Matrix (GLCM) is used as a feature, and a BPNN is employed to identify four types of surface defects: punctures, bruises, abrasions, and russeting. This method is particularly suitable for non-destructive testing of fruits such as pears and apples.
[0027] 2. The internal quality of fruit is evaluated based on the presence or absence of internal defects. Local Binary Patterns (LBP) and Histogram of Oriented Gradient (HOG) features are extracted from X-ray images. A multi-criteria decision fusion model including LBP-SVM, HOG-SVM, and DenseNet-121 is constructed. The weight of each classifier during fusion is determined by the evaluation matrix, which improves the accuracy of internal defect detection.
[0028] 3. Extract sugar-rich regions from X-ray images to obtain the fruit pulp region; further extract the mean gray level, gray level variance, gray level distribution skewness, and gray level entropy of the fruit pulp region, and use DenseNet (densely connected convolutional network) to construct a sugar content prediction model to achieve sugar content prediction, thereby more comprehensively reflecting the overall quality of the fruit. Attached Figure Description
[0029] Figure 1 A schematic diagram for determining the symmetry of the fruit shape;
[0030] Figure 2 A schematic diagram for determining the rectangularity of the fruit shape;
[0031] Figure 3 This is the overall flowchart;
[0032] Figure 4 This is a flowchart of the internal defect detection process;
[0033] Figure 5 This is a flowchart for predicting sugar content. Detailed Implementation
[0034] Specific embodiments are given below with reference to the accompanying drawings. These specific embodiments are only used to further describe the technical solution of the present invention in detail, and are not intended to limit the scope of protection of this application.
[0035] This invention provides a comprehensive fruit quality detection method based on machine vision and X-rays (hereinafter referred to as the method, see [link]). Figures 1-5 This includes the following steps:
[0036] The first step is to construct a fruit appearance image dataset, a fruit appearance defect image dataset, and an X-ray image dataset. The fruit appearance image dataset includes several pre-processed fruit appearance images, the fruit appearance defect image dataset includes several fruit appearance defect images, and the X-ray image dataset includes several pre-processed X-ray images.
[0037] The process involves acquiring fruit appearance images, converting them to grayscale images, binarizing the grayscale images, and segmenting the fruit contours using Ostu thresholding to obtain fruit contour images. Morphological processing is then performed on the fruit contour images to remove noise and fruit stems, resulting in a surface region mask. Finally, a Boolean operation is performed between the surface region mask and the fruit appearance image to obtain the fruit surface region, thus yielding a preprocessed fruit appearance image.
[0038] Thresholding segmentation is performed on the fruit outline image to obtain the surface defect outline image; the surface defect outline image is then subjected to morphological operations and contour filtering to obtain a surface defect region mask; Boolean operations are performed between the surface defect mask and the fruit appearance image to obtain the fruit surface defect region, and thus the fruit appearance defect image.
[0039] X-ray images of the fruit were acquired and preprocessed to obtain preprocessed X-ray images. The fruit was then sliced and its sugar content was measured. Based on the slice information and sugar content measurement results, internal defects and sugar content were labeled on the preprocessed X-ray images, respectively.
[0040] The energy of the X-ray source needs to be moderate, capable of penetrating the entire fruit structure without damaging it. For fruit testing, X-ray sources with an energy range of 30-50kV are typically chosen to ensure a balance between penetration and image resolution. X-ray attenuation primarily depends on the density and composition of the fruit's internal substances. As X-rays penetrate the fruit, they undergo a series of attenuations, including absorption and scattering. Denser areas absorb more X-rays, corresponding to darker regions in the X-ray image, while less dense areas correspond to brighter regions. Since sugar content is related to density, the sugar distribution can be inferred by analyzing the brightness differences in different regions of the X-ray image.
[0041] X-ray image preprocessing includes noise reduction and data augmentation. A dual noise reduction approach using wavelet transform and adaptive median filtering (AMF) is employed. Wavelet transform suppresses Gaussian noise through frequency domain decomposition, while AMF eliminates salt-and-pepper noise by dynamically adjusting the window size (initially 3×3, expanding to a maximum of 7×7). Compared to traditional Gaussian filtering, AMF preserves more vascular bundle texture details. Since the number of fruit X-ray images is relatively small, data augmentation is used to expand the data volume and improve detection accuracy. Data augmentation techniques include horizontal flipping, vertical flipping, transposition, flipping, random Gamma transformation, random brightness / contrast transformation, optical distortion transformation, and mesh distortion transformation.
[0042] The second step is to construct the fruit surface defect feature matrix, fruit shape feature matrix, and color feature matrix, and then use the appearance quality classification model to classify the appearance quality to achieve the first-level classification.
[0043] According to national standards, the appearance quality of fruits is mainly judged from three aspects: fruit surface defects, fruit shape, and color. Fruit surface defect characteristics include: total defect area, angular second moment (ASM) of the gray-level co-occurrence matrix, contrast, inverse difference matrix (IDM), and entropy. These characteristics constitute the fruit surface defect feature matrix.
[0044] Based on the fruit's appearance image, calculate the fruit shape and color features. Fruit shape features include: fruit shape symmetry and fruit shape rectangularity; these two features together form the fruit shape feature matrix; for example... Figure 1 As shown, the center line of the fruit outline is the midline of the circumscribed rectangle of the fruit outline. In the image coordinate system, the distance deviation between a pair of pixels with the same ordinate on the left and right outlines of the fruit and the center line of the fruit is the fruit shape symmetry. If there are many pixels with the same ordinate on the left and right outlines of the fruit, the pixel with the largest distance from the center line of the fruit is selected for calculation. The formula for calculating fruit shape symmetry is:
[0045]
[0046] In the formula, C represents the symmetry of the fruit shape. This represents the maximum distance between the pixel with the y-coordinate on the left outline of the fruit and the left and right center lines of the fruit. This represents the maximum distance between the pixel with the y-coordinate on the right side outline of the fruit and the left and right center lines of the fruit.
[0047] like Figure 2As shown, the ratio of the distance between the x-coordinates of a pair of pixels with the same y-coordinate on the left and right contours of the fruit to the longer side of the bounding rectangle of the fruit contour is the fruit shape rectangularity. If there are many pixels with the same y-coordinate on the left and right contours of the fruit, the pair of pixels with the largest difference in x-coordinate is used for calculation. The formula for calculating the fruit shape rectangularity is:
[0048]
[0049] In the formula, R represents the rectangularity of the fruit shape. d represents the maximum absolute value of the difference in the x-coordinates of a pair of pixels with the same y-coordinate on the left and right outlines of a fruit. l This represents the length of the longer side of the bounding rectangle of the fruit's outline;
[0050] Color features include: the mean and variance of the R channel, the mean and variance of the G channel, and the ratio of the mean of the R channel to the mean of the G channel. These features form a color feature matrix; the formulas for calculating each color feature value are as follows:
[0051]
[0052] In the formula, μ r σ r These are the mean and variance of the R channels, μ g σ g These are the mean and variance of the G channel, respectively, r e g e These are the pixel values of the e-th pixel in the R and G channels, respectively, and U represents the total number of pixels on the fruit surface area in the R and G channels.
[0053] The appearance quality classification model includes a BPNN network and an SVM model. The fruit surface defect feature matrix is input into a BPNN network to classify fruit surface defects into no defects, punctures, bruises, abrasions, or rust. The fruit shape feature matrix is input into another BPNN network to classify fruit shape into standard fruit shape, protruding fruit shape, or off-center fruit shape. The color feature matrix is input into the SVM model to classify color into standard color and off-center color.
[0054] The third step is to establish internal defect detection models, including HOG-SVM, LBP-SVM and DenseNet-121 models; and to fuse the detection results of each internal defect detection model based on multi-criteria decision-making to obtain the internal defect detection results and achieve the second-level classification.
[0055] HOG and LBP features are extracted from the preprocessed X-ray images. HOG-SVM and LBP-SVM models are constructed using an SVM model for these two features. The inputs to the HOG-SVM and LBP-SVM models are the HOG features and LBP features, respectively, and the outputs are the internal defect detection results. The preprocessed X-ray images are then input into the DenseNet-121 model, which outputs the internal defect detection results.
[0056] Multi-criteria decision-making includes establishing an evaluation matrix, normalizing and weighting the evaluation matrix, calculating the weights, and making decisions based on the weights.
[0057] The evaluation matrix is established based on the performance evaluation metrics of each detection model, including the weighted average recall rate. Weighted average precision Weighted average F1 score Accuracy A y And the Cohen's Kappa correlation coefficient CK, calculated using the following formula:
[0058]
[0059] In the formula, δ c p c F1 c Let A represent the recall, precision, and F1 score for category c, respectively. y Indicates accuracy, I represents the number of classes, and TP c Let A represent the number of samples that actually belong to category c and are predicted as category c, and let p represent the random consistency coefficient. The formula is as follows:
[0060]
[0061] In the formula, a c b represents the number of samples that actually belong to category c. c This represents the number of samples predicted as class c.
[0062] Based on the above performance evaluation indicators, construct the evaluation matrix Q = (q m,n ) M×N ; where q m,n Let M represent the nth performance evaluation index value of the mth internal defect detection model, M represent the number of internal defect detection models, and N represent the number of performance evaluation indices.
[0063] The weighting formulas for each performance evaluation indicator are as follows:
[0064]
[0065]
[0066] In the formula, α n C represents the weight of the nth performance evaluation metric. n σ represents the relative importance of the nth performance evaluation metric. n This represents the standard deviation of all internal defect detection models with respect to the nth performance evaluation index. Let q represent the mean of the nth performance evaluation index. m,k This represents the element in the m-th row and k-th column of the evaluation matrix. Let r represent the mean of the k-th performance evaluation metric. nk This represents the correlation coefficient between the nth performance evaluation index and the kth performance evaluation index;
[0067] The evaluation matrix Q is normalized and weighted to obtain the normalized weighted evaluation matrix. The normalized weighted formula is:
[0068]
[0069] The weights of each internal defect detection model are calculated based on the normalized weighted evaluation matrix.
[0070]
[0071] In the formula, ω m d represents the weight of the m-th internal defect detection model. m,min d represents the Euclidean distance between each element in the normalized weighted evaluation matrix and the minimum value of each performance evaluation index. m,max This represents the Euclidean distance between each element in the normalized weighted evaluation matrix and the maximum value of each performance evaluation index.
[0072] Based on the weights of each internal defect detection model, the detection results of each internal defect detection model are weighted and fused to obtain the internal defect detection result; the weighted fusion calculation formula is as follows:
[0073]
[0074] In the formula, p m Let P represent the detection result of the m-th internal defect detection model.
[0075] The fourth step is to extract the pulp region from the X-ray image, further extract the features of the pulp region, and form a multi-dimensional feature vector of the pulp region; input the multi-dimensional feature vector of the pulp region into the sugar content prediction model to predict the sugar content; and perform sugar content grading based on the sugar content prediction results to achieve the third level of classification.
[0076] 4-1. Segment the X-ray image, extract the region of interest (ROI) from the segmented image to obtain the pulp region;
[0077] Since the sugar content of fruits varies unevenly in the pit, calyx, and pedicel, the preprocessed X-ray image is input into the U-Net network for image segmentation to obtain a segmented image that includes the pit, calyx, and pedicel. The region of interest (ROI) is extracted from the segmented image to obtain the pulp region, thus avoiding interference from the pit or peel on the sugar content prediction.
[0078] First, calculate the centroid of the pulp region:
[0079]
[0080] In the formula, (x c ,y c ) indicates the centroid of the fruit pulp region, M flesh I represents the set of pixels in the pulp region; pre (x,y) represents the probability that pixel (x,y) is fruit pulp;
[0081] Next, radial density gradient analysis was performed on the segmented image. Concentric rings were divided with the centroid of the pulp region as the origin (radius step size of 5 mm), and the average density of each ring was calculated.
[0082]
[0083] In the formula, D(r) represents the average density of the annulus, r represents the radius of the annulus, Δr represents the step size of the annulus radius, and N... r This indicates the number of pixels contained in the ring;
[0084] Finally, the density gradient of the ring is calculated. The ring with the largest density gradient is regarded as the sugar-rich area, i.e., the pulp area; morphological optimization is performed on the pulp area to extract its morphological features.
[0085] 4-2. Extract the gray-level statistical features of the differences in internal tissue density and spatial variation of fruits, including the gray-level mean, gray-level variance, gray-level distribution skewness, and gray-level entropy of the pulp region;
[0086] The grayscale mean is the arithmetic average of the grayscale values of all pixels within the fruit pulp area. The calculation formula is:
[0087]
[0088] In the formula, μ ROI G represents the average gray value of the pulp area. h N represents the grayscale value at the h-th pixel. ROIThis indicates the number of pixels in the pulp area; the sugar-rich areas have increased X-ray absorption due to increased density, so the average gray value is significantly lower than that of the low-sugar areas.
[0089] Gray-scale variance reflects the uniformity of sugar content distribution. Regions with large gray-scale variance (such as the junction of pulp and vascular bundles) correspond to transitional zones where the sugar content gradient changes significantly; the gray-scale variance σ of the pulp region... ROI 2 The calculation formula is:
[0090]
[0091] Gray-scale distribution skewness S in the pulp region ROI The calculation formula is:
[0092]
[0093] Positive skewness (S) ROI >0.5 indicates that sugars are concentrated in the core region, with a negative skewness (S). ROI <-0.5) indicates that the sugar is dispersed at the edge;
[0094] Gray entropy is used to quantify the concentration of sugar distribution, while information entropy measures the complexity of sugar distribution. The calculation formula is as follows:
[0095]
[0096] In the formula, p(G) h ) represents the gray level frequency at the h-th pixel, and L represents the total number of gray levels;
[0097] 4-3. Combining the morphological features and gray-scale statistical features of the pulp region to form a multi-dimensional feature vector of the pulp region can improve the model's sensitivity to small changes in sugar content; inputting the multi-dimensional feature vector of the pulp region into the sugar content prediction model can predict the sugar content of the fruit.
[0098] The sugar content prediction model is based on a densely connected convolutional network (DenseNet-121). The fully connected layers of the DenseNet-121 are replaced with a support vector regression (SVR) model to further improve the accuracy of DenseNet-121 in sugar content prediction. Due to the limitations of the dataset, a transfer learning strategy is used to train the sugar content prediction model. First, the sugar content prediction model is pre-trained using the ImageNet dataset, and then the pre-trained sugar content prediction model is fine-tuned using an X-ray image dataset to adapt the model to the sugar content prediction task, resulting in the trained sugar content prediction model.
[0099] The multidimensional feature vector of the pulp region is input into the sugar content prediction model to obtain the sugar content prediction value. Based on the sugar content prediction value, the sugar content is graded to achieve the third level of classification, thus completing the entire detection process.
[0100] Any aspects not covered in this invention are applicable to existing technologies.
Claims
1. A machine vision and X-ray based comprehensive fruit quality detection method, characterized in that, The method comprises the following steps: The first step is to construct a fruit appearance image dataset, a fruit appearance defect image dataset and an X-ray image dataset; The second step is to construct a fruit surface defect feature matrix, a fruit shape feature matrix and a color feature matrix; The fruit surface defect feature matrix is composed of total fruit surface defect area, angular second moment of a gray level co-occurrence matrix, contrast, difference matrix and entropy, the fruit shape feature matrix includes two features of fruit shape symmetry and fruit shape rectangularity, and the color feature matrix is composed of R channel mean and variance, G channel mean and variance and ratio of R channel mean to G channel mean; The fruit surface defect feature matrix is input into a BPNN network to realize fruit surface defect detection, the fruit shape feature matrix is input into another BPNN network to realize fruit shape detection, and the color feature matrix is input into an SVM model to realize color detection; The third step is to establish multiple different internal defect detection models, fuse results of the internal defect detection models based on multi-criteria decision, and obtain internal defect detection results; The fourth step is to segment the X-ray image, extract a fruit pulp region from the segmented image, calculate a fruit pulp region centroid first, then divide the segmented image into concentric circles with the fruit pulp region centroid as the origin, calculate average density of each circle, and finally regard a circle with maximum density gradient as the fruit pulp region; In the formula, (x c ,y c ) represents the flesh area centroid, M flesh represents the pixel point set of the flesh area; I pre (x,y) represents the probability that the pixel point (x,y) is flesh. The fruit pulp region is subjected to morphological optimization to extract morphological features of the fruit pulp region, gray level statistical features of the fruit pulp region including gray level mean, gray level variance, gray level distribution skewness and gray level entropy are extracted, and the morphological features and the gray level statistical features of the fruit pulp region are combined to form a fruit pulp region multi-dimensional feature vector; In the formula, D(r) represents the average density of the circular ring, r represents the circular ring radius, Δr represents the circular ring radius step, N r represents the number of pixel points contained in the circular ring; The fruit pulp region multi-dimensional feature vector is input into a sugar content prediction model to predict sugar content of the fruit; The fruit is graded according to the sugar content prediction value. The internal defect detection models include HOG-SVM models, LBP-SVM models and DenseNet-121 models, HOG and LBP features of the X-ray image are extracted, the HOG and LBP features are input into SVM models respectively to predict internal defects, and the HOG-SVM models and the LBP-SVM models are obtained; The DenseNet-121 model inputs the X-ray image into the DenseNet-121 model to predict internal defects. 2.The machine vision and X-ray based comprehensive fruit quality detection method according to claim 1, characterized in that, The sugar content prediction model is based on the DenseNet-121 model, and a full connection layer of the DenseNet-121 model is replaced by an SVR model. The fruit appearance image dataset includes a plurality of preprocessed fruit appearance images, the fruit appearance defect image dataset includes a plurality of fruit appearance defect images, and the X-ray image dataset includes a plurality of preprocessed X-ray images. 3.The machine vision and X-ray based comprehensive fruit quality detection method according to claim 1, characterized in that, 4. The method according to any one of claims 1 to 3, wherein the method is characterized by, The fruit appearance image is collected, the fruit appearance image is converted into a gray image, the gray image is binarized, the fruit contour is segmented on the binarized image to obtain a fruit contour image, the fruit contour image is subjected to morphological processing to obtain a surface region mask, the surface region mask is subjected to Boolean operation with the fruit appearance image to obtain a fruit surface region, and then a pretreated fruit appearance image is obtained; The fruit contour image is subjected to threshold segmentation to obtain a surface defect contour image; The surface defect contour image is subjected to morphological operation and contour screening to obtain a surface defect region mask; the surface defect mask is subjected to Boolean operation with the fruit appearance image to obtain a fruit surface defect region, and then a fruit appearance defect image is obtained; The preprocessing of the X-ray image at least includes noise reduction and data enhancement.
Citation Information
Patent Citations
Fruit quality comprehensive grading method and device based on machine vision and X rays
CN114354637A