Peach screening and grading method and system based on machine vision

By constructing a peach individual screening index system and machine vision detection technology, the problem of lack of credibility in the existing technology of peach grading results is solved, and efficient and accurate grading of different varieties and batches of peaches is achieved.

CN119169615BActive Publication Date: 2025-05-16PEACH RES INST FENGHUA DISTRICT NINGBO CITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411188262.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2025-05-16
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

The existing machine vision fruit quality grading methods are difficult to adapt to different varieties or batches of peaches, resulting in the lack of credibility in classification results.

Method used

A peach individual screening index system is constructed, and the screening index is classified into forward, reverse, intermediate and interval indexes. The data of various screening indexes are obtained through machine vision detection, and the distance between each index and the optimal value and the worst value is calculated to score the grade of peach individuals.

Benefits of technology

Through this method, the impact of characteristic differences between different varieties or batches on classification results can be reduced, and the credibility and accuracy of peach grading can be improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119169615B_ABST
    Figure CN119169615B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for screening and grading peaches based on machine vision, which relates to the technical field of machine vision detection. By constructing an individual screening index system for peaches, the screening indexes are classified into four categories: positive indexes, negative indexes, intermediate indexes, and interval indexes. Obtain the machine vision detection images of the individual peaches to be graded, extract the data values of each screening index of the individuals in the detection images, and normalize the data values of the negative indexes, intermediate indexes, and interval indexes of the individuals. Calculate the distances #imgabs0# and #imgabs1# between the data of each screening index of the i-th individual and the optimal value and the worst value respectively. According to the formula: #imgabs2# calculate the score value C of the i-th individual j Taking the individual score value as the standard, classify the grades of the peach individuals, which can reduce the influence degree of the characteristic differences existing between different varieties or different batches on the classification results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision detection, and in particular to a peach screening and grading method and system based on machine vision. Background Art

[0002] The quality of fruits is an important criterion for grading. Traditional manual and simple mechanical grading methods cannot meet the grading requirements of fruit quality. The fruit quality grading method based on machine vision uses image recognition technology such as deep learning to grade fruit quality. It has the advantages of high efficiency, no damage, multiple grading indicators, and reliable grading results. It can solve the problems of manual grading and simple mechanical grading and has been widely used.

[0003] At present, the fruit quality grading method using machine vision needs to determine the grading standard. Generally, the grading threshold can be set manually or the characteristics of some individual samples can be determined by machine learning, and then the individuals are classified according to the classification standard. Due to the differences in characteristics between individuals of different varieties or even different batches, the unified classification standard is not applicable to the grading of individuals of different varieties or different batches, resulting in unreliable classification results. To this end, we propose a peach screening and grading method and system based on machine vision. Summary of the invention

[0004] The main purpose of the present invention is to provide a peach screening and grading method and system based on machine vision, which can effectively solve the problems in the background technology.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is:

[0006] The peach screening and grading method based on machine vision includes:

[0007] An individual screening index system for peaches was constructed, and the screening indexes were classified into four categories: positive index, reverse index, intermediate index and interval index, wherein the screening indexes included at least one of individual maximum fruit diameter, individual maximum perimeter, individual maximum cross-sectional area, roundness, optimal RGB interval of surface color, color uniformity and optimal color coloring rate;

[0008] Obtain a machine vision inspection image of the individual peaches to be graded, and extract the data values ​​x of various screening indicators of the individual in the inspection image. ij , represented by the j-th screening index value of the i-th individual, wherein the process of obtaining the color uniformity includes the following steps:

[0009] The obtained machine vision inspection image of the individual peaches to be graded is divided into grids with a step length of ε, and the grids are numbered in sequence;

[0010] Extracting grids whose RGB values ​​are within the optimal RGB interval of the surface color as control areas;

[0011] Get the chromaticity value Cv of the u-th control area u and brightness value Bv u , calculate the contrast chromaticity and contrast brightness Cv' and Bv', where, when u = 1, Cv' = Cv u , Bv'=Bv u ; When u>1, U is the total number of control areas;

[0012] Obtain the chromaticity value Cv of the vth non-control area in sequence v and brightness value Bv v , calculate the uniformity evaluation value H between the non-control area and the control area v , the calculation formula is: Wherein, α and β are constant coefficients, and α+β=1, 0<α<1, 0<β<1;

