Hyperspectral rice grain waxiness discrimination method based on multi-branch collaborative modeling

By employing a multi-branch collaborative modeling method, combining feature extraction and fusion of CNN, SRU, and HorNet, the problems of low efficiency and insufficient accuracy in rice glutinousness discrimination are solved. This enables rapid, non-destructive, and accurate discrimination of hyperspectral rice grains, supporting the scientific classification and quality improvement of rice breeding.

CN121353752APending Publication Date: 2026-01-16RICE RES ISTITUTE ANHUI ACAD OF AGRI SCI
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511468006.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-14
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing methods for determining the glutinousness of rice suffer from low efficiency, reliance on manual intervention, and insufficient modeling capabilities. Traditional methods struggle to fully exploit the local features, temporal dependencies, and global semantics of hyperspectral data, resulting in limited accuracy.

Method used

A multi-branch collaborative modeling approach is adopted, combining local feature extraction from CNN, temporal modeling from SRU, and global high-order modeling from HorNet. Through multi-branch feature fusion and pooling attention mechanism, a hyperspectral rice grain glutinousness discrimination model is constructed to achieve fast, lossless, and high-precision discrimination.

Benefits of technology

It improves the accuracy and robustness of rice grain glutinousness identification, provides a rapid, non-destructive, and reliable automatic detection method, and supports the scientific classification and quality improvement of rice breeding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121353752A_ABST
    Figure CN121353752A_ABST
Patent Text Reader

Abstract

Aiming at the problems of low efficiency, strong subjectivity, insufficient modeling ability, complex hyperspectral data noise, weak waxiness spectrum difference and the like of a traditional rice grain waxiness discrimination method, the invention provides a hyperspectral rice grain waxiness discrimination method based on multi-branch collaborative modeling. The method comprises the following steps: S1, acquiring glutinous and non-glutinous rice grain images by using a hyperspectral imaging system to obtain spectral data; s2, preprocessing spectral data through a combined method of SG smoothing, an asymmetric weighted penalty least square method and multivariate scatter correction to reduce noise and interference; s3, constructing a multi-branch modeling architecture which comprises a CNN local feature extraction module, an SRU spectrum sequence modeling module and a HorNet global high-order modeling module, and outputting a discrimination result through a classifier after multi-branch features are subjected to fusion and pooling attention weighting; and S4, evaluating the performance. According to the method, high-precision lossless discrimination of the waxiness is realized, and a technical support is provided for germplasm screening and quality evaluation in rice breeding.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent agriculture and spectral detection, and relates to a hyperspectral method for determining the glutinousness of rice grains based on multi-branch collaborative modeling. Background Technology

[0002] Rice is one of my country's most important food crops, playing a fundamental role in ensuring food security and serving as a vital source for meeting the diverse dietary needs of its residents. Glutinous rice, as an important type of rice, is increasingly in demand for food processing, specialty consumption, and functional food development due to its low amylose content and soft, chewy texture, showing a broad market prospect. Non-glutinous rice, on the other hand, has significant advantages in staple food supply and industrial applications. Therefore, accurate differentiation between glutinous and non-glutinous rice is not only crucial for the scientific classification and rational utilization of rice varieties but also a core aspect of germplasm resource identification, superior variety selection, and quality improvement in rice breeding. By accurately detecting and distinguishing between glutinous and non-glutinous rice, breeders can quickly screen materials that meet specific consumer and industrial needs, accelerating the breeding process and shortening the breeding cycle. Simultaneously, it provides reliable phenotypic support for molecular breeding and quality improvement, promoting genetic analysis and targeted improvement of quality traits. Therefore, rice glutinousness identification is a key task in the breeding process, directly impacting the efficiency of germplasm resource screening and variety improvement.

[0003] Currently, traditional methods for determining the glutinousness of rice mainly include iodine staining, physicochemical detection methods, and near-infrared spectroscopy. Iodine staining distinguishes glutinous from non-glutinous rice based on the color difference after the reaction of starch with iodine. While simple and low-cost, it relies on manual observation, making the results susceptible to subjective influence and unable to meet high-throughput requirements. Physicochemical detection methods primarily determine glutinousness by measuring indicators such as amylose content and gel consistency, offering high accuracy, but the experimental process is complex, time-consuming, and destructive to the samples. Near-infrared spectroscopy can achieve a certain degree of non-destructive testing, but traditional modeling methods (such as PLSR and SVM) struggle to fully exploit the complex spectral-spatial features, limiting the accuracy of the determination.

