CN116797575A - Intelligent detection method for broken rice rate based on machine vision - Google Patents

Intelligent detection method for broken rice rate based on machine vision Download PDF

Info

Publication number
CN116797575A
CN116797575A CN202310758387.6A CN202310758387A CN116797575A CN 116797575 A CN116797575 A CN 116797575A CN 202310758387 A CN202310758387 A CN 202310758387A CN 116797575 A CN116797575 A CN 116797575A
Authority
CN
China
Prior art keywords
rice
image
broken
whole
broken rice
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310758387.6A
Other languages
Chinese (zh)
Inventor
陈卫东
李宛玉
王莹
范冰冰
刘超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Henan University of Technology
Original Assignee
Henan University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Henan University of Technology filed Critical Henan University of Technology
Priority to CN202310758387.6A priority Critical patent/CN116797575A/en
Publication of CN116797575A publication Critical patent/CN116797575A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)

Abstract

A machine vision-based intelligent detection method for broken rice rate comprises the following steps: s1, randomly selecting a plurality of groups of rice samples with different quality, and collecting sample images, wherein the sample images comprise whole rice images and broken rice images; s2, performing preprocessing optimization on the whole rice image; s3, determining a whole broken rice classification threshold value based on the sum of the projection areas of the rice grains in the whole rice image and the number of the rice grains; s4, establishing association data of the sum of the projection areas of the rice grains in the whole rice image and the broken rice image and the quality of the rice sample, and generating training data and test data based on the association data; s5, building a regression model, training the regression model by using training data, and checking a training result of the regression model by using verification data; s6, collecting a mixed image containing whole rice and broken rice, and calculating the broken rice rate based on the mixed image and a trained regression model. The invention has higher detection efficiency and higher accuracy of detection results.

Description