[0013] Set the uniformity evaluation threshold H' to determine the uniformity evaluation value H of the vth non-control area v The relationship between H and the threshold value H' is v Non-control areas with <H′ were classified as low-difference areas;

[0014] The number of grids in the low-difference area is counted, and the color uniformity is calculated based on the statistical results. The calculation formula is: color uniformity = [(f+U) / N] × 100%, where N is the total number of grids;

[0015] The data values ​​of individual reverse indicators, intermediate indicators, and interval indicators are processed positively. The positive processing formula is:

[0016] For the reverse indicator: x'=Mx;

[0017] For intermediate indicators:

[0018] For interval indicators:

[0019] In the formula, x' is the value after positive processing; x is the value before processing; M is the maximum value of the index; m is the minimum value of the index; a and b are the lower and upper limits of the optimal interval of the interval index respectively; a * 、b * They are the lower and upper limits of the interval before the interval indicator is processed;

[0020] Calculate the distance between each screening index data of the i-th individual and the optimal value and the worst value respectively and The calculation formula is:

[0021]

[0022] In the formula, is the weight of the j-th screening index value, and It is expressed as the maximum value of the jth screening index value among all individuals; It is expressed as the minimum value of the jth screening index value among all individuals; m is the total number of screening index types;

[0023] According to the formula: Calculate the score C of the i-th individual j , using the individual score value as the standard to classify the grades of individual peaches, the specific process includes the following steps:

[0024] Get individual score C j The value of individual score C j The numerical value of creates a sample set, denoted as {C j1 , C j2 ,,,,,C jT}, where T is the total sample size of individual rating values;

[0025] Get the mean and standard deviation of the sample set, and use the mean and standard deviation to standardize the data. The standardization formula is: In this formula, z is the standard parameter, σ is the variance of the sample data, and μ is the mean of the sample data;

[0026] After standardization is completed, the standard parameters are used Adjust the numerical interval to [0,1], and use the function value of f(k) to classify the individual score values. The classification mechanism is:

[0027] When f(k) min When ≤f(k)<f(k)1, the individual score value is classified as level one;

[0028] When f(k)1≤f(k)<f(k)2, the individual score value is classified as level 2;

[0029] When f(k)2≤f(k)<f(k)3, the individual score values ​​are classified into three levels;

[0030] And so on.

[0031] When f(k) t ≤f(k)<f(k) max When , the individual score value is classified into level t;

[0032] Among them, f(k) min ,f(k)max are the minimum and maximum values ​​of the function value of the f(k) function, f(k)1, f(k)2,,,f(k) t are the middle values ​​of f(k), and f(k) min <f(k)1<f(k)2<,,,<f(k) t <f(k) max .

[0033] The peach screening and grading system based on machine vision includes a machine vision detection module, an image processing module, a data processing module, an evaluation model building module, and an individual grade classification module;

[0034] The machine vision detection module is used to obtain machine vision detection images of individual peaches to be graded;

[0035] The image processing module is used to extract at least one screening index value of the i-th individual in the detection image, including individual maximum fruit diameter, individual maximum perimeter, individual maximum cross-sectional area, roundness, optimal RGB interval of surface color, color uniformity, and optimal color coloring rate;

[0036] The data processing module is used to perform positive processing on the data values ​​of the individual reverse index, intermediate index, and interval index to obtain the screening index value after positive processing;

[0037] The evaluation model building module is used to calculate the distance between the screening index data of the i-th individual and the optimal value and the worst value. and

[0038] The individual level classification module is used according to the formula: Calculate the score C of the i-th individual j , using the individual score value as the standard to classify the grades of individual peaches;

[0039] The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor.

[0040] The present invention has the following beneficial effects:

[0041] Compared with the prior art, an individual screening index system for peaches is constructed, screening indexes are classified into four categories: positive index, negative index, intermediate index and interval index, a machine vision detection image of individual peaches to be graded is obtained, and data values ​​of various screening indexes of individuals in the detection image are extracted. The data values ​​of the negative index, intermediate index and interval index of the individuals are positively processed, and the distances between the screening index data of the i-th individual and the optimal value and the worst value are calculated respectively. and According to the formula: Calculate the score C of the i-th individual j The individual grades of peaches are classified based on the individual score values. Peaches from the same batch are taken as the classification objects, and the superiority and inferiority distance method is used for individual classification, which can reduce the influence of characteristic differences between different varieties or batches on the classification results. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a flow chart of the peach screening and grading method based on machine vision of the present invention;

[0043] Figure 2 The figure is a structural block diagram of the peach screening and grading system based on machine vision of the present invention. DETAILED DESCRIPTION

[0044] The present invention will be further described below in conjunction with specific implementation methods, wherein the accompanying drawings are only used for exemplary descriptions and represent only schematic diagrams rather than actual drawings, and should not be understood as limiting the present invention. In order to better illustrate the specific implementation methods of the present invention, some parts of the accompanying drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product.

[0045] The specific implementation process of the technical solution of the present invention includes the following steps:

[0046] Step 1: Construct an individual screening index system for peaches, and classify the screening indexes into four categories: positive index, reverse index, intermediate index, and interval index;

[0047] It should be noted that the screening index includes at least one of individual maximum fruit diameter, individual maximum circumference, individual maximum cross-sectional area, roundness, optimal RGB interval of external color, color uniformity, and optimal color coloring rate. In this embodiment, we take color uniformity, roundness, individual maximum circumference, and optimal RGB interval of external color as examples to illustrate this solution;

[0048] Step 2: Obtain the machine vision inspection image of the individual peaches to be graded, and extract the data values ​​x of the individual screening indicators in the inspection image ij , represented by the j-th screening index value of the i-th individual, wherein the process of obtaining color uniformity includes the following steps:

[0049] Step 21: Segment the acquired machine vision inspection image of the individual peaches to be graded into grids with a step length of ε, and number the grids in sequence;

[0050] Step 22: extracting the grid whose RGB value is within the optimal RGB interval of the appearance color as the control area;

[0051] Step 23: Get the chromaticity value Cv of the u-th control area u and brightness value Bv u , calculate the contrast chromaticity and contrast brightness Cv' and Bv', where, when u = 1, Cv' = Cv u , Bv'=Bv u ; When u>1, U is the total number of control areas;

[0052] Step 24: Obtain the chromaticity value Cv of the vth non-control area in sequence v and brightness value Bv v , calculate the uniformity evaluation value H between the non-control area and the control area v , the calculation formula is: Wherein, α and β are constant coefficients, and α+β=1, 0<α<1, 0<β<1;

[0053] Step 25: Set the uniformity evaluation threshold H' and determine the uniformity evaluation value H of the vth non-control area v The relationship between H and the threshold value H' is v Non-control areas with <H′ were classified as low-difference areas;

[0054] Step 26: Count the number of grids f in the low-difference area, and calculate the color uniformity according to the statistical results. The calculation formula is: color uniformity = [(f+U) / N] × 100%, where N is the total number of grids;

[0055] The best RGB interval of the appearance color can be obtained by manually setting it or determining it based on the detection image, manually selecting the individual outer surface image with the best color from the detection image, and extracting the RGB interval value of the corresponding area in the image as the best RGB interval of the appearance color;

[0056] For obtaining the roundness and individual maximum circumference data, the roundness calculation method in Halcon can be used, specifically:

[0057] Let p be the center point of the region, p i is all the pixels on the image contour, F is the image contour area, that is, the total number of pixels, then:

[0058]

[0059] Where Di is the average distance from the pixel point on the contour to the center; Si is the deviation between the distance from the pixel point on the contour to the center and the average distance; Ro is the relationship between the average and the standard deviation;

[0060] To obtain the individual maximum perimeter data, the individual contours in the image at different angles are extracted and the contour perimeter is taken as the maximum value;

[0061] Step 3: Perform positive processing on the data values ​​of individual reverse indicators, intermediate indicators, and interval indicators. The positive processing formula is:

[0062] For the reverse indicator: x'=Mx;

[0063] For intermediate indicators:

[0064] For interval indicators:

[0065] In the formula, x' is the value after positive processing; x is the value before processing; M is the maximum value of the index; m is the minimum value of the index; a and b are the lower and upper limits of the optimal interval of the interval index respectively; a * 、b * They are the lower and upper limits of the interval before the interval indicator is processed;

[0066] It should be noted that for the color uniformity index, the more uniform the color distribution is, the more proportional it is to the sum of the low-difference area and the control area. This means that the larger the proportion of the low-difference area and the control area in the grid, the more uniform the color distribution is. The more uniform the color distribution is, the better the quality of the individual peaches is. Therefore, color uniformity is a positive indicator and does not require data conversion.

