Intelligent screening method and system for rice grains
By combining technologies such as convolutional neural networks and sparse coding, the visual and spectral characteristics of rice particles are extracted, and the characteristics are fusion through self-attention mechanisms are solved, and the problem of difficulty in using multidimensional data in the existing technology is achieved, achieving a more efficient and flexible intelligent screening effect.
Patent Information
- Application Number
- CN202510259673.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-24
AI Technical Summary
现有智能筛选技术难以充分利用光谱等多维数据,导致在大米等农产品的质量控制中可能忽视颗粒的内在化学特性,且难以实时更新和调整筛选标准以适应不同来源颗粒的特性。
Convolutional neural network is used to capture the visual features of the rice particles surface and refine local features through spatial attention mechanisms. At the same time, chemical component information is extracted from the spectral data using sparse encoding, and the spectral data is denoised and characteristic compression is performed through a deep automatic encoder. Combining visual and spectral features, the feature weight is adjusted through the self-attention mechanism, feature fusion is performed, and finally intelligent screening is performed through transfer learning.
It improves the accuracy and comprehensiveness of rice particle screening, can make more efficient use of multi-dimensional data, adapt to the characteristics of particles from different sources, reduces the needs and operating costs of manual intervention, and improves production flexibility and economic efficiency.
Smart Images

Figure CN120198723A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent screening, and particularly to an intelligent screening method and system for rice grains. Background Art
[0002] Intelligent screening technology is an advanced technology integrating machine learning, image processing, data analysis, and automation systems, mainly applied to material classification and quality control in industrial and agricultural fields. This technology uses deep learning models to analyze the visual features of objects, such as shape, size, color, and texture, to automatically identify and classify different items. However, existing intelligent screening technologies are mainly limited to processing single data types, such as relying on visual data and failing to fully utilize multi-dimensional data such as spectra, resulting in the screening process possibly overlooking the intrinsic chemical properties of particles. Especially in the quality control of agricultural products such as rice, it may lead to missed inspections of key quality indicators. In addition, when faced with a large quantity and diversity of rice grains, it is difficult to update and adjust the screening criteria in real time to adapt to the characteristics of grains from different sources, increasing the need for manual intervention and operation costs, and reducing the flexibility and economic efficiency of production. Summary of the Invention
[0003] The purpose of the present invention is to solve the disadvantages existing in the prior art, and to propose an intelligent screening method and system for rice grains.
[0004] To achieve the above purpose, the present invention adopts the following technical solutions. An intelligent screening method for rice grains includes the following steps:
[0005] Capture the color, gloss, and texture on the surface of rice grains through a convolutional neural network, extract visual features hierarchically, and generate a visual feature dataset; based on the visual feature dataset, use spatial attention to focus on the cracks and different-color points of rice grains, refine local features, and generate locally enhanced visual features;
[0006] Based on the locally enhanced visual features, use sparse coding to extract chemical composition information from rice spectral data, obtain a spectral feature dataset; based on the spectral feature dataset, perform noise reduction and feature compression on the spectral data through a deep autoencoder, and generate optimized spectral features;
[0007] Combine the locally enhanced visual features with the optimized spectral features, assign feature weights to different modal data through a self-attention mechanism, and generate a weight-adjusted feature set; based on the weight-adjusted feature set, integrate features through feature fusion to generate a fused feature set;
[0008] Based on the fused feature set, classify rice grains, and adapt to the characteristics of different batches of rice grains through transfer learning to generate an intelligent screening optimization result.
[0009] Preferably, the steps for obtaining the visual feature dataset are as follows:
[0010] Deploy cameras to obtain rice images, and capture the color, gloss, and texture features on the surface of rice grains through a convolutional neural network. Through the forward propagation of the convolutional neural network, convert the image data into original visual data;
[0011] Based on the original visual data, apply a convolutional neural network for multi-layer feature extraction. Through the continuous action of convolutional layers, pooling layers, and non-linear activation layers, form refined visual features;
[0012] According to the refined visual features, integrate the visual information extracted in multiple layers, and through feature standardization and data formatting processing, construct a visual feature dataset containing the visual information of rice grains.
[0013] Preferably, the steps for obtaining the locally enhanced visual features are as follows:
[0014] Based on the visual feature dataset, focus on the cracks and discolored points of rice grains through spatial attention, analyze the feature differences, and optimize the feature expressions in the crack and discolored point regions to obtain initially focused features;
[0015] According to the initially focused features, calculate the refined local feature scores, and the calculation formula is:
[0016]
[0017] where, F i represents the visual feature of the i-th region, μ is the mean of the full-image features, σ i is the standard deviation of the i-th region feature, D i is the deviation of the i-th region feature from the mean, α is an adjustment factor, S is the refined local feature score, and N is the total number of regions analyzed in the image;
[0018] Based on the refined local feature scores, adjust the local contrast and sharpness of the image to obtain locally enhanced visual features.
[0019] Preferably, the steps for obtaining the spectral feature dataset are as follows:
[0020] Use the locally enhanced visual features to perform preprocessing on the spectral data of rice, including denoising and normalization, to obtain standardized spectral data;
[0021] Based on the standardized spectral data, calculate the characteristic composite values of chemical components, and the calculation formula is:
[0022]
[0023] where, Xj is the data of the j-th spectral point after preprocessing, S jk is the sparse basis representation of the j-th point in the k-th chemical component, G k is the occurrence frequency of the k-th chemical component in all spectral points, λ is the scaling factor, β is the non-linear adjustment factor, K is the total number of chemical components, J is the total number of spectral data points, and C is the characteristic composite value of the chemical component;
[0024] Based on the characteristic composite value of the chemical component, the spectral data is reconstructed, non-characteristic noise and irrelevant data are removed, and a spectral feature dataset is formed.
[0025] Preferably, the steps for obtaining the optimized spectral features are as follows:
[0026] Based on the spectral feature dataset, an input feature matrix is constructed, the spectral data is normalized, and at the same time, outliers and isolated points are removed through neighborhood filtering to form a preprocessed spectral feature matrix;
[0027] According to the preprocessed spectral feature matrix, feature compression and noise reduction are performed through a deep autoencoder, and the expression is:
[0028]
[0029] where Z is the eigenvalue after compression and noise reduction, and X k is the eigenvalue of the k-th column in the input spectral feature matrix, and Y k is the corresponding eigenvalue generated by neighborhood filtering after noise reduction processing;
[0030] Based on the eigenvalue after compression and noise reduction, non-linear reconstruction of the feature information is performed, noise and redundant features are removed, and optimized spectral features are obtained.
[0031] Preferably, the steps for obtaining the weight-adjusted feature set are as follows:
[0032] Based on the local enhanced visual features and the optimized spectral features, the self-attention mechanism is used to learn the interdependent relationships between different features, and the weights of each feature are assigned to obtain the feature weight assignment result;
[0033] According to the feature weight assignment result, the weights of each feature are adjusted, and the feature set is reconstructed by combining the adjusted weights to obtain the weight-adjusted feature set.
[0034] Preferably, the steps for obtaining the fused feature set are as follows:
[0035] Based on the weight-adjusted feature set, the scales and formats of different features are unified to obtain a standardized weight-adjusted feature set;
[0036] Adjust the feature set according to the standardized weights, perform feature fusion, and generate a feature fusion result by comparing features one by one and matching the relevance between different features;
[0037] Based on the feature fusion result, reconstruct a feature representation that includes visual features and spectral features, remove redundant information, and generate a fused feature set.
[0038] Preferably, the steps for obtaining the intelligent screening optimization result are as follows:
[0039] Based on the fused feature set, divide the fused feature set into a training set and a test set, load a classification model, and perform an initial training operation on the training set for the classification model to obtain a preliminary classification model;
[0040] According to the preliminary classification model, conduct classification tests on the characteristics of rice grains in different batches in the test set, analyze the data characteristics that fail to adapt in the classification results, and combine the unadapted data to expand the model's capabilities to obtain a classification model adjusted through transfer learning;
[0041] Based on the classification model adjusted through transfer learning, classify the rice grains, generate a classification label for each grain, and obtain the intelligent screening optimization result.
[0042] The present invention provides a screening system, including:
[0043] A visual feature extraction module that analyzes the color, gloss, and texture on the surface of rice grains through a convolutional neural network, extracts the visual features of each grain, and generates a visual feature data set;
[0044] An attention refinement module that uses a spatial attention mechanism to focus on the cracks and different - colored points of rice grains, refine the local features of the visual feature data set, improve the feature resolution, and generate locally enhanced visual features;
[0045] A spectral feature optimization module that extracts chemical composition information from spectral data using sparse coding, coordinates with the locally enhanced visual features to obtain a spectral feature data set, and then performs noise reduction and feature compression on the spectral data through a deep auto - encoder to generate optimized spectral features;
[0046] A feature fusion module that combines the locally enhanced visual features and the optimized spectral features, adjusts the feature weights of different modal data through a self - attention mechanism, integrates each feature, and generates a weight - adjusted feature set;
[0047] An intelligent screening and classification module that classifies rice grains based on the weight - adjusted feature set, matches the characteristics of rice grains in different batches through transfer learning, and obtains the intelligent screening optimization result.
[0048] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0049] In the present invention, a spatial attention mechanism is used to focus on key quality indicators, refine local features, analyze cracks and abnormal color points, and improve the accuracy of screening. The application of sparse coding extracts chemical components from spectral data, providing a more comprehensive basis for quality judgment. The self-attention mechanism dynamically adjusts feature weights, combined with feature fusion technology, optimizes the utilization of multi-dimensional information, and ensures the comprehensiveness and accuracy of classification. The introduction of transfer learning can adapt to the characteristics of different batches of rice, continuously optimize its generalization ability, and improve the application flexibility and economic benefits of the system. Brief Description of the Drawings
[0050] Figure 1 It is a schematic diagram of the steps of the present invention. Detailed Embodiments
[0051] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0052] Please refer to Figure 1 , the present invention provides a technical solution, an intelligent screening method for rice grains, including the following steps:
[0053] Capture the color, gloss and texture on the surface of rice grains through a convolutional neural network, hierarchically extract visual features, and generate a visual feature dataset; based on the visual feature dataset, use spatial attention to focus on cracks and abnormal color points of rice grains, refine local features, and generate a locally enhanced visual feature;
[0054] Based on the locally enhanced visual features, use sparse coding to extract chemical component information from rice spectral data, and obtain a spectral feature dataset; based on the spectral feature dataset, perform noise reduction and feature compression on the spectral data through a deep autoencoder to generate optimized spectral features;
[0055] Combine the locally enhanced visual features and the optimized spectral features, assign feature weights to different modality data through the self-attention mechanism, and generate a weight-adjusted feature set; based on the weight-adjusted feature set, integrate features through feature fusion to generate a fused feature set;
[0056] Based on the fused feature set, classify rice grains, and adapt to the characteristics of different batches of rice grains through transfer learning to generate an intelligent screening optimization result.
[0057] The steps for obtaining the visual feature dataset are as follows:
[0058] Deploy a camera to obtain rice images, and capture the color, gloss, and texture features on the surface of rice grains through a convolutional neural network. Through the forward propagation of the convolutional neural network, convert the image data into raw visual data;
[0059] Based on the raw visual data, apply a convolutional neural network for multi-layer feature extraction. Through the continuous action of convolutional layers, pooling layers, and non-linear activation layers, form refined visual features;
[0060] According to the refined visual features, integrate the visual information extracted from multiple layers. Through feature standardization and data formatting processing, construct a visual feature dataset containing the visual information of rice grains.
[0061] Specifically, first read the technical materials on the installation of the camera and imaging requirements, disassemble and extract specific parameters such as resolution, focal length, and illuminance range from them. Then, when deploying the camera in the experimental area, ensure that the imaging height meets the listed visible range, and the angle can be adjusted according to the site area within the range of 0 degrees to 30 degrees. The illuminance threshold is obtained by trying from 1 lux to 1000 lux and recording the changes in shooting clarity. Generally, set the average illuminance at the shooting site between 50 lux and 500 lux. Then, record the shutter speed and gain value of the camera respectively to form a set of preliminary shooting parameter sets. After completing the configuration of the camera hardware part, input the captured rice images into the finalized and trained convolutional neural network for forward propagation. The training process of this convolutional neural network includes preparing 50,000 rice images labeled with color, gloss, and texture features, uniformly using the settings of learning rate 0.001 and batch size 32, and converging to obtain stable convolutional kernel parameters after 1000 iterations. Subsequently, in actual application, use this network to extract the color, gloss, and texture information in the image frame by frame and output the corresponding matrix, without repeating the training process. Finally, summarize the results in matrix form into raw visual data.
[0062] Based on the original visual data obtained previously, first cut it into several small pieces according to the image size to facilitate local fine analysis of rice grains. Then perform pixel-level traversal on each small piece, and set a chromaticity deviation threshold to identify areas that may have different colors. This threshold is statistically obtained from the rice images with obvious different-color spots taken before. The specific calculation method is to record the average chromaticity and standard deviation of all these images, and take the average chromaticity plus 1.5 times the standard deviation as the chromaticity deviation threshold. If any pixel exceeds this threshold, it is determined as a suspicious area and marked. Then call the trained convolutional layer to perform further texture and gloss analysis on these suspicious areas. The weights used in the convolutional layer are from the aforementioned training process. Pooling operations are performed after each layer of convolution through forward operations to reduce the feature dimension. The ReLU activation function is added after each pooling to ensure stable gradient changes during parameter updates. Repeat the multi-layer convolution and pooling structure in the same way to repeatedly accumulate the feature representations of the suspicious areas. Finally, merge the feature maps output by all layers and record them in the same matrix to form refined visual features.
[0063] Based on the refined visual features obtained previously, first read the texture, gloss, and color distribution at each position from the feature map matrix, query the pre-established rice surface texture benchmark and perform pixel-by-pixel comparison. For example, refer to the color range of (200, 200, 200) to (255, 255, 255) in the RGB channels as an approximate pure white interval. If some pixels deviate from this interval by more than 30, they are marked as outliers. At the same time, make a secondary confirmation in combination with the gloss data. If its fluctuation value relative to the average gloss exceeds the preset 0.2 times, it is also marked as abnormal. All such abnormal pixels are uniformly summarized in the feature record list. Then standardize the entire feature map, subtract the global mean of each feature statistically obtained from one thousand rice images from each feature value and divide it by the corresponding global standard deviation, and re-arrange the indices of the matrix in row and column order so that all feature maps adopt the same row and column dimensions for data formatting. When multiple outliers are found, additional markings are made for subsequent tracking. Finally, collect all the refined and processed visual data information into a unified data structure to obtain a visual feature dataset containing the visual information of rice grains.
[0064] The steps to obtain locally enhanced visual features are as follows:
[0065] Based on the visual feature dataset, focus on the cracks and different-color points of rice grains through spatial attention, analyze the feature differences, and optimize the feature expressions in the crack and different-color point areas to obtain initially focused features;
[0066] According to the initially focused features, calculate the refined local feature scores. The calculation formula is:
[0067]
[0068] Among them, F i represents the visual feature of the i-th region, μ is the mean of the whole image feature, and σ i is the standard deviation of the i-th region feature, D i is the deviation of the i-th region feature from the mean, α is the adjustment factor, S is the refined local feature score, and N is the total number of regions analyzed in the image;
[0069] Based on the refined local feature score, adjust the local contrast and sharpness of the image to obtain the locally enhanced visual feature.
[0070] Specifically, based on the visual feature dataset, focus on the cracks and abnormal color points of rice grains through spatial attention. First, disassemble the surface attribute information of rice grains recorded in the previously obtained visual feature dataset, specifically including the color brightness distribution on the rice surface and the possible local defect areas. Then, refer to the resolution, illumination range, visible size, etc. given in the relevant image acquisition specifications, compare this information with the actually captured image pixel by pixel and generate a comparison list. Then, screen out the relevant entries for cracks and abnormal color points in the comparison list, and judge by setting a color interval threshold obtained based on historical image statistics. For example, refer to the common brightness range interval of 50 to 120 for the crack area and the deviation of the common chromaticity value of abnormal color points between ±20 and ±40 obtained from the previous test. At the same time, use the gloss measurement value in the range of 0.2 to 0.7 as the basis. If there are recorded values exceeding these intervals, mark them as key observation objects in the comparison list. To avoid misjudgment, focus data needs to be introduced for re-comparison. The focus data is recorded from the previous image acquisition process. When a large focus shift is found during the comparison, move the entry to the quality review list and perform repeated scans. The repeated scans use the existing sampling frequency settings, such as shooting three frames per second, to obtain more image samples. Subsequently, cross-check the detailed information of the cracks and abnormal color points collected with the previous annotation reference. If prominent crack widths or obvious chromaticity deviations still appear after multi-frame comparison, retain the identification information of such regions, otherwise remove them from the attention list and only record the values. All the cracks and abnormal color points that have been screened and analyzed are finally merged into the same set of differential comparison data, so as to optimize the feature expression of the cracks and abnormal color points on the rice grain surface and obtain the initially focused features.
[0071] The advantage of the formula is that by comprehensively considering the degree of difference between each region and the whole image mean, the standard deviation, and the exponential decay factor, it can more finely highlight the regions with larger deviations from the overall feature, thereby strengthening the cracks or abnormal color points that need attention.
[0072] F iThe acquisition steps for are as follows: In the preliminary focused image obtained previously, read the texture, gloss, and chromaticity distributions of the i-th region one by one, and convert these values into a single index F. i , and this index is obtained from the local feature values obtained by comparing the image information collected by the previously deployed camera with the reference benchmark.
[0073] The acquisition steps for μ are as follows: Summarize the F values of N regions. i , and obtain the mean value of the full-image features by adding them up and dividing by the total number of regions N. When the image resolution is 1920×1080, usually one region is defined for every 100×100 pixels. By summing up the F values extracted from each region and then dividing by N, μ is obtained. i ;
[0074] σ i The acquisition steps for are as follows: While determining F. i , calculate the degree of feature dispersion of this region, perform variance operation on the F values of multiple frames of images within the same region, and then take the square root to obtain the standard deviation, and use this value as σ. i ; i ;
[0075] D i The acquisition steps for are as follows: Subtract the mean value μ of the full image from the F value of the current region to obtain the deviation value, record it in the data table, and then average it with multiple frames of images collected under different lighting conditions to reduce accidental noise, and finally form a stable deviation value for this region. i ;
[0076] The acquisition steps for α are as follows: In the process of statistically analyzing the influence of crack depth or different-color spots on the overall image distribution, combine the actual deviation value range recorded previously, select a factor with an appropriate exponential decay rate, and through repeatedly comparing the image features of N images with obvious cracks or different-color spots, confirm that a more appropriate exponential decay rate is obtained when α is between 0.05 and 0.2, and finally select 0.1 as the adjustment factor.
[0077] Calculation process:
[0078] Suppose the image of a certain analysis is divided into N = 5 regions, and the corresponding F values obtained are F1 = 35, F2 = 50, F3 = 28, F4 = 60, F5 = 46 in sequence. By cumulative averaging, μ = (35 + 50 + 28 + 60 + 46) / 5 = 43.8 can be obtained. Then calculate the standard deviation σ of each region respectively. i , for example, after multi-frame sampling in the first region, the statistical standard deviation σ1 = 3.2, in the second region σ2 = 4.1, and so on for the rest. If α = 0.1 is taken, and each D. i = F i - μ is recorded and then can be substituted. Suppose D1 = -8.8 in the first region, then:
[0079]
[0080] The values of the remaining 4 regions are calculated in the same way and then all added together to obtain S.
[0081] This result indicates that the larger the calculated value of S, the more obvious the overall deviation. Subsequently, more prominent crack or abnormal color point regions can be identified based on this, which is directly related to the refined local feature score obtained in this step. When further screening is required in the subsequent determination process, a threshold division will be performed on the S value. For example, the threshold is set between 10 and 15. If S is above this interval, it is determined as a region with a large deviation. If S is below this interval, it is a region with a small deviation.
[0082] Based on the refined local feature score, first divide several sub-regions in image processing according to the positions of each marked crack and abnormal color point, then read the brightness, contrast, and texture gradient information of these sub-regions one by one, and record the previously obtained S value corresponding to this information. Set a multi-level threshold system for the adjustment of contrast and clarity. By first defining an upper limit interval of contrast, such as 70 to 90, in the crack region, and then defining another interval, such as 50 to 70, for the abnormal color point region. If the detected contrast value is lower than this interval, the brightness is moderately increased. If it exceeds this interval, the brightness is decreased and the sharpness value is checked. The sharpness value is statistically obtained in the previous image shooting experiment, generally concentrated between 1.0 and 2.5, and a deviation from the mean value exceeding 0.5 is regarded as a significant change. Therefore, the sharpness of each sub-region is separately recorded. If the sharpness of a certain sub-region is less than 1.0, the sharpening parameter is increased within the same processing cycle. If the sharpness is greater than 2.5, the existing clarity is maintained and the color curve is slightly adjusted. Subsequently, the adjusted parameters are returned and compared with the original sub-region information. If it is found that both the brightness and sharpness are at the higher end of the above interval, the processing amplitude can be reduced. If they are at the lower end, the processing amplitude is moderately increased, and this process is repeated in multiple consecutive cycles until the contrast and clarity data are within the medium deviation range. Then, the adjusted sub-regions are integrated into the overall image, and all processed sub-regions are uniformly recorded and stored to obtain local enhanced visual features.
[0083] The steps for obtaining the spectral feature dataset are as follows:
[0084] Using the local enhanced visual features, perform preprocessing on the spectral data of rice, including denoising and normalization, to obtain standardized spectral data;
[0085] Based on the standardized spectral data, calculate the characteristic composite value of chemical components. The calculation formula is:
[0086]
[0087] Among them, X j is the data of the j-th spectral point after preprocessing, S jk is the sparse basis representation of the j-th point in the k-th chemical component, G k is the occurrence frequency of the k-th chemical component among all spectral points, λ is the scaling factor, β is the non-linear adjustment factor, K is the total number of chemical components, J is the total number of spectral data points, and C is the characteristic composite value of the chemical components;
[0088] Based on the characteristic composite value of the chemical components, the spectral data is reconstructed, non-characteristic noise and irrelevant data are removed, and a spectral feature dataset is formed.
[0089] Specifically, local enhanced visual features are used to preprocess the spectral data of rice, including denoising and normalization. First, each spectral curve is classified by wavelength segment according to the previously obtained correspondence between rice images and spectra, and the noise distribution characteristics are compared segment by segment with reference to the collected spectral measurement reference materials. Then, a statistically obtained noise threshold is set for each wavelength segment. This threshold is usually obtained by recording the noise peak range during multiple measurements and taking the average of its maximum and minimum values. For example, if the noise peak is observed to be as high as 0.015 and as low as 0.002 in the wavelength band of 400nm to 500nm, then the sum of the two is divided by 2 to obtain 0.0085 as the preset noise threshold for this section. If it is detected that the amplitude of the current spectral curve exceeds the threshold in this section, it is identified as a high-noise point and smoothed. Then, the curve data processed in each wavelength segment is normalized. When normalizing, first calculate the difference between the maximum and minimum values of each wavelength segment, and use this difference as the denominator for linear scaling, so that the spectral intensity is distributed between 0 and 1 and remains at the same magnitude level as other wavelength segments in subsequent records. To prevent individual abnormal extreme values from affecting the global scaling, the mean plus twice the standard deviation is also used to screen for abnormal points that are too large or too small. If abnormal values are found in certain wavelength segments, the characteristics of this segment are independently recorded in the abnormal list and their true effectiveness is confirmed through multiple sampling comparisons. Finally, all the spectral data after denoising and normalization are unified and integrated into the standardized spectral data structure to obtain the standardized spectral data.
[0090] The advantage of the formula is that it comprehensively considers the difference between the spectral point data and the sparse basis representation of the chemical components, and through the correction of the occurrence frequency of each chemical component and the introduction of the non-linear adjustment factor, the spectral feature differences of different components of rice can be more effectively superimposed and emphasized.
[0091] X jThe acquisition steps are as follows: sequentially extract the intensity value of the j-th spectral point from the previously obtained standardized spectral data. This intensity value is formed by collecting multiple measurements in the early stage, averaging them. If more precision is required, the number of measurements can be set between 10 and 20, and all spectral data points are recorded and then averaged;
[0092] S jk The acquisition steps are as follows: select the corresponding sparse basis when analyzing each chemical component. By means of the sparse decomposition experiment on the rice spectra of multiple samples in the early stage, obtain the coefficient vector in the sparse representation, and regard the component corresponding to the j-th point as S jk , and this component is usually obtained by operating from the training data through a sparse optimization method;
[0093] G k The acquisition steps are as follows: respectively count the occurrence frequency of each chemical component among all spectral points. In actual operation, first initialize a cumulative count for each component, then retrieve the sparse representation of the J spectral points. If the component appears at a certain point, accumulate 1 time. Finally, divide the cumulative count by J to obtain G k ;
[0094] The acquisition steps of λ are as follows: the scaling factor introduced between the spectral intensity and the sparse representation coefficient is derived from the comparison of historical samples. Whenever a large deviation is found between the intensity value and the sparse coefficient, λ is adjusted appropriately. After multiple batches of tests, it is found that setting it in the range of 0.8 to 1.2 can keep the subsequent operations balanced, and it can be further corrected according to the rice variety and measurement instrument;
[0095] The acquisition steps of β are as follows: perform trial calculations on the obtained ln terms for a large number of sample data, observe the overall non-linear amplification effect after adjustment. It is more appropriate to set β between 1.2 and 2.0. Determine the final value by reading and comparing the differences of each component in the actual spectrum. For example, statistics show that β = 1.5 can obtain good discrimination when the sparse coefficient is large;
[0096] Calculation process:
[0097] First, determine the magnitudes of K and J. For example, for 3 main chemical components, let K = 3, and the total number of spectral data points is recorded as J = 500. Then, extract X point by point from the spectral data j , such as in a certain measurement, the intensity value of the j = 10th spectral point is 0.72. The corresponding S obtained from the previous sparse decomposition 10,1 = 0.30, S 10,2 = 0.15, S 10,3 = 0.00, and the occurrence frequencies of the three components are counted as G1 = 0.50, G2 = 0.40, G3 = 0.10. Set λ to 1.0 and β to 1.5. Then, first calculate |X j -λ·Sjk | 2 , for example, when k = 1 for the first component:
[0098] |0.72 - 1.0×0.30| 2 = 0.42 2 = 0.1764
[0099] The rest of the components are analogized and then merged into , and then calculate and substitute it into ln(·), then take the β-th power of the whole term result, and finally sum from k = 1 to 3 to obtain the value of C;
[0100] This result indicates that after obtaining C, the comprehensive influence of each chemical component on the spectral distribution of rice can be distinguished by the numerical value. When C is larger, it means the overall difference is more obvious, and then the spectral signals can be further screened in the subsequent analysis. If C is below a certain range, it means the contribution degree of the current component is relatively small and may not be prominent in the spectrum.
[0101] Reconstruct the spectral data based on the characteristic composite value of the chemical components to remove non-characteristic noise and irrelevant data. First, select the part with higher numerical values from the characteristic composite values of the chemical components obtained in the previous steps and record their indexes. Subsequently, compare the spectral data pointed to by these indexes with the original standardized spectral curve one by one. If it is found that some points show excessive dispersion in the sample comparison, they will be marked as irrelevant data according to the threshold division principle determined statistically. This threshold is usually set by the variance range of the spectral intensity actually observed in multiple batches of measurements. For example, when the intensity variance is generally found to fluctuate between 0.001 and 0.010 during multiple batches of collection, 0.012 can be obtained by adding 0.002 to its upper limit range as the threshold. If the variance record of the current spectral point exceeds 0.012, it is considered highly discrete and listed in the irrelevant data list. Immediately, these irrelevant data are removed from the spectral curve and the interpolation of adjacent points is corrected according to the reconstruction rule. The linear interpolation method is used for the interpolation process, and the intensity difference between each wavelength point and its adjacent wavelength point is distributed according to an equal proportion to make the new interpolated curve retain the continuity consistent with the context. Then, combined with the previously recorded suspicious noise value range, for example, there are sometimes abnormal sudden increases or decreases in the numerical fluctuations in the 500nm to 600nm band, which can be mapped to the range where the variance value exceeds 0.01 for secondary judgment, and the repeated abnormal data are listed as high noise and removed again. This can reduce the interference to the overall distribution of the reconstructed curve. Finally, all the updated spectral curves are merged to form a new data set and recorded again to form a spectral feature data set.
[0102] The steps to optimize the acquisition of spectral features are as follows:
[0103] Based on the spectral feature dataset, construct an input feature matrix, normalize the spectral data, and at the same time remove outliers and isolated points through neighborhood filtering to form a preprocessed spectral feature matrix;
[0104] According to the preprocessed spectral feature matrix, perform feature compression and noise reduction through a deep autoencoder. The expression is:
[0105]
[0106] where Z is the eigenvalue after compression and noise reduction, X k is the eigenvalue of the k-th column in the input spectral feature matrix, and Y k is the corresponding eigenvalue generated by neighborhood filtering after noise reduction;
[0107] Based on the eigenvalue after compression and noise reduction, perform non-linear reconstruction of the feature information, eliminate noise and redundant features, and obtain the optimized spectral features.
[0108] Specifically, based on the spectral feature dataset, construct an input feature matrix, normalize the spectral data, and at the same time remove outliers and isolated points through neighborhood filtering. First, disassemble each wavelength position and its corresponding rice sample number from the previously obtained rice spectral feature dataset, and extract the spectral intensity value at each wavelength. Then, perform point-by-point comparison for each wavelength segment. If the intensity deviates too much from the global mean, the deviation degree needs to be recorded and included in the subsequent anomaly detection range. The anomaly detection range is generally formed by statistically sampling multiple batches of spectra. For example, after collecting the spectral values of 100 rice samples in the wavelength segment from 400nm to 500nm, calculate the maximum value, minimum value, and variance, and take the sum of three times the variance plus the mean and the difference between three times the variance minus the mean to jointly form an upper and lower limit interval. Points outside this interval are regarded as high-deviation points, and then use the neighborhood filtering method to determine whether they belong to isolated situations. The specific method is to compare the spectral intensities within the adjacent wavelength ranges around. If the intensity of a certain point differs from the average value of adjacent points by more than a certain empirical threshold, for example, from the previous tests, the average deviation of adjacent ten points is generally not more than 0.02, but here it is greater than 0.04, then this point can be determined as an isolated point and smoothed. At the same time, the normalization operation can adopt the linear normalization method, such as mapping the minimum value of the current wavelength segment to 0 and the maximum value to 1. After obtaining the normalization results of all wavelength segments, perform row and column alignment to construct a matrix format with the same dimension for subsequent calls. If it is detected that there are continuously high or low outliers in some wavelength segments during multiple repeated measurements, it is necessary to query the previous records again to confirm whether it is an instrument error in sampling, and then exclude the fault factors through multiple measurement comparisons. Finally, integrate all the data that have undergone neighborhood filtering and normalization to form a preprocessed spectral feature matrix.
[0109] The advantage of the formula is that it maps the fusion expression of the input features and the filtered features by the deep autoencoder in a dual way, and nonlinearly compresses the final output by the tanh function, which can balance the ratio of noise to effective information.
[0110] X k The acquisition steps of X are as follows: read the spectral intensity corresponding to the k-th column from the preprocessed spectral feature matrix obtained previously. If there are multiple samples in the same column, first calculate the average value or median value to represent the feature point, then correct it in combination with the comparison range recorded previously, and finally obtain X. k ;
[0111] Y k The acquisition steps of Y are as follows: after neighborhood filtering previously, obtain a corresponding filtering result with the same dimension as X. k If outliers are found during the filtering process, perform smooth interpolation at that position and then include it in the vector of Y. k ;
[0112] Calculation process:
[0113] First, select a column from the preprocessed spectral feature matrix. Let the eigenvalue of the k-th column be X. k = 0.8, and the corresponding filtering result is set as Y. k = 0.3. Since it is necessary to satisfy that the denominator of is not zero, the numerical value can be directly substituted for calculation:
[0114]
[0115] Then calculate ln(|X k |·|Y k |):
[0116] ln(0.8 × 0.3) = ln(0.24) ≈ -1.427
[0117] Add the two:
[0118] 0.613 + (-1.427) ≈ -0.814
[0119] Then use the tanh function:
[0120] Z = tanh(-0.814) ≈ -0.671
[0121] This result shows that in this example, if the Z value is negatively biased, it indicates that there is a certain degree of difference between the denoised feature and the filtering result. The difference can be separately recorded in the subsequent reconstruction and the surrounding wavelength points can be compared. If -0.671 is less than -0.5, it is marked as a relatively obvious negative shift. If it is close to 0, it means that the difference between the feature and the filtering result is small.
[0122] Based on the compressed and noise-reduced eigenvalue, non-linearly reconstruct the feature information, eliminate noise and redundant features. First, find the high-offset records corresponding to each eigenvalue according to the output result of the previously generated deep autoencoder, and check whether these high-offset features appear repeatedly against the reference interval of neighborhood filtering in the previous stage. If they appear multiple times, it indicates that there are similar distribution changes of this feature in different measurement batches. By comparing the distribution of this feature at the corresponding position of the spectral wavelength, if its deviation degree exceeds the upper limit of the standard deviation range defined previously, for example, the difference is concentrated between 0.01 and 0.03 below most wavelengths, but there is an outlier exceeding 0.05, then these outliers need to be deleted and compensation values similar to adjacent features are inserted within the same column vector range. If the deviation only appears in individual batches, continue to observe more sampling times to confirm whether it still exceeds the preset threshold in the future. After all outliers have been reviewed and corrected, an updated feature matrix will be formed. Immediately, perform non-linear reconstruction at the output layer of the deep autoencoder, use this updated matrix as the input for multiple rounds of forward calculation, and record the difference between each feature point after reconstruction and the previous output during each iteration. When the difference gradually converges within a certain range, regard this range as the final convergence determination criterion. For example, when the difference is within the range of ±0.02, it is considered to reach stability. Then, summarize these stable feature vectors to obtain a new feature list, further filter out feature rows with too low density or too low correlation, and finally produce an optimized spectral feature that can be directly used for subsequent discrimination or classification after continuously checking whether there is abnormal jitter in each wavelength segment.
[0123] The steps to obtain the weight-adjusted feature set are as follows:
[0124] Based on the local enhanced visual features and the optimized spectral features, learn the interdependent relationship between different features through the self-attention mechanism, assign weights to each feature, and obtain the feature weight assignment result;
[0125] According to the feature weight assignment result, adjust the weight of each feature, and reconstruct the feature set by combining the adjusted weights to obtain the weight-adjusted feature set.
[0126] Specifically, based on local enhanced visual features and optimized spectral features, the self-attention mechanism is used to learn the interdependencies between different features. First, the color, texture, and difference values of each local area are disassembled from the previously obtained local enhanced visual features. Then, the spectral intensity distribution and the filtered key wavelength information are read column by column from the previously obtained optimized spectral features. After aligning these two parts, they are respectively labeled and stored in the same data structure. Then, a unique index number is assigned to each visual feature and spectral feature within this data structure. Next, the values pointed to by these index numbers are associated and compared one by one. For example, the visual texture distribution is paired with the intensity value of a certain wavelength band in the spectrum to see if they frequently co-occur in multiple historical batches of measurements. If they frequently co-occur, the attention ratio in the correlation matrix is increased; if they only occasionally co-occur, the medium ratio is maintained. To convert these comparison results into the input of weight assignment, a matrix record needs to be generated according to the index number first. Different visual features are listed in the row direction, and different spectral features are listed in the column direction. The detailed parameters such as the corresponding occurrence times, amplitude differences, and the previously recorded local difference values are stored at the matrix intersection. In the self-attention mechanism, each element of the matrix is traversed in a loop, and the mutual relationship of this element relative to other elements is calculated in a one-to-many manner. Higher scores are given to combinations that frequently co-occur and have small deviations. If the score exceeds a predefined empirical threshold, such as 0.6, it is additionally marked as a highly correlated combination. This threshold is obtained by statistical analysis in a thousand sample comparisons. When it exceeds 0.6, it is recorded in the key list, so as to continuously accumulate the attention degree of each feature in multiple rounds of iteration. Subsequently, the associated values after all calculations are completed are summarized, normalized, and weighted and integrated. Finally, corresponding weights are assigned to each feature to obtain the feature weight assignment result.
[0127] According to the feature weight assignment results, adjust the weights of each feature, and reconstruct the feature set by combining the adjusted weights. First, read the final weights of visual texture, visual color, spectral intensity, etc. in the self-attention mechanism one by one according to the previously obtained weight assignment result table, and then compare the distribution ranges of each feature in multi-batch sampling and different scenarios. For example, if the weights of a certain feature in different samples are concentrated between 0.4 and 0.5, it can be regarded as having a medium importance level. However, if the weights of a certain feature fluctuate between 0.1 and 0.7, it indicates that it is very prominent in some samples. Then, make fine-tuning according to this fluctuation situation. To avoid extreme imbalance during reconstruction, a reference threshold obtained from historical experience, such as 0.8, will be set. If the weight exceeds 0.8, the influence value of this feature will be temporarily limited within 0.8 to prevent a certain feature from having too high a proportion in extreme cases. If the weight is lower than 0.2, continue to record and observe more samplings. If it remains below 0.2 after multiple observations, it can be classified as a weakly correlated feature. Then, write these adjusted weights into the reconstruction matrix item by item, using row indices to distinguish each visual feature and column indices to distinguish each spectral feature, and perform a compact sorting according to the final weight values. If the correlation degrees of adjacent features are close in multiple rounds of verification, arrange them in adjacent positions for subsequent calls. After all features complete weight adjustment, summarize and generate a newly constructed feature set to obtain the weight-adjusted feature set.
[0128] The steps for obtaining the fused feature set are as follows:
[0129] Based on the weight-adjusted feature set, unify the scales and formats of different features to obtain a standardized weight-adjusted feature set;
[0130] According to the standardized weight-adjusted feature set, perform feature fusion, and generate a feature fusion result by comparing and matching the correlations between different features feature by feature;
[0131] Based on the feature fusion result, reconstruct the feature representation including visual features and spectral features, remove redundant information, and generate a fused feature set.
[0132] Specifically, based on the weight-adjusted feature set, first read the data dimensions of each feature sequentially from the previously obtained weight assignment records, and mark their visual or spectral sources respectively in a data structure. Then, retrieve the previous rice grain detection data to confirm the data types and value ranges of each feature. For example, the color feature is mostly in the integer range of 0 to 255, and the spectral intensity is often a small numerical range between 0.0 and 1.0 or 0.0 and 2.0. Then, set a predetermined standard in comparison with the historical sample information to judge whether the value deviates from the central distribution of most features. This predetermined standard can be obtained by statistically calculating the mean and standard deviation of the feature in hundreds of rice samples. If the distance of the value from the mean exceeds twice the standard deviation, it is recorded as a deviation value. Subsequently, list all suspicious deviation values as observation objects and conduct a check during the summary process. To ensure the comparability of data with different dimensions such as vision and spectrum, the same transformation method needs to be adopted for all features. For example, when the value range of the visual feature is mostly between 0 and 255, the min-max normalization can be introduced to map it to the range of 0 to 1. If the value range of some spectral features is relatively large, the logarithmic transformation combined with the standardization measure can be used to compress it to an amplitude similar to that of other features. Then, adjust the scaling coefficient according to the importance of each feature. When it is found that the fluctuation amplitude of local features may affect the overall distribution, additional smoothing processing can be applied to these local features, but it is necessary to judge whether it has exceeded the preset threshold in combination with the previously observed variance threshold. For example, set the threshold at about 0.05. If the variance value of the current feature exceeds 0.05 repeatedly in multiple batches of acquisitions, the feature will be smoothed separately. Finally, write all features into a new matrix structure in a unified format and sort them according to the column index to keep their data formats consistent, obtaining the standardized weight-adjusted feature set.
[0133] Adjust the feature set according to the standardized weights, perform feature fusion, and by comparing features one by one and matching the correlation between different features. First, list the row indices of all visual features and spectral features, record their normalized values or standardized values in a table, and then check the numerical deviation between each visual feature and the spectral features in turn. If the deviation is within a relatively small interval, it is regarded as highly correlated. To determine this interval, the frequency of occurrence and numerical differences of these features can be statistically analyzed in the historical training data, and then a threshold interval from 0.02 to 0.05 can be set according to the statistical results. If the current deviation is lower than 0.02, it is recorded as a tight match; if the deviation is higher than 0.05, it may be regarded as a weak match. Mark the feature pairs with high matches in a matching list, and then sort them in the matching list after comparing each feature one by one, so that the feature pairs with high matching frequencies are arranged in the front. Finally, when traversing this matching list, comprehensively evaluate whether some feature combinations remain stable in multiple batches of detections according to the previously recorded difference data. For example, if the same visual texture feature remains within the range of ±0.03 with the spectral intensity of adjacent wavelengths multiple times, it indicates a strong correlation. During this process, if it is found that a local feature does not appear in any matching combination, it will be listed in the low-frequency area and marked as an optional object to be removed. After summarizing all verification information, give the final correlation measure and fuse each feature into a new matrix structure to generate the feature fusion result.
[0134] Based on the feature fusion result, reconstruct the feature representation including visual features and spectral features, and remove redundant information. First, select the feature combinations with higher correlation degrees from the fusion result and retain their indices, and check whether there are overly repeated feature columns among them. For example, when the correlation between two spectral features is always greater than 0.95 and they increase and decrease simultaneously in multiple comparisons, they can be regarded as redundant columns and removed. Then, perform a difference check on the new feature columns formed by the intersection of vision and spectrum. If a certain column feature changes very little and it is difficult to distinguish different rice samples among thousands of detection samples, it will be listed as a low-difference column and added to the list to be removed. Through the above removal steps, the entire feature set can be made more compact. If there are features whose redundancy has not been determined, multiple samplings can be performed or compared with historical records to judge the performance of the feature in a larger range. If the feature is still small or has ineffective fluctuations in multiple batches, it will be retained in the list for re-evaluation. Finally, sort all the confirmed features and write them into the same data structure uniformly, so that the visual features and spectral features are consistent in the row-column correspondence relationship, and then check whether there are extreme values statistically obtained in other paragraphs. If they exceed the previously set variance threshold such as 0.01, mark for inspection. After excluding all abnormalities, the final formatted fusion feature set is obtained.
[0135] The steps to obtain the intelligent screening optimization result are as follows:
[0136] Based on the fused feature set, divide the fused feature set into a training set and a test set, load the classification model, and perform the initial training operation of the classification model on the training set to obtain a preliminary classification model;
[0137] According to the preliminary classification model, conduct classification tests on the characteristics of rice grains in different batches in the test set, analyze the data characteristics that fail to adapt in the classification results, and combine the unadapted data to expand the model's capabilities to obtain a classification model adjusted through transfer learning;
[0138] Based on the classification model adjusted through transfer learning, classify the rice grains, generate classification labels for each grain, and obtain the intelligent screening optimization result.
[0139] Specifically, based on the fused feature set, divide the fused feature set into a training set and a test set. First, refer to the rice grain sample numbers and their characteristic distribution ranges marked in the previous spectral and visual fusion process, and separate 70% of the rice samples as the training set item by item, and use the remaining 30% as the test set. Then, review the feature values of each sample record within the training set again to compare their numerical ranges one by one according to the previously obtained feature indices. For example, check whether the visual texture distribution is in the range of 0 to 255, whether the spectral intensity is in the range of 0.0 to 2.0, and check whether there are outliers outside this range. If the degree of deviation from the mean deviation threshold set by multi-batch statistics, such as 0.03, exceeds, record this sample and reconfirm whether there is abnormal interference in its original acquisition process. If it is confirmed that it is not due to hardware failure, retain it and mark it as a special sample. Then, when loading the classification model, keep the selected model parameters consistent with the previously determined learning rate and number of iterations. For example, the learning rate is set between 0.001 and 0.005, and the number of iterations usually takes the range of 100 to 300. Each time an iteration is performed, read the training set samples and calculate the classification loss item by item, and compare whether the loss exceeds the previously statistically determined error range, such as the range of 0.1 to 0.15. If it exceeds, update the internal weights and bias values in the next iteration. If the error is still at a high level after multiple iterations, record the model state and check whether the convergence condition needs to be relaxed until the final trained parameters are stored after the end of this round of training to obtain a preliminary classification model.
[0140] According to the preliminary classification model, classification tests are conducted on the characteristics of rice grains from different batches in the test set. First, the visual and spectral feature values of each test sample are retrieved in the same way as in the training phase, and compared with the sampling batch information recorded earlier. If the color values of the rice grains in this batch generally deviate from the mean range of existing samples, for example, most of them are distributed above 200 in the range of 0 to 255, then this difference is marked in a reference list, and then these data with large differences are sent to the preliminary classification model for prediction. If an incorrect classification occurs, the prediction results of the model on the corresponding category output are recorded in detail and compared with the similarity threshold set previously, such as 0.7. If the prediction score is higher than 0.7, it is regarded as having a medium to high probability of recognition ability for the sample. If it is lower than 0.3, it indicates that the model has weak adaptability on this type of samples. Such test data will be marked as unfit, and these samples will be weighted and added to new training batches during subsequent transfer learning. The above training process will be repeated around the texture and spectral difference range of these new data. During this period, local adjustments can be made to the learning rate or number of iterations. If some batches of samples still have large deviations from the model judgment after multiple trainings, the extreme values of these batches in spectral intensity and visual texture will be compared. If the extreme value exceeds the variance threshold of 0.1 set previously, it will be retained as a key sample until the final training converges. Finally, the updated model parameters are output based on the expanded training data to obtain the classification model adjusted by transfer learning.
[0141] Based on the classification model adjusted by transfer learning, rice grains are classified. First, the weight and bias information contained in the new model is read, and the characteristic values of the rice samples are read in sequence according to the order of spectral and visual features. For each data row of rice, check whether the color value falls between 0 and 255, and whether the spectral intensity falls between 0.0 and 2.0. If there is a column of features that deviates from the valid range of the previous statistics, first check whether there are batch collection anomalies or instrument errors. If no other problems are found after investigation, the model is allowed to give a prediction result as usual, and the sample is marked according to the classification label output by the model. If the label is consistent with the expected category in the standard classification control of rice collected in the early stage, it is regarded as meeting the model classification output. Otherwise, the deviation is recorded for subsequent re-inspection. After all samples have gone through the classification process, the classification label of each grain is summarized, and finally merged to form a complete rice classification list to obtain intelligent screening optimization results.
[0142] The present invention provides a screening system, comprising:
[0143] The visual feature extraction module analyzes the color, gloss and texture of the rice grain surface through a convolutional neural network, extracts the visual features of each grain, and generates a visual feature dataset;
[0144] Attention refinement module, which uses spatial attention mechanism to focus on the cracks and discolored points of rice grains, refines local features of the visual feature dataset, improves feature resolution, and generates locally enhanced visual features;
[0145] Spectral feature optimization module, which extracts chemical component information from spectral data by using sparse coding, cooperates with the locally enhanced visual features to obtain a spectral feature dataset, and then performs noise reduction and feature compression on the spectral data through a deep autoencoder to generate optimized spectral features;
[0146] Feature fusion module, which combines the locally enhanced visual features and the optimized spectral features, adjusts the feature weights of different modal data through self-attention mechanism, integrates each feature, and generates a weight-adjusted feature set;
[0147] Intelligent screening and classification module, which classifies rice grains based on the weight-adjusted feature set, matches the characteristics of different batches of rice grains through transfer learning, and obtains an intelligent screening optimization result.
[0148] The above are only the preferred embodiments of the present invention, and do not limit the present invention in other forms. Any person skilled in the art may use the technical content disclosed above to make changes or modifications into equivalent embodiments with equivalent changes and apply them to other fields. However, as long as it does not depart from the technical solution content of the present invention, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention still fall within the protection scope of the technical solution of the present invention.
Claims
1. A method for intelligent screening of rice grains, characterized in that: The following steps are involved: The color, gloss and texture of the rice grain surface are captured by a convolutional neural network, and visual features are extracted in layers to generate a visual feature dataset; based on the visual feature dataset, spatial attention is used to focus on cracks and discolored spots of the rice grains, local features are refined, and local enhanced visual features are generated; Based on the local enhanced visual features, sparse coding is used to extract chemical composition information from rice spectral data to obtain a spectral feature data set; based on the spectral feature data set, spectral data is denoised and feature compressed by a deep autoencoder to generate optimized spectral features; Combining the local enhanced visual features with the optimized spectral features, allocating feature weights of different modal data through a self-attention mechanism to generate a weight-adjusted feature set; based on the weight-adjusted feature set, integrating features through feature fusion to generate a fused feature set; Based on the fused feature set, rice grains are classified, and the characteristics of rice grains in different batches are adapted through transfer learning to generate intelligent screening optimization results.
2. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps for obtaining the visual feature dataset are as follows: Deploy cameras to obtain rice images and use convolutional neural networks to capture the color, gloss, and texture features of the rice grain surface. Through the forward propagation of the convolutional neural network, the image data is converted into raw visual data. Based on the original visual data, a convolutional neural network is applied to perform multi-layer feature extraction, and refined visual features are formed through the continuous action of convolutional layers, pooling layers and non-linear activation layers; According to the refined visual features, the multi-layer extracted visual information is integrated, and a visual feature dataset containing the visual information of rice grains is constructed through feature standardization and data formatting.
3. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps of acquiring the local enhanced visual features are: Based on the visual feature dataset, focusing on the cracks and discolored spots of rice grains through spatial attention, analyzing feature differences, optimizing feature expressions of the cracks and discolored spots, and obtaining preliminary focused features; According to the initially focused features, the refined local feature score is calculated using the following formula: Among them, F i represents the visual features of the ith region, μ is the mean of the full-image features, and σ i is the standard deviation of the i-th region feature, D i is the deviation of the feature of the ith region from the mean, α is the adjustment factor, S is the score of the refined local feature, and N is the total number of regions analyzed in the image; Based on the refined local feature score, the local contrast and clarity of the image are adjusted to obtain local enhanced visual features.
4. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps of acquiring the spectral feature data set are: Using the local enhanced visual features, preprocessing the spectrum data of rice is performed, including denoising and normalization, to obtain standardized spectrum data; Based on the standardized spectral data, the characteristic composite value of the chemical composition is calculated using the following formula: Among them, X j is the jth spectral point data after preprocessing, S jk is the sparse basis representation of the kth chemical component at the jth point, G k is the frequency of occurrence of the kth chemical component in all spectral points, λ is the scaling factor, β is the nonlinear adjustment factor, K is the total number of chemical components, J is the total number of spectral data points, and C is the characteristic composite value of the chemical component; Based on the characteristic composite values of chemical components, the spectral data is reconstructed, non-characteristic noise and irrelevant data are removed, and a spectral feature data set is formed.
5. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps of obtaining the optimized spectral characteristics are: Based on the spectral feature data set, an input feature matrix is constructed, the spectral data is normalized, and outliers and isolated points are removed by neighborhood filtering to form a preprocessed spectral feature matrix; According to the preprocessed spectral feature matrix, feature compression and noise reduction are performed through a deep autoencoder, and the expression is: Among them, Z is the eigenvalue after compression and noise reduction, X k is the eigenvalue of the kth column in the input spectrum feature matrix, Y k The corresponding eigenvalues generated by neighborhood filtering after noise reduction processing; Based on the compressed and denoised eigenvalues, the characteristic information is nonlinearly reconstructed to remove noise and redundant features, thereby obtaining optimized spectral features.
6. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps for obtaining the weight adjustment feature set are: Based on the local enhanced visual features and the optimized spectral features, the interdependence between different features is learned through a self-attention mechanism, and a weight of each feature is assigned to obtain a feature weight assignment result; According to the feature weight distribution result, the weight of each feature is adjusted, and the feature set is reconstructed in combination with the adjusted weight to obtain a weight-adjusted feature set.
7. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps of obtaining the fusion feature set are: Based on the weight-adjusted feature set, unifying the scales and formats of different features to obtain a standardized weight-adjusted feature set; Adjust the feature set according to the standardized weights, perform feature fusion, and generate a feature fusion result by comparing and matching the correlations between different features one by one; Based on the feature fusion result, the feature representation including the visual features and the spectral features is reconstructed, redundant information is eliminated, and a fused feature set is generated.
8. The method for intelligent screening of rice grains according to claim 1, characterized in that: The steps for obtaining the intelligent screening optimization results are as follows: Based on the fused feature set, the fused feature set is divided into a training set and a test set, a classification model is loaded, and an initial training operation of the classification model is performed on the training set to obtain a preliminary classification model; According to the preliminary classification model, classification tests are performed on the characteristics of rice grains in different batches in the test set, the characteristics of data that cannot be adapted in the classification results are analyzed, and the model capabilities are expanded in combination with the unadapted data to obtain a classification model adjusted by transfer learning; Based on the classification model adjusted by transfer learning, rice grains are classified, a classification label for each grain is generated, and an intelligent screening optimization result is obtained.
9. The screening system of the rice grain intelligent screening method according to any one of claims 1 to 8, characterized in that: include: The visual feature extraction module analyzes the color, gloss and texture of the rice grain surface through a convolutional neural network, extracts the visual features of each grain, and generates a visual feature dataset; The attention refinement module uses the spatial attention mechanism to focus on the cracks and discolored spots of rice grains, refines the local features of the visual feature dataset, improves the feature resolution, and generates local enhanced visual features; The spectral feature optimization module uses sparse coding to extract chemical composition information from spectral data, and combines it with local enhanced visual features to obtain a spectral feature dataset. It then uses a deep autoencoder to perform denoising and feature compression on the spectral data to generate optimized spectral features. The feature fusion module combines local enhanced visual features with optimized spectral features, adjusts the feature weights of different modal data through the self-attention mechanism, integrates various features, and generates a weight-adjusted feature set; The intelligent screening and classification module classifies rice grains based on the weight-adjusted feature set and matches the characteristics of rice grains from different batches through transfer learning to obtain intelligent screening optimization results.