[0004] With the development of spectral technology and artificial intelligence, non-destructive testing technology based on spectral imaging has gradually become an emerging method for seed variety and quality testing. Hyperspectral imaging technology combines the advantages of spectral analysis and imaging, enabling the simultaneous acquisition of the external morphology and internal spectral characteristics of rice seeds without damaging the sample, revealing their physical structure and physiological state. However, the spectral characteristics of glutinous and non-glutinous rice seeds differ little, and hyperspectral data is usually high-dimensional and informationally redundant. Traditional statistical modeling or shallow machine learning methods are insufficient to fully explore their potential spectral-spatial features and lack the ability to express subtle differences in glutinousness. In recent years, deep learning methods have been gradually applied to spectral analysis. Among them, CNN excels at local feature extraction but is insufficient in modeling global dependencies; Transformer can capture global correlations, but its computational cost is high and its sensitivity to local details is low; recurrent networks such as LSTM / GRU can model temporal dependencies, but they have not specifically addressed the long-range inter-band dependencies in hyperspectral data. Existing technologies generally suffer from the following shortcomings: ① They lack the ability to collaboratively model local features, temporal dependencies, and global semantics; ② Hyperspectral data has high dimensionality and complex noise, making it difficult for traditional preprocessing methods to effectively improve the signal-to-noise ratio; ③ Existing models are insufficient in expressing subtle spectral differences in glutinousness. Therefore, there is an urgent need for a deep learning architecture that combines local feature enhancement, short-range temporal dependencies, and global long-range modeling to achieve rapid, lossless, and high-precision identification of glutinousness in rice grains. Summary of the Invention

[0005] To overcome the problems of low efficiency, reliance on manual labor, and insufficient modeling capabilities in existing methods for detecting glutinousness, this paper proposes a hyperspectral method for rice grain glutinousness discrimination based on multi-branch collaborative modeling, achieving high-precision and non-destructive discrimination of rice grain glutinousness. By introducing simple recurrent units to improve temporal modeling efficiency, and combining the global modeling capabilities of high-order spatial interaction modeling networks with the local feature extraction advantages of convolutional neural networks (CNNs), a multi-branch feature extraction and fusion framework is constructed to enhance the model's ability to capture spectral features, enabling the detection of glutinous and non-glutinous rice grains. This provides an accurate, non-destructive, and reliable automatic detection method for rice breeding.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A hyperspectral method for determining the glutinousness of rice grains based on multi-branch collaborative modeling includes: S1. Hyperspectral images of glutinous and non-glutinous rice grains are acquired using a hyperspectral imaging system. After correction with a black and white plate, the region of interest of the rice grains is extracted. The average spectral reflectance of the region of interest of the rice grains is calculated to obtain the spectral data of glutinous and non-glutinous rice grains. S2. The spectral data is processed using a combination of SG smoothing, asymmetric weighted least squares method and multivariate scattering correction to obtain the preprocessed spectrum. S3. Design a multi-branch system modeling architecture. The detection model includes a CNN local feature extraction module, an SRU spectral sequence modeling module, a HorNet global high-order modeling module, and a multi-branch feature fusion and classification module. The multi-branch fusion and classification module fuses CNN local features, SRU sequence features, and HorNet global features, and outputs the results of rice glutinousness and non-glutinousness through a fully connected layer and a classifier. S4. Divide the spectral data into training, validation and test sets, train the model using the cross-entropy loss function, and evaluate the model performance based on accuracy, precision and recall.

[0007] Furthermore, the hyperspectral imaging system in S1 includes an imaging hyperspectral camera, a light source, and an image acquisition platform to acquire hyperspectral images of glutinous and non-glutinous rice seeds; The original hyperspectral image is subjected to black-and-white plate correction, specifically as follows: ; In the formula, R The corrected reflectance of rice grains; R O This is the original hyperspectral image; R D The calibration image is completely black after the lens is covered; R W This is a whiteboard reference value; After correction, the region of interest for a single rice seed in the hyperspectral image was extracted using ENVI software. The average spectral reflectance of the pixels in each region of interest was calculated to obtain the spectral data required for subsequent processing.