[0067] As for roundness, it is the degree to which the individual contour in the image is close to the theoretical circle. When the difference between the maximum radius and the minimum radius is 0, the roundness is 0. The closer the roundness value is to 0, the closer the individual is to a sphere and the better the quality. It is an inverse indicator.

[0068] For the maximum circumference of an individual, the larger the maximum circumference of an individual, the larger the fruit and the better the quality, so it is a positive indicator and does not require data conversion;

[0069] For the optimal RGB interval of the external color, when the external surface color of the fruit individual is closer to the set interval, it means that its color is better and the quality is better, so it is an interval-type indicator;

[0070] According to the division results of the above indicators, the corresponding positive processing method can be used for processing;

[0071] Step 4: Calculate the distance between each screening index data of the i-th individual and the optimal value and the worst value respectively and , the calculation formula is:

[0072]

[0073] In the formula, is the weight of the j-th screening index value, and It is expressed as the maximum value of the jth screening index value among all individuals; It is expressed as the minimum value of the jth screening index value among all individuals; m is the total number of screening index types;

[0074] Step 5: According to the formula: Calculate the score C of the i-th individual j , using the individual score value as the standard to classify the grades of individual peaches, the specific process includes the following steps:

[0075] Step 51: Obtain individual score C j The value of individual score C j The numerical value of creates a sample set, denoted as {C j1 , C j2 ,,,,,C jT}, where T is the total sample size of individual rating values;

[0076] Step 52: Get the mean and standard deviation of the sample set, and use the mean and standard deviation to standardize the data. The standardization formula is: In this formula, z is the standard parameter, σ is the variance of the sample data, and μ is the mean of the sample data;

[0077] Step 53: After completing the standardization, use the standard parameters Adjust the numerical interval to [0,1], and use the function value of f(k) to classify the individual score values. The classification mechanism is:

[0078] When f(k) min When ≤f(k)<f(k)1, the individual score value is classified as level one;

[0079] When f(k)1≤f(k)<f(k)2, the individual score value is classified as level 2;

[0080] When f(k)2≤f(k)<f(k)3, the individual score values ​​are classified into three levels;

[0081] And so on.

[0082] When f(k) t ≤f(k)<f(k) max When , the individual score value is classified into level t;

[0083] Among them, f(k) min ,f(k) max are the minimum and maximum values ​​of the function value of the f(k) function, f(k)1, f(k)2,,,f(k) t are the middle values ​​of f(k), and f(k)min <f(k)1<f(k)2<,,,<f(k) t <f(k) max .

[0084] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A peach screening and grading method based on machine vision, characterized in that: include: An individual screening index system for peaches was constructed, and the screening indexes were classified into four categories: positive index, reverse index, intermediate index and interval index. Obtain a machine vision inspection image of the individual peaches to be graded, and extract the data values ​​x of various screening indicators of the individual in the inspection image. ij , expressed as the j-th screening index value of the i-th individual; The data values ​​of individual reverse indicators, intermediate indicators, and interval indicators are processed positively; Calculate the distance between each screening index data of the i-th individual and the optimal value and the worst value respectively and The calculation formula is: In the formula, is the weight of the j-th screening index value, and It is expressed as the maximum value of the jth screening index value among all individuals; It is expressed as the minimum value of the jth screening index value among all individuals; m is the total number of screening index types; According to the formula: Calculate the score C of the i-th individual j , using the individual score value as the standard to classify the grades of individual peaches; The forward processing formula is: For the reverse indicator: x'=Mx; For intermediate indicators: For interval indicators: In the formula, x' is the value after positive processing; x is the value before processing; M is the maximum value of the index; m is the minimum value of the index; a and b are the lower and upper limits of the optimal interval of the interval index respectively; a * , b * They are respectively the lower and upper limits of the interval before the interval-type indicator is processed.

2. The method for screening and grading honey peaches based on machine vision according to claim 1, characterized in that: The screening index includes at least one of individual maximum fruit diameter, individual maximum circumference, individual maximum cross-sectional area, roundness, optimal RGB interval of surface color, color uniformity, and optimal color coloring rate.