Intelligent detection method for broken rice rate based on machine vision
Technical Field
The invention relates to the technical field of rice detection, in particular to an intelligent detection method for broken rice rate based on machine vision.
Background
The appearance of rice is an important consideration in measuring the quality of rice, wherein broken rice is related to the cooking quality of rice, the eating quality and the storage safety thereof. Meanwhile, in the production and processing process of rice, the higher the processing precision of the rice is, the higher the broken rice rate is correspondingly increased. The broken rice rate is not only an index for determining the quality of rice, but also an important basis for purchasing, selling and pricing rice, and relates to economic benefits of both purchasing and selling parties.
The traditional broken rice rate detection mainly realizes the classification of whole broken rice by a screening method and a manual method, the quality of the broken rice and the batch of samples is obtained by a weighing method, the broken rice content is calculated according to the mass ratio, but the detection capability of a grain storage enterprise of a basic level is generally weak, and the detection result has strong subjectivity. The phenomenon of excessive broken rice content caused by the method not only affects the nutritive value of rice, but also brings huge loss to enterprises, and meanwhile, the phenomenon that a fleet of long dragons appear on a rice purchasing site can be caused, so that the requirement of detecting broken rice rate under a new situation can not be met. Most of the existing machine vision-based broken rice rate detection methods adopt a machine vision technology to finish the classification of the whole broken rice, then count the number of the broken rice and rice grains in the batch of samples by a counting method, and measure the broken rice rate by a number ratio. However, because different types of rice have differences in volume, density, volume weight and the like, a large error exists in calculating the broken rice rate by using the number ratio.
Disclosure of Invention
In order to solve the defects in the prior art, the invention provides the intelligent detection method for the broken rice rate based on machine vision, which has higher detection efficiency and higher accuracy of detection results.
In order to achieve the above purpose, the invention adopts the following specific scheme: a machine vision-based intelligent detection method for broken rice rate comprises the following steps:
s1, randomly selecting a plurality of groups of rice samples with different quality, and collecting sample images, wherein the sample images comprise whole rice images and broken rice images;
s2, performing preprocessing optimization on the whole rice image;
s3, determining a whole broken rice classification threshold value based on the sum of the projection areas of the rice grains in the whole rice image and the number of the rice grains;
s4, establishing association data of the sum of the projection areas of the rice grains in the whole rice image and the broken rice image and the quality of the rice sample, and generating training data and test data based on the association data;
s5, building a regression model, training the regression model by using training data, and checking a training result of the regression model by using verification data;
s6, collecting a mixed image containing whole rice and broken rice, and calculating the broken rice rate based on the mixed image and a trained regression model.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: in S1, the method for acquiring the sample image includes:
randomly scattering the rice samples on a black background object;
and shooting the rice sample by using an industrial camera to obtain a sample image.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: in S2, the method for optimizing the pretreatment of the whole rice image comprises pretreatment, background segmentation and adhered rice segmentation.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: in S2, the pretreatment method comprises the following steps:
transforming the sample image from a color image to a gray scale image;
noise is eliminated through median filtering;
the background segmentation method comprises the following steps:
determining a binarization segmentation threshold by adopting a maximum inter-class variance method;
performing binarization processing on the sample image based on the binarization segmentation threshold value to obtain a binarized image;
removing target boundary noise of the binarized image through morphological opening operation and filling holes;
the method for cutting the adhered rice grains is a cutting algorithm based on convex hull defect point detection.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: the specific method of S3 comprises the following steps: acquiring contour lines of all rice grains through an edge detection algorithm;
calculating the contour line and the number of pixel points in the contour line as the projection area of rice grains;
calculating the sum of the projection areas of all rice grains and the number of the rice grains;
and calculating the average value of the projection area of each rice grain, and multiplying the average value by a preset proportion value to obtain the whole broken rice classification threshold value.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: and S4, counting the sum of the projection areas of rice grains in all sample images corresponding to each group of rice samples, establishing associated data with the quality of the rice samples, and dividing training data and test data according to a preset dividing proportion.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: and S5, respectively establishing two regression models, respectively training the two regression models by using training data corresponding to the whole-meter image and training data corresponding to the broken-meter image, and further respectively testing training results of the two regression models by using test data corresponding to the whole-meter image and test data corresponding to the broken-meter image.
As a further optimization of the intelligent detection method for the broken rice rate based on machine vision, the following steps are adopted: the specific method of S6 comprises the following steps: calculating the projection area of each rice grain in the mixed image, and classifying each rice grain based on the whole broken rice classification threshold;
calculating the sum of the projection areas of the whole rice and the sum of the projection areas of the broken rice in the mixed image based on the classification result of each rice grain; calculating the whole rice quality and the broken rice quality by using a regression model, and summing the whole rice quality and the broken rice quality to obtain total quality;
calculating the ratio of the broken rice mass to the total mass as the broken rice rate.
The beneficial effects are that: according to the invention, the broken rice rate of rice is detected by using a machine vision method, image data is analyzed, the calculation of the broken rice rate is completed through the mass ratio, a weighing method is not needed in the whole process, and no human participation is needed, so that the detection process is quicker, lossless, accurate and objective, the system of the existing detection technology is enriched, and the method can be widely applied in the rice processing production and purchasing process.
Drawings
Fig. 1 is a flow chart of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, an intelligent detection method for broken rice rate based on machine vision includes S1 to S6.
S1, randomly selecting a plurality of groups of rice samples with different quality, and collecting sample images, wherein the sample images comprise whole rice images and broken rice images. In S1, the method for acquiring the sample image includes: randomly scattering the rice samples on a black background object; and shooting the rice sample by using an industrial camera to obtain a sample image. The rice samples are scattered on the black background randomly, so that the rice samples can be prevented from being placed neatly, the posture of the rice is guaranteed to be closer to an actual application scene, the black background can highlight the rice, the subsequent processing of sample images is facilitated, the black background can be subjected to rough processing, the light reflectivity is reduced, glare on the sample images is avoided, and the subsequent processing is further facilitated.
S2, performing preprocessing optimization on the whole rice image. In S2, the method for optimizing the pretreatment of the whole rice image comprises pretreatment, background segmentation and adhered rice segmentation. Wherein the preprocessing is used to optimize the whole rice image so that it is easier to process by a computer, the background segmentation is used to separate the portion of the rice kernels in the whole rice image from the portion of the black background scene, and the adhered rice kernels segmentation is used to separate two or more rice kernels with certain overlapping portions. More specifically, in S2, the method of preprocessing includes transforming the sample image from a color image to a gray image, and then removing noise by median filtering, which may be a median filter with a window size of 5×5, by setting the gray value of each pixel point in the whole-meter image to be the median of the gray values of all the pixels points in the 5×5 neighborhood window of the point, so as to achieve noise point removal.
The background segmentation method comprises the following steps: and determining a binarization segmentation threshold value by adopting a maximum inter-class variance method, performing binarization processing on the sample image based on the binarization segmentation threshold value to obtain a binarization image so as to realize separation of a target area and a background area, wherein the target area is a part containing rice grains, and removing target boundary noise of the binarization image and filling holes through morphological opening operation. The maximum inter-class variance method is to select a threshold value, divide the gray value of the image pixel point into two types of data which are smaller than and larger than or equal to the threshold value, the variance between the gray values of the background and the target image obtained by the method is maximum, the probability of misclassification of the two areas is caused to be minimum, and meanwhile, each rice image is provided with a respective segmentation threshold value of the rice and the background so as to realize the separation of the target area and the background area. The morphological open operation firstly carries out corrosion-before-expansion operation on the rice binary image to remove rice boundary noise and other isolated noise, and then carries out opposite operation by using morphological close operation to fill holes in the rice binary image.
The method for dividing the adhered rice grains is a division algorithm based on convex hull defect point detection, and specifically comprises the steps of firstly adopting convex hull detection and convex defect detection to obtain convex defects and the furthest point of the convex defects, then calculating the Euclidean distance between the convex defects and the convex hull outline, then selecting two points with the furthest distance as division point pairs, and finally dividing the adhered rice grains through two-dot chain line division.
And S3, determining a whole broken rice classification threshold value based on the sum of the projection areas of the rice grains in the whole rice image and the number of the rice grains. The specific method of S3 comprises the following steps.
And acquiring the contour lines of all rice grains through an edge detection algorithm. In this embodiment, the edge detection algorithm employs a Canny detection algorithm.
And calculating the contour line and the number of pixel points in the contour line as the projection area of the rice grains. By converting the projected area of the rice into the number of pixels, subsequent calculations can be facilitated.
The sum of the projected areas of all rice kernels and the number of rice kernels was calculated.
And calculating the average value of the projection area of each rice grain, and multiplying the average value by a preset proportion value to obtain the whole broken rice classification threshold value. Obviously, the whole meter has larger volume and larger corresponding projection area, and the broken meter has smaller volume and smaller corresponding projection area, so that the projection area of the broken meter can be estimated based on the projection area of the whole meter. In this embodiment, the ratio value may be 0.75. In other embodiments of the present invention, the appropriate ratio value may be determined according to the variety and quality of rice.
And S4, establishing correlation data of the sum of the projection areas of the rice grains in the whole-rice image and the broken-rice image and the quality of the rice sample, and generating training data and test data based on the correlation data. Because the invention finally needs to detect the broken rice rate which is determined by the proportion of the total weight of broken rice to the total weight of rice, the sum of the projection areas of the rice grains needs to be related with the quality of the rice. The specific method in S4 is as follows: and counting the sum of the projection areas of rice grains in all sample images corresponding to each group of rice samples, establishing associated data with the quality of the rice samples, and dividing training data and test data according to preset dividing proportion. It should be noted that, in order to determine the sum of the projection areas of the rice grains in the broken rice image conveniently, the broken rice image needs to be processed, and the processing method is the same as S2, and will not be described here again.
S5, building a regression model, training the regression model by using training data, and checking the training result of the regression model by using verification data. And S5, respectively establishing two regression models, respectively training the two regression models by using training data corresponding to the whole-meter image and training data corresponding to the broken-meter image, and further respectively testing training results of the two regression models by using test data corresponding to the whole-meter image and test data corresponding to the broken-meter image. After training the regression model, the total weight of all grains can be calculated according to the sum of the projection areas of the grains in the image. Before training starts, the iteration times are required to be preset, and the network structure and parameters including weights, biases, learning rates and the like are continuously optimized in the training process, which belong to the conventional technology and are not repeated here. After the regression model is trained, the optimal parameters may be stored for use.
S6, collecting a mixed image containing whole rice and broken rice, and calculating the broken rice rate based on the mixed image and a trained regression model. The specific method of S6 comprises the following steps.
The projected area of each rice grain in the blended image is calculated and each rice grain is classified based on the whole broken rice classification threshold.
And calculating the sum of the projection areas of the whole rice and the sum of the projection areas of the broken rice in the mixed image based on the classification result of each rice grain.
And calculating the whole rice quality and the broken rice quality by using a regression model, and summing the whole rice quality and the broken rice quality to obtain the total quality.
Calculating the ratio of the broken rice mass to the total mass as the broken rice rate.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. The intelligent detection method for the broken rice rate based on the machine vision is characterized by comprising the following steps of:
s1, randomly selecting a plurality of groups of rice samples with different quality, and collecting sample images, wherein the sample images comprise whole rice images and broken rice images;
s2, performing preprocessing optimization on the whole rice image;
s3, determining a whole broken rice classification threshold value based on the sum of the projection areas of the rice grains in the whole rice image and the number of the rice grains;
s4, establishing association data of the sum of the projection areas of the rice grains in the whole rice image and the broken rice image and the quality of the rice sample, and generating training data and test data based on the association data;
s5, building a regression model, training the regression model by using training data, and checking a training result of the regression model by using verification data;
s6, collecting a mixed image containing whole rice and broken rice, and calculating the broken rice rate based on the mixed image and a trained regression model.
2. The intelligent detection method for the broken rice rate based on machine vision according to claim 1, wherein in S1, the method for collecting the sample image comprises the following steps:
randomly scattering the rice samples on a black background object;
and shooting the rice sample by using an industrial camera to obtain a sample image.
3. The intelligent detection method for the rice breakage rate based on machine vision according to claim 1, wherein in S2, the method for optimizing the pretreatment of the whole rice image comprises pretreatment, background segmentation and adhered rice grain segmentation.
4. The intelligent detection method for the broken rice rate based on machine vision according to claim 3, wherein in S2, the pretreatment method comprises:
transforming the sample image from a color image to a gray scale image;
noise is eliminated through median filtering;
the background segmentation method comprises the following steps:
determining a binarization segmentation threshold by adopting a maximum inter-class variance method;
performing binarization processing on the sample image based on the binarization segmentation threshold value to obtain a binarized image;
removing target boundary noise of the binarized image through morphological opening operation and filling holes;
the method for cutting the adhered rice grains is a cutting algorithm based on convex hull defect point detection.
5. The intelligent detection method for the broken rice rate based on machine vision according to claim 1, wherein the specific method of S3 comprises:
acquiring contour lines of all rice grains through an edge detection algorithm;
calculating the contour line and the number of pixel points in the contour line as the projection area of rice grains;
calculating the sum of the projection areas of all rice grains and the number of the rice grains;
and calculating the average value of the projection area of each rice grain, and multiplying the average value by a preset proportion value to obtain the whole broken rice classification threshold value.
6. The intelligent detection method for the broken rice rate based on machine vision according to claim 1, wherein in S4, the sum of the projection areas of rice grains in all sample images corresponding to each group of rice samples is counted, correlation data is established with the quality of the rice samples, and training data and test data are divided according to preset dividing proportions.
7. The intelligent detection method for broken rice rate based on machine vision according to claim 1, wherein in S5, two regression models are respectively built, the two regression models are respectively trained by training data corresponding to whole rice images and training data corresponding to broken rice images, and further training results of the two regression models are respectively tested by using test data corresponding to whole rice images and test data corresponding to broken rice images.
8. The intelligent detection method for the broken rice rate based on machine vision according to claim 1, wherein the specific method of S6 comprises:
calculating the projection area of each rice grain in the mixed image, and classifying each rice grain based on the whole broken rice classification threshold;
calculating the sum of the projection areas of the whole rice and the sum of the projection areas of the broken rice in the mixed image based on the classification result of each rice grain;
calculating the whole rice quality and the broken rice quality by using a regression model, and summing the whole rice quality and the broken rice quality to obtain total quality;
calculating the ratio of the broken rice mass to the total mass as the broken rice rate.
CN202310758387.6A 2023-06-26 2023-06-26 Intelligent detection method for broken rice rate based on machine vision Pending CN116797575A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310758387.6A CN116797575A (en) 2023-06-26 2023-06-26 Intelligent detection method for broken rice rate based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310758387.6A CN116797575A (en) 2023-06-26 2023-06-26 Intelligent detection method for broken rice rate based on machine vision