[0008] Furthermore, in step S2, SG smoothing is performed based on local polynomial fitting and convolution operations, with the specific formula as follows: ; In the formula, i is the i-th wavelength point in the spectral signal. It is the value of the original spectral signal. These are the spectral values ​​after SG smoothing. m It is an integer that is half the window size. The coefficients are determined by the polynomial order and the size of the 2m+1 moving window. By calculating the center spectral data point within each moving window, high-frequency noise is reduced while maintaining the overall shape of the spectral signal and its features, including peaks and troughs, without distortion. The asymmetric weighted penalized least squares baseline correction introduces a penalty term during baseline calculation to balance signal fitting and smoothing constraints. It then estimates the baseline of the SG-smoothed spectral data using the following formula: ; ; In the formula, It is the input spectral data. To fit a baseline to the target to be estimated, These are the baseline-corrected spectral values. N For spectral wavelengths, D It is a second-order difference matrix, where λ is the coefficient of the smoothing term. W It is an asymmetric weight vector; By performing a difference operation between the baseline signal obtained through iterative optimization and the input spectrum, baseline drift in the spectrum is eliminated, thereby improving spectral resolution and enhancing the recognizability of characteristic absorption peaks. The multivariate scattering correction described above is based on univariate linear regression and corrects for the scattering effects in the baseline-corrected spectrum caused by sample surface inhomogeneities and internal heterogeneity of the grains. The specific formula is as follows: ; In the formula, For input spectral data The average spectrum, These are the relative offset coefficient and the displacement, respectively. To correct the spectrum; First, the mean of all spectral data is calculated to construct a reference spectrum. Then, a univariate linear regression is performed on each measured spectrum in combination with the reference spectrum to obtain the relative offset coefficient and displacement. Finally, the original spectrum is corrected using the relative offset coefficient and displacement to eliminate scattering effects.

[0009] Furthermore, in step S3, the CNN local feature extraction module consists of at least three convolutional blocks, each of which sequentially includes a full-dimensional dynamic convolutional layer, a batch normalization layer, an activation function layer, and a max pooling layer. The aforementioned full-dimensional dynamic convolutional layer performs fine-grained adjustments in four dimensions during the convolution process: the number of convolutional kernels, spatial size, number of input channels, and number of output channels. This allows for dynamic adjustment of the shape and size of the convolutional kernels based on the characteristics of the input data, dynamically matching spectral variation patterns across different bands, and enhancing the ability to capture local absorption peaks and troughs. The specific formula is as follows: ; in, As input features, z For output features, W iFor the i-th convolution kernel, , , , These represent the attention scalars in four dimensions: number of convolutional kernels, number of input channels, number of output channels, and spatial size, respectively. * represents multiplication operations along the kernel space in different dimensions, and * represents convolution operations.

[0010] Furthermore, in the process of constructing the rice grain glutinousness discrimination model in step S3, an SRU spectrum sequence modeling module is introduced to perform temporal modeling of the local features output by the CNN; The local features extracted by the CNN are divided into time series sequences according to the spectral band order, which is consistent with the number of bands. t The time step corresponds to the first t The local features of each band are modeled using the SRU cyclic mechanism to capture the dynamic dependencies between adjacent bands in the spectral data, thereby achieving temporal encoding of local features and generating a feature representation with a continuous time line. The specific formula is as follows: ; ; ; ; in, z t For the current layer t Input value at any given time; f t and r t They are respectively t The forgetting gate and the reset gate of time; Sigmoid activation functions for the forget gate and reset gate; c t-1 and c t They are t- 1. t The unit state value at that moment; h t for t The hidden state vector at time t; Tanh is the hyperbolic tangent activation function for the hidden state; W c , W f , W r For weighting functions; b f , b r It is the bias vector; Multiply by elements.

[0011] Furthermore, in the rice grain glutinousness discrimination model construction process in step S3, the HorNet module is used to globally model the spectral data, and global features are extracted through multi-level recurrent gated convolution operations, ultimately outputting a global semantic representation containing long-distance dependencies. The recurrent gated convolution g... n Conv achieves spatial interaction through operations such as standard convolution, linear mapping, and matrix element-wise multiplication. The basic structure of HorNet is a first-order gated convolution gConv with n=1. The mathematical definition of a first-order gated convolution is: ; in y For input, z gconv For the output of gConv, and It is a linear mapping operation based on channel mixing operation implemented with a 1×1 convolution kernel; This is a depthwise separable convolution with a kernel size of 7×7; p 0 and q 0 represents the feature layer after the result of the linear mapping operation is segmented along the channel dimension; Multiply by elements; repeat n Then we can get n recursive gated convolution of order g n Conv enables the modeling of information interaction between higher-order channels.

[0012] Furthermore, in the process of constructing the S3 rice grain glutinousness discrimination model, the multi-branch feature fusion and classification module performs three-branch feature splicing through Concat, including local features extracted by the CNN local feature extraction module, temporal features extracted by the SRU spectrum sequence modeling module, and global features extracted by the HorNet global high-order modeling module. A pooling attention mechanism is introduced, which generates channel-level feature statistics through max pooling and average pooling. Different channel attention weights are generated using a fully connected layer, key features are dynamically weighted, redundant information is suppressed, and spectral key features are output. The key spectral features are processed by a fully connected layer and a Softmax classifier to output the classification results of whether rice grains are glutinous or non-glutinous.

[0013] Furthermore, the pooling attention mechanism includes: Perform a one-dimensional convolution operation on the features after Concat fusion to obtain C Individual channel characteristics; Max pooling and average pooling are performed on the channel features respectively, resulting in two pools of length 1. C eigenvectors; The two feature vectors are concatenated and then input into the weight generation module to obtain the attention weights. Multiplying the attention weights by the input features yields the spectral key features, specifically using the following formula: ; ; ; ; ; In the formula, It is length And the number of channels C For the input features, , These are the vectors generated by average pooling and max pooling, respectively. for , The concatenated feature vector This is a fully connected operation function. W FC These are parameters of the fully connected layer network. b FC It is the parameter offset. w c It is the first c Characteristics of the channel z out This is the output spectral feature vector. Further, in step S4, the model training and evaluation selects the cross-entropy loss function as the model's loss function, and uses accuracy, precision, and recall as model performance evaluation metrics. The processed glutinous and non-glutinous hyperspectral datasets are divided into training, validation, and test sets. The rice grain detection model is trained using the training and validation sets, and its performance is evaluated using the test set. The model parameters with the highest test accuracy are saved as the parameters for the rice grain glutinousness detection model.

[0014] Compared with the prior art, the present invention has the following beneficial effects: This invention leverages hyperspectral technology to acquire the internal physicochemical characteristics of rice grains across multiple continuous bands, capturing subtle differences in components related to glutinousness. It also utilizes the strong self-learning capabilities of deep learning technology to construct a method for discriminating the glutinousness of rice grains based on hyperspectral and deep learning. The method employs multi-branch learning modules of CNN, SRU, and HorNet to acquire local, temporal, and global features from spectral data. It combines feature splicing and fusion of multi-branch features and introduces a pooling attention mechanism to adaptively adjust attention weights based on the input spectral features. This guides the model to focus more on features related to glutinousness and non-glutinousness, enhancing feature expression capabilities and achieving effective discrimination of rice grain glutinousness. This method is of great significance for rice germplasm resource screening, seed quality evaluation, and the breeding of superior varieties. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating the implementation of the method of this invention; Figure 2 This is a schematic diagram of the hyperspectral acquisition system of the present invention; Figure 3 These are partial spectral curves of the glutinous and non-glutinous seeds of this invention; Figure 4 This is a structural diagram of the rice grain glutinousness discrimination model of the present invention; Figure 5 This is a schematic diagram of the full-dimensional dynamic convolution of the present invention; Figure 6 This is a schematic diagram of the SRU (Simple Recurrent Unit) structure of the present invention; Figure 7 This is a schematic diagram of the HorNet structure, a high-order spatial interaction modeling network of this invention. Figure 8 This is a schematic diagram of the pooling attention mechanism structure of the present invention. Detailed Implementation

[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] like Figure 1 As shown, the purpose of this invention is to provide a hyperspectral rice grain glutinousness discrimination based on multi-branch collaborative modeling. By accurately identifying the glutinousness and non-glutinousness of rice grains, it provides technical support for rice germplasm resource screening, seed quality evaluation, and breeding of superior varieties. It is of great significance for improving rice breeding efficiency, promoting the dissemination of high-quality varieties, and ensuring national food security.

[0018] S1. Hyperspectral Image Acquisition: A hyperspectral imaging system is built to acquire hyperspectral images of glutinous and non-glutinous rice grains. After black and white plate correction, the regions of interest (ROI) of the rice grains are extracted, and the average spectral reflectance of the ROI is calculated to obtain the spectral data of glutinous and non-glutinous rice grains.

[0019] A hyperspectral imaging system was constructed, including an imaging hyperspectral camera, a light source, and an image acquisition platform, for acquiring hyperspectral images of glutinous and non-glutinous rice seeds. The original hyperspectral images underwent black-and-white plate correction, specifically as follows: ; In the formula, R The corrected reflectance of rice grains; R O This is the original hyperspectral image; R D The calibration image is completely black with the lens covered (reflectivity is almost 0); R W This is a reference value for a whiteboard; the reflectivity is close to 100%.

[0020] After correction, the region of interest for a single rice seed in the hyperspectral image was extracted using ENVI software. The average spectral reflectance of the pixels in each region of interest was calculated to obtain the spectral data required for subsequent processing.