3. The method for screening and grading honey peaches based on machine vision according to claim 2, characterized in that: The process of obtaining the color uniformity includes the following steps: The obtained machine vision inspection image of the individual peaches to be graded is divided into grids with a step length of ε, and the grids are numbered in sequence; Extracting grids whose RGB values ​​are within the optimal RGB interval of the surface color as control areas; Get the chromaticity value Cv of the u-th control area u and brightness value Bv u , calculate the contrast chromaticity and contrast brightness Cv' and Bv', where, when u = 1, Cv' = Cv u , Bv'=Bv u ; When u>1, U is the total number of control areas; Obtain the chromaticity value Cv of the vth non-control area in sequence v and brightness value Bv v , calculate the uniformity evaluation value H between the non-control area and the control area v , the calculation formula is: Wherein, α and β are constant coefficients, and α+β=1, 0<α<1, 0<β<1; Set the uniformity evaluation threshold H' to determine the uniformity evaluation value H of the vth non-control area v The relationship between H and the threshold value H' is v Non-control areas with <H′ were classified as low-difference areas; The number of grids in the low-difference area is counted, and the color uniformity is calculated based on the statistical results. The calculation formula is: color uniformity=[(f+U) / N]×100%, where N is the total number of grids.

4. The method for screening and grading honey peaches based on machine vision according to claim 1, characterized in that: The classification process of individual peaches includes the following steps: Get individual score C j The value of individual score C j The numerical value of creates a sample set, denoted as {C j1 , C j2 ,,,,,C jT }, where T is the total sample size of individual rating values; Get the mean and standard deviation of the sample set, and use the mean and standard deviation to standardize the data. The standardization formula is: In this formula, z is the standard parameter, σ is the variance of the sample data, and μ is the mean of the sample data; After standardization is completed, the standard parameters are used Adjust the numerical interval to [0,1], and use the function value of f(k) to classify the individual score values. The classification mechanism is: When f(k) min When ≤f(k)<f(k)1, the individual score value is classified as level one; When f(k)1≤f(k)<f(k)2, the individual score value is classified as level 2; When f(k)2≤f(k)<f(k)3, the individual score values ​​are classified into three levels; And so on. When f(k) t ≤f(k)<f(k) max When , the individual score value is classified into level t; Among them, f(k) min ,f(k) max are the minimum and maximum values ​​of the function value of the f(k) function, f(k)1, f(k)2,,,f(k) t are the middle values ​​of f(k), and f(k) min <f(k)1<f(k)2<,,,<f(k) t <f(k) max .

5. The peach screening and grading system based on machine vision is characterized by: It includes machine vision detection module, image processing module, data processing module, evaluation model building module, and individual grade classification module; The machine vision detection module is used to obtain machine vision detection images of individual peaches to be graded; The image processing module is used to extract the jth screening index value x of the i-th individual in the detection image ij , wherein the screening index includes at least one of individual maximum fruit diameter, individual maximum circumference, individual maximum cross-sectional area, roundness, optimal RGB interval of surface color, color uniformity, and optimal color coloring rate; The data processing module is used to perform positive processing on the data values ​​of the individual reverse index, intermediate index, and interval index to obtain the screening index value after positive processing; the positive processing formula is: For the reverse indicator: x'=Mx; For intermediate indicators: For interval indicators: In the formula, x' is the value after positive processing; x is the value before processing; M is the maximum value of the index; m is the minimum value of the index; a and b are the lower and upper limits of the optimal interval of the interval index respectively; a * , b * They are the lower and upper limits of the interval before the interval indicator is processed; The evaluation model building module is used to calculate the distance between the screening index data of the i-th individual and the optimal value and the worst value. and The calculation formula is: In the formula, is the weight of the j-th screening index value, and It is expressed as the maximum value of the jth screening index value among all individuals; It is expressed as the minimum value of the jth screening index value among all individuals; m is the total number of screening index types; The individual level classification module is used according to the formula: Calculate the score C of the i-th individual j , the grades of individual peaches are classified based on the individual score values.

6. The peach screening and grading system based on machine vision according to claim 5 is characterized in that: The system comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the method according to any one of claims 1 to 4 are implemented when the processor executes the program.

Citation Information

Patent Citations

  • A non-destructive testing method for agricultural product quality indicators

    AU2020102405A4

  • Apple grading method and system based on machine vision

    CN110276386A