Image processing-based quality detection method for lossless bulk agricultural products and related equipment
Through image processing technology, identify and analyze agricultural product packaging images, calculate the ratio of the quality to actual quality of agricultural products, solve the problems of single detection and missed detection in the existing technology, improve the detection efficiency and accuracy, and reduce the use of inferior products as good ones phenomenon.
Patent Information
- Application Number
- CN202411309461.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-31
AI Technical Summary
The prior art has the problem of single testing methods and easy to miss inspection in agricultural product quality testing. Especially when the size of agricultural products is inferior, it is difficult to effectively supervise the market and seriously damage consumer rights.
The lossless bulk agricultural product quality detection method based on image processing is adopted. By collecting images of packaging agricultural products, image recognition and semantic segmentation are carried out, the total packaging volume, agricultural product type, quality level and pore ratio are calculated, combined with the density of agricultural products, the due quality is determined, and Compare with the actual mass ratio to determine whether there is a situation where inferior products are used as good products.
It improves quality inspection efficiency, reduces the risk of errors and missed inspections, achieves high-quality and high-priced agricultural products, reduces the phenomenon of selling inferior products as good as good products, and improves the accuracy of inspection.
Smart Images

Figure CN119223977A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of agricultural product quality detection and artificial intelligence technology, and in particular to a quality detection method for non-destructive bulk agricultural products based on image processing and related equipment. Background Art
[0002] At present, agricultural product quality grading has effectively achieved the effect of high quality and high price and promoted efficient circulation. However, in the actual market circulation, there is still a phenomenon of using packaging to sell inferior agricultural products as good ones, such as placing good and large fruits in visible positions and filling the inside with small fruits or other heavy objects. Figure 1 As shown, consumers spend high-quality prices to buy low-quality agricultural products, which seriously damages their rights and interests. At present, the market mostly adopts random inspections, which have a single detection method and are prone to missed detection. Summary of the invention
[0003] In order to improve the efficiency of quality inspection and reduce the risk of false inspection and missed inspection, especially the quality inspection of agricultural products that are sold as good ones by using inferior packaging, the present invention provides a quality inspection method and related equipment for non-destructive bulk agricultural products based on image processing, which can have a good supervision effect on the market.
[0004] In a first aspect, the present invention provides a non-destructive bulk agricultural product quality detection method based on image processing, comprising:
[0005] Step 1: Collect the actual quality and packaging images of packaged agricultural products;
[0006] Step 2: performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity ratio;
[0007] Step 3: Determine the expected mass of the packaged agricultural product according to the total volume of the package, the void ratio of the package and the density of the corresponding type of agricultural product;
[0008] Step 4: Calculate the actual mass ratio based on the actual mass and expected mass of the packaged agricultural products, and compare the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size and passed off as good ones.
[0009] Furthermore, before step 2, the method further includes: preprocessing the packaging image; the preprocessing includes: at least one of image surface correction, image enhancement, image equalization, standardization and edge detection.
[0010] Furthermore, in step 2, image recognition and semantic segmentation are performed on the packaging image to obtain the quality grade and packaging porosity ratio, specifically including:
[0011] extracting a product outline and a quantity of each agricultural product visible in the package image to determine an average volume of the individual agricultural products;
[0012] The quality grade of the packaged agricultural products is determined according to the average volume of the individual agricultural products, and the packaging porosity ratio is determined according to a preset relationship between the average volume of the individual agricultural products at the corresponding quality grade and the packaging porosity ratio.
[0013] Furthermore, a deep learning model is used to determine the preset relationship between the average volume of individual agricultural products and the packaging porosity ratio of different types of agricultural products at different quality levels.
[0014] Furthermore, step 3 specifically includes:
[0015] M=ρV0(1-P)
[0016] Among them, M is the required mass of packaged agricultural products, ρ is the density of the corresponding type of agricultural products, V0 is the total volume of the package, and P is the porosity ratio of the package.
[0017] Furthermore, in step 4, the actual mass ratio is calculated based on the actual mass and the expected mass of the packaged agricultural products, specifically:
[0018]
[0019] Among them, α is the actual mass ratio, M is the expected mass of packaged agricultural products, and m is the actual mass of packaged agricultural products.
[0020] In a second aspect, the present invention provides a quality detection system for non-destructive bulk agricultural products based on image processing, comprising:
[0021] An information collection module, used to collect the actual quality of packaged agricultural products and packaging images;
[0022] An image processing module, used for performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity ratio;
[0023] A mass calculation module, used to determine the expected mass of the packaged agricultural products according to the total volume of the package, the void ratio of the package and the density of the corresponding type of agricultural products;
[0024] The quality detection module is used to calculate the actual mass ratio according to the actual mass and the expected mass of the packaged agricultural products, and compare the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size and good in quality.
[0025] Furthermore, the quality inspection system also includes:
[0026] The preprocessing module is used to preprocess the packaging image; the preprocessing includes: at least one of image surface correction, image enhancement, image equalization, standardization and edge detection.
[0027] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0028] In a fourth aspect, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in the first aspect.
[0029] Beneficial effects of the present invention:
[0030] The present invention collects packaging images of the inspected packaged agricultural products from various viewing angles, performs image processing and analysis on the packaging images, and can analyze and judge the quality of the agricultural products without damaging the packaging of the agricultural products. The method of the present invention can effectively improve the efficiency of quality inspection, reduce the risk of false inspections, and is conducive to achieving high-quality and high-price agricultural products, promoting efficient circulation, and reducing the phenomenon of selling inferior products as good ones. It is particularly suitable for quality inspection of the size of agricultural products. At the same time, the present invention adopts a method of comparing the actual mass ratio with the theoretical mass ratio range to achieve quality inspection, which can improve the detection accuracy of agricultural products. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of the cross section of the packaging for agricultural products;
[0032] Figure 2 A schematic flow chart of a non-destructive bulk agricultural product quality detection method based on image processing provided by an embodiment of the present invention;
[0033] Figure 3 A schematic diagram of the structure of a non-destructive bulk agricultural product quality detection system based on image processing provided by an embodiment of the present invention;
[0034] Figure 4 A structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] like Figure 2 As shown, an embodiment of the present invention provides a method for quality detection of non-destructive bulk agricultural products based on image processing, comprising the following steps:
[0037] S101: Collecting actual quality and packaging images of packaged agricultural products;
[0038] It can be understood that in order to facilitate the accurate analysis of the packaged agricultural products in the subsequent steps, the packaging image should satisfy the requirement that the complete arrangement of the agricultural products on at least one side (e.g., the top, the side, or the bottom) of the packaged agricultural products can be observed. In practical applications, this step can collect packaging images from various viewing angles, such as the front view, the rear view, the left view, the right view, the top view, and the bottom view of the packaged agricultural products. The actual quality of the packaged agricultural products refers to the real-time detection weight of the packaged agricultural products themselves. The agricultural products in this embodiment include but are not limited to apples, oranges, garlic, potatoes, and other agricultural products that can be bulked and have a certain packaging porosity ratio.
[0039] S102: performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity ratio;
[0040] It can be understood that the total packaging volume refers to the volume of the agricultural product packaging in its natural state. The quality grade refers to the classification of the quality of agricultural products mainly according to the size of the agricultural products, such as extra-large fruit, large fruit, medium fruit and small fruit, etc. The packaging porosity refers to the ratio of the pores inside the packaging to the total packaging volume.
[0041] In this embodiment, the following formula is used to define the packaging void ratio:
[0042]
[0043] Where P is the porosity of the package, V0 is the total volume of the package, and V is the total absolute dense volume of the agricultural products inside the package.
[0044] S103: Determining the required mass of the packaged agricultural products according to the total volume of the package, the void ratio of the package and the density of the corresponding type of agricultural products;
[0045] It can be understood that from the above formula (1) we can get:
[0046] V=V0×(1-P) (2)
[0047] Therefore, combined with the known density of the corresponding type of agricultural products, the application quality of packaged agricultural products can be calculated according to the following formula:
[0048] M=ρV=ρV0(1-P) (3)
[0049] S104: Calculate the actual mass ratio according to the actual mass and the expected mass of the packaged agricultural product, and compare the actual mass ratio with the theoretical mass ratio range under the corresponding quality level to determine whether the packaged agricultural product is inferior in size and good in quality. When it is considered that the quality is inferior in quality and good in quality, an output display and / or voice reminder can be performed. If not, the next packaged agricultural product is tested.
[0050] It can be understood that, in order to facilitate comparison, for the same type of agricultural products, the theoretical mass ratio range can be pre-defined and stored in the database; when setting the theoretical mass ratio range, the influence of factors such as temperature on density and the size differences of agricultural products of the same grade can be taken into account. By analyzing the mass ratios of agricultural products of different sizes at the same grade, the mass ratio range [α min ,α max According to the above method, the theoretical mass ratio ranges of various types of agricultural products are stored in the database in advance. If the calculated actual mass ratio exceeds the corresponding theoretical mass ratio range, it is considered that there is a situation where the size of agricultural products is inferior to that of good ones.
[0051] The non-destructive bulk agricultural product quality inspection method based on image processing provided by the embodiment of the present invention collects packaging images of packaged agricultural products from various viewing angles, performs image processing and analysis on the packaging images, and can analyze and judge the quality of agricultural products without damaging the packaging of agricultural products. The method of the present invention can effectively improve the efficiency of quality inspection, reduce the risk of false inspections, and is conducive to achieving high-quality and high-price agricultural products, promoting efficient circulation, and reducing the phenomenon of selling inferior products as good ones. It is particularly suitable for the quality inspection of agricultural products. At the same time, the quality inspection can be realized by comparing the actual mass ratio with the theoretical mass ratio range, which can improve the detection accuracy of agricultural products.
[0052] In one embodiment, existing image recognition algorithms are used to extract features such as surface texture, shape and size of agricultural products and features such as contour boundaries of packaging to identify the total volume of packaging and the type of agricultural products in the packaging image, which will not be repeated here.
[0053] In one embodiment, image recognition and semantic segmentation are performed on the packaging image to obtain the quality grade and packaging porosity ratio, specifically including: extracting the visible product outline (such as maximum diameter, minimum diameter, taper and other features) and the number of agricultural products of each agricultural product from the packaging image to determine the average volume of a single agricultural product; determining the quality grade of the packaged agricultural product according to the average volume of the single agricultural product, and determining the packaging porosity ratio according to a preset relationship between the average volume of the single agricultural product at the corresponding quality grade and the packaging porosity ratio.
[0054] It can be understood that the volume of agricultural products can be estimated by extracting the product outline of agricultural products, and the volume and quantity of all visible agricultural products can be counted, and then the average volume of a single agricultural product can be calculated. In actual applications, users can pre-define the volume size range of a single agricultural product corresponding to different quality levels according to the needs of actual scenarios, so that the corresponding quality level can be determined according to the average volume of a single agricultural product.
[0055] It can be understood that a data-driven deep learning model can be used to determine the preset relationship between the average volume of individual agricultural products and the packaging porosity ratio of different types of agricultural products at different quality levels. Specifically, first, an agricultural product database is constructed to collect the average volume and packaging porosity ratio of individual agricultural products of various types of agricultural products at different quality levels; then a deep learning network is selected and trained using the agricultural product database to finally obtain the preset relationship between the two.
[0056] In this embodiment, the actual mass ratio is calculated using the following formula:
[0057]
[0058] Among them, α is the actual mass ratio, M is the expected mass of packaged agricultural products, and m is the actual mass of packaged agricultural products.
[0059] In one embodiment, in order to improve the efficiency and accuracy of image processing, the packaging image may be preprocessed before image recognition and semantic segmentation are performed on the packaging image.
[0060] Specifically, preprocessing includes: at least one of image surface correction, image enhancement, image equalization, standardization and edge detection. Among them, image surface correction aims to remove distortion, deviation, optical and chromatic deviation in the shooting process and improve the accuracy of features; image enhancement aims to improve image contrast and make features more obvious; image equalization aims to make image grayscale distribution more uniform; standardization aims to improve data processing efficiency; edge detection aims to enhance image edge information, which helps to accurately extract features and improve segmentation accuracy.
[0061] like Figure 3As shown, an embodiment of the present invention provides a quality detection system for lossless bulk agricultural products based on image processing, including: an information collection module, an image processing module, a quality calculation module and a quality detection module.
[0062] The information collection module is used to collect the actual mass and packaging images of packaged agricultural products; the image processing module is used to perform image recognition and semantic segmentation on the packaging images to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity; the mass calculation module is used to determine the expected mass of the packaged agricultural products based on the total packaging volume, the packaging porosity and the density of the corresponding type of agricultural products; the quality detection module is used to calculate the actual mass ratio based on the actual mass and the expected mass of the packaged agricultural products, and compare the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size.
[0063] Furthermore, the quality inspection system also includes a preprocessing module; the preprocessing module is used to preprocess the packaging image; the preprocessing includes: at least one of image surface correction, image enhancement, image equalization, standardization and edge detection.
[0064] Furthermore, the quality detection system also includes a prompt module for displaying the judgment result or providing voice prompts.
[0065] It should be noted that the system provided in the embodiment of the present invention is for implementing the above method, and its specific functions can be referred to the above method embodiments, which will not be described again here.
[0066] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 401, a communication interface 402, a memory 403 and a communication bus 404, wherein the processor 401, the communication interface 402 and the memory 403 communicate with each other through the communication bus 404. The processor 401 may call the logic instructions in the memory 403 to execute the quality detection method, which includes: step 1: collecting the actual quality and packaging image of the packaged agricultural product; step 2: performing image recognition and semantic segmentation on the package image to obtain the total packaging volume, the type of agricultural product, the quality grade and the packaging porosity; step 3: determining the expected quality of the packaged agricultural product according to the total packaging volume, the packaging porosity and the density of the corresponding type of agricultural product; step 4: calculating the actual quality ratio according to the actual quality and the expected quality of the packaged agricultural product, and comparing the actual quality ratio with the theoretical quality ratio range under the corresponding quality grade to determine whether the packaged agricultural product is inferior in size.
[0067] In addition, when the logic instructions in the above-mentioned memory 403 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0068] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: Step 1: Collecting the actual mass and packaging image of packaged agricultural products; Step 2: Performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity; Step 3: Determining the expected mass of the packaged agricultural products based on the total packaging volume, the packaging porosity and the density of the corresponding type of agricultural products; Step 4: Calculating the actual mass ratio based on the actual mass and the expected mass of the packaged agricultural products, and comparing the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size.
[0069] An embodiment of the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the methods provided by the above-mentioned method embodiments are implemented, for example, including: Step 1: Collecting the actual mass and packaging image of packaged agricultural products; Step 2: Performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity; Step 3: Determining the expected mass of the packaged agricultural products based on the total packaging volume, the packaging porosity and the density of the corresponding type of agricultural products; Step 4: Calculating the actual mass ratio based on the actual mass and the expected mass of the packaged agricultural products, and comparing the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size and good in quality.
[0070] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0071] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A non-destructive bulk agricultural product quality detection method based on image processing, characterized in that: include: Step 1: Collect the actual quality and packaging images of packaged agricultural products; Step 2: performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity ratio; Step 3: Determine the expected mass of the packaged agricultural product according to the total volume of the package, the void ratio of the package and the density of the corresponding type of agricultural product; Step 4: Calculate the actual mass ratio based on the actual mass and expected mass of the packaged agricultural products, and compare the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size and passed off as good ones.
2. The method for quality inspection of non-destructive bulk agricultural products based on image processing according to claim 1 is characterized in that: Before step 2, the method further includes: preprocessing the packaging image; the preprocessing includes: at least one of image surface correction, image enhancement, image equalization, standardization and edge detection.
3. The method for quality inspection of non-destructive bulk agricultural products based on image processing according to claim 1, characterized in that: In step 2, image recognition and semantic segmentation are performed on the packaging image to obtain the quality grade and packaging porosity ratio, specifically including: extracting a product outline and a quantity of each agricultural product visible in the package image to determine an average volume of the individual agricultural products; The quality grade of the packaged agricultural products is determined according to the average volume of the individual agricultural products, and the packaging porosity ratio is determined according to a preset relationship between the average volume of the individual agricultural products at the corresponding quality grade and the packaging porosity ratio.
4. The method for quality inspection of non-destructive bulk agricultural products based on image processing according to claim 3 is characterized in that: A deep learning model is used to determine the preset relationship between the average volume of individual agricultural products and the packaging porosity ratio for different types of agricultural products at different quality levels.
5. The method for quality inspection of non-destructive bulk agricultural products based on image processing according to claim 1, characterized in that: Step 3 specifically includes: M=ρV0(1-P) Among them, M is the required mass of packaged agricultural products, ρ is the density of the corresponding type of agricultural products, V0 is the total volume of the package, and P is the porosity ratio of the package.
6. The method for quality inspection of non-destructive bulk agricultural products based on image processing according to claim 1, characterized in that: In step 4, the actual mass ratio is calculated based on the actual mass and the expected mass of the packaged agricultural products, specifically: Among them, α is the actual mass ratio, M is the expected mass of packaged agricultural products, and m is the actual mass of packaged agricultural products.
7. A non-destructive bulk agricultural product quality inspection system based on image processing, characterized in that: include: An information collection module, used to collect the actual quality of packaged agricultural products and packaging images; An image processing module, used for performing image recognition and semantic segmentation on the packaging image to obtain the total packaging volume, agricultural product type, quality grade and packaging porosity ratio; A mass calculation module, used to determine the expected mass of the packaged agricultural products according to the total volume of the package, the void ratio of the package and the density of the corresponding type of agricultural products; The quality detection module is used to calculate the actual mass ratio according to the actual mass and the expected mass of the packaged agricultural products, and compare the actual mass ratio with the theoretical mass ratio range under the corresponding quality grade to determine whether the packaged agricultural products are inferior in size and good in quality.
8. The non-destructive bulk agricultural product quality inspection system based on image processing according to claim 7 is characterized in that: Also includes: A preprocessing module, used for preprocessing the packaging image; The preprocessing includes: at least one of image surface correction, image enhancement, image equalization, standardization and edge detection.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
