A durian quality detection method and system based on computer vision
By using computer vision technology to identify appearance defects and classification grades of durians, the problem of inconsistent manual assessments has been solved, and stable and non-destructive classification of durian quality has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG BOSHI NETWORK TECHNOLOGY CO LTD
- Filing Date
- 2026-03-23
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, durian quality assessment relies on human judgment, which leads to highly subjective and inconsistent assessment results, affecting sales reliability and consumer experience.
Using a computer vision-based approach, the quality, appearance, and CT images of durians are collected to identify the types and classification levels of appearance defects, calculate quality scores, and achieve non-destructive quality classification.
This improved the stability and consistency of durian quality assessment, enabled non-destructive quality classification, and reduced human error.
Smart Images

Figure CN122493093A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fruit and vegetable quality testing technology, specifically to a method and system for testing durian quality based on computer vision. Background Technology
[0002] Durian, hailed as the "King of Fruits," possesses unique qualities. These characteristics, such as ripeness, overall grade, and the presence or absence of defects, are crucial in determining the fruit's market value and consumer demand. The assessment of these criteria has historically relied on human judgment, a method fraught with subjectivity and inconsistency. Given durian's importance in different markets, these inconsistencies lead to varying consumer experiences and impact sellers' perceived reliability. Existing classification methods primarily depend on manual labor. While human inspectors bring years of experience, the process is inherently subjective, leading to potential oversights or discrepancies in quality assessment. Summary of the Invention
[0003] To address the technical problems in existing technologies where durian quality is judged subjectively by humans, leading to potential oversights or discrepancies in quality assessment, this invention provides a durian quality detection method and system based on computer vision.
[0004] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: A computer vision-based method for durian quality inspection includes the following steps: Collect images of the quality and appearance of durians, as well as CT tomographic images; Identify the type of appearance defect of the durian based on the appearance image; The classification grade of the durian was determined based on the CT tomographic images; The quality score of the durian is calculated based on the type of appearance defect, the classification level, and the quality. The quality grade of the durian is determined based on the quality score.
[0005] The beneficial effects of this invention are: by using computer vision recognition methods to identify the types of appearance defects in durians, and by using computer image recognition methods to identify the classification level of durians, the quality score of the durians is determined based on the type of appearance defects, classification level, and quality, so as to determine the quality level of durians based on the quality score; thereby realizing non-destructive quality classification of durians and improving the stability of quality assessment.
[0006] Based on the above technical solution, the present invention can be further improved as follows.
[0007] Furthermore, identifying the type of appearance defect of the durian based on the appearance image includes the following steps: Multiple images of durian appearance defects were collected from different seasons and regions; A computer defect recognition model was trained using multiple images of durian appearance defects to obtain a durian appearance recognition model; The appearance image is input into the durian appearance recognition model to identify appearance defects and obtain the type of appearance defect.
[0008] Furthermore, the computer defect recognition model is a defect recognition model based on color features.
[0009] Furthermore, the defect recognition model based on color features is a support vector machine or a backpropagation neural network.
[0010] Furthermore, determining the classification grade of the durian based on the CT tomographic images includes the following steps: The Canny edge detection algorithm was used to detect the edges of the region between the peel and pulp in the CT tomographic image. Calculate the edge distance between the regions between the peel and the pulp in the CT tomographic image to obtain the distance value; The classification level is determined based on the distance value.
[0011] Further, the edge distance between the peel and pulp in the CT tomographic image is calculated to obtain the distance value, including the following steps: By iterating through the contour points of the fruit peel edge in the CT tomographic images, a fruit peel boundary coordinate dataset is obtained; By iterating through the contour points of the inner edge of the pulp in the CT tomographic images, the coordinate dataset of the pulp head boundary is obtained; The minimum distance between each peel boundary coordinate in the peel boundary coordinate dataset and each flesh head boundary coordinate in the flesh head boundary coordinate dataset is calculated using the Euclidean distance formula, resulting in multiple spacing values. The largest value among the multiple spacing values is taken as the distance value.
[0012] Furthermore, the classification levels include Level A, Level B, and Level C; Determining the classification level based on the distance value includes the following steps: If the distance value is less than or equal to the first distance threshold, then the classification level is determined to be level A; If the distance value is greater than the first distance threshold and less than the second distance threshold, then the classification level is determined to be level B; wherein, the second distance threshold is greater than the first distance threshold; If the distance value is greater than or equal to the second distance threshold, then the classification level is determined to be level C.
[0013] Furthermore, the quality score of the durian is calculated based on the type of appearance defect, the classification level, and the quality, including the following steps: Assign a value to the type of appearance defect to obtain an appearance score; Set appearance weight values for the aforementioned appearance defect types; Assign values to the classification levels to obtain classification score values; Set classification weight values for the classification levels; Set a quality weight value for the quality; The quality score is calculated based on the appearance score, the appearance weight score, the classification score, the classification weight score, and the quality weight score.
[0014] Furthermore, the formula for calculating the quality score based on the appearance score, appearance weight value, classification score, classification weight value, and quality weight value is as follows: ; in, This indicates the quality score. This indicates the appearance rating value. This represents the appearance weight value. This represents the classification score. This represents the classification weight value. This represents the quality weight value. This represents the quality weight value.
[0015] To address the aforementioned technical problems, this invention also provides a computer vision-based durian quality inspection system, the specific technical details of which are as follows: A computer vision-based durian quality inspection system includes: The data acquisition module is used to acquire images of the quality and appearance of durians, as well as CT tomographic images. The defect identification module is used to identify the type of appearance defect of the durian based on the appearance image; A classification module is used to determine the classification level of the durian based on the CT tomographic images; The quality assessment module is used to calculate the quality score of the durian based on the type of appearance defect, the classification level, and the quality; and to determine the quality grade of the durian based on the quality score. Attached Figure Description
[0016] Figure 1 This is a flowchart of a computer vision-based durian quality detection method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a computer vision-based durian quality inspection system according to an embodiment of the present invention. Detailed Implementation
[0017] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0018] like Figure 1 As shown in the figure, this embodiment provides a computer vision-based method for durian quality detection, including the following steps: S1. Collect images of the quality and appearance of durians, as well as CT tomographic images; The quality of durians is measured using digital electronic scales or mass sensors, and the appearance of durians is captured using a high-resolution camera. CT images of the durians are also acquired using a computed tomography (CT) scanner. To improve accuracy, the acquired CT images are taken from the middle or largest section of the durian.
[0019] S2. Identify the type of appearance defect of the durian based on the appearance image; Identifying the type of appearance defect of the durian based on the appearance image includes the following steps: Collect at least 3,000 images of durian appearance defects from different seasons and regions; the images of appearance defects include at least bite marks, perforations, cracks, and gaps on the durian skin.
[0020] A computer-based defect recognition model was trained using multiple images of durian appearance defects to obtain a durian appearance recognition model; the computer-based defect recognition model is a color feature-based defect recognition model. The color feature-based defect recognition model is a support vector machine or a backpropagation neural network.
[0021] The specific training steps for Support Vector Machine (SVM) are as follows: Data cleaning: removing noise, handling missing and outliers to ensure data quality.
[0022] Feature scaling: SVM is sensitive to feature scale and needs to be standardized (e.g., Z-score) or normalized (e.g., the [0,1] interval) to avoid certain features dominating model training due to excessively large scale.
[0023] Use statistical methods (such as correlation coefficient, chi-square test) or models (such as random forest) to evaluate feature importance, select the most discriminative feature subset, reduce dimensionality and improve model efficiency.
[0024] The preprocessed data is divided into training and testing sets (common ratios are 70%:30% or 80%:20%) to ensure that the model can be evaluated on unseen data.
[0025] Choose a kernel function: Linear kernel: suitable for cases with a large number of features and a moderate number of samples, computationally efficient. Polynomial kernel: suitable for nonlinear but structurally clear data. RBF kernel (Radial Basis Function): the most commonly used, suitable for complex nonlinear classification problems, requires tuning of parameter γ.
[0026] Model building and parameter tuning utilize SVC or LinearSVC classes from scikit-learn. Key parameter: C (regularization parameter): controls the tolerance for classification errors. A smaller C value allows for more misclassifications, resulting in a smoother model; a larger C value aims for lower training error but is prone to overfitting. It can be optimized through cross-validation (e.g., GridSearchCV).
[0027] SVM aims to solve a convex quadratic programming problem, maximizing the classification margin. Common algorithms include: SMO (Sequence Minimum Optimization): efficiently solving the dual problem, suitable for large-scale data; and QP solvers: suitable for small-scale problems. The model is fitted using the training set, and then predictions are made on the test set, outputting class labels. Model evaluation uses metrics such as accuracy, precision, recall, and F1 score to assess performance. Visualizing the decision boundary and support vectors helps in understanding model behavior.
[0028] A BP neural network consists of an input layer and hidden layers. Input Layer: Function: Receives raw data from external input, such as image pixels, sensor signals, feature vectors, etc. Structural characteristics: The number of neurons equals the dimension of the input features. For example, when processing a 28×28 image, the input layer has 784 neurons. It does not perform computational processing; it only passes the data to the next layer. It has no activation function or uses a linear function f(x) = x, and the threshold is usually 0.
[0029] Hidden layers, function: extract abstract features from input data layer by layer to achieve nonlinear mapping. Structural characteristics: can contain one or more layers, with the number of neurons in each layer being customizable, commonly 1-3 layers. Each neuron performs a weighted summation of the output of the previous layer and applies a nonlinear transformation through an activation function. Common activation functions include Sigmoid, Tanh, and ReLU, used to introduce nonlinearity, enabling the network to approximate arbitrarily complex functions. When there are enough hidden layer neurons, a single hidden layer can approximate any continuous nonlinear function with arbitrarily high precision.
[0030] The appearance image is input into the durian appearance recognition model to identify appearance defects and obtain the type of appearance defect.
[0031] S3. Determine the classification grade of the durian based on the CT tomographic images; the classification grades include grade A, grade B, and grade C; Determining the classification grade of the durian based on the CT tomographic images includes the following steps: The Canny edge detection algorithm was used to detect the edges of the region between the peel and pulp in the CT tomographic image. Calculate the edge distance between the regions between the peel and the pulp in the CT tomographic image to obtain the distance value; The classification level is determined based on the distance value.
[0032] Calculating the edge distance between the peel and pulp in the CT tomographic image to obtain the distance value includes the following steps: By iterating through the contour points of the fruit peel edge in the CT tomographic images, a fruit peel boundary coordinate dataset is obtained; By iterating through the contour points of the inner edge of the pulp in the CT tomographic images, the coordinate dataset of the pulp head boundary is obtained; Traverse the contour points of the fruit peel edge in the CT tomographic image to obtain the fruit peel boundary coordinate dataset; let the fruit peel boundary coordinate dataset S1={(a1, b1), (a2, b2), ..., (an, bn)}; (a1, b1) represents the coordinates of the first point of the peel boundary contour; (a2, b2) represents the coordinates of the second point of the boundary contour; (an, bn) represents the coordinates of the nth point of the boundary contour; a1 represents the x-coordinate value of the first point of the peel boundary contour; b1 represents the y-coordinate value of the first point of the peel boundary contour; a2 represents the x-coordinate value of the second point of the peel boundary contour; b2 represents the y-coordinate value of the second point of the peel boundary contour; an represents the x-coordinate value of the nth point of the peel boundary contour; bn represents the y-coordinate value of the nth point of the peel boundary contour.
[0033] Traverse the contour points of the inner edge of the pulp in the CT tomographic image to obtain the pulp head boundary coordinate dataset; let the pulp head boundary coordinate dataset S2={(c1,d1),(c2,y2),……,(cn,yn)}; (c1,y1) represents the coordinates of the first point of the skin boundary contour; (c2,y2) represents the coordinates of the second point of the boundary contour; (cn,yn) represents the coordinates of the nth point of the boundary contour; c1 represents the x-coordinate value of the first point of the skin boundary contour; d1 represents the y-coordinate value of the first point of the skin boundary contour; c2 represents the x-coordinate value of the second point of the skin boundary contour; d2 represents the y-coordinate value of the second point of the skin boundary contour; cn represents the x-coordinate value of the nth point of the skin boundary contour; dn represents the y-coordinate value of the nth point of the skin boundary contour.
[0034] The minimum distance between each peel boundary coordinate in the peel boundary coordinate dataset and each flesh head boundary coordinate in the flesh head boundary coordinate dataset is calculated using the Euclidean distance formula, resulting in multiple spacing values. The largest value among the multiple spacing values is taken as the distance value.
[0035] Determining the classification level based on the distance value includes the following steps: If the distance value is less than or equal to the first distance threshold, then the classification level is determined to be level A; If the distance value is greater than the first distance threshold and less than the second distance threshold, then the classification level is determined to be level B; wherein, the second distance threshold is greater than the first distance threshold; If the distance value is greater than or equal to the second distance threshold, then the classification level is determined to be level C.
[0036] S4. Calculate the quality score of the durian based on the type of appearance defect, the classification level, and the quality. The quality score of the durian is calculated based on the type of appearance defect, the classification level, and the quality, including the following steps: Assign a value to the appearance defect type to obtain an appearance score; set different score values for different appearance defect types, and query the corresponding score value using the identified appearance defect type.
[0037] Set appearance weight values for the aforementioned appearance defect types; Assign values to the classification levels to obtain classification scores; set different scores for different classification levels, and use the identified classification levels to query the corresponding scores to obtain the classification scores.
[0038] Set classification weight values for the classification levels; Set a quality weight value for the quality; The quality score is calculated based on the appearance score, the appearance weight score, the classification score, the classification weight score, and the quality weight score.
[0039] The formula for calculating the quality score based on the appearance score, appearance weight value, classification score, classification weight value, and quality weight value is as follows: ; in, This indicates the quality score. This indicates the appearance rating value. This represents the appearance weight value. This represents the classification score. This represents the classification weight value. This represents the quality weight value. This represents the quality weight value. The appearance weight value, the classification weight value, and the quality weight value can be set as needed.
[0040] S5. Determine the quality grade of the durian based on the quality score.
[0041] If the quality score is less than or equal to the first scoring threshold, then the quality level is determined to be low quality. If the quality score is greater than the first scoring threshold and less than the second scoring threshold, then the quality level is determined to be medium quality; wherein the second scoring threshold is greater than the first scoring threshold. If the quality score is greater than or equal to the second scoring threshold, then the quality level is determined to be high quality.
[0042] This invention identifies the types of appearance defects in durians using computer vision recognition methods, classifies durians according to computer image recognition methods, and determines the quality score of the durians based on the type of appearance defects, classification level, and quality. The quality score determines the quality grade of the durians, thereby achieving non-destructive quality classification of durians and improving the stability of quality assessment.
[0043] like Figure 2 As shown, in some other embodiments, a computer vision-based durian quality inspection system is also provided, comprising: The data acquisition module is used to acquire images of the quality and appearance of durians, as well as CT tomographic images. The defect identification module is used to identify the type of appearance defect of the durian based on the appearance image; A classification module is used to determine the classification level of the durian based on the CT tomographic images; The quality assessment module is used to calculate the quality score of the durian based on the type of appearance defect, the classification level, and the quality; and to determine the quality grade of the durian based on the quality score.
[0044] The data acquisition module, defect identification module, classification module, and quality judgment module can be program modules or computing devices.
[0045] In some other embodiments, a storage medium is also provided, which stores a computer program or computer instructions that, when executed by a computer processor, implement the steps of the above-described computer vision-based durian quality detection method.
[0046] The storage medium can be an internal storage unit of any data processing device described in any of the foregoing embodiments, such as a hard disk or memory. The storage medium can also be an external storage device of any data processing device, such as a plug-in hard disk, smart memory card, SD card, flash memory card, etc., mounted on the device. Furthermore, the storage medium can include both internal storage units and external storage devices of any data processing device. The computer-readable storage medium is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.
[0047] In other embodiments, a computer is also provided, including a memory and one or more processors, wherein executable code is stored in the memory, and when the one or more processors execute the executable code, the steps of the above-described computer vision-based durian quality detection method are implemented.
[0048] The memory can be an internal storage unit of any data processing device described in any of the foregoing embodiments, such as a hard disk or RAM. The memory can also be an external storage device of any data processing device, such as a plug-in hard disk, smart memory card, SD card, flash memory card, etc., mounted on the device. Furthermore, the memory can include both internal storage units and external storage devices of any data processing device. The memory is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.
[0049] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the concept and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A computer vision-based method for durian quality inspection, characterized in that, Includes the following steps: S1. Collect images of the quality and appearance of durians, as well as CT tomographic images; S2. Identify the type of appearance defect of the durian based on the appearance image; S3. Determine the classification grade of the durian based on the CT tomographic images; S4. Calculate the quality score of the durian based on the type of appearance defect, the classification level, and the quality. S5. Determine the quality grade of the durian based on the quality score.
2. The computer vision-based durian quality detection method according to claim 1, characterized in that, Identifying the type of appearance defect of the durian based on the appearance image includes the following steps: Multiple images of durian appearance defects were collected from different seasons and regions; A computer defect recognition model was trained using multiple images of durian appearance defects to obtain a durian appearance recognition model; The appearance image is input into the durian appearance recognition model to identify appearance defects and obtain the type of appearance defect.
3. The computer vision-based durian quality detection method according to claim 2, characterized in that, The computer defect recognition model is a defect recognition model based on color features.
4. The computer vision-based durian quality detection method according to claim 3, characterized in that, Defect recognition models based on color features are support vector machines or backpropagation neural networks.
5. The computer vision-based durian quality detection method according to claim 1, characterized in that, Determining the classification grade of the durian based on the CT tomographic images includes the following steps: The Canny edge detection algorithm was used to detect the edges of the region between the peel and pulp in the CT tomographic image. Calculate the edge distance between the regions between the peel and the pulp in the CT tomographic image to obtain the distance value; The classification level is determined based on the distance value.
6. The computer vision-based durian quality detection method according to claim 5, characterized in that, Calculating the edge distance between the peel and pulp in the CT tomographic image to obtain the distance value includes the following steps: By iterating through the contour points of the fruit peel edge in the CT tomographic images, a fruit peel boundary coordinate dataset is obtained; By iterating through the contour points of the inner edge of the pulp in the CT tomographic images, the coordinate dataset of the pulp head boundary is obtained; The minimum distance between each peel boundary coordinate in the peel boundary coordinate dataset and each flesh head boundary coordinate in the flesh head boundary coordinate dataset is calculated using the Euclidean distance formula, resulting in multiple spacing values. The largest value among the multiple spacing values is taken as the distance value.
7. The computer vision-based durian quality detection method according to claim 6, characterized in that, The classification levels include Level A, Level B, and Level C; Determining the classification level based on the distance value includes the following steps: If the distance value is less than or equal to the first distance threshold, then the classification level is determined to be level A; If the distance value is greater than the first distance threshold and less than the second distance threshold, then the classification level is determined to be level B; wherein, the second distance threshold is greater than the first distance threshold; If the distance value is greater than or equal to the second distance threshold, then the classification level is determined to be level C.
8. The computer vision-based durian quality detection method according to claim 1, characterized in that, The quality score of the durian is calculated based on the type of appearance defect, the classification level, and the quality, including the following steps: Assign a value to the type of appearance defect to obtain an appearance score; Set appearance weight values for the aforementioned appearance defect types; Assign values to the classification levels to obtain classification score values; Set classification weight values for the classification levels; Set a quality weight value for the quality; The quality score is calculated based on the appearance score, the appearance weight score, the classification score, the classification weight score, and the quality weight score.
9. The computer vision-based durian quality detection method according to claim 8, characterized in that, The formula for calculating the quality score based on the appearance score, appearance weight value, classification score, classification weight value, and quality weight value is as follows: ; in, This indicates the quality score. This indicates the appearance rating value. This represents the appearance weight value. This represents the classification score. This represents the classification weight value. This represents the quality weight value. This represents the quality weight value.
10. A system employing the computer vision-based durian quality inspection method as described in any one of claims 1 to 9, characterized in that, include: The data acquisition module is used to acquire images of the quality and appearance of durians, as well as CT tomographic images. The defect identification module is used to identify the type of appearance defect of the durian based on the appearance image; A classification module is used to determine the classification level of the durian based on the CT tomographic images; The quality assessment module is used to calculate the quality score of the durian based on the type of appearance defect, the classification level, and the quality; and to determine the quality grade of the durian based on the quality score.