Grain quality index intelligent detection method based on machine vision
By combining convolutional neural network and light scattering theory, the food quality detection method is achieved comprehensively identifying external and internal defects of food, and a detailed quality evaluation report is generated, which solves the problem of insufficient internal structure evaluation of food in the existing technology, and improves detection accuracy and efficiency.
Patent Information
- Application Number
- CN202510290777.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-03-12
AI Technical Summary
The existing food quality detection methods mainly focus on the identification of external food defects, making it difficult to comprehensively evaluate the internal structure of food, and most solutions can only provide a single quality indicator, resulting in complex operations and increased costs.
High-resolution cameras are used to collect grain images, combine convolutional neural networks to identify external defects, use light scattering theory to analyze internal defects, and perform three-dimensional reconstruction through stereo vision algorithms, random forest algorithms for data fusion and classification, and finally use SVM classifiers to generate quality evaluation reports.
A comprehensive assessment of the internal and external quality of the grain has been achieved, detection accuracy and efficiency have been improved, equipment costs and operation complexity have been reduced, detailed quality assessment reports have been generated, and user experience has been improved.
Smart Images

Figure CN120375357A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of food quality safety detection, and particularly to an intelligent detection method for food quality indicators based on machine vision. Background Art
[0002] Food is a necessity for human life, and the detection of food safety is crucial. With the progress of intelligent detection methods, traditional food quality detection methods have gradually been replaced by intelligent detection means based on machine vision. Traditional detection methods rely on manual labor, which is not only inefficient but also inaccurate in results. Subsequently, digital image processing technology has been applied in detection means. By using a computer to process and analyze the collected food images, automatic recognition of food appearance defects can be achieved.
[0003] However, there are still some deficiencies in existing food quality detection methods. On the one hand, most existing technologies focus on the recognition of external defects of food, and have limited ability to evaluate the internal structure of food. On the other hand, most current solutions can only provide quality indicators in a single aspect and are difficult to comprehensively reflect the overall condition of food. This leads to the need to combine multiple detection methods in practical applications to obtain a relatively complete quality evaluation result, increasing the operation difficulty and cost. Summary of the Invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides an intelligent detection method for food quality indicators based on machine vision to solve the problems of limited ability to evaluate the internal structure of food and failure to evaluate the overall quality of food.
[0006] To solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides an intelligent detection method for food quality indicators based on machine vision, which includes using a high-resolution camera to collect the upper surface and lower surface images of food samples, performing preprocessing to obtain preprocessed two-dimensional images;
[0008] Extracting two-dimensional features using a convolutional neural network, identifying external defects of food, and analyzing internal defects of food using a physical model of light scattering theory to obtain a preliminary quality evaluation result;
[0009] Based on the two-dimensional features and the preliminary quality evaluation result, using a stereo vision algorithm to perform three-dimensional reconstruction on food grains to obtain multi-dimensional features;
[0010] Fusing the two-dimensional features and the multi-dimensional features, and using a random forest algorithm for analysis to identify potential quality problems and generate a secondary quality evaluation result;
[0011] Based on the secondary quality assessment results, identify and classify the quality status of each grain, and evaluate the overall quality status of the grains according to multi-dimensional characteristics to generate a final quality assessment report.
[0012] As a preferred solution of the intelligent detection method for grain quality indicators based on machine vision according to the present invention, wherein: the process of the preprocessing includes bilateral filtering, histogram equalization, size cropping, color transformation, flip transformation, geometric correction, and data augmentation.
[0013] As a preferred solution of the intelligent detection method for grain quality indicators based on machine vision according to the present invention, wherein: based on the preprocessed two-dimensional image, use a convolutional neural network to extract two-dimensional features and identify external defects of the grains, specifically including the following steps,
[0014] Based on the preprocessed two-dimensional image, design multi-layer convolutional kernels using a convolutional neural network to capture local texture information, and combine with a pooling layer to compress the feature dimension to obtain two-dimensional features;
[0015] During the training process of the convolutional neural network, adopt transfer learning to accelerate convergence, optimize the classification performance through a cross-entropy loss function, and at the same time adopt an attention mechanism to dynamically weight and highlight the defect area to generate a defect probability map for each pixel;
[0016] Based on the defect probability map of each pixel, generate a binary mask through defect segmentation thresholding to identify external defects of the grains.
[0017] As a preferred solution of the intelligent detection method for grain quality indicators based on machine vision according to the present invention, wherein: analyze internal defects of the grains using a physical model applying the light scattering theory to obtain a preliminary quality assessment result, specifically including the following steps,
[0018] Establish a light scattering model based on the optical characteristics of the preprocessed two-dimensional image, and calculate the propagation path of light rays inside the grain particles through the Fresnel diffraction equation;
[0019] Combine the image brightness gradient with the phase information and the propagation path of light rays inside the grain particles to identify internal defects of the grains;
[0020] Perform multi-source data fusion on external defects and internal defects of the grains, and input them into a random forest for quality grade determination to generate a preliminary quality assessment result.
[0021] As a preferred solution of the intelligent detection method for grain quality indicators based on machine vision according to the present invention, wherein: based on the two-dimensional features and the preliminary quality assessment result, use a stereo vision algorithm to perform three-dimensional reconstruction on the grain particles to obtain multi-dimensional characteristics, specifically including the following steps,
[0022] Based on the two-dimensional features and the preliminary quality assessment results, using the disparity information of multi-view images, combining the local structure of the two-dimensional features, generating a disparity map through a semi-global matching algorithm, performing weighted correction on the disparity map, and obtaining a three-dimensional reconstruction model through depth map to point cloud conversion, point cloud filtering, and surface reconstruction;
[0023] Based on the three-dimensional reconstruction model, extracting three-dimensional point cloud parameters, combining the three-dimensional mapping of the defect positions in the two-dimensional images, and the porosity parameters of the light scattering model, generating multi-modal features that integrate shape, surface texture, and internal structure anomalies.
[0024] As a preferred solution of the machine vision-based intelligent detection method for grain quality indicators described in the present invention, wherein: fusing the two-dimensional features and multi-dimensional features, and using a random forest algorithm for analysis to identify potential quality problems and generate a secondary quality assessment result, which specifically includes the following steps,
[0025] Eliminating the dimension difference of the two-dimensional features and multi-dimensional features through Z-score normalization, and adopting a weighted fusion strategy to generate a comprehensive feature vector;
[0026] Constructing a classification model based on the random forest algorithm, and using the non-linear classification ability and the feature importance voting mechanism to identify the abnormal patterns of the comprehensive feature vector and locate potential quality problems;
[0027] The abnormal patterns refer to local density mutations and surface micro-deformations;
[0028] For the potential quality problems located by the classification model, determining the grain quality grade, and combining the two-dimensional and multi-dimensional features for defect location, counting the abnormal features to generate a risk warning, and obtaining a secondary quality assessment result.
[0029] As a preferred solution of the machine vision-based intelligent detection method for grain quality indicators described in the present invention, wherein: based on the secondary quality assessment result, identifying and classifying the quality status of each grain, and evaluating the overall quality status of the grain according to the multi-dimensional features to generate a final quality assessment report, which specifically includes the following steps,
[0030] Based on the secondary quality assessment result, using an SVM classifier to determine the final quality status of single grains of grain. When the proportion of the defect area of the grain exceeds the defect demarcation threshold, it is marked as unqualified, otherwise it is divided into three grades: excellent, good, and qualified according to the severity of the defect;
[0031] Based on the determination results of the final quality status of single grains of grain, extracting statistical indicators such as the pass rate, average defect density, and maximum void size, and combining the parameters of the overall volume variation coefficient, surface area, and volume ratio of the three-dimensional reconstruction model to predict the comprehensive quality index;
[0032] The comprehensive quality index is weighted by a weighted fusion algorithm to generate a quantitative score reflecting the overall quality of the batch, and the overall quality status of the grain is evaluated;
[0033] By integrating the determination results of the single-grain quality status, the evaluation results of the overall quality status, and the parameters of the three-dimensional reconstruction model, a final quality evaluation report including quality grade statistics and improvement suggestions is generated.
[0034] As a preferred solution of the machine vision-based intelligent detection method for grain quality indicators of the present invention, wherein: the final quality evaluation report renders the abnormal defect area with a red alarm mark in real time through AR technology and displays it to the administrator.
[0035] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and wherein: when the computer program is executed by the processor, any step of the machine vision-based intelligent detection method for grain quality indicators as described in the first aspect of the present invention is implemented.
[0036] In a third aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and wherein: when the computer program is executed by the processor, any step of the machine vision-based intelligent detection method for grain quality indicators as described in the first aspect of the present invention is implemented.
[0037] The beneficial effects of the present invention are as follows: By combining a convolutional neural network to extract two-dimensional features to identify external defects of grains and applying a physical model of the light scattering theory to analyze internal defects of grains, a comprehensive evaluation of the internal and external quality of grains is realized. This multi-modal data fusion method not only improves the detection accuracy, but also reduces the equipment cost and operation complexity. A support vector machine (SVM) classifier is used to determine the final quality status of each grain, and the overall quality status of the grain is evaluated according to multi-dimensional features, and a final quality evaluation report including detailed improvement suggestions is generated, further improving the user experience and work efficiency. Description of the Drawings
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0039] Figure 1 It is a flowchart of the machine vision-based intelligent detection method for grain quality indicators in Embodiment 1;
[0040] Figure 2Flow chart for obtaining the preliminary quality assessment result based on the two-dimensional image in Embodiment 1. Detailed implementation manners
[0041] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will describe the detailed implementation manners of the present invention with reference to the accompanying drawings of the specification.
[0042] In the following description, many specific details are set forth to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described herein. Those skilled in the art can make similar generalizations without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.
[0043] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that can be included in at least one implementation manner of the present invention. The appearances of "in one embodiment" in different places in this specification do not all refer to the same embodiment, nor are they separate or selectively exclusive embodiments from other embodiments.
[0044] Embodiment 1, referring to Figure 1 and Figure 2 , is the first embodiment of the present invention. This embodiment provides an intelligent detection method for grain quality indicators based on machine vision, including the following steps:
[0045] S1. Use a high-resolution camera to collect the upper and lower surface images of the grain sample, perform preprocessing, and obtain the preprocessed two-dimensional image.
[0046] Specifically, it includes the following steps.
[0047] Use a high-resolution camera to collect the upper and lower surface images of the grain sample to capture as much detailed information as possible, and at the same time perform preprocessing operations on the collected initial images.
[0048] Bilateral filtering is the first step of preprocessing. By considering both the spatial distance and the brightness difference of pixels to determine the new value of each pixel, this dual perspective enables it to remove noise while maintaining important edge features, which is crucial for identifying small cracks or subtle defects of insect damage on the surface of grain particles.
[0049] Next, apply histogram equalization to enhance the contrast of the initial image. Histogram equalization redistributes the number of pixels at each gray level in the initial image, making the overall brightness distribution of the initial image more uniform and making it easier to distinguish the subtle differences between different regions.
[0050] Subsequently, the initial image is cropped in size to focus the picture on the grain area. This process not only reduces the subsequent computational amount but also improves the efficiency of feature extraction. At the same time, to optimize the image information, color transformation technology is used to convert the image from the RGB color space to the HSV color space, which helps to better separate color information from brightness information;
[0051] In addition, flip transformation and geometric correction are performed as needed to ensure that the positions of all grain particles in the initial image are consistent, facilitating subsequent batch processing and analysis. The flip transformation can adjust the orientation of the initial image through rotation or mirror operations, while geometric correction is used to correct the shape distortion caused by the shooting angle or lens aberration;
[0052] Finally, data augmentation operations are performed on the initial image to simulate the grain particle morphology under different perspectives, obtaining the preprocessed two-dimensional image.
[0053] S2. Use a convolutional neural network to extract two-dimensional features, identify external defects of grains, and apply the physical model of light scattering theory to analyze internal defects of grains to obtain a preliminary quality assessment result.
[0054] Specifically, it includes the following steps:
[0055] Based on the preprocessed two-dimensional image, a convolutional neural network is used to design multiple convolutional kernels to capture local texture information. Each convolutional layer contains multiple filters, and these filters traverse the entire two-dimensional image in a sliding window manner to calculate the corresponding feature maps. The initial layer is usually used to detect basic edge and texture features, while the deep layer can capture more complex patterns, such as specific shapes or structures. To enhance the learning ability of the convolutional neural network model, a ReLU non-linear activation function usually follows each layer of convolution. By introducing non-linearity, the convolutional neural network model can learn more complex patterns. Then, max pooling is used to compress the spatial size of the feature maps. Retaining the most important feature information while reducing the data volume not only helps to reduce the computational complexity but also prevents the occurrence of overfitting;
[0056] During the training of the convolutional neural network, transfer learning technology is adopted to accelerate convergence and improve classification accuracy. Specifically, in the operation, a convolutional neural network model that has been pre-trained on a large-scale image dataset is used, and the convolutional neural network structure in the current task is initialized with known parameters. By leveraging existing knowledge, a better performance starting point can be quickly achieved without having to train from scratch. In addition, the cross-entropy loss function is adopted during the optimization process to measure the difference between the defect prediction result and the actual grain defect situation, and the network weights are continuously adjusted through the backpropagation algorithm to optimize the classification performance. To further improve the recognition accuracy of the defect area, the attention mechanism is utilized simultaneously, which can dynamically weight and highlight potential defect areas during the forward propagation process to generate a defect probability map for each pixel. Specifically, by inserting attention units between convolutional layers, it automatically learns which areas are more important and assigns higher weights. Then, based on the defect probability map, a defect segmentation threshold is defined according to the pixel intensity distribution for binary segmentation operation to generate a binary mask for accurately identifying external defects of grains;
[0057] Based on the optical properties of the preprocessed two-dimensional image, a light scattering model is constructed. The light scattering model calculates the propagation path of light inside the grain particles through the Fresnel diffraction equation, and at the same time combines the changes in the image brightness gradient and phase information to detect possible defects inside the grains. Specifically, an edge detection algorithm is applied to the input two-dimensional image to identify the particle boundaries, and the regions that may contain defects are extracted through region segmentation technology. Next, by combining the changes in the image brightness gradient and phase information, the light intensity attenuation and phase changes in these regions are analyzed to infer whether there are defects such as cavities, cracks, or mildew inside the grains. To accurately simulate the behavior of light at the interfaces of different media, the light scattering model is used to simulate the reflection and refraction processes of light to further analyze the internal structure of the grains;
[0058] After completing the identification of external and internal defects of the grains, the data results of the two are fused. Here, a multi-source data fusion strategy is adopted, aiming to integrate the defect information from different detection channels to form a more comprehensive and accurate quality evaluation. Specifically, the data of external defects and internal defects are standardized to ensure they have the same scale and range. Then, the LDA feature selection algorithm is used to further screen out the most representative features to generate a defect feature vector, which contains the feature information of the edges, textures, colors, sizes, and shapes of the grain particles. And the defect feature vector is processed through the random forest algorithm to determine the quality grade of the grains and obtain a preliminary quality evaluation score. The mathematical formula is as follows,
[0059]
[0060] Where S represents the preliminary quality assessment score, T represents the total number of decision trees in the random forest, t represents the index of the decision tree in the random forest, and w t represents the weight of the t-th tree, and p t represents the predicted probability of the t-th tree for the defect feature vector, and S e represents the external defect score, μ represents the mean, σ represents the standard deviation, and S i represents the internal defect score;
[0061] Define the quality grade standard based on the color, shape, size, surface damage of the grain appearance and the bulk density, moisture content and impurity content inside;
[0062] According to the preliminary quality assessment score, by comparing with the quality grade standard, directly determine the corresponding quality grade and generate an assessment report to obtain the preliminary quality assessment result;
[0063] Through the above operations, the efficient identification of external and internal defects and the accuracy of the preliminary quality assessment are ensured, laying a foundation for the subsequent steps.
[0064] S3. Based on the two-dimensional features and the preliminary quality assessment result, use the stereo vision algorithm to perform three-dimensional reconstruction on the grain particles to obtain multi-dimensional features.
[0065] Specifically, it includes the following steps,
[0066] Based on the two-dimensional features and the preliminary quality assessment result, use the stereo vision algorithm to perform three-dimensional reconstruction on the grain particles. In the specific operation, the semi-global matching (SGM) algorithm is used to process multi-view images. The semi-global matching calculates the optimal disparity value for each pixel point by considering the cost aggregation in the surrounding area of the pixel, thus providing higher accuracy than local stereo matching. To further improve the quality of the disparity map, it is weighted and corrected. Usually, an adaptive weight function is used to adjust the disparity value to optimize the depth information. The depth information refers to the distance or depth value of each pixel point relative to the camera deduced from the two-dimensional image, which is crucial for generating an accurate three-dimensional model. In the specific operation, the weight can be dynamically adjusted by analyzing the similarity of adjacent pixels to ensure the accuracy of the depth information;
[0067] The corrected disparity map is converted into a depth map through the principle of triangulation. Based on the geometric relationship of the internal parameters of the camera and the baseline distance, the depth map is converted into point cloud data. A point cloud is a set composed of a series of points with coordinate information, and these points represent the positions of the object surface. However, there may be noise and redundant points in the original point cloud data, so filtering and simplification are required. Common filtering methods include statistical outlier removal and voxel grid downsampling. Statistical outlier removal can identify and remove those abnormal points whose distances from neighboring points deviate significantly from the average value. Voxel grid downsampling reduces the data volume by dividing the space into grids and retaining a representative point in each grid.
[0068] After completing the preprocessing of the point cloud data, it enters the surface reconstruction stage, converting the point cloud data into a continuous surface representation. Here, Poisson Surface Reconstruction and triangulation methods can be used. Poisson Surface Reconstruction is a method based on implicit surfaces. It recovers the surface shape of the object by estimating the gradient field of the indicator function, and is especially suitable for objects with complex geometries. Triangulation creates a mesh model composed of triangles by connecting the points in the point cloud, which is suitable for quickly generating a rough but effective surface representation. In addition, when marking the defect positions on the three-dimensional reconstruction model, it is necessary to combine the feature information in the two-dimensional image for accurate spatial mapping to ensure that the defects can be accurately presented on the three-dimensional model.
[0069] Based on the generated three-dimensional reconstruction model, various multi-dimensional feature parameters are further extracted, such as volume, surface area, and curvature. These geometric parameters are crucial for describing the overall morphology of the grain particles. At the same time, combined with the defect positions identified in the two-dimensional image, they are accurately marked on the three-dimensional model through three-dimensional mapping to achieve the spatial association from two dimensions to three dimensions. In addition, the porosity parameter calculated using the light scattering model reflects the abnormal conditions of the internal structure of the grain.
[0070] Based on the multi-dimensional feature parameters of the three-dimensional reconstruction model, the defect positions identified in the two-dimensional image, and the porosity parameter calculated using the light scattering model, multi-modal features that fuse shape, surface texture, and internal structure abnormalities are generated. It not only considers the external morphological features of the grain particles but also deeply analyzes their internal structure features, forming a comprehensive and detailed description system.
[0071] Through the above operations, an efficient conversion from a two-dimensional image to a three-dimensional model is achieved, laying a good foundation for the final quality assessment. It not only significantly improves the ability to comprehensively evaluate the quality of the grain but also ensures the accuracy and reliability of the detection results.
[0072] S4. Integrate the two-dimensional features and multi-dimensional features, and use the random forest algorithm for analysis to identify potential quality problems and generate a secondary quality assessment result.
[0073] Specifically, it includes the following steps:
[0074] Normalize the two-dimensional features and multi-dimensional features through Z-score to eliminate the dimension difference, and adjust each eigenvalue to make it have similar distribution characteristics, so as to avoid some features having too much influence on the result due to a large numerical range. After the normalization process, adopt a weight fusion strategy to generate a comprehensive feature vector. In this process, the importance of the two-dimensional features and multi-dimensional features is evaluated, and corresponding weights are assigned according to their influence on the final classification result. For example, the importance can be determined by analyzing the performance of the features on the training set, and then the weight allocation is optimized to ensure that the comprehensive feature vector can most effectively reflect the overall quality status of the grain particles.
[0075] Based on the comprehensive feature vector, construct a classification model using the random forest algorithm and train it. During the training process, the random forest randomly extracts samples and feature subsets from the training set to construct each decision tree. Each tree independently classifies the two-dimensional image data, multi-dimensional feature data, and comprehensive feature vector, and determines the final classification result through a voting mechanism. This non-linear classification ability makes the random forest particularly suitable for dealing with complex feature spaces and can effectively identify abnormal patterns in the comprehensive feature vector. In addition, the random forest also provides a mechanism for evaluating feature importance, which can identify which features are most critical for the classification result and help further optimize the feature selection process.
[0076] Use the classification model constructed by the random forest algorithm to determine the grain quality grade. The classification model constructed by the random forest algorithm can identify local density mutations or surface micro-deformations in specific areas by deeply analyzing the comprehensive feature vector. These abnormal patterns usually indicate possible internal or external quality problems of the grain. To achieve more accurate defect location, clustering analysis methods can be applied to group the abnormal areas and mark the specific defect positions. In addition, the classification model constructed by the random forest algorithm also counts the abnormal features that appear and generates risk warning information. This process involves real-time monitoring and analysis of quality data to ensure that any problems that may affect the grain quality can be detected and reported in a timely manner.
[0077] Integrate potential quality problems, grain quality grades, and risk warning information to generate secondary quality assessment results. This process not only relies on the classification and location information provided by the random forest algorithm but also requires a comprehensive assessment by combining multi-dimensional features. For example, by quantifying and classifying all identified defects, calculating indicators such as the defect area ratio and severity of each granule, and combining physical properties such as the weight, density, and particle size distribution of the grain to form a comprehensive quality scoring system. In addition, other machine learning algorithms, such as the K-nearest neighbor algorithm, can be used to verify and optimize the preliminary grain quality grade classification results to ensure the accuracy and reliability of the final assessment results;
[0078] Through the above operations, the efficiency and accuracy of grain quality detection are greatly improved, providing detailed data support for generating the final quality assessment report and ensuring the scientific nature and credibility of the assessment results.
[0079] S5. Based on the secondary quality assessment results, identify and classify the quality status of each grain, and evaluate the overall quality status of the grain according to multi-dimensional features to generate the final quality assessment report.
[0080] Specifically, it includes the following steps:
[0081] Based on the secondary quality assessment results, conduct the determination of the quality status of single grains of grain and the assessment of the overall quality status. First, use the SVM (Support Vector Machine) classifier to determine the final quality status of each grain. The SVM classifier is a powerful supervised learning model that maximizes the margin between different classes by finding an optimal hyperplane. In this process, each grain particle is compared according to the ratio of its defect area to a pre-set defect boundary threshold, which is determined based on industry standards and experimental data, ensuring the scientific nature and accuracy of the classification results. If the ratio of the defect area of a certain particle exceeds the defect boundary threshold, it is marked as unqualified; otherwise, it is further subdivided into three grades: excellent, good, and qualified according to the severity of its defects. For example, according to industry standards and experimental data, the defect boundary threshold is determined to be 5%. If the ratio of the defect area of the grain is greater than 5%, it is considered unqualified; if the ratio of the defect area of the grain is between 0% and 3%, it is considered an excellent grade; if the ratio of the defect area of the grain is between 3% and 4%, it is considered a good grade; if the ratio of the defect area of the grain is between 4% and 5%, it is considered a qualified grade;
[0082] After determining the quality status of individual grains, a series of statistical indicators are extracted to describe the quality of the entire batch of grains. The statistical indicators include the pass rate, average defect density, maximum void size, etc. Combining with the parameters provided by the three-dimensional reconstruction model, such as the overall volume variation coefficient, surface area to volume ratio, etc., a comprehensive quality index is constructed. This process not only depends on the accurate determination results of individual grain quality status but also needs to consider the contribution degrees of multi-dimensional features. For example, the overall volume variation coefficient can reflect the consistency of the grain sizes of the entire batch of grains, while the surface area to volume ratio helps to understand the morphological characteristics of the grains. For a more comprehensive analysis, clustering analysis techniques can also be used to analyze and understand the distribution of quality data. In addition, principal component analysis (PCA) can be applied to reduce redundant information and improve the efficiency of subsequent processing;
[0083] The weighted fusion algorithm is used to assign appropriate weights to the comprehensive quality index to generate a quantitative score that can reflect the overall quality of the batch. The weighted fusion algorithm allows different weights to be assigned according to the importance and influence degree of different comprehensive quality index parameters, thus optimizing the evaluation results. This step not only integrates the quality status information of individual grains but also combines the analysis results of multi-dimensional features, ensuring the comprehensiveness and scientificity of the evaluation process. Specifically, by evaluating the importance of each comprehensive quality index parameter, it is possible to determine which factors are the most critical for overall quality detection and adjust the weight assignment strategy accordingly to provide more accurate quality status determination results;
[0084] Finally, based on the quality status determination results of individual grains, the overall quality status evaluation results, and the parameters such as volume, surface area, surface roughness, and internal porosity provided by the three-dimensional reconstruction model, a detailed final quality assessment report is generated. This report not only contains the statistical data of the quality grade but also puts forward targeted improvement suggestions to help improve the overall quality of the grains. For the convenience of management and sharing, this report supports export in multiple formats, such as PDF, Excel, etc., facilitating communication and archiving among different departments;
[0085] The entire process of grain quality detection realizes automated processing, greatly improving the efficiency and accuracy of grain quality detection. It not only provides detailed quality analysis results, ensuring the scientificity and effectiveness of decision-making, but also provides a solid foundation for future improvement measures.
[0086] S6. Use AR to display the final quality assessment report to the administrator.
[0087] Specifically, it includes the following steps,
[0088] Based on the generated final quality assessment report, for the purpose of using AR technology for display, it is necessary to preprocess and transform the data in the final quality assessment report so that it can be rendered in real time in the AR environment. This step includes converting the detected defect information, such as location, size, severity, etc., into a data format that AR can recognize and process. For example, red alert markers will be added to the areas determined to have abnormal defects;
[0089] Next, an AR development platform, such as Unity combined with Vuforia, is used to build a display environment. In this environment, administrators can view the enhanced content virtually superimposed on the real image through intelligent devices, such as tablets or AR glasses. Specifically, when an administrator views a specific batch of grains, the AR application will, based on the data in the preprocessed final quality assessment report, render in real time on the actual grain samples the abnormal defect areas with red alert markers. This real-time rendering is not limited to surface defects but can also combine with 3D reconstruction models to display the problem points in the internal structure, making the quality problems clear at a glance;
[0090] In addition, to enhance the user experience, the AR application can also integrate interactive functions, allowing administrators to click on or select specific defect markers to obtain more detailed information, such as the specific description of the defect, the affected range, and its potential impact on the overall quality. At the same time, voice prompts and text explanations are provided to further explain what is seen, helping administrators quickly understand and make decisions, not only improving the efficiency of information transmission but also enhancing the administrators' understanding and control ability of the grain quality situation, greatly improving the accuracy and convenience of quality management work.
[0091] This embodiment also provides a computer device applicable to the situation of the intelligent detection method for grain quality indicators based on machine vision, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the intelligent detection method for grain quality indicators based on machine vision as proposed in the above embodiment.
[0092] The computer device may be a terminal, which includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, carrier networks, NFC (Near Field Communication), or other technologies. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball, or touchpad provided on the casing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0093] This embodiment also provides a storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the intelligent detection method for grain quality indicators based on machine vision proposed in the above embodiment; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0094] In summary, the present invention combines a convolutional neural network to extract two-dimensional features to identify external defects of grains, and applies a physical model of the light scattering theory to analyze internal defects of grains, thereby achieving a comprehensive evaluation of the internal and external quality of grains. This multi-modal data fusion method not only improves the detection accuracy, but also reduces the equipment cost and operation complexity. A Support Vector Machine (SVM) classifier is used to determine the final quality status of each grain, and the overall quality of grains is evaluated according to multi-dimensional features, generating a final quality evaluation report containing detailed improvement suggestions, further enhancing the user experience and work efficiency.
[0095] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered within the scope of the claims of the present invention.
Claims
1. An intelligent detection method for grain quality indicators based on machine vision, characterized in that: including Collecting the upper surface and lower surface images of grain samples using a high-resolution camera, performing preprocessing, and obtaining the preprocessed two-dimensional images; Extracting two-dimensional features using a convolutional neural network, identifying external defects of grains, and applying a physical model of light scattering theory to analyze internal defects of grains to obtain a preliminary quality assessment result; Based on the two-dimensional features and the preliminary quality assessment result, using a stereo vision algorithm to perform three-dimensional reconstruction of grain particles to obtain multi-dimensional features; Fusing the two-dimensional features and the multi-dimensional features, and using a random forest algorithm to analyze, identifying potential quality problems, and generating a secondary quality assessment result; Based on the secondary quality assessment result, identifying and classifying the quality status of each grain, and evaluating the overall quality status of the grains according to the multi-dimensional features, and generating a final quality assessment report.
2. The intelligent detection method for grain quality indicators based on machine vision according to claim 1, characterized in that: The process of the preprocessing includes bilateral filtering, histogram equalization, size cropping, color transformation, flip transformation, geometric correction, and data augmentation.
3. The intelligent detection method for grain quality indicators based on machine vision according to claim 2, characterized in that: Based on the preprocessed two-dimensional images, using a convolutional neural network to extract two-dimensional features and identify external defects of grains, specifically including the following steps Based on the preprocessed two-dimensional images, designing multi-layer convolutional kernels using a convolutional neural network to capture local texture information, and combining with a pooling layer to compress the feature dimension to obtain two-dimensional features; During the training process of the convolutional neural network, using transfer learning to accelerate convergence, optimizing the classification performance through a cross-entropy loss function, and at the same time using an attention mechanism to dynamically weight and highlight the defect area to generate a defect probability map for each pixel; Based on the defect probability map of each pixel, generating a binary mask through defect segmentation threshold segmentation to identify external defects of grains.
4. The intelligent detection method for grain quality indicators based on machine vision according to claim 3, characterized in that: Applying a physical model of light scattering theory to analyze internal defects of grains to obtain a preliminary quality assessment result, specifically including the following steps Establishing a light scattering model based on the optical characteristics of the preprocessed two-dimensional images, and calculating the propagation path of light inside the grain particles through the Fresnel diffraction equation; Combining the image brightness gradient with the phase information and the propagation path of light inside the grain particles to identify internal defects of grains; Performing multi-source data fusion on the external defects and internal defects of grains, and inputting them into a random forest for quality grade determination to generate a preliminary quality assessment result.
5. The intelligent detection method for grain quality indicators based on machine vision according to claim 4, characterized in that: Based on the two-dimensional features and the preliminary quality assessment result, using a stereo vision algorithm to perform three-dimensional reconstruction of grain particles to obtain multi-dimensional features, specifically including the following steps Based on the two-dimensional features and the preliminary quality assessment result, using the disparity information of multi-view images, combining with the local structure of the two-dimensional features, and generating a disparity map through a semi-global matching algorithm; Performing weighted correction on the disparity map, and obtaining a three-dimensional reconstruction model through depth map to point cloud, point cloud filtering, and surface reconstruction; Extracting the parameters of the three-dimensional point cloud based on the three-dimensional reconstruction model, combining with the three-dimensional mapping of the two-dimensional image defect position, and the porosity parameter of the light scattering model, to generate multi-modal features that integrate shape, surface texture, and internal structure anomalies.
6. The intelligent detection method for grain quality indicators based on machine vision according to claim 5, characterized in that: Fusing the two-dimensional features and the multi-dimensional features, and using a random forest algorithm to analyze, identifying potential quality problems, and generating a secondary quality assessment result, specifically including the following steps The two-dimensional features and multi-dimensional features are normalized by Z-score to eliminate the dimension difference, and a weighted fusion strategy is adopted to generate a comprehensive feature vector; A classification model is constructed based on the random forest algorithm, and the non-linear classification ability and the feature importance voting mechanism are used to identify the abnormal patterns of the comprehensive feature vector and locate potential quality problems; The abnormal patterns refer to local density mutation and surface micro-deformation; For the potential quality problems located by the classification model, the grain quality grade is determined, and the defect location is carried out by combining two-dimensional and multi-dimensional features. The abnormal features are statistically analyzed to generate a risk warning, and the secondary quality assessment result is obtained.
7. The intelligent detection method for grain quality indicators based on machine vision according to claim 6, characterized in that: Based on the secondary quality assessment result, the quality status of each grain is identified and classified, and the overall quality status of the grain is evaluated according to multi-dimensional features to generate a final quality assessment report. The specific steps are as follows: Based on the secondary quality assessment result, an SVM classifier is used to determine the final quality status of a single grain of grain. When the proportion of the defect area of the grain exceeds the defect demarcation threshold, it is marked as unqualified. Otherwise, it is divided into three grades: excellent, good and qualified according to the severity of the defect; Based on the determination result of the final quality status of a single grain of grain, statistical indicators such as the pass rate, average defect density, and maximum void size are extracted, and combined with the parameters of the overall volume variation coefficient, surface area and volume ratio of the three-dimensional reconstruction model, the comprehensive quality index is predicted; The comprehensive quality index is weighted by a weighted fusion algorithm to generate a quantitative score reflecting the overall quality of the batch, and the overall quality status of the grain is evaluated; By integrating the determination result of the single-grain quality status, the evaluation result of the overall quality status, and the parameters of the three-dimensional reconstruction model, a final quality assessment report including quality grade statistics and improvement suggestions is generated.
8. The intelligent detection method for grain quality indicators based on machine vision according to claim 7, characterized in that: The final quality assessment report renders the abnormal defect area with a red alert mark in real time through AR technology and displays it to the administrator.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the machine vision-based intelligent detection method for grain quality indicators according to any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the machine vision-based intelligent detection method for grain quality indicators according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Double-surface damage detection method for corn seeds based on machine vision
CN108896564A
Seed variety quality detection method and system based on hyperspectrum
CN114882249A
Method for measuring granular nature of rice grain
JP2017219527A
Air Cleaner
KR1020240009739A
Cited By
Whole vehicle grain quality evaluation method based on online sampling and intelligent sampling device
CN121141956A
Grain crop quality detection method and device based on dynamic video stream
CN121883543A