Publications (1)

Publication Number Publication Date
CN116797575A true CN116797575A (en) 2023-09-22

Family

ID=88043510

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310758387.6A Pending CN116797575A (en) 2023-06-26 2023-06-26 Intelligent detection method for broken rice rate based on machine vision

Country Status (1)

Country Link
CN (1) CN116797575A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117611927A (en) * 2024-01-22 2024-02-27 中储粮成都储藏研究院有限公司 Method and device for detecting rice mixing rate

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117611927A (en) * 2024-01-22 2024-02-27 中储粮成都储藏研究院有限公司 Method and device for detecting rice mixing rate
CN117611927B (en) * 2024-01-22 2024-04-16 中储粮成都储藏研究院有限公司 Method and device for detecting rice mixing rate

Similar Documents

Publication Publication Date Title
CN115294113B (en) Quality detection method for wood veneer
CN115082418B (en) Precise identification method for automobile parts
CN107607554A (en) A kind of Defect Detection and sorting technique of the zinc-plated stamping parts based on full convolutional neural networks
CN109100323B (en) Nondestructive quantitative evaluation method for transmission spectrum of apple water core disease
CN113989279A (en) Plastic film quality detection method based on artificial intelligence and image processing
CN115239704B (en) Accurate detection and repair method for wood surface defects
CN115063409B (en) Method and system for detecting surface material of mechanical cutter
CN116645367B (en) Steel plate cutting quality detection method for high-end manufacturing
CN116703911B (en) LED lamp production quality detecting system
CN116797575A (en) Intelligent detection method for broken rice rate based on machine vision
CN109239073A (en) A kind of detection method of surface flaw for body of a motor car
CN111160451A (en) Flexible material detection method and storage medium thereof
Thinh et al. Mango classification system based on machine vision and artificial intelligence
CN111161237A (en) Fruit and vegetable surface quality detection method, storage medium and sorting device thereof
CN116246174B (en) Sweet potato variety identification method based on image processing
CN114972342B (en) Method for detecting surface defects of gearbox gear
CN114066848A (en) FPCA appearance defect visual inspection system
CN114359235A (en) Wood surface defect detection method based on improved YOLOv5l network
CN117237747B (en) Hardware defect classification and identification method based on artificial intelligence
EP3896650A1 (en) Quality control system for series production
CN110687120A (en) Flange appearance quality detecting system
CN116740449A (en) Shaving form detection method and system based on AI (advanced technology attachment) computer vision technology
CN116958960A (en) Egg dark spot detection method based on machine learning random forest algorithm
CN115830514A (en) Method and system for calculating surface flow velocity of whole river section of riverway with curve
CN115545383A (en) Binocular stereoscopic vision detection method for crisp appearance quality of strawberries

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination