Rice quality evaluation system based on machine vision

Through machine vision technology and deep learning models, the subjectivity and time-consuming problems of traditional rice quality assessment methods have been solved, and rapid, objective assessment and large-scale detection of rice quality have been achieved.

CN120807480APending Publication Date: 2025-10-17TENCENT YANTAI NEW ENG RES INST +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511047242.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-29
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Traditional rice quality assessment methods rely on manual sensory evaluation, which is highly subjective and time-consuming, and laboratory chemical analysis operations are cumbersome, making it difficult to achieve large-scale rapid testing.

Method used

A rice quality assessment system based on machine vision is designed, which includes image acquisition, preprocessing, image segmentation, feature extraction and quality assessment modules. The deep belief network and XGBoost model are used to evaluate rice quality.

Benefits of technology

It achieves objectivity and consistency in rice quality assessment, shortens testing time, is suitable for large-scale online testing, and provides a reliable basis for quality control and market grading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure EBJSAEH2BAUP8S1AE7GZI9CIOUOOETC713QSNAWS
    Figure EBJSAEH2BAUP8S1AE7GZI9CIOUOOETC713QSNAWS
  • Figure ESJ3D7URVOFZGEGNUZGMVPRNGFFPT4B5ON3M4SXK
    Figure ESJ3D7URVOFZGEGNUZGMVPRNGFFPT4B5ON3M4SXK
  • Figure SNMT1QXBHP4N11FUZG3KSHIDLOVXWHD3CW5YKLE4
    Figure SNMT1QXBHP4N11FUZG3KSHIDLOVXWHD3CW5YKLE4
Patent Text Reader

Abstract

The invention relates to the technical field of agricultural product quality detection, and discloses a rice quality evaluation system based on machine vision, an image acquisition module is used for acquiring an original image of a rice sample, and preprocessing the acquired original image to obtain a preprocessed rice image; the image segmentation module is used for carrying out image segmentation on the preprocessed rice image to obtain a rice particle image; the feature extraction module is used for extracting chalkiness features and appearance features of the segmented rice particle images to obtain target feature information; the quality evaluation module is used for inputting the target feature information into a quality evaluation model and outputting a rice quality evaluation result through the quality evaluation model; according to the invention, the detection time is greatly shortened, and the requirements of large-scale and on-line detection can be met.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of agricultural product quality detection, and particularly relates to a rice quality evaluation system based on machine vision. BACKGROUND

[0002] Rice is one of the important food crops in the world, and the quality thereof directly affects the eating experience and nutrition intake of consumers. Traditional rice quality evaluation methods mainly rely on artificial sensory evaluation and laboratory chemical analysis. Artificial sensory evaluation is greatly affected by subjective factors, and the evaluation results of different evaluators are quite different. Laboratory chemical analysis is accurate, but is tedious, time-consuming, and requires professional equipment and technical personnel, and thus cannot be used for large-scale, rapid online detection. SUMMARY

[0003] The present application aims to solve the above problems, and provides a rice quality evaluation system based on machine vision.

[0004] The present application provides a rice quality evaluation system based on machine vision, which comprises: An image acquisition module, configured to acquire an original image of a rice sample, and to pre-process the acquired original image to obtain a pre-processed rice image; An image segmentation module, configured to perform image segmentation on the pre-processed rice image to obtain a rice grain image; A feature extraction module, configured to extract chalkiness features and appearance features from the segmented rice grain image to obtain target feature information; A quality evaluation module, configured to input the target feature information into a quality evaluation model, and to output a rice quality evaluation result through the quality evaluation model.

[0005] Optionally, in the first implementation manner of the present application, the image acquisition module comprises: A grayscale sub-module, configured to acquire an original image of a rice sample, and to perform grayscale processing on the original image to obtain a grayscale image; A denoising sub-module, configured to perform median filtering on the grayscale image to obtain a denoised image; An equalization sub-module, configured to divide the denoised image into a plurality of non-overlapping small blocks, to perform histogram equalization processing on each small block, and to perform smoothing processing on the boundaries of adjacent small blocks by using a bilinear interpolation method, to obtain a pre-processed rice image.

[0006] Optionally, in the second implementation manner of the present application, the denoising sub-module comprises: The traversal unit is used to determine the filter window size as 3×3, traverse each pixel in the grayscale image row by row and column by column, and extract all pixel values ​​within the filter window of the currently traversed pixel with the pixel as the center; The sorting unit is used to sort all the pixel values ​​in the extracted window in ascending order. In the sorted pixel value sequence, the pixel value in the middle position is selected as the median. The selected median is assigned to the currently traversed pixel, replacing its original grayscale value, until all pixels in the image are traversed to obtain the denoised image.

[0007] Optionally, in a third implementation of the present invention, the image segmentation module includes: The smoothing submodule is used to smooth the pre-processed rice image using Gaussian filtering and calculate the gradient amplitude and direction of the image in the horizontal and vertical directions using the Canny operator; The dual-threshold processing submodule is used to perform non-maximum suppression on the gradient amplitude. By applying dual-threshold processing, pixels with gradient amplitudes greater than a high threshold are determined as strong edge pixels, and pixels with gradient amplitudes less than a low threshold are determined as non-edge pixels. The connection submodule is used to connect edge pixels and segment the image into rice grain area and background area to obtain a segmented rice grain image.

[0008] Optionally, in a fourth implementation of the present invention, the feature extraction module includes: A binarization processing submodule is used to perform binarization processing on the segmented rice grain image and perform morphological operations on the binarized image; The first calculation submodule is used to calculate the area, chalkiness and chalkiness shape characteristics of the chalky area according to the binary image to obtain the chalkiness characteristics of the rice grains.

[0009] Optionally, in a fifth implementation of the present invention, the feature extraction module further includes: a second calculation submodule, for calculating the length and width of the rice grains, the area of ​​the rice grains, and the perimeter of the rice grains in the segmented rice grain images to obtain size features; A third calculation submodule is used to calculate the shape factor, circularity and ellipticity in the segmented rice grain image to obtain shape features; The texture analysis submodule is used to perform texture analysis on the segmented rice grain image using a gray-level co-occurrence matrix to obtain texture features; The integration submodule is used to integrate size features, shape features and texture features to obtain the appearance features of rice grains.

[0010] Optionally, in the sixth implementation of the present application, the quality evaluation module comprises: a determination sub-module, configured to determine a network structure of the deep belief network and hyperparameters of the XGBoost model, and initialize base learners of the XGBoost model, wherein the quality evaluation module is constructed by the deep belief network and the XGBoost model; an input sub-module, configured to input the target feature information into a visible layer of the deep belief network, and sequentially perform unsupervised pre-training on each layer of the deep belief network by using a layer-by-layer greedy training method; an adjustment sub-module, configured to, after the unsupervised pre-training is completed, adjust the deep belief network by using a back propagation algorithm, input the target feature information into the deep belief network again after the training and adjustment, and extract an output of a hidden layer of the deep belief network as new feature representation; a division sub-module, configured to divide the features extracted by the deep belief network and corresponding real labels of rice quality into a training set and a test set; a training sub-module, configured to train the XGBoost model by using the training set data, and update a structure and parameters of a tree by minimizing an objective loss function in an iterative manner to construct a new decision tree each time; an output sub-module, configured to input the target feature information extracted by the deep belief network into the trained XGBoost model, and output an evaluation result of the rice quality.

[0011] Optionally, in the seventh implementation of the present application, the training sub-module comprises: an initialization unit, configured to initialize parameters of a PSO algorithm, and set a maximum iteration number; a boundary processing unit, configured to update a velocity and a position of each particle, perform boundary processing on the updated position, apply a parameter combination corresponding to the updated position of each particle to the XGBoost model, calculate an objective loss function on the training set, and obtain a new fitness value of each particle; an updating unit, configured to compare the new fitness value of each particle with an individual optimal fitness value, find out a particle with an optimal fitness value from all the particles, and update a global optimal position and a fitness value thereof; a construction unit, configured to construct a new decision tree in the XGBoost model by using a parameter combination corresponding to the global optimal position; a judgment unit, configured to determine a structure and parameters of the decision tree by dividing and splitting nodes of the training set data, and judge whether a current iteration number reaches the maximum iteration number, and if so, terminate the iterative training to obtain the trained XGBoost model.

[0012] Optionally, in the eighth implementation form of the present application, the initialization unit comprises: determining the number of particles; setting the dimension of each particle, the dimension being the same as the number of parameters to be optimized in the XGBoost model; initializing the position and velocity of each particle, the position representing a combination of parameters of a group of XGBoost models, and the velocity being used to update the position of the particle.

[0013] Optionally, in the ninth implementation form of the present application, a method for evaluating rice quality based on machine vision is provided, and the method comprises the following steps: collecting an original image of a rice sample, and preprocessing the collected original image to obtain a preprocessed rice image; performing image segmentation on the preprocessed rice image to obtain a rice grain image; extracting chalkiness features and appearance features from the segmented rice grain image to obtain target feature information; inputting the target feature information into a quality evaluation model, and outputting a rice quality evaluation result through the quality evaluation model.

[0014] Compared with the prior art, the present application has the following advantages: 1. The present application is based on machine vision technology, and the rice features are extracted and evaluated through objective algorithms, thereby avoiding subjective deviation of artificial sensory evaluation and ensuring the objectivity and consistency of the evaluation result; 2. The present application can realize rapid collection and processing of rice sample images, greatly shortens the detection time compared with traditional laboratory chemical analysis methods, and can meet the needs of large-scale and online detection; 3. The present application can accurately reflect the actual quality of rice by extracting various feature parameters related to rice quality and using advanced models for evaluation, thereby providing reliable basis for rice quality control and market grading. BRIEF DESCRIPTION OF DRAWINGS

[0015] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included only to illustrate preferred embodiments and are not to be considered as limiting of the present application.

[0016] Figure 1 A structure schematic diagram of the rice quality evaluation system based on machine vision provided by the embodiments of the present application is shown in the figure; Figure 2 A preprocessing effect diagram provided by the embodiments of the present application is shown in the figure; Figure 3 An image segmentation effect diagram provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION

[0017] The terms "first," "second," "third," "fourth," and so forth (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar items and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that shown or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, product, or device.

[0018] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 A schematic structural diagram of a rice quality assessment system based on machine vision provided in an embodiment of the present invention includes: The image acquisition module 101 is used to collect the original image of the rice sample and pre-process the collected original image to obtain the pre-processed rice image; In this embodiment, the hardware for rice quality testing primarily includes a testing platform, a ring light source, a camera, an image acquisition card, and a computer system. The testing platform integrates the camera, ring light source, a material receiving plate, and a light shielding box to provide a stable testing environment for rice quality testing. The light shielding box is coated with milky white paint on all sides to accommodate the changing testing environment. The ring light source provides 360° uniform light with varying intensities for rice sample testing, ensuring that the collected rice samples are highly clear and free of artifacts. This article uses a MadeVision MV-UBD130M industrial camera as the image acquisition device, capable of capturing images of rice samples with a maximum resolution of 1280x960 and a frame rate of 35. The computer system is the hardware deployed by the rice quality testing software system, and the various driver software installed on it provide services for the setup and operation of the camera, light source, and other hardware.

[0019] In this embodiment, the image acquisition module includes: The grayscale submodule is used to collect the original image of the rice sample and grayscale the original image to obtain a grayscale image; The denoising submodule is used to filter and denoise the grayscale image using a median filter to obtain a denoised image; The equalization sub-module is configured to divide the denoised image into a plurality of non-overlapping small blocks, perform histogram equalization processing on each small block respectively, and perform smoothing processing on the boundaries of adjacent small blocks by using a bilinear interpolation method to obtain a preprocessed rice image.

[0020] In this embodiment, the denoising sub-module includes: The traversal unit is configured to determine that the filter window size is 3*3, traverse each pixel in the gray image row by row and column by column, extract all pixel values in the filter window in which the current traversed pixel is located, sort all the extracted pixel values in ascending order, select a pixel value located at the middle position in the sorted pixel value sequence as a median value, assign the selected median value to the current traversed pixel to replace the original gray value of the pixel, and repeat the above process until all the pixels in the image are traversed to obtain a denoised image. The sorting unit is configured to sort all the extracted pixel values in ascending order, select a pixel value located at the middle position in the sorted pixel value sequence as a median value, assign the selected median value to the current traversed pixel to replace the original gray value of the pixel, and repeat the above process until all the pixels in the image are traversed to obtain a denoised image.

[0021] In this embodiment, the size of the filter window is an important parameter, which determines the number of pixels participating in sorting. The window size can be an odd size such as 3*3 or 5*5. For example, selecting a 3*3 window means that when processing each pixel, the values of the pixel and its eight adjacent pixels are considered. Each pixel in the gray image is traversed row by row and column by column from the top left corner of the image. For pixels on the image boundary, there can be no complete window of pixels around them, and there are usually multiple processing methods, such as ignoring the boundary pixels or extending the image boundary. Here, the image boundary is extended as an example, and the pixel values of the extended pixels can be filled by copying the nearest boundary pixels. For the current traversed pixel, all pixel values in the filter window in which the pixel is located are extracted. If a 3*3 window is used, the gray values of the current pixel and its eight adjacent pixels are extracted. All the extracted pixel values in the window are sorted in ascending order. Common sorting algorithms such as bubble sort or quick sort can be used. In the sorted pixel value sequence, the pixel value located at the middle position is selected as the median value. If the number of pixels in the window is odd, the pixel value at the middle position is the median value. If the number of pixels in the window is even, the average of the two middle pixel values can be selected as the median value, but in the median filter, an odd-sized window is generally used, so the value at the middle position is directly taken. The selected median value is assigned to the current traversed pixel to replace the original gray value of the pixel. The next pixel in the image is traversed, and the above processes of extracting pixel values in the window, sorting, selecting a median value, and updating the pixel value are repeated until all the pixels in the image are traversed. After the above processing, the gray values of all the pixels in the image are updated, and a denoised image is obtained.

[0022] In this embodiment, the mean filter is a common filtering method in image processing, which uses the average value of the pixels around a certain pixel to smooth the noise and eliminate the noise points on the image. In this paper, the mean filter operator mean_image(Image, ImageMean, 3, 3) is used to filter the sample image Image, and the filtered image ImageMean is obtained.

[0023] To obtain the rice region of interest, a binary threshold is needed to segment the image ImageMean. Halcon provides many binary operators. The Threshold() operator uses a fixed threshold to segment the image, which is commonly used for images with stable sampling environment and small changes in pixel values after multiple acquisitions. For cases where the pixel values of the acquired image change dynamically, the dyn_threshold() operator is called to segment the image dynamically. Since the rice detection system in this paper is equipped with a light shielding box, the detection environment is stable, so the threshold(ImageMean, Region, 215, 255) is used to perform binary operation on ImageMean to extract the rice region Region. Please refer to Figure 2 Preprocessing effect diagram.

[0024] The image segmentation module 102 is used for image segmentation of the preprocessed rice image to obtain a rice grain image; In this embodiment, the threshold segmentation method: select a suitable threshold determination method; common ones are global threshold method (such as Otsu algorithm) and local threshold method; if Otsu algorithm is selected, it will automatically calculate a global threshold that can maximize the inter-class variance; if Otsu algorithm is used, first count the gray value distribution of all pixels in the rice image to construct a gray histogram; traverse all possible gray thresholds, for each threshold, divide the image pixels into two classes (foreground and background), and calculate the inter-class variance of the two classes; find the gray value that maximizes the inter-class variance as the best threshold; perform binary processing on the rice image according to the determined threshold; set the pixels with gray value greater than the threshold in the image as foreground (such as white, pixel value 255), and set the pixels with gray value less than or equal to the threshold as background (such as black, pixel value 0); perform morphological operation (optional) on the binary image; for example, use opening operation (first erosion and then dilation) to remove small noise points and connect adjacent rice grains; use closing operation (first dilation and then erosion) to fill small holes in the rice grains; finally, the segmented rice grain image is obtained. Region growing method: determine the seed point; the pixel at the center of the rice grain can be manually selected as the seed point, or it can be automatically determined by some algorithms; for example, first perform rough preprocessing on the image to find pixels whose grayscale values ​​are within the characteristic range of the rice grain as potential seed points; define the growth criterion; generally determined based on the grayscale value, color, texture and other characteristics of the pixel; for example, set a grayscale value difference range, when the grayscale value difference between the adjacent pixel and the seed point is within this range, it is considered that the adjacent pixel can grow to the current region; starting from the seed point, check the pixels in its 4-neighborhood or 8-neighborhood; for the pixels that meet the growth criterion, Neighboring pixels are added to the current growing region; starting from the newly added pixel, continue to check its neighboring pixels and repeat the third step until there are no neighboring pixels that meet the growth criteria, at which point a rice grain region is formed; repeat steps 2 to 4, select new seed points, and grow new rice grain regions until all seed points are processed; merge adjacent and highly similar regions (optional); by calculating the feature similarity between regions (such as average gray value, area, etc.), merge regions with similarity above a certain threshold into a larger rice grain region; Step 7: Obtain the segmented rice grain image; Edge detection and segmentation method: Smooth the rice image; use methods such as Gaussian filtering to remove noise in the image and reduce the interference of noise on edge detection; select a suitable edge detection operator; common ones include Sobel operator and Canny operator; if the Canny operator is selected, its detection effect is better, but the steps are relatively complicated; if the Canny operator is used, first calculate the gradient amplitude and direction of the image in the horizontal and vertical directions; perform non-maximum suppression on the gradient amplitude; in the gradient direction, only retain the pixels with the local maximum gradient amplitude, and set the gradient amplitude of other pixels to 0 to refine the edge; Step 5: Apply double threshold Value processing; set two thresholds (high threshold and low threshold), determine the pixels with gradient amplitude greater than the high threshold as strong edge pixels, and the pixels with gradient amplitude less than the low threshold as non-edge pixels. If the pixels with gradient amplitude between the two are connected to the strong edge pixels, they are retained as edge pixels, otherwise they are removed; connect edge pixels; connect the broken edges through some algorithms (such as region tracking) to form a complete rice grain edge; segment the image into rice grain area and background area according to the detected edges; use a filling algorithm (such as seed filling) to fill the area inside the edge as foreground to obtain the segmented rice grain image.

[0025] In this embodiment, the image segmentation module includes: The smoothing submodule is used to smooth the pre-processed rice image using Gaussian filtering and calculate the gradient amplitude and direction of the image in the horizontal and vertical directions using the Canny operator; The double-threshold processing submodule is configured to perform non-maximum suppression on the gradient amplitudes, apply double-threshold processing, determine pixels with gradient amplitudes greater than a high threshold as strong edge pixels, and determine pixels with gradient amplitudes less than a low threshold as non-edge pixels. The connection submodule is configured to connect the edge pixels, divide the image into a rice kernel region and a background region, and obtain a segmented rice kernel image.

[0026] In this embodiment, after the preprocessing of the rice image, a variable Region is obtained, and the Region is composed of a plurality of rice kernels. In order to detect the integrity and chalkiness of the rice kernels, a single rice kernel needs to be extracted. In this embodiment, the Region is divided into a plurality of independent region sets ConnectedRegions by using an operator connection (Region, ConnectedRegions). At this time, the regions in the region set ConnectedRegions are not necessarily rice kernel regions, but also include some small noise regions.

[0027] In order to eliminate these noise regions, an opening operation opening_rectangle1 () of a morphological operator can be used to eliminate the noise regions, or a region screening operator select_shape () can be used to screen the regions. In this embodiment, a region screening operator select_shape (ConnectedRegions, SelectedRegions1, 'area', 'and', 1219.69, 7599) is used, and the area of the region is used as the screening standard. Please refer to Figure 3 An image segmentation effect diagram.

[0028] The feature extraction module 103 is configured to extract chalkiness features and appearance features from the segmented rice kernel image, and obtain target feature information. In this embodiment, the feature extraction module includes: The binarization processing submodule is configured to perform binarization processing on the segmented rice kernel image, and perform morphological operations on the binarized image. The first calculation submodule is configured to calculate the area of the chalkiness region, the chalkiness degree, and the shape feature of the chalkiness from the binarized image, and obtain the chalkiness feature of the rice kernel.

[0029] In this embodiment, the feature extraction module further includes: The second calculation submodule is configured to calculate the length and width of the rice kernel, the area of the rice kernel, and the perimeter of the rice kernel in the segmented rice kernel image, and obtain the size feature. The third calculation submodule is configured to calculate the shape factor, the circularity, and the ellipticity in the segmented rice kernel image, and obtain the shape feature. a texture analysis submodule configured to perform texture analysis on the segmented rice kernel image by using a gray level co-occurrence matrix to obtain texture features; a combination submodule configured to combine the size features, the shape features and the texture features to obtain appearance features of the rice kernel.

[0030] In this embodiment, the chalky region is identified as follows: the color image is converted into a gray scale image to reduce the amount of data for subsequent processing; a gray scale threshold range for the chalky region is set; the gray scale distribution of the chalky region and the non-chalky region in the rice image is counted to automatically determine a suitable threshold value by using the Otsu algorithm or manually set according to experience; the rice kernel image is binarized according to the set gray scale threshold range; the pixels with a gray scale value within the chalky threshold range are marked as the chalky region (set as white with a pixel value of 255) and the remaining pixels are marked as the non-chalky region (set as black with a pixel value of 0); morphological operations are performed on the binarized image; open operation (erosion followed by dilation) is used to remove small noise points and isolated pixels in the chalky region; and close operation (dilation followed by erosion) is used to fill small holes in the chalky region to make the chalky region more complete; chalky feature calculation: the area of the chalky region is calculated; the number of pixels marked as the chalky region in the binarized image is counted and multiplied by the actual area represented by a single pixel to obtain the actual area of the chalky region; chalkiness is calculated; chalkiness refers to the proportion of the area of the chalky region to the total area of the rice kernel; the total area of the rice kernel is calculated by counting the number of foreground pixels in the segmented rice kernel image and multiplying by the actual area represented by a single pixel; then the chalkiness is obtained by dividing the area of the chalky region by the total area of the rice kernel; shape features of the chalky region are calculated; the perimeter and circularity of the chalky region can be calculated; the perimeter can be obtained by counting the number of boundary pixels of the chalky region; the circularity can be calculated by the formula circularity = area / perimeter, and the value closer to 1 indicates that the chalky region is closer to a circle; size feature extraction: the length and width of the rice kernel are calculated; in the segmented rice kernel image, the circumscribed rectangle of the rice kernel is found, the length of the long side of the rectangle is the length of the rice kernel and the length of the short side is the width of the rice kernel; the area of the rice kernel is calculated by counting the number of foreground pixels in the segmented rice kernel image and multiplying by the actual area represented by a single pixel; the perimeter of the rice kernel is calculated by counting the number of boundary pixels of the rice kernel and multiplying by the actual length represented by a single pixel; Shape feature extraction: calculate shape factor. Common shape factors include aspect ratio, which is the ratio of the length to the width of a rice kernel, reflecting the elongation of the rice kernel; calculate circularity. Use the same formula as the chalkiness area perimeter to evaluate the degree to which the shape of the rice kernel approximates a circle; calculate ellipticity. By fitting the rice kernel into an ellipse, the ratio of the major axis to the minor axis of the ellipse can be calculated, reflecting the elliptical shape of the rice kernel.

[0031] Texture feature extraction: select a suitable texture analysis method, such as gray level co-occurrence matrix (GLCM); calculate the gray level co-occurrence matrix. Set the parameters of the gray level co-occurrence matrix, such as distance and angle, usually distance is 1 or 2 pixels, angle is 0°, 45°, 90°, 135°. According to the set parameters, the gray level co-occurrence relationship of pixel pairs in the image is calculated, and the gray level co-occurrence matrix is constructed; extract texture feature parameters from the gray level co-occurrence matrix. Common texture feature parameters include contrast, correlation, energy and homogeneity. Contrast reflects the degree of difference in gray values in the image; correlation measures the linear dependence relationship of local gray in the image; energy represents the uniformity of gray distribution in the image; homogeneity reflects the similarity of gray in the image. Calculate these feature parameters from the gray level co-occurrence matrix under different angles, and then take the average value as the final texture feature.

[0032] The quality evaluation module 104 is configured to input the target feature information into the quality evaluation model, and output a rice quality evaluation result through the quality evaluation model.

[0033] In this embodiment, the quality evaluation module includes: A determination sub-module is configured to determine the network structure of the deep belief network and the hyperparameters of the XGBoost model, and initialize the base learners of the XGBoost model, wherein the quality evaluation module is constructed by the deep belief network and the XGBoost model; An input sub-module is configured to input the target feature information into the visible layer of the deep belief network, and sequentially perform unsupervised pre-training on each layer of the deep belief network by using a layer-by-layer greedy training method; An adjustment sub-module is configured to, after completing the unsupervised pre-training, adjust the deep belief network by using a back propagation algorithm, input the target feature information into the deep belief network again after training and adjustment, and extract the output of the hidden layer of the deep belief network as a new feature representation; A division sub-module is configured to divide the features extracted by the deep belief network and the corresponding true labels of the rice quality into a training set and a test set; A training sub-module is configured to train the XGBoost model using the training set data, and update the structure and parameters of the tree by minimizing the target loss function in an iterative manner to construct a new decision tree each time. The output sub-module is configured to input the target feature information extracted by the deep belief network into the trained XGBoost model, and output an evaluation result of the rice quality.

[0034] In this embodiment, the training sub-module comprises: An initialization unit is configured to initialize parameters of the PSO algorithm and set a maximum number of iterations; A boundary processing unit is configured to update the speed and position of each particle, perform boundary processing on the updated position, apply the parameter combination corresponding to the updated position of each particle to the XGBoost model, calculate the target loss function on the training set, and obtain a new fitness value of each particle; An updating unit is configured to compare the new fitness value of each particle with an individual optimal fitness value, find a particle with the optimal fitness value among all particles, and update a global optimal position and its fitness value; A construction unit is configured to use the parameter combination corresponding to the global optimal position to construct a new decision tree in the XGBoost model; A judgment unit is configured to determine the structure and parameters of the decision tree by dividing and splitting the training set data, judge whether the current number of iterations reaches the maximum number of iterations, and terminate the iteration training if the maximum number of iterations is reached, thereby obtaining the trained XGBoost model.

[0035] In this embodiment, the initialization unit comprises: The number of particles is determined; The dimension of each particle is set, which is the same as the number of parameters to be optimized in the XGBoost model; The position and speed of each particle are initialized, the position represents a parameter combination of a group of XGBoost models, and the speed is used to update the position of the particle.

[0036] The basic principles, main features and advantages of the present application are shown and described above. It should be understood by those skilled in the art that the present application is not limited by the above embodiments, and the above embodiments and descriptions in the specification are only preferred examples of the present application and are not intended to limit the present application. Without departing from the spirit and scope of the present application, various changes and improvements can be made to the present application, and these changes and improvements all fall within the scope of the claimed present application. The scope of protection of the present application is defined by the appended claims and their equivalents.

Claims

1. A rice quality assessment system based on machine vision, characterized in that: The system includes: An image acquisition module is used to acquire an original image of a rice sample and pre-process the acquired original image to obtain a pre-processed rice image; An image segmentation module is used to perform image segmentation on the preprocessed rice image to obtain a rice grain image; A feature extraction module is used to extract chalky features and appearance features from the segmented rice grain image to obtain target feature information; The quality assessment module is used to input the target feature information into the quality assessment model and output the rice quality assessment result through the quality assessment model.

2. A rice quality assessment system based on machine vision as claimed in claim 1, characterized in that, The image acquisition module includes: The grayscale submodule is used to collect the original image of the rice sample and grayscale the original image to obtain a grayscale image; The denoising submodule is used to filter and denoise the grayscale image using a median filter to obtain a denoised image; The equalization submodule is used to divide the denoised image into multiple non-overlapping small blocks, perform histogram equalization on each small block, and use bilinear interpolation method to smooth the boundaries of adjacent small blocks to obtain the preprocessed rice image.

3. A rice quality assessment system based on machine vision as claimed in claim 2, characterized in that, The denoising submodule includes: The traversal unit is used to determine the filter window size as 3×3, traverse each pixel in the grayscale image row by row and column by column, and extract all pixel values ​​within the filter window of the currently traversed pixel with the pixel as the center; The sorting unit is used to sort all the pixel values ​​in the extracted window in ascending order. In the sorted pixel value sequence, the pixel value in the middle position is selected as the median. The selected median is assigned to the currently traversed pixel, replacing its original grayscale value, until all pixels in the image are traversed to obtain the denoised image.

4. A rice quality assessment system based on machine vision as claimed in claim 1, characterized in that, The image segmentation module includes: The smoothing submodule is used to smooth the pre-processed rice image using Gaussian filtering and calculate the gradient amplitude and direction of the image in the horizontal and vertical directions using the Canny operator; The dual-threshold processing submodule is used to perform non-maximum suppression on the gradient amplitude. By applying dual-threshold processing, pixels with gradient amplitudes greater than a high threshold are determined as strong edge pixels, and pixels with gradient amplitudes less than a low threshold are determined as non-edge pixels. The connection submodule is used to connect edge pixels and segment the image into rice grain area and background area to obtain a segmented rice grain image.

5. A rice quality assessment system based on machine vision as claimed in claim 1, characterized in that: The feature extraction module includes: A binarization processing submodule is used to perform binarization processing on the segmented rice grain image and perform morphological operations on the binarized image; The first calculation submodule is used to calculate the area, chalkiness and chalkiness shape characteristics of the chalky area according to the binary image to obtain the chalkiness characteristics of the rice grains.

6. A rice quality assessment system based on machine vision as claimed in claim 1, characterized in that: The feature extraction module also includes: a second calculation submodule, for calculating the length and width of the rice grains, the area of ​​the rice grains, and the perimeter of the rice grains in the segmented rice grain images to obtain size features; A third calculation submodule is used to calculate the shape factor, circularity and ellipticity in the segmented rice grain image to obtain shape features; The texture analysis submodule is used to perform texture analysis on the segmented rice grain image using a gray-level co-occurrence matrix to obtain texture features; The integration submodule is used to integrate size features, shape features and texture features to obtain the appearance features of rice grains.

7. A rice quality assessment system based on machine vision as claimed in claim 1, characterized in that: The quality assessment module includes: Determine the submodules used to determine the network structure of the deep belief network and the hyperparameters of the XGBoost model, and initialize the base learner of the XGBoost model. The quality evaluation module is constructed by the deep belief network and the XGBoost model. The input submodule is used to input the target feature information into the visible layer of the deep belief network, and use the layer-by-layer greedy training method to perform unsupervised pre-training on each layer of the deep belief network in turn; The adjustment submodule is used to adjust the deep belief network using the backpropagation algorithm after completing the unsupervised pre-training. After training and adjustment, the target feature information is input into the deep belief network again, and the output of the hidden layer of the deep belief network is extracted as the new feature representation; A partitioning submodule is used to divide the features extracted by the deep belief network and the corresponding true labels of rice quality into a training set and a test set; The training submodule is used to train the XGBoost model using the training set data. It uses an iterative approach to build a new decision tree in each iteration and update the tree structure and parameters by minimizing the target loss function. The output submodule is used to input the target feature information extracted by the deep belief network into the trained XGBoost model and output the evaluation results of rice quality.

8. A rice quality assessment system based on machine vision as claimed in claim 7, characterized in that: The training submodule includes: Initialization unit, used to initialize PSO algorithm parameters and set the maximum number of iterations; The boundary processing unit is used to update the velocity and position of each particle, perform boundary processing on the updated position, apply the parameter combination corresponding to the updated position of each particle to the XGBoost model, calculate the target loss function on the training set, and obtain the new fitness value of each particle; The updating unit is used to compare the new fitness value of each particle with the individual optimal fitness value, find the particle with the best fitness value among all particles, and update the global optimal position and its fitness value; The construction unit is used to build a new decision tree in the XGBoost model using the parameter combination corresponding to the global optimal position; The judgment unit is used to determine the structure and parameters of the decision tree by dividing the training set data and splitting the nodes, and to judge whether the current number of iterations has reached the maximum number of iterations. If so, the iterative training is terminated to obtain the trained XGBoost model.

9. A rice quality assessment system based on machine vision as claimed in claim 8, characterized in that: The initialization unit includes: Determine the number of particles; Set the dimension of each particle, which is the same as the number of parameters to be optimized in the XGBoost model; Initialize the position and velocity of each particle. The position represents a set of parameter combinations of the XGBoost model, and the velocity is used to update the position of the particle.

10. A method for implementing a rice quality assessment system based on machine vision as claimed in claim 1, characterized in that: The method comprises the following steps: Collecting an original image of a rice sample, and preprocessing the collected original image to obtain a preprocessed rice image; Perform image segmentation on the preprocessed rice image to obtain a rice grain image; Extract chalky features and appearance features from the segmented rice grain image to obtain target feature information; The target characteristic information is input into a quality evaluation model, and a rice quality evaluation result is output through the quality evaluation model.

Citation Information

Patent Citations

  • Hyper-spectral image technology-based detection method for distinguishing rice growing areas

    CN104215584A

  • Image-based rice appearance quality detection method

    CN111879735A

  • Rice chalkiness degree detection system based on image salient region extraction method

    CN112070741A

  • Air quality prediction and prediction model training method and device and storage medium

    CN113052353A

  • Short-term wind power prediction method, system and device and storage medium

    CN119623228A