[0021] Using hyperspectral imaging systems, such as Figure 2 As shown, the system includes a FigSpec FS-25 hyperspectral imaging camera, a light source, and an image acquisition platform. The hyperspectral imaging camera has a spectral range of 900-1700 nm, a spectral resolution of 8 nm, and an image resolution of 320×320 pixels. During hyperspectral image acquisition, 100 seeds from each seed category were randomly selected and arranged on a plate at a size of 10×10, ensuring no overlap or adhesion between seeds. The seeds were then scanned with the hyperspectral camera to collect hyperspectral data. To eliminate the effects of dark current, uneven illumination, and sensor noise, the acquired hyperspectral images of rice grains were corrected using a black and white board using FigSpec software. After image acquisition and correction, the reflectance of the regions of interest in the obtained hyperspectral images of rice grains was extracted using ENVI 5.6 (Exelis Visual Information Solutions) software, constructing a spectral dataset containing all samples. Partial spectral curves of glutinous and non-glutinous grains are shown below. Figure 3 As shown.

[0022] S2. Spectral data preprocessing: The spectral data is processed using a combination of Savitzky-Golay (SG) smoothing, asymmetrically reweighted penalized least squares (arPLS), and multivariate scatter correction (MSC) to reduce noise, eliminate baseline drift, and weaken scattering effects, resulting in preprocessed spectra.

[0023] In step S2, SG smoothing is performed based on local polynomial fitting and convolution operations. The specific formula is as follows: ; In the formula, i is the i-th wavelength point in the spectral signal. It is the value of the original spectral signal. These are the spectral values ​​after SG smoothing. m It is an integer that is half the window size. The coefficients are determined by the polynomial order and the 2m+1 moving window size.

[0024] By calculating the center spectral data point within each moving window, high-frequency noise is reduced while maintaining the overall shape of the spectral signal and its features, including peaks and troughs, without distortion. The asymmetric weighted penalized least squares baseline correction introduces a penalty term during baseline calculation to balance signal fitting and smoothing constraints. It then estimates the baseline of the SG-smoothed spectral data using the following formula: ; ; In the formula, It is the input spectral data. To fit a baseline to the target to be estimated, These are the baseline-corrected spectral values. N For spectral wavelengths, D It is a second-order difference matrix, where λ is the coefficient of the smoothing term. W It is an asymmetric weight vector; By performing a differential operation between the baseline signal obtained through iterative optimization and the input spectrum, baseline drift in the spectrum is eliminated, thereby improving spectral resolution and enhancing the recognizability of characteristic absorption peaks.

[0025] The multivariate scattering correction described above is based on univariate linear regression and corrects for the scattering effects in the baseline-corrected spectrum caused by sample surface inhomogeneities and internal heterogeneity of the grains. The specific formula is as follows: ; In the formula, For input spectral data The average spectrum, These are the relative offset coefficient and the displacement, respectively. To correct the spectrum; First, the mean of all spectral data is calculated to construct a reference spectrum. Then, a univariate linear regression is performed on each measured spectrum in combination with the reference spectrum to obtain the relative offset coefficient and displacement. Finally, the original spectrum is corrected using the relative offset coefficient and displacement to eliminate scattering effects and improve the comparability of spectral signals and the significance of characteristic absorption peaks.

[0026] S3. Construction of Rice Grain Waxiness Discrimination Model: A multi-branch system modeling architecture was designed. Based on Convolutional Neural Network (CNN), Simple Recurrent Unit (SRU), and High-Order Spatial Interaction Modeling Network (HorNet), a hyperspectral feature fusion model for rice grain waxiness detection was constructed. The detection model includes a CNN local feature extraction module, an SRU spectral sequence modeling module, a HorNet global high-order modeling module, and a multi-branch feature fusion and classification module. The CNN module is used to extract local spatial-spectral fine-grained features of rice seeds from preprocessed hyperspectral data; the SRU module is used for temporal modeling to capture short-range dependencies between adjacent bands and generate temporally aware features; the HorNet module uses a recursively gated high-order convolution mechanism to model long-range dependencies and generate a global semantic representation; the multi-branch fusion and classification module fuses CNN local features, SRU sequence features, and HorNet global features, and outputs the waxiness and non-waxiness results of rice seeds through fully connected layers and a classifier.

[0027] Furthermore, in step S3, the CNN local feature extraction module consists of at least three convolutional blocks, each of which sequentially includes a full-dimensional dynamic convolutional layer, a batch normalization layer, an activation function layer, and a max pooling layer. The aforementioned full-dimensional dynamic convolutional layer performs fine-grained adjustments in four dimensions during the convolution process: the number of convolutional kernels, spatial size, number of input channels, and number of output channels. This allows for dynamic adjustment of the shape and size of the convolutional kernels based on the characteristics of the input data, dynamically matching spectral variation patterns across different bands, and enhancing the ability to capture local absorption peaks and troughs. The specific formula is as follows: ; in, As input features, z For output features, W i For the i-th convolution kernel, , , , These represent the attention scalars in four dimensions: number of convolutional kernels, number of input channels, number of output channels, and spatial size, respectively. * represents multiplication operations along the kernel space in different dimensions, and * represents convolution operations.

