Rice seed vigor detection method and system based on hyperspectral image

Through the rice seed vitality detection method based on hyperspectral images, using a neural network model combined with Transformer, CNN and LightGBM modules, the problem of time-consuming and damaged traditional measurement methods is solved, and a fast, accurate and lossless rice seed vitality detection is achieved.

CN119915771AActive Publication Date: 2025-05-02ANHUI AGRICULTURAL UNIVERSITY

Patent Information

Application Number
CN202510398362.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-05-02
Estimated Expiration
2045-04-01

AI Technical Summary

Technical Problem

The traditional rice seed vigor determination method takes a long time and causes damage to the seeds, making it difficult to meet the needs of modern agriculture for efficient and non-destructive testing technology.

Method used

The rice seed vitality detection method based on hyperspectral images is used to process the sample rice seeds at different aging degrees, spectral data are collected and neural network models are trained, including Transformer module, CNN module and LightGBM module, which are used to quickly and non-destructively detect rice seed vitality.

Benefits of technology

It has achieved the vitality of rapid, accurate and non-destructive detection of rice seeds, improved judgment accuracy and adaptability, and met the demand for efficient detection technology in modern agriculture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119915771A_ABST
    Figure CN119915771A_ABST
Patent Text Reader

Abstract

The invention discloses a rice seed vigor detection method and system based on a hyperspectral image, and the method comprises the steps: randomly grouping sample rice seeds, and respectively carrying out aging treatment to obtain a sample rice seed group which is not subjected to aging treatment and a plurality of sample rice seed groups with different aging degrees; collecting rice seed spectrum data of different sample rice seed groups as training samples; placing the different sample rice seed groups in a preset environment for germination, and determining the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; training a pre-constructed neural network model based on the rice seed spectrum data of different sample rice seed groups and the corresponding activity levels to obtain a trained rice seed activity detection model; and for to-be-detected rice seeds, collecting rice seed spectrum data, and inputting the rice seed vigor detection model to obtain a rice seed vigor level detection result. The method realizes rapid detection of the activity level of the rice seeds, and provides powerful support for quality estimation of the rice seeds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of measurement technology, and in particular to a rice seed vitality detection method and system based on hyperspectral images. Background Art

[0002] Rice, as one of the most important food crops in the world, ranks second in the world in terms of planting area and total output. In the production and planting of rice, seed vigor is considered to be one of the key indicators for evaluating seed quality. Seed vigor not only reflects the germination ability of seeds, but also determines the growth rate of seedlings and the final harvest yield of crops. Therefore, accurate, rapid and non-destructive determination of rice seed vigor has important practical application value.

[0003] Traditional seed vigor determination methods mainly rely on germination tests and chemical reagent tests. Although these methods have high accuracy, they usually take a long time and cause certain damage to the seeds during the determination process, so they are difficult to meet the needs of modern agriculture for efficient and non-destructive testing technologies. With the rapid development of information technology and optical detection technology, non-destructive testing technology based on spectral imaging has gradually become an emerging means in the field of seed quality detection. In particular, near-infrared hyperspectral imaging technology, with its ability to simultaneously obtain spectral information and image information in multiple bands, has received widespread attention and application in the agricultural field, and has shown good prospects.

[0004] Near-infrared hyperspectral imaging technology (NIR-HSI) combines the advantages of spectral analysis and imaging technology, and can obtain physical and chemical information of seeds without destroying the samples. This technology can not only identify the appearance characteristics of seeds, but also infer the internal structure and physiological state of seeds by analyzing their spectral data. Hyperspectral imaging technology has been widely used in the field of non-destructive testing by efficiently collecting surface images and spectral information of samples to be tested, and has achieved remarkable results. Existing research has covered the variety detection of crops such as tea, red dates, apples, and corn, and has achieved good application results. Summary of the invention

[0005] In view of the problems existing in the above-mentioned prior art, the present invention provides a rice seed vitality detection method and system based on hyperspectral images. The technical solution is as follows: In a first aspect, a method for detecting rice seed vitality based on hyperspectral images is provided, comprising: The sample rice seeds are randomly grouped, one of the groups is not subjected to aging treatment, and the remaining groups are subjected to different aging degree treatments, so as to obtain a sample rice seed group that is not subjected to aging treatment and a plurality of sample rice seed groups with different aging degrees; Collecting rice seed spectral data of different sample rice seed groups as training samples; placing different sample rice seed groups in a preset environment for germination, and determining the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; Training a pre-constructed neural network model based on rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model, wherein the pre-constructed neural network model includes a Transformer module, and the Transformer module adopts an improved attention score acquisition method to determine the attention score based on a dynamic self-attention mechanism; For the rice seeds to be tested, the rice seed spectrum data is collected and input into the rice seed vitality detection model to obtain the rice seed vitality level detection result.

[0006] In some embodiments, before inputting the rice seed spectral data into the neural network model or the rice seed vitality detection model, the method further includes: preprocessing the rice seed spectral data, wherein the preprocessing includes: The spectral data are processed by using at least one of polynomial convolution smoothing SG, standard normal transformation SNV, and multivariate scatter correction MSC; The spectral data were processed for dimension reduction using principal component analysis (PCA). The successive projection algorithm SPA is used to extract characteristic wavelengths from spectral data.

[0007] In some embodiments, the pre-built neural network model includes: Transformer module, used to receive rice seed spectral data and capture global features of multi-dimensional rice seed spectral data; CNN module, used to extract local features from the spectral feature data output by the Transformer module; The LightGBM module is used to classify the spectral feature data output by the CNN module and output the classification results.

[0008] In some embodiments, the attention score in the Transformer module is calculated as: Get the input spectral data sequence ; Obtaining spectral data sequence through local feature extraction network The local feature representation of the i-th position in ; Local feature representation based on the i-th position and the local feature representation of the jth position The association weights determine the local feature change weight matrix The weight element value of the i-th row and j-th column in the local feature change weight matrix is ​​obtained. ; The attention score in the Transformer module is obtained based on the attention score calculation formula, which is: , where the query vector , the key vector , value vector ,in, , , is the weight matrix, For the input spectral data sequence, is the key vector dimension, is the local feature change weight matrix calculated based on the local feature changes of the spectral data.

[0009] In some implementations, the attention score calculation in the Transformer module further includes: When the critical wavelength region related to seed vigor appears in the spectrum, the enhancement factor The attention weight of the region is enhanced, and the adjusted attention score is: ,in > 1.

[0010] In some embodiments, a deformable convolution kernel is used in the CNN module.

[0011] In some embodiments, the LightGBM module uses quantum computing to discretize features and uses the superposition and entanglement characteristics of quantum states to optimize the discretization process.

[0012] In some embodiments, the LightGBM module uses quantum computing to discretize features, including: Step a1: for continuous features, based on the distribution of feature values, iterative analysis is performed starting from the larger value of the feature until the minimum value of the feature value is reached, and the split points of each box are determined one by one to obtain the value range of the box and the number of boxes n; Step a2, converting the characteristic value of the sample into a quantum state, obtaining the quantum state of the box and the quantum state of the characteristic value of the sample, the conversion is performed by quantum gate operation Perform quantum state transformation on the eigenvalues, ,in, A quantum state representing an eigenvalue; Step a3: Based on the characteristic values ​​of the samples, the binning function Divide the samples into different boxes. ,in, represents the quantum state of the b-th box, b=1, 2, ..., n, x represents the sample, and the binning function characterizes the acquisition The box number b to which the maximum sample x is assigned; Step a4, using quantum statistical function Count the samples in each box.

[0013] In some embodiments, the aging treatment includes: using a saturated salt accelerated aging test method to create a high humidity environment using a saturated salt solution, and aging the rice seeds for 1 day, 2 days, 3 days, 4 days, or 5 days under high temperature and high humidity conditions.

[0014] In a second aspect, a rice seed vitality detection system based on hyperspectral images is provided, comprising: The sample pretreatment unit is used to randomly group the sample rice seeds, not perform aging treatment on one of the groups, and perform different aging degree treatments on the remaining groups, so as to obtain a sample rice seed group without aging treatment and a plurality of sample rice seed groups with different aging degrees; A first sample data collection unit is used to collect rice seed spectrum data of different sample rice seed groups as training samples; The second sample data collection unit is used to place different sample rice seed groups in a preset environment for germination, and determine the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; A vitality detection model training unit is provided, which trains a pre-constructed neural network model based on the rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model, wherein the pre-constructed neural network model includes a Transformer module, and the Transformer module adopts an improved attention score acquisition method to determine the attention score based on a dynamic self-attention mechanism; The rice seed vitality detection unit is used to collect rice seed spectrum data for the rice seeds to be detected, input the rice seed vitality detection model, and obtain the rice seed vitality level detection result.

[0015] A rice seed vitality detection method and system based on hyperspectral images of the present invention have the following beneficial effects: Compared with traditional models, the innovation of the Transformer-CNN-LightGBM integrated network classification model has significant advantages. In the Transformer part, the traditional self-attention mechanism has a relatively fixed attention allocation to each position, while the dynamic self-attention mechanism can flexibly adjust the weight according to the change of local spectral features. When the key wavelength region appears, the attention is enhanced. Compared with the traditional mechanism, it can more accurately capture the key information of seed vitality, greatly improve the judgment accuracy, and has stronger adaptability to different spectral data. In the CNN part, the traditional fixed convolution kernel is difficult to adapt to the complex feature distribution of the spectrum. The deformable convolution kernel can automatically adjust the size and shape according to the feature distribution, the small kernel captures subtle features, and the large kernel takes extensive information. Compared with the traditional convolution kernel, the feature extraction is more comprehensive, giving the model higher flexibility in processing complex data. In the LightGBM part, the traditional histogram algorithm has limited computational efficiency and accuracy. After combining quantum computing optimization, the discretization and statistical calculation are more efficient and accurate. Compared with the traditional method, the model performance is significantly improved, and the advantages are obvious when processing spectral data features. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a schematic diagram of a process of a rice seed vitality detection method based on hyperspectral images according to an embodiment of the present application; Figure 2 This is the original spectrum of rice seeds at different aging levels; Figure 3 is the average spectrum of rice seeds at different aging levels; Figure 4 It is a schematic diagram of the Mahalanobis distance outlier detection results of the SG preprocessing effect on the spectral data of rice seeds; Figure 5 It is a schematic diagram of the Mahalanobis distance outlier detection results of MSC preprocessing of spectral data of rice seeds; Figure 6 It is a schematic diagram of the Mahalanobis distance outlier detection results of the spectral data of rice seeds subjected to SNV preprocessing; Figure 7 It is the feature point map extracted by SPA feature. DETAILED DESCRIPTION

[0017] 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.

[0018] like Figure 1 As shown, a rice seed vitality detection method based on hyperspectral images provided in an embodiment of the present application includes: Step 1, randomly grouping the sample rice seeds, not subjecting one of the groups to aging treatment, and subjecting the remaining groups to different aging degree treatments, to obtain a sample rice seed group that has not been subjected to aging treatment and a plurality of sample rice seed groups with different aging degrees; Step 2, collecting rice seed spectral data of different sample rice seed groups as training samples; Step 3, placing different sample rice seed groups in a preset environment for germination, and determining the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; Step 4, training a pre-constructed neural network model based on the rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model; the pre-constructed neural network model includes a Transformer module, and the Transformer module adopts an improved attention score acquisition method to determine the attention score based on a dynamic self-attention mechanism. Specifically, the self-attention score calculation process is dynamically adjusted according to the correlation relationship of local features at different positions in the spectral data, that is, the degree of attention of the model to different positions of the spectral data is dynamically adjusted according to the correlation relationship of local features at different positions in the spectral data; Step 5: For the rice seeds to be tested, collect the rice seed spectrum data, input the rice seed vitality detection model, and obtain the rice seed vitality level detection result.

[0019] Specifically, in the above step 1, the selected rice seeds are subjected to aging treatment for 1 day, 2 days, 3 days, 4 days, and 5 days, and the rice seeds without aging treatment are set as the control group. After completing the artificial aging treatment, when selecting seed samples, the damaged and shriveled seeds are removed, and the samples with uniform color and complete particles are selected, and a total of 1200 rice seeds are prepared. All samples are randomly divided into training set, validation set and test set according to the ratio of 7:2:1 for subsequent data analysis and model verification. In the embodiment of the present application, the method of accelerated aging test with saturated salt uses a saturated salt solution to create a high humidity environment. The saturated salt solution under 48 degrees Celsius can provide a stable high humidity environment. Under this high temperature and high humidity condition, the rice seeds are subjected to aging treatment for 1 day, 2 days, 3 days, 4 days, and 5 days, and the rice seeds without aging treatment are set as the control group. The sample rice seeds were placed in a nylon mesh bag with good air permeability, with the same number of seeds in each bag. Plastic bottles were prepared and holes were opened on the side to facilitate the addition of saturated sodium chloride solution to control the relative humidity of the environment. The saturated salt solution was prepared by dissolving sodium chloride in water in proportion until solid precipitation appeared and stopping stirring to ensure that the solution was in a saturated state. The prepared solution was poured into a plastic bottle, and the nylon mesh bag containing rice seeds was hung on the mouth of the plastic bottle. The bottle cap was screwed on. The amount of water vapor released was controlled by opening a small hole in the bottle cap to ensure that the seeds were in a high humidity environment but not in contact with the solution. The entire system was placed in an oven set at 48 degrees Celsius for aging. The saturated salt solution at 48 degrees Celsius can provide a stable high humidity environment to simulate the high temperature and high humidity aging conditions of seeds. According to the experimental design, the aging time was set to 1 day, 2 days, 3 days, 4 days and 5 days, respectively, and the seeds of the corresponding treatment group were taken out after each time period. During the experiment, the amount of saturated salt solution in the plastic bottle was checked regularly, and the solution was replenished through the small holes on the side when necessary to maintain a constant relative humidity in the environment.

[0020] In one embodiment, in step 2, the raw spectra of rice seed samples without aging treatment, aging treatment for 1 day, aging treatment for 2 days, aging treatment for 3 days, aging treatment for 4 days, and aging treatment for 5 days are collected at full-band wavelengths (300-1100 nanometers) using a near-infrared hyperspectral spectrometer; the hyperspectral imaging camera FS-20 of the FigSpec series is used to collect the hyperspectral images: the FigSpec software is opened, and after the near-infrared hyperspectral spectrometer is calibrated using a whiteboard, the hyperspectral camera is used to capture the rice seed image, and the Envi software is used to extract the reflectance of the area of ​​interest of the rice seed. The collected raw data spectra and average spectra are shown in FIG. Figure 2 , Figure 3 shown.

[0021] In one embodiment, in step 3 above, the relationship between seed vigor level and germination rate is analyzed through a seed germination experiment. A rice seed germination experiment was conducted in accordance with the regulations of the International Seed Testing Association (ISTA). 120 rice seeds of different aging degrees were selected and randomly divided into 3 groups, and the results were averaged. The seeds were evenly placed in a culture dish, a layer of moistened filter paper was placed inside, sterile water was used for watering, and a 14-day germination test was carried out in a greenhouse at a temperature of 23°C and a humidity of 60%. The germination of each group of seeds was observed regularly, and the average germination rate was recorded. The vitality level of different sample rice seed groups was determined based on the germination rate of different sample rice seed groups.

[0022] In one embodiment, the above step 4, training a pre-built neural network model based on the rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model, includes: Step 41, pre-processing the collected rice seed spectrum data of different sample rice seed groups, Step 42, then training the pre-constructed neural network model based on the pre-processed rice seed spectral data and the corresponding vitality level annotation data.

[0023] Wherein, in step 41, preprocessing the rice seed spectral data includes: Step 411, using at least one of polynomial convolution smoothing SG, standard normal transformation SNV, and multivariate scatter correction MSC to process the spectral data; Step 412, using principal component analysis PCA to perform dimension reduction processing on the spectral data; Step 413: extract characteristic wavelengths from the spectral data using a continuous projection algorithm SPA.

[0024] In the embodiments of the present application, in order to reduce the influence of interference factors on the spectral data of rice seed samples and improve the discrimination accuracy of the model, three commonly used spectral data preprocessing methods are used: polynomial convolution smoothing (Savitzky-Golay, SG), standard normal transformation (Standard Normal Variate, SNV) and multiplicative scatter correction (Multiplicative Scatter Correction, MSC), and the Mahalanobis distance outlier detection is used to compare and evaluate their effects. The SG method is based on sliding window and polynomial fitting technology to smooth the noise in the spectral data; while SNV and MSC use the average spectrum of the sample spectrum as a benchmark, combined with linear regression or normalization transformation to correct each spectrum, thereby effectively reducing the interference of multiplicative scattering on the data. Figure 4 , Figure 5 , Figure 6The effect evaluation of Mahalanobis distance outlier detection shows that the SG preprocessing method achieves the best effect, so the SG method is used to preprocess the spectral data in the embodiment of the present application.

[0025] Furthermore, the PCA method was used to conduct exploratory analysis on the spectral data and evaluate the applicability of the classification task, providing a solid data foundation for the construction of the subsequent classification model. Principal component analysis (PCA) is a widely used technology for data dimensionality reduction. It effectively reduces the dimension of the data by extracting the main components in the data and removes noise and redundant information.

[0026] In order to extract the most valuable feature information for modeling from spectral data, the Successive Projection Algorithm (SPA) is used to select and extract characteristic wavelengths. SPA transforms the variable selection problem into a constrained combinatorial optimization problem, implements projection operations in the vector space, and selects a subset of variables with minimal multicollinearity. The algorithm evaluates the similarity between wavelengths by measuring the angular differences between spectra, thereby giving priority to wavelengths with a strong correlation with the target variable. This method significantly reduces the dimensionality of the data, reduces redundant information, effectively reduces the complexity of subsequent analysis, and provides a concise and representative feature set for establishing an efficient classification model. Figure 7 Feature point map extracted by SPA feature.

[0027] The pre-built neural network model described in step 4 or step 42 above adopts the Transformer-CNN-LightGBM integrated model, and the pre-built neural network model includes: Transformer module, used to receive rice seed spectral data and capture global features of multi-dimensional rice seed spectral data; CNN module, used to extract local features from the spectral feature data output by the Transformer module; The LightGBM module is used to classify the spectral feature data output by the CNN module and output the classification results.

[0028] In the embodiment of the present application, the Transformer-CNN-LightGBM classification model is used to quickly detect the vitality level of rice seeds, combining the global feature capture capability of Transformer, the local feature extraction advantage of CNN and the efficient classification performance of LightGBM.

[0029] This paper innovatively optimizes the Transformer-CNN-LightGBM classification model as follows: In the Transformer part, a dynamic self-attention mechanism is innovatively introduced. The traditional Transformer architecture is based on the self-attention mechanism. The attention score is calculated by the query, key, and value matrices, and the output is normalized by the softmax function and multiplied with the value matrix to capture the intra-sequence dependency. Suppose the input spectral data sequence is , query vector , key vector , value vector , the traditional attention score calculation formula is .in, , , is the weight matrix, For the input spectral data sequence, is the key vector dimension.

[0030] The dynamic self-attention mechanism introduced in the embodiment of the present application extracts local features of spectral data through an additional local feature extraction module, and then generates a weight adjustment factor to adjust the attention weight in the traditional self-attention mechanism. The attention score calculation process of the Transformer module in the embodiment of the present application includes: Step 421, obtaining the input spectral data sequence ; Step 422, obtaining a spectral data sequence through a local feature extraction network The local feature representation of the i-th position in ; Step 423, local feature representation based on the i-th position and the local feature representation of the jth position The association weights determine the local feature change weight matrix The weight element value of the i-th row and j-th column in , obtain the local feature change weight matrix ; Step 424, obtaining the attention score in the Transformer module based on the attention score calculation formula, the attention score calculation formula is: , where the query vector , the key vector , value vector ,in, , , is the weight matrix, For the input spectral data sequence, is the key vector dimension, is the local feature change weight matrix calculated based on the local feature change of spectral data, the matrix The changing relationship between the local features at each position in the entire spectral data sequence is recorded.

[0031] In the embodiment of the present application, under the dynamic self-attention mechanism, a local feature change weight matrix calculated according to the local feature change of the spectral data is introduced. , assuming that the local feature representation is obtained through the local feature extraction network , where the local feature extraction network can use algorithms such as CNN convolutional network, Indicates Position and The association weight between the positions based on local features can be determined based on the dot product of the local feature vector extracted by the local feature extraction network and its own transposition. The matrix It reflects the relationship between the features at different positions in the spectral data, so that more attention is paid to different parts of the entire spectral data in the attention score calculation. The calculation formula of the dynamically adjusted attention score is: When the key wavelength region closely related to seed vitality appears in the spectrum (the index set is S), the enhancement factor ( >1) Enhance the attention weight of this area, and the adjusted attention score is , to capture key information more accurately.

[0032] In one embodiment, in order to better mine the hidden correlation relationship of the local features of the spectral data sequence, after the attention score of the Transformer module is calculated, it can also include: the attention data calculated based on the attention mechanism is input into a preset convolution module, and the result after processing by the preset convolution module is residually connected and fused with the attention data calculated based on the attention mechanism and then input into the feedforward neural network layer; the preset convolution module includes: a convolution layer, a causal convolution layer and a dilated convolution layer connected in series in sequence. The causal convolution layer and the dilated convolution layer are combined to fully mine the hidden correlation relationship of the local features of the spectral data sequence. Furthermore, in order to better capture the local and global features of the spectral data sequence, in the Transformer module, it can also include: using the ConvFFN algorithm as the above-mentioned feedforward neural network layer.

[0033] In the CNN part, a deformable convolution kernel is used. The sampling position of the traditional convolution kernel is fixed, and it is not adaptable enough to the complex characteristic distribution of spectral data. In the present invention, the size and shape of the deformable convolution kernel can be adaptively adjusted according to the characteristic distribution of spectral data. Let the input feature map be F, and the traditional convolution operation is expressed as (( ) is the output feature map location, ( ) is the convolution kernel position). The present invention introduces the offset learned by the additional convolution layer , the deformable convolution operation formula becomes At the same time, let the adaptive adjustment function be , calculate the adjustment parameters of the convolution kernel size and shape according to the statistical information (such as variance, mean, etc.) of the input feature map F, and then obtain the adjusted convolution kernel , which improves the ability to extract local features of different scales and shapes.

[0034] In the LightGBM part, the histogram algorithm is improved by combining the principle of quantum computing. LightGBM originally used the histogram algorithm to discretize features, discretizing continuous floating eigenvalues ​​into integers, forming discrete bins and constructing a width The present invention combines the principle of quantum computing and uses the superposition and entanglement characteristics of quantum states to optimize the discretization process, specifically including the following steps: Step a1: for continuous features, based on the distribution of feature values, iterative analysis is performed starting from the larger value of the feature until the minimum value of the feature value is reached, and the split points of each box are determined one by one to obtain the value range of the box and the number of boxes n; Step a2, converting the characteristic value of the sample into a quantum state, obtaining the quantum state of the box and the quantum state of the characteristic value of the sample, the conversion is performed by quantum gate operation Perform quantum state transformation on the eigenvalues, ,in, A quantum state representing an eigenvalue; Step a3: Based on the feature values ​​of the samples, the samples are divided into different boxes through the binning function. ,in, represents the quantum state of the b-th box, b=1, 2, ..., n, x represents the sample, and the binning function characterizes the acquisition The box number b to which the maximum sample x is assigned; Step a4, using quantum statistical function Count the samples in each box.

[0035] Specifically, quantum state transformation is achieved through quantum gate operations, the bin to which the sample belongs is determined through the binning function, and quantum parallelism is used to accelerate the calculation. , improving computational efficiency and classification accuracy. In one embodiment, in the above step a1, based on the distribution of feature values, the number of feature value categories and the frequency of each category of values ​​can be determined first; the split point of the first box is analyzed starting from the maximum value of the feature, and then the split point of each box is iteratively analyzed in order of the feature value from large to small until the minimum value of the feature is reached, and the split points of all boxes and the total number of boxes are determined. The split point of each box is determined based on whether the number of values ​​of the current feature is greater than the total number of values ​​of the remaining features in the current stage and the total number of available boxes remaining in the current stage (the total number of available boxes remaining in the current stage is equal to the preset maximum number of boxes minus the number of boxes used to determine the split point). If it is greater, it is a large number. If it is less, it is a small number in the current stage. The value of the current feature determined to be a large number is determined as a split point, and the value of the next feature of the value of the current feature determined to be a large number is determined as the next split point. For the remaining values ​​of the current feature determined to be small numbers, the number of feature values ​​between two adjacent feature values ​​of the determined split points is counted. When the count reaches the quotient value of the current stage, the value of the current feature is determined to be a split point. When the count reaches the quotient value of the current stage and encounters a previously determined split point, the feature value before the feature value of the determined split point is taken as a split point. In one embodiment, for the above step a3, by The bin number b assigned to the maximum determined sample x can be used to adaptively determine the best binning. In one embodiment, the above step a4 uses the quantum statistical function By counting the samples in each box, we can count the number of samples in each box, the gradient of the samples, and other data.

[0036] The present application also provides a rice seed vitality detection system based on hyperspectral images, including: The sample pretreatment unit is used to randomly group the sample rice seeds, not perform aging treatment on one of the groups, and perform different aging degree treatments on the remaining groups, so as to obtain a sample rice seed group without aging treatment and a plurality of sample rice seed groups with different aging degrees; A first sample data collection unit is used to collect rice seed spectrum data of different sample rice seed groups as training samples; The second sample data collection unit is used to place different sample rice seed groups in a preset environment for germination, and determine the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; A vitality detection model training unit is used to train a pre-built neural network model based on the rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model; The rice seed vitality detection unit is used to collect rice seed spectrum data for the rice seeds to be detected, input the rice seed vitality detection model, and obtain the rice seed vitality level detection result.

[0037] For the specific definition of the rapid nondestructive detection system of rice seed vitality level based on near-infrared spectroscopy, please refer to the definition of the rice seed vitality detection method based on hyperspectral imagery mentioned above, which will not be repeated here. Each unit in the above-mentioned rapid nondestructive detection system of rice seed vitality level based on near-infrared spectroscopy can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned units can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned units.

[0038] The present invention is not limited to the above-mentioned specific implementation modes. Various changes made by ordinary technicians in this field based on the above-mentioned concepts without creative work are all within the protection scope of the present invention.

Claims

1. A rice seed vitality detection method based on hyperspectral images, characterized in that: include: The sample rice seeds are randomly grouped, one of the groups is not subjected to aging treatment, and the remaining groups are subjected to different aging degree treatments, so as to obtain a sample rice seed group that is not subjected to aging treatment and a plurality of sample rice seed groups with different aging degrees; Collecting rice seed spectral data of different sample rice seed groups as training samples; placing different sample rice seed groups in a preset environment for germination, and determining the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; Training a pre-constructed neural network model based on rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model, wherein the pre-constructed neural network model includes a Transformer module, and the Transformer module adopts an improved attention score acquisition method to determine the attention score based on a dynamic self-attention mechanism; For the rice seeds to be tested, the spectral data of the rice seeds are collected and input into the rice seed vitality detection model to obtain the detection results of the rice seed vitality level.

2. The rice seed vitality detection method based on hyperspectral images according to claim 1, characterized in that: Before inputting the rice seed spectral data into the neural network model or the rice seed vitality detection model, the method further includes: preprocessing the rice seed spectral data, wherein the preprocessing includes: The spectral data are processed by using at least one of polynomial convolution smoothing SG, standard normal transformation SNV, and multivariate scatter correction MSC; The spectral data were processed for dimension reduction using principal component analysis (PCA). The successive projection algorithm SPA is used to extract characteristic wavelengths from spectral data.

3. The rice seed vitality detection method based on hyperspectral image according to claim 1, characterized in that: The pre-built neural network model includes: Transformer module, used to receive rice seed spectral data and capture global features of multi-dimensional rice seed spectral data; CNN module, used to extract local features from the spectral feature data output by the Transformer module; The LightGBM module is used to classify the spectral feature data output by the CNN module and output the classification results.

4. The rice seed vitality detection method based on hyperspectral image according to claim 3, characterized in that: The attention score in the Transformer module is calculated as: Get the input spectral data sequence ; Obtaining spectral data sequence through local feature extraction network The local feature representation of the i-th position in ; Local feature representation based on the i-th position and the local feature representation of the jth position The association weights determine the local feature change weight matrix The weight element value of the i-th row and j-th column in the local feature change weight matrix is ​​obtained. ; The attention score in the Transformer module is obtained based on the attention score calculation formula, which is: , where the query vector , the key vector , value vector ,in, , , is the weight matrix, For the input spectral data sequence, is the key vector dimension, is the local feature change weight matrix calculated based on the local feature changes of the spectral data.

5. The rice seed vitality detection method based on hyperspectral image according to claim 4, characterized in that: The attention score calculation in the Transformer module also includes: When the critical wavelength region related to seed vigor appears in the spectrum, the enhancement factor The attention weight of the region is enhanced, and the adjusted attention score is: ,in >

1.

6. The rice seed vitality detection method based on hyperspectral image according to claim 3, characterized in that: The CNN module uses a deformable convolution kernel.

7. The rice seed vitality detection method based on hyperspectral image according to claim 3, characterized in that: The LightGBM module uses quantum computing to discretize features and uses the superposition and entanglement characteristics of quantum states to optimize the discretization process.

8. The rice seed vitality detection method based on hyperspectral images according to claim 7, characterized in that: The LightGBM module uses quantum computing to discretize features, including: Step a1: for continuous features, based on the distribution of feature values, iterative analysis is performed starting from the larger value of the feature until the minimum value of the feature value is reached, and the split points of each box are determined one by one to obtain the value range of the box and the number of boxes n; Step a2, converting the characteristic value of the sample into a quantum state, obtaining the quantum state of the box and the quantum state of the characteristic value of the sample, the conversion is performed by quantum gate operation Perform quantum state transformation on the eigenvalues, ,in, A quantum state representing an eigenvalue; Step a3: Based on the feature values ​​of the samples, the samples are divided into different boxes through the binning function. ,in, represents the quantum state of the b-th box, b=1, 2, ..., n, x represents the sample, and the binning function characterizes the acquisition The box number b to which the maximum sample x is assigned; Step a4, using quantum statistical function Count the samples in each box.

9. The rice seed vitality detection method based on hyperspectral image according to claim 1, characterized in that: The aging treatment includes: using a saturated salt accelerated aging test method to create a high humidity environment using a saturated salt solution, and performing aging treatment on rice seeds for 1 day, 2 days, 3 days, 4 days, or 5 days under high temperature and high humidity conditions.

10. A rapid non-destructive detection system for rice seed vitality level based on near infrared spectroscopy, characterized in that: include: The sample pretreatment unit is used to randomly group the sample rice seeds, not perform aging treatment on one of the groups, and perform different aging degree treatments on the remaining groups, so as to obtain a sample rice seed group without aging treatment and a plurality of sample rice seed groups with different aging degrees; A first sample data collection unit is used to collect rice seed spectrum data of different sample rice seed groups as training samples; The second sample data collection unit is used to place different sample rice seed groups in a preset environment for germination, and determine the vitality levels of the different sample rice seed groups based on the germination rates of the different sample rice seed groups; A vitality detection model training unit is provided, which trains a pre-constructed neural network model based on the rice seed spectral data and corresponding vitality levels of different sample rice seed groups to obtain a trained rice seed vitality detection model, wherein the pre-constructed neural network model includes a Transformer module, and the Transformer module adopts an improved attention score acquisition method to determine the attention score based on a dynamic self-attention mechanism; The rice seed vitality detection unit is used to collect rice seed spectrum data for the rice seeds to be detected, input the rice seed vitality detection model, and obtain the rice seed vitality level detection result.

Citation Information

Patent Citations

  • Rapid rice seed vigor detection method based on near infrared spectrum

    CN119498063A

  • CIELAB color space-based quantitative testing and analysis method for rice seed viability

    US12002242B1

Cited By

  • Soybean germplasm resource viability small sample classification prediction method, system and equipment

    CN120632573A