A machine vision-based intelligent detection method for grain quality indicators
By combining machine vision with convolutional neural networks and light scattering theory, the problem of insufficient assessment of the internal structure of grains has been solved, enabling multi-dimensional assessment and efficient detection of grain quality and generating detailed quality reports.
Patent Information
- Application Number
- CN202510290777.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-03-12
AI Technical Summary
Existing methods for testing grain quality are insufficient to comprehensively assess the internal structure of grain, and most can only provide a single quality indicator, leading to complex operations and increased costs.
A machine vision-based approach, combining high-resolution cameras, convolutional neural networks, light scattering theory, and stereo vision algorithms, is used to identify external defects and analyze internal defects in grain. The final quality assessment report is generated through multi-dimensional feature fusion and random forest algorithms.
It enables a comprehensive assessment of the internal and external quality of grains, improves testing accuracy, reduces equipment costs and operational complexity, generates detailed quality assessment reports, and enhances user experience and work efficiency.
Smart Images

Figure CN120375357B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of grain quality and safety detection, and particularly to a grain quality index intelligent detection method based on machine vision. BACKGROUND
[0002] Grain is a necessity for human life, and the detection of grain safety is crucial. With the progress of intelligent detection methods, traditional grain quality detection methods are gradually replaced by intelligent detection methods based on machine vision. Traditional detection methods rely on manual operation, which is not only inefficient but also lacks accuracy. Subsequently, digital image processing technology is applied in detection methods. By using computers to process and analyze collected grain images, automatic identification of grain appearance defects can be achieved.
[0003] However, the existing grain quality detection methods still have some deficiencies. On the one hand, most existing technologies focus on the identification of external defects of grain, and have limited ability to evaluate the internal structure of grain. On the other hand, most current solutions can only provide a single quality indicator, making it difficult to fully reflect the overall condition of grain. This leads to the need to combine multiple detection methods to obtain a more complete quality evaluation result in actual application, increasing the operation difficulty and cost. SUMMARY
[0004] In view of the above existing problems, the present application is proposed.
[0005] Therefore, the present application provides a grain quality index intelligent detection method based on machine vision to solve the problems of limited ability to evaluate the internal structure of grain and inability to evaluate the overall quality of grain.
[0006] To solve the above technical problems, the present application provides the following technical solutions:
[0007] In a first aspect, the present application provides a grain quality index intelligent detection method based on machine vision, which includes: using a high-resolution camera to collect images of the upper and lower surfaces of a grain sample, performing preprocessing to obtain a preprocessed two-dimensional image;
[0008] Using a convolutional neural network to extract two-dimensional features, identifying external defects of grain, and applying a physical model of light scattering theory to analyze internal defects of grain 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 of the grain particles to obtain multi-dimensional features;
[0010] Fusing the two-dimensional features and the multi-dimensional features, and using a random forest algorithm to analyze and identify potential quality problems to generate a secondary quality evaluation result;
[0011] Based on the secondary quality evaluation result, the quality state of each grain is identified and classified, and the overall quality condition of the grain is evaluated according to the multi-dimensional characteristics to generate a final quality evaluation report.
[0012] As a preferred scheme of the intelligent detection method for grain quality indicators based on machine vision, the pre-processing process includes bilateral filtering, histogram equalization, size cropping, color transformation, flip transformation, geometric correction and data augmentation.
[0013] As a preferred scheme of the intelligent detection method for grain quality indicators based on machine vision, the pre-processed two-dimensional image is used to extract two-dimensional features using a convolutional neural network to identify external defects of the grain, specifically including the following steps,
[0014] Based on the pre-processed two-dimensional image, a multi-layer convolution kernel is designed using a convolutional neural network to capture local texture information, and the feature dimension is compressed by combining a pooling layer to obtain two-dimensional features.
[0015] During the training process of the convolutional neural network, a transfer learning method is used to accelerate convergence, and a cross-entropy loss function is used to optimize classification performance, while a attention mechanism is used 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, a binary mask is generated by defect segmentation threshold segmentation to identify external defects of the grain.
[0017] As a preferred scheme of the intelligent detection method for grain quality indicators based on machine vision, the physical model based on light scattering theory is used to analyze internal defects of the grain to obtain preliminary quality evaluation results, specifically including the following steps,
[0018] Based on the optical properties of the pre-processed two-dimensional image, a light scattering model is established, and the propagation path of light in the grain particle is calculated by Fresnel diffraction equation.
[0019] The image brightness gradient is combined with the phase information and the propagation path of light in the grain particle to identify internal defects of the grain.
[0020] The external defects of the grain and the internal defects of the grain are fused with multi-source data, and input into a random forest for quality grade determination to generate preliminary quality evaluation results.
[0021] As a preferred scheme of the intelligent detection method for grain quality indicators based on machine vision, based on the two-dimensional features and the preliminary quality evaluation results, a stereo vision algorithm is used 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 evaluation results, a disparity map is generated by using the disparity information of the multi-view images, combining the local structure of the two-dimensional features, through a semi-global matching algorithm, the disparity map is weighted and corrected, and through depth map conversion, point cloud filtering and surface reconstruction, a three-dimensional reconstruction model is obtained;
[0023] Based on the three-dimensional reconstruction model, three-dimensional point cloud parameters are extracted, combined with the three-dimensional mapping of the two-dimensional image defect position, and the void fraction parameters of the light scattering model, a multi-modal feature is generated, which fuses shape, surface texture and internal structure abnormalities.
[0024] As a preferred scheme of the grain quality index intelligent detection method based on machine vision, wherein: the two-dimensional features and multi-dimensional features are fused, and a random forest algorithm is used for analysis to identify potential quality problems and generate secondary quality evaluation results, specifically including the following steps,
[0025] The two-dimensional features and multi-dimensional features are normalized by Z-score to eliminate dimensional differences, and a weighted fusion strategy is used to generate a comprehensive feature vector;
[0026] A classification model is constructed based on the random forest algorithm, and the nonlinear classification ability and feature importance voting mechanism are used to identify the abnormal mode of the comprehensive feature vector and locate the potential quality problem;
[0027] The abnormal mode refers to local density mutation and surface micro-deformation;
[0028] The potential quality problem located by the classification model determines the grain quality grade, and the defects are located by combining two-dimensional and multi-dimensional features, the risk warning is generated by counting abnormal features, and the secondary quality evaluation results are obtained.
[0029] As a preferred scheme of the grain quality index intelligent detection method based on machine vision, wherein: based on the secondary quality evaluation results, the quality state of each grain is identified and classified, and the overall quality of the grain is evaluated according to the multi-dimensional features, and a final quality evaluation report is generated, specifically including the following steps,
[0030] Based on the secondary quality evaluation results, an SVM classifier is used to determine the final quality state of single grain, when the defect area ratio of the particle exceeds the defect boundary threshold, it is marked as unqualified, otherwise it is divided into three levels of excellent, good and qualified according to the defect severity;
[0031] Based on the final quality state determination result of single grain, the statistical indicators of qualified rate, average defect density and maximum void size are extracted, and combined with the overall volume coefficient of variation, surface area and volume ratio parameters of the three-dimensional reconstruction model, the comprehensive quality index is predicted;
[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 of the grain is evaluated.
[0033] The final quality evaluation report containing quality grade statistics and improvement suggestions is generated by integrating the single grain quality state determination result, the overall quality evaluation result and the parameters of the three-dimensional reconstruction model.
[0034] As a preferred scheme of the machine vision-based intelligent detection method for grain quality indicators, the final quality evaluation report is rendered in real time with an abnormal defect area marked with a red alarm by AR technology and displayed to the administrator.
[0035] In a second aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and wherein the computer program, when executed by the processor, implements any step of the machine vision-based intelligent detection method for grain quality indicators according to the first aspect of the present application.
[0036] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any step of the machine vision-based intelligent detection method for grain quality indicators according to the first aspect of the present application.
[0037] The present application has the following advantages: by combining convolutional neural network to extract two-dimensional features to identify external defects of grain, and applying a physical model of light scattering theory to analyze internal defects of grain, comprehensive evaluation of internal and external quality of grain 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 state of each grain, and the overall quality of the grain is evaluated according to multi-dimensional features to generate a final quality evaluation report containing detailed improvement suggestions, further improving user experience and work efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0039] Figure 1 Flowchart of the machine vision-based intelligent detection method for grain quality indicators in Example 1;
[0040] Figure 2For the flowchart of obtaining preliminary quality evaluation results based on two-dimensional images in Example 1. DETAILED DESCRIPTION
[0041] In order to make the above objectives, characteristics and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0042] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present application, but the present application can also be implemented in other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the concept of the present application, therefore the present application is not limited to the specific embodiments disclosed below.
[0043] Secondly, the "one embodiment" or "embodiment" referred to herein means that the specific features, structures or characteristics can be included in at least one implementation of the present application. "In one embodiment" appearing in different places in the specification does not mean the same embodiment, nor is it an embodiment that is separate or alternative to other embodiments.
[0044] Example 1, refer to Figure 1 and Figure 2 , for the first embodiment of the present application, the embodiment provides a machine vision-based intelligent detection method for grain quality indicators, comprising the following steps:
[0045] S1, using a high-resolution camera to collect the upper and lower surface images of the grain sample, pre-processing, and obtaining the pre-processed two-dimensional image.
[0046] Specifically, the following steps are included,
[0047] Using a high-resolution camera to collect the upper and lower surface images of the grain sample to capture as much detail information as possible, and pre-processing the collected initial images;
[0048] Bilateral filtering is the first step of pre-processing, which determines the new value of each pixel by considering both the spatial distance and the brightness difference of the pixel. This dual perspective allows it to remove noise while preserving important edge features, which is crucial for identifying small cracks or subtle defects of insect damage on the surface of grain particles;
[0049] Next, histogram equalization is applied 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 easier to distinguish subtle differences between different regions;
[0050] Subsequently, the initial image is size-cropped to focus on the grain area, which not only reduces the subsequent calculation amount, but also improves the efficiency of feature extraction. In order to optimize image information, color transformation technology is used to convert the image from RGB color space to HSV color space, which helps to better separate color information and brightness information;
[0051] In addition, according to the needs of flip transformation and geometric correction are carried out, ensure that all the grain particles in the initial image location consistent, facilitate subsequent batch processing and analysis, flip transformation can be adjusted by rotating or mirroring the direction of the initial image, while geometric correction is used to correct the shape distortion caused by the shooting angle or lens distortion;
[0052] Finally, the initial image is subjected to data augmentation operation to simulate the morphology of grain particles under different viewing angles and obtain the preprocessed two-dimensional image.
[0053] S2, using convolutional neural network to extract two-dimensional features, identify external defects of grain, and apply physical model of light scattering theory to analyze internal defects of grain, and obtain preliminary quality evaluation results.
[0054] Specifically, the steps include,
[0055] Based on the preprocessed two-dimensional image, a multi-layer convolution kernel is designed to capture local texture information using a convolutional neural network. Each convolution layer contains multiple filters, which traverse the entire two-dimensional image through a sliding window to calculate the corresponding feature map. 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. In order to enhance the learning ability of the convolutional neural network model, a ReLU nonlinear activation function is usually followed after each convolution layer. By introducing nonlinear factors, the convolutional neural network model can learn more complex patterns. Then, max-pooling is used to compress the spatial size of the feature map, which not only helps to reduce the computational complexity, but also prevents overfitting phenomenon from occurring;
[0056] In the training process of the convolutional neural network, the transfer learning technology is adopted to accelerate the convergence and improve the classification accuracy. In the specific operation, a convolutional neural network model that has been pre-trained on a large-scale image dataset is used, and the known parameters are used to initialize the convolutional neural network structure in the current task. Through the existing knowledge, a good performance starting point is quickly reached, and it is not necessary to start training from zero. In addition, in the optimization process, the cross-entropy loss function is used to measure the difference between the defect prediction result and the real grain defect situation, and the network weight is continuously adjusted through the back propagation algorithm, so as to optimize the classification performance. In order to further improve the recognition accuracy of the defect area, the attention mechanism is used, which can dynamically weight the potential defect area in the forward propagation process and generate a defect probability map for each pixel point. In the specific operation, attention units are inserted between convolutional layers to automatically learn which areas are more important and give them higher weights. Then, based on the defect probability map, a defect segmentation threshold is defined according to the pixel intensity distribution, and a binary segmentation operation is performed to produce a binary mask for accurate identification of external defects of grain.
[0057] Based on the optical characteristics 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 combines the changes of image brightness gradient and phase information to detect possible defects inside the grain. In the specific operation, an edge detection algorithm is applied to the input two-dimensional image to identify the particle boundary, and region segmentation technology is used to extract the area that may contain defects. Next, the changes of image brightness gradient and phase information are combined to analyze the light intensity attenuation and phase change in these areas, and to infer whether there are defects such as holes, cracks or mold inside the grain. In order to accurately simulate the behavior of light at different medium interfaces, the light scattering model is used to simulate the reflection and refraction process of light, and further analyze the internal structure of the grain.
[0058] After identifying the external and internal defects of the grain, the data results of the two are fused. Here, a multi-source data fusion strategy is adopted to integrate defect information from different detection approaches to form a more comprehensive and accurate quality evaluation. In the specific operation, the data of external and internal defects are standardized to ensure that they have the same scale and range. Then, the LDA feature selection algorithm is used to further select the most representative features to generate a defect feature vector containing edge and texture features, color, size and shape information of the grain particles. The random forest algorithm is used to process the defect feature vector to determine the quality grade of the grain and obtain the preliminary quality evaluation score, which is mathematically expressed as follows,
[0059]
[0060] where S represents the preliminary quality evaluation 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, w t represents the weight of the tth tree, p t represents the prediction probability of the tth tree for the defect feature vector, S e represents the external defect score, μ represents the mean, and σ represents the standard deviation, S i represents the internal defect score.
[0061] Based on the color, shape, size, and surface damage of the grain appearance, and the bulk density, moisture content, and impurity content inside, the quality grade standard is defined.
[0062] According to the preliminary quality evaluation score, by comparing with the quality grade standard, the corresponding quality grade is directly determined and the evaluation report is generated to obtain the preliminary quality evaluation result.
[0063] Through the above operation, the efficient identification of external and internal defects and the accuracy of preliminary quality evaluation are ensured, laying a foundation for subsequent steps.
[0064] S3, based on the two-dimensional features and the preliminary quality evaluation result, using a stereo vision algorithm to perform three-dimensional reconstruction on the grain particles to obtain multi-dimensional features.
[0065] Specifically, the following steps are included,
[0066] Based on the two-dimensional features and the preliminary quality evaluation result, using a stereo vision algorithm to perform three-dimensional reconstruction on the grain particles, in the specific operation, a Semi-Global Matching (SGM) algorithm is used to process multi-view images, which calculates the optimal disparity value of each pixel point by considering the cost aggregation of the surrounding area of the pixel, thereby providing higher accuracy than local stereo matching. In order to further improve the quality of the disparity map, it is usually adjusted using an adaptive weight function to optimize the depth information, which refers to the distance or depth value of each pixel point relative to the camera derived 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 modified disparity map is converted into a depth map by the principle of triangulation, and based on the geometric relationship of the camera internal parameters and the baseline distance, the depth map is converted into point cloud data, which is a set of points with coordinate information representing the position of the object surface. However, there may be noise and redundant points in the original point cloud data, so filtering and simplification processing is needed. Common filtering methods include statistical outlier removal and voxel grid downsampling. Statistical outlier removal can identify and remove abnormal points that deviate significantly from the average distance of neighboring points. Voxel grid downsampling reduces data volume by dividing the spatial grid and retaining a representative point in each grid.
[0068] After completing the preprocessing of point cloud data, enter the surface reconstruction stage to convert 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 that estimates the gradient field of the indicator function to recover the surface shape of the object, which is particularly suitable for objects with complex geometric shapes. Triangulation creates a grid model composed of triangles by connecting points in the point cloud, which is suitable for quickly generating a rough but effective surface representation. In addition, when marking defect locations on the three-dimensional reconstruction model, it is necessary to combine feature information in the two-dimensional image for accurate spatial mapping to ensure that defects can be accurately presented on the three-dimensional model.
[0069] Based on the generated three-dimensional reconstruction model, further extract various multi-dimensional feature parameters such as volume, surface area, and curvature. These geometric parameters are crucial for describing the overall morphology of grain particles. In combination with the defect locations identified in the two-dimensional image, accurately mark them on the three-dimensional model through three-dimensional mapping to achieve spatial correlation from two-dimensional to three-dimensional. In addition, the void fraction 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 locations identified in the two-dimensional image, and the void fraction parameter calculated using the light scattering model, generate multi-modal features that integrate shape, surface texture, and internal structure abnormalities. This not only considers the external morphological features of grain particles, but also deeply analyzes their internal structural features, forming a comprehensive and detailed description system.
[0071] Through the above operations, efficient conversion from two-dimensional images to three-dimensional models is achieved, laying a good foundation for the final quality assessment. This not only significantly improves the ability to comprehensively assess grain quality, but also ensures the accuracy and reliability of the detection results.
[0072] S4, fuse the two-dimensional features and the multi-dimensional features, and analyze using a random forest algorithm to identify potential quality problems and generate a secondary quality evaluation result.
[0073] Specifically comprising the following steps,
[0074] The two-dimensional features and the multi-dimensional features are normalized by Z-score to eliminate dimensional differences, adjust each feature value, and make them have similar distribution characteristics, thereby avoiding that some features have too large an impact on the result due to a large numerical range. After the normalization process, a comprehensive feature vector is generated using a weight fusion strategy. In this process, the importance of the two-dimensional features and the multi-dimensional features is evaluated, and corresponding weights are assigned according to their impact on the final classification result. For example, the importance of a feature can be determined by analyzing its performance on the training set, and then the weight distribution is optimized to ensure that the comprehensive feature vector can most effectively reflect the overall quality of the grain particles.
[0075] Based on the comprehensive feature vector, a classification model using a random forest algorithm is constructed and trained. In the training process, the random forest randomly selects 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 nonlinear classification capability makes the random forest particularly suitable for processing complex feature spaces and can effectively identify abnormal patterns in the comprehensive feature vector. In addition, the random forest provides a mechanism to evaluate the importance of features, which can identify which features are most critical to the classification result and help further optimize the feature selection process.
[0076] The classification model constructed using the random forest algorithm is used to determine the quality grade of the grain. The classification model constructed using the random forest algorithm can identify local density mutations or surface micro-deformations in specific regions through in-depth analysis of the comprehensive feature vector. These abnormal patterns usually indicate that the grain may have internal or external quality problems. To achieve more accurate defect positioning, clustering analysis methods can be applied to group abnormal regions and mark specific defect locations. In addition, the classification model constructed using the random forest algorithm also counts abnormal features and generates risk warning information. This process involves real-time monitoring and analysis of quality data to ensure that any potential quality problems can be discovered and reported in a timely manner.
[0077] Integrating 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 positioning information provided by the random forest algorithm, but also needs to combine multi-dimensional features for comprehensive evaluation, such as quantifying and classifying all identified defects, calculating the defect area proportion and severity of each grain, and combining the physical properties of grain weight, density, and particle size distribution to form a comprehensive quality scoring system. In addition, other machine learning algorithms such as 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 evaluation 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, ensuring the scientificity and credibility of the evaluation results.
[0079] S5, based on the secondary quality assessment results, identifying and classifying the quality state of each grain, and evaluating the overall quality condition of the grain based on multi-dimensional features, generating the final quality assessment report.
[0080] Specifically including the following steps,
[0081] Based on the secondary quality assessment results, the quality state of single grain is determined and the overall quality condition is evaluated. First, the SVM (Support Vector Machine) classifier is used to determine the final quality state of each grain. SVM classifier is a powerful supervised learning model that maximizes the separation between different classes by finding an optimal hyperplane. In this process, each grain particle is compared with the pre-set defect threshold based on its defect area proportion. The defect threshold is determined based on industry standards and experimental data to ensure the scientificity and accuracy of the classification results. If the defect area proportion of a grain exceeds the defect threshold, it is marked as unqualified. Otherwise, it is further divided into three grades of excellent, good, and qualified according to the defect severity, such as setting the defect threshold to 5% based on industry standards and experimental data. If the defect area proportion of the grain is greater than 5%, it is identified as unqualified. If the defect area proportion of the grain is between 0 and 3%, it is identified as excellent. If the defect area proportion of the grain is between 3% and 4%, it is identified as good. If the defect area proportion of the grain is between 4% and 5%, it is identified as qualified.
[0082] After the quality state of each grain is determined, a series of statistical indicators are extracted to describe the quality status of the entire batch of grain, including the pass rate, average defect density, maximum void size, etc. Combined with parameters provided by the three-dimensional reconstruction model, such as the overall volume coefficient of variation, surface area to volume ratio, etc., a comprehensive quality index is constructed. This process not only relies on accurate single grain quality state determination results, but also considers the contribution of multi-dimensional features. For example, the overall volume coefficient of variation can reflect the consistency of the size of the entire batch of grain, while the surface area to volume ratio helps to understand the morphological characteristics of the grain. In order to analyze the quality data distribution more comprehensively, clustering analysis techniques can be used, and principal component analysis (PCA) can be applied to reduce redundant information and improve the efficiency of subsequent processing.
[0083] A weighted fusion algorithm is used to assign appropriate weights to the comprehensive quality index, generating a quantitative score that reflects the overall quality of the batch. The weighted fusion algorithm allows different weights to be assigned according to the importance and impact of different comprehensive quality index parameters, thereby optimizing the evaluation results. This step not only integrates the quality state information of single grain, 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 can be determined which factors are most critical to overall quality detection, and the weight distribution strategy can be adjusted accordingly to provide more accurate quality state determination results.
[0084] Finally, based on the quality state determination results of single grain, the overall quality status evaluation results, and the volume, surface area, surface roughness, internal void ratio, etc. Parameters provided by the three-dimensional reconstruction model, a detailed final quality evaluation report is generated. This report not only contains statistical data of quality grades, but also provides targeted improvement suggestions to help improve the overall quality of grain. In order to facilitate management and sharing, the report supports multiple formats for export, such as PDF, Excel, etc., facilitating communication and archiving between different departments.
[0085] The entire grain quality detection process is realized automatically, greatly improving the efficiency and accuracy of grain quality detection. Not only does it provide detailed quality analysis results to ensure the scientificity and effectiveness of decision-making, but it also provides a solid foundation for future improvement measures.
[0086] S6, using AR to display the final quality evaluation report to the administrator.
[0087] Specifically, the following steps are included,
[0088] Based on the final quality evaluation report that has been generated, in order to utilize AR technology for presentation, the data in the final quality evaluation report needs to be pre-processed and converted 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 areas that are determined to have abnormal defects.
[0089] Next, an AR development platform such as Unity is used in conjunction with Vuforia to build a presentation environment. In this environment, administrators can view augmented content overlaid on real images through smart devices such as tablets or AR glasses. Specifically, when an administrator views a specific batch of grain, the AR application will render the abnormal defect area with a red alert marker on the actual grain sample in real time based on the pre-processed data in the final quality evaluation report. This real-time rendering is not limited to surface defects, but can also combine three-dimensional reconstruction models to show problem points in the internal structure, making quality problems obvious at a glance.
[0090] In addition, to enhance user experience, the AR application can also integrate interactive functions, allowing administrators to click or select specific defect markers to obtain more detailed information, such as specific descriptions of defects, impact ranges, and potential impacts on overall quality. At the same time, voice prompts and written explanations are provided to further explain what is seen, helping administrators quickly understand and make decisions. Not only does this achieve efficiency in information transmission, but it also enhances administrators' understanding and control of grain quality, greatly improving the accuracy and convenience of quality management work.
[0091] The embodiment also provides a computer device suitable for the machine vision-based intelligent detection method of grain quality indicators, which includes 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 realize the machine vision-based intelligent detection method of grain quality indicators as proposed in the above embodiments.
[0092] The computer device can be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected by a system bus. The processor of the computer device is configured 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 a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is configured to perform wired or wireless communication with an external terminal. The wireless communication can be achieved by WIFI, an operator network, 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. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the housing of the computer device, or an external keyboard, touchpad or mouse.
[0093] The embodiment also provides a storage medium having a computer program stored thereon, the program being executed by a processor to implement the method for intelligently detecting a grain quality index based on machine vision as described above. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic storage, a flash memory, a magnetic disk or an optical disk.
[0094] To sum up, the present application achieves comprehensive evaluation of the internal and external quality of grains by combining convolutional neural networks to extract two-dimensional features for identifying external defects of grains and applying a physical model of light scattering theory to analyze internal defects 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 state of each grain, and the overall quality of the grain is evaluated according to multi-dimensional features to generate a final quality evaluation report containing detailed improvement suggestions, further improving user experience and work efficiency.
[0095] It should be noted that the above examples are only used to illustrate the technical solutions of the present application but not limit the present application. Although the present application is described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or equivalently replaced, without departing from the spirit and scope of the technical solutions of the present application, which should be covered in the scope of the claims of the present application.
Claims
1. A machine vision-based intelligent detection method for grain quality indicators, characterized in that: The application relates to a grain quality evaluation method based on multi-source data fusion and a three-dimensional reconstruction model. The method comprises the following steps of: collecting upper surface and lower surface images of a grain sample by using a high-resolution camera, pre-processing, and obtaining a pre-processed two-dimensional image; extracting two-dimensional features by using a convolutional neural network to identify external defects of the grain; applying a physical model of light scattering theory to analyze internal defects of the grain to obtain a preliminary quality evaluation result, and the method comprises the following steps: establishing a light scattering model based on optical characteristics of the pre-processed two-dimensional image, and calculating a propagation path of light in the grain particle by using a Fresnel diffraction equation; combining image brightness gradients with phase information and the propagation path of light in the grain particle to identify internal defects of the grain; performing multi-source data fusion on the external defects of the grain and the internal defects of the grain, inputting the multi-source data fusion into a random forest to determine a quality grade, and generating the preliminary quality evaluation result; based on the two-dimensional features and the preliminary quality evaluation result, using a stereo vision algorithm to perform three-dimensional reconstruction on the grain particle to obtain multi-dimensional features; performing fusion on the two-dimensional features and the multi-dimensional features, and using a random forest algorithm to analyze and identify an abnormal mode of a comprehensive feature vector, locate potential quality problems, and generate a secondary quality evaluation result; the abnormal mode refers to local density mutation and surface micro-deformation; based on the secondary quality evaluation result, identifying and classifying quality states of each grain, and evaluating an overall quality condition of the grain according to the multi-dimensional features to generate a final quality evaluation report, and the method comprises the following steps: based on the secondary quality evaluation result, using an SVM classifier to determine a final quality state of a single grain, and when a defect area proportion of the grain exceeds a defect boundary threshold value, marking the grain as unqualified, otherwise, dividing the grain into three levels of excellent, good and qualified according to defect severity; based on the final quality state determination result of the single grain, extracting statistical indexes of a qualified rate, an average defect density and a maximum void size, and combining parameters of a three-dimensional reconstruction model, such as a whole volume variation coefficient, a surface area and a volume ratio, to predict a comprehensive quality index; assigning weights to the comprehensive quality index by using a weighted fusion algorithm to generate a quantitative score reflecting an overall quality of a batch, and evaluating the overall quality condition of the grain; 2.The machine vision-based intelligent detection method for grain quality indicators according to claim 1, characterized in that: integrating the single grain quality state determination result, the overall quality condition evaluation result and parameters of the three-dimensional reconstruction model to generate a final quality evaluation report containing quality grade statistics and improvement suggestions. 3.The machine vision-based intelligent detection method for grain quality indicators according to claim 2, characterized in that: The pre-processing process comprises bilateral filtering, histogram equalization, size cropping, color transformation, flip transformation, geometric correction and data augmentation. The method for extracting two-dimensional features by using a convolutional neural network based on the pre-processed two-dimensional image to identify external defects of the grain comprises the following steps: based on the pre-processed two-dimensional image, using a convolutional neural network to design a multi-layer convolution kernel to capture local texture information, combining a pooling layer to compress feature dimensions, and obtaining two-dimensional features; in the convolutional neural network training process, a transfer learning method is used to accelerate convergence, a cross-entropy loss function is used to optimize classification performance, and an attention mechanism is used to dynamically weight and highlight defect regions to generate a defect probability map of each pixel; based on the defect probability map of each pixel, a binary mask is generated by using a defect segmentation threshold to identify external defects of the grain.
4. The machine vision-based intelligent detection method for grain quality indicators according to claim 3, characterized in that: The two-dimensional features and the preliminary quality evaluation results are used to perform three-dimensional reconstruction on the grain particles by using a stereo vision algorithm to obtain multi-dimensional features, specifically including the following steps, Based on the two-dimensional features and the preliminary quality evaluation results, the parallax information of the multi-view images is used to generate a disparity map by a semi-global matching algorithm in combination with the local structure of the two-dimensional features; The disparity map is weighted and corrected, and a three-dimensional reconstruction model is obtained by converting the depth map to a point cloud, filtering the point cloud, and reconstructing the surface; Based on the three-dimensional reconstruction model, the parameters of the three-dimensional point cloud are extracted, and the three-dimensional mapping of the defect position of the two-dimensional image is combined with the void ratio parameters of the light scattering model to generate multi-modal features that fuse shape, surface texture, and internal structural abnormalities.
5. The machine vision-based intelligent detection method for grain quality indicators according to claim 4, characterized in that: The two-dimensional features and the multi-dimensional features are fused, and a random forest algorithm is used for analysis to identify potential quality problems and generate a secondary quality evaluation result, specifically including the following steps, The two-dimensional features and the multi-dimensional features are normalized by Z-score to eliminate dimensional differences, and a comprehensive feature vector is generated by using a weighted fusion strategy; A classification model is constructed based on the random forest algorithm, and the abnormal patterns of the comprehensive feature vector are identified by using the nonlinear classification ability and the feature importance voting mechanism to locate potential quality problems; The abnormal patterns refer to local density mutations and surface micro-deformations; The potential quality problems located by the classification model are used to determine the grain quality grade, and the defects are located by combining the two-dimensional and multi-dimensional features to generate a risk warning by counting the abnormal features, thereby obtaining a secondary quality evaluation result. 6.The machine vision-based intelligent detection method for grain quality indicators according to claim 1, characterized in that: The final quality evaluation report uses AR technology to render the abnormal defect area with a red warning mark in real time and displays it to the administrator. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is characterized in that: The processor executes the computer program to implement the steps of the machine vision-based intelligent detection method for grain quality indicators according to any one of claims 1-6.
8. A computer readable storage medium having stored thereon a computer program, characterized in that: The computer program is executed by the processor to implement the steps of the machine vision-based intelligent detection method for grain quality indicators according to any one of claims 1-6.
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