[0028] Furthermore, in the process of constructing the rice grain glutinousness discrimination model in step S3, an SRU spectrum sequence modeling module is introduced to perform temporal modeling of the local features output by the CNN; The local features extracted by the CNN are divided into time series sequences according to the spectral band order, which is consistent with the number of bands. t The time step corresponds to the first t The local features of each band are modeled using the SRU cyclic mechanism to capture the dynamic dependencies between adjacent bands in the spectral data, thereby achieving temporal encoding of local features and generating a feature representation with a continuous time line. The specific formula is as follows: ; ; ; ; in, z t For the current layer t Input value at any given time; f t and r t They are respectively t The forgetting gate and the reset gate of time; Sigmoid activation functions for forget gates and reset gates; c t-1 and c t They are t-1 , t The unit state value at that moment; h t for t The hidden state vector at time t; Tanh is the hyperbolic tangent activation function for the hidden state; W c , W f , W r For weighting functions; b f , b r It is the bias vector; Multiply by elements.

[0029] Furthermore, in the rice grain glutinousness discrimination model construction process in step S3, the HorNet module is used to globally model the spectral data, and global features are extracted through multi-level recurrent gated convolution operations, ultimately outputting a global semantic representation containing long-distance dependencies. The recurrent gated convolution g... n Conv achieves spatial interaction through operations such as standard convolution, linear mapping, and matrix element-wise multiplication. The basic structure of HorNet is... n =1 first-order gated convolution gConv, the mathematical definition of first-order gated convolution is: ; in y For input, z gconv For the output of gConv, and It is a linear mapping operation based on channel mixing operation implemented with a 1×1 convolution kernel; This is a depthwise separable convolution with a kernel size of 7×7; p 0 and q 0 represents the feature layer after the result of the linear mapping operation is segmented along the channel dimension; Multiply by elements; repeat n Then we can get n recursive gated convolution of order g n Conv enables the modeling of information interaction between higher-order channels.

[0030] Furthermore, in the process of constructing the S3 rice grain glutinousness discrimination model, the multi-branch feature fusion and classification module performs three-branch feature splicing through Concat, including local features extracted by the CNN local feature extraction module, temporal features extracted by the SRU spectrum sequence modeling module, and global features extracted by the HorNet global high-order modeling module.

[0031] A pooling attention mechanism is introduced, which generates channel-level feature statistics through max pooling and average pooling. Different channel attention weights are generated using a fully connected layer, key features are dynamically weighted, redundant information is suppressed, and spectral key features are output. The key spectral features are processed by a fully connected layer and a Softmax classifier to output the classification results of whether rice grains are glutinous or non-glutinous.

[0032] Furthermore, the pooling attention mechanism includes: Perform a one-dimensional convolution operation on the features after Concat fusion to obtain C Individual channel characteristics; Max pooling and average pooling are performed on the channel features respectively, resulting in two pools of length 1. C eigenvectors; The two feature vectors are concatenated and then input into the weight generation module to obtain the attention weights. Multiplying the attention weights by the input features yields the spectral key features, specifically using the following formula: ; ; ; ; ; In the formula, It is length And the number of channels C For the input features, , These are the vectors generated by average pooling and max pooling, respectively. for , The concatenated feature vector This is a fully connected operation function. W FC These are parameters of the fully connected layer network. b FC It is the parameter offset. w c It is the first c Characteristics of the channel z out It is the output spectral feature vector.

[0033] In step S3, the hyperspectral rice grain glutinousness discrimination based on multi-branch collaborative modeling is implemented as follows: Figure 4 As shown, it mainly includes the following core modules: In the feature extraction stage, a three-layer cascaded CNN local feature extraction module is used, such as... Figure 5 As shown, each layer contains a one-dimensional full-dimensional dynamic convolution (equipped with 3 adaptive base kernels), batch normalization, GeLU activation, and a max pooling layer with a stride of 2. The output channels increase layer by layer to 256 to enhance the ability to capture multi-scale local features. A two-layer SRU temporal modeling module is deployed simultaneously, such as... Figure 6 As shown, the CNN output is transformed into a time-series sequence according to band order. Temporal dependencies between bands are mined using two layers of simple recurrent units (each with 256 hidden units, including input / forget / output gating mechanisms). Simultaneously, a higher-order spatial interaction module from HorNet is introduced, such as... Figure 7 As shown, a third-order recurrent gated convolution (g³Conv) is used to model long-distance dependencies across channels through standard convolution, linear mapping to 512 channels, and cubic matrix multiplication. Multi-branch features are concatenated using Concat and then processed as follows: Figure 8The pooling attention mechanism shown is dynamically weighted and optimized, and the final binary classification of glutinous rice is completed by a fully connected layer. This scheme significantly improves the accuracy and robustness of rice glutinousness discrimination by fusing multidimensional features of local details, temporal correlations and global semantics.

[0034] S4. Model Training and Evaluation: Divide the spectral data into training, validation, and test sets, train the model using the cross-entropy loss function, and evaluate the model performance based on accuracy, precision, and recall.

[0035] The cross-entropy loss function is used as the model loss function, and accuracy, precision, and recall are used as model performance evaluation indicators. The preprocessed spectral data is divided into training set, test set, and validation set in a 3:1:1 ratio. The rice grain detection model is trained using the training set and validation set, and the model performance is evaluated using the test set. The model parameters with the highest test accuracy are saved as the parameters of the rice grain glutinousness detection model.

[0036] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for identifying the waxy property of a rice grain based on multi-branch collaborative modeling, characterized in that, The method comprises the following steps: S1, acquiring high-spectrum images of waxy and non-waxy rice grains by using a hyperspectral imaging system, performing black and white board correction, extracting the region of interest of the rice grains, calculating the average spectral reflectivity of the region of interest of the rice grains, and obtaining spectral data of the waxy and non-waxy rice grains; S2, processing the spectral data by using a combination method of SG smoothing, asymmetric weighted penalty least squares and multivariate scattering correction to obtain preprocessed spectra; S3, designing a multi-branch system modeling architecture, the detection model comprising a CNN local feature extraction module, an SRU spectral sequence modeling module, a HorNet global high-order modeling module, a multi-branch feature fusion and classification module, the multi-branch fusion and classification module fusing the CNN local feature, the SRU sequence feature and the HorNet global feature, and outputting the waxy and non-waxy rice seed results through a full connection layer and a classifier; S4, dividing the spectral data into a training set, a validation set and a test set, training the model by using a cross-entropy loss function, and evaluating the model performance based on the accuracy, precision and recall.

2. The method of claim 1, wherein, The hyperspectral imaging system in S1 comprises an imaging hyperspectral camera, a light source and an image acquisition platform, and the hyperspectral images of the waxy and non-waxy rice seeds are acquired; The original hyperspectral images are corrected by a black and white board, specifically: ; In the formula, R is the corrected rice grain reflectance; R O is the original hyperspectral image; R D is the full black calibration image with lens cover; R W is the white board reference value; After correction, the region of interest of the single rice seed in the hyperspectral image is extracted by using ENVI software, the average spectral reflectivity of the pixel points in each region of interest is calculated, and the spectral data required for subsequent processing is obtained.

3. The method of claim 1, wherein, In step S2, the SG smoothing is based on a local polynomial fitting and convolution operation method, and the specific formula is: ; where i is the i-th wavelength point in the spectral signal, is the value of the original spectral signal, is the smoothed spectral value of SG, m is the integer half of the window size, is the coefficient determined by the polynomial order and 2m+1 moving window size; By calculating the center spectral data points in each moving window, the high-frequency noise is reduced while the overall shape of the spectral signal and the characteristics of the peaks and valleys are not distorted; The baseline correction of the asymmetric weighted penalty least squares is to balance the signal fitting and smoothing constraint by introducing a penalty term in the baseline calculation process, and the baseline of the spectral data after SG smoothing is estimated, and the specific formula is: ; ; wherein is the input spectral data, is the target fitting baseline to be estimated, is the spectral value after baseline correction, N is the spectral wavelength point, D is the second-order difference matrix, and λ is the smoothing item coefficient, W is the asymmetric weight vector; The baseline signal obtained by iterative optimization is differentially operated with the input spectrum, and the baseline drift in the spectrum is eliminated, so as to improve the spectral resolution and enhance the identifiable characteristics of the absorption peaks; The multivariate scattering correction is based on a linear regression, and the scattering effect caused by the non-uniformity of the sample surface and the heterogeneity of the grain is corrected, and the specific formula is: ; wherein is the average spectrum of the input spectral data is the average spectrum of the input spectral data are the relative offset coefficients and the displacement, respectively is the corrected spectrum; First, the mean value of all spectral data is calculated to construct a reference spectrum, and then a linear regression is performed on each measured spectrum based on the reference spectrum to obtain a relative offset coefficient and a displacement amount, and finally the original spectrum is corrected by using the relative offset coefficient and the displacement amount to eliminate the scattering effect.

4. The method of claim 1, wherein, In step S3, the CNN local feature extraction module is composed of at least three convolution blocks, and each convolution block comprises a full-dimensional dynamic convolution layer, a batch normalization layer, an activation function layer and a maximum pooling layer in sequence. The full-dimensional dynamic convolution layer adjusts the number of convolution kernels, the spatial size, the number of input channels and the number of output channels in the convolution process, dynamically adjusts the shape and size of the convolution kernel according to the characteristics of the input data, dynamically matches the spectral variation mode between different wavebands, and enhances the capture ability of local absorption peaks and troughs, and the specific formula is: ; where, is the input feature, z is the output feature, W i is the th convolution kernel, , , , denote the attention scalar in four dimensions of kernel number, input channel number, output channel number, and spatial size, respectively, is the multiplication operation along the kernel space in different dimensions, and * is the convolution operation.

5. The method of claim 1 or 4, wherein, The SRU spectral sequence modeling module is introduced in the process of constructing the rice grain waxy discrimination model of the step S3 to perform time sequence modeling on the local features output by the CNN. The local features extracted by the CNN are divided into time series sequences according to the spectral band order, which is consistent with the number of bands. t The time step corresponds to the first t The local features of each band are modeled using the SRU cyclic mechanism to capture the dynamic dependencies between adjacent bands in the spectral data, thereby achieving temporal encoding of local features and generating a feature representation with a continuous time line. The specific formula is as follows: ; ; ; ; wherein, z t is the input value at time t for the current layer; t f t and r t are the forget gate and the reset gate at time t, respectively; t is the Sigmoid activation function for the forget gate and the reset gate; c t-1 and c t are the cell state and the output at time t, respectively; t- 1, t h t is the hidden state vector at time t; Tanh is the hyperbolic tangent activation function for the hidden state; t W c , W f , W r is the weight function; b f , b r is the bias vector; are multiplied element-wise.​​​​ 6. The method of claim 1 or 5, wherein, In the process of constructing the rice grain waxy identification model in the step S3, the HorNet module is used for global modeling of the spectral data, global features are extracted through multi-level loop gating convolution operation, and finally global semantic representation containing long distance dependence is output. n Conv realizes spatial interaction through standard convolution, linear mapping and matrix element multiplication, and the basic structure of HorNet is a first-order gating convolution gConv with n=1. The mathematical definition of the first-order gating convolution is as follows: ; wherein y is an input, z gconv is an output of gConv, and is a linear mapping operation based on a channel mixing operation implemented by a 1x1 convolution kernel; is a depthwise separable convolution with a convolution kernel size of 7x7; p 0 and q 0 is a feature layer after the result of the linear mapping operation is split in the channel dimension; element-wise multiplication; repetition n then, the following n recursive gated convolution g n Conv, which realizes the modeling of high-order inter-channel information interaction.

7. The method of claim 1 or 6, wherein, In the process of constructing the rice grain waxy discrimination model of the S3, the multi-branch feature fusion and classification module performs three-branch feature splicing through Concat, including the local features extracted by the CNN local feature extraction module, the time sequence features extracted by the SRU spectral sequence modeling module and the global features extracted by the HorNet global high-order modeling module. The pooling attention mechanism is introduced, channel-level feature statistics are generated through maximum pooling and average pooling, different channel attention weights are generated by using a full connection layer, key features are dynamically weighted, redundant information is suppressed, and spectral key features are output. The key spectral features are output by a full connection layer and a Softmax classifier to output the classification results of the waxy or non-waxy rice grains.

8. The method of claim 7, wherein, The pooling attention mechanism includes: A one-dimensional convolution operation is performed on the features after being concatenated to obtain C channel features; The channel features are respectively maximum-pooled and average-pooled to obtain two feature vectors with lengths of C ​ After the two feature vectors are spliced, they are input into the weight generation module to obtain the attention weight; The attention weight is multiplied by the input feature to obtain the spectral key feature, and the specific formula is: ; ; ; ; ; In the formula, is the length is the number of channels C is the input feature, , is the average pooling, maximum pooling vector respectively, is , is the feature vector after concatenation, is the full connection operation function, W FC is the full connection layer network parameter, b FC is the parameter offset, w c is the feature of the first c channel, z out is the output spectral feature vector.

9. The method of claim 1, wherein, In the step S4, the cross-entropy loss function is selected as the loss function of the model for model training and evaluation, the accuracy, precision and recall are used as the model performance evaluation indexes, the processed waxy and non-waxy hyperspectral data set is divided into a training set, a validation set and a test set, the training set and the validation set are used to train the rice grain detection model, the test set is combined to evaluate the performance of the model, and the model parameters with the highest test precision are saved as the rice grain waxy detection model parameters.

Citation Information

Cited By

  • Method and device for determining starch content of glutinous rice seeds based on hyperspectral image

    CN122223713A

  • A method and apparatus for determining starch content in glutinous rice seeds based on hyperspectral imaging.

    CN122223713B