Agricultural seed screening method and system based on data analysis
By filtering out background noise through the Otsu's method and morphological operations, and combining a one-dimensional deep fully convolutional neural network and a width learning system, a dynamic classification model is constructed. This solves the problems of background noise and confusion between similar and dissimilar objects in existing technologies, and achieves high-precision, low-cost, and real-time online seed selection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NUWA GOD GRASS IN SHAANXI PROVINCE AGRI SCI & TECH CO LTD
- Filing Date
- 2026-04-28
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies struggle to effectively eliminate complex grid background noise and edge diffraction interference generated by the conveying mechanism in transmitted light imaging mode. Furthermore, single spectral or image detection methods cannot simultaneously resolve the confusion between foreign objects with the same spectrum and heterogeneous substances with the same image. This results in poor target segmentation accuracy and a high false positive rate for impurity removal in industrial applications, failing to meet the requirements for low-cost and real-time online sorting.
Background noise is filtered out using the maximum inter-class variance method and morphological operations. Key feature wavelengths are extracted using a one-dimensional deep fully convolutional neural network model and class activation mapping algorithm. A dynamic classification model is constructed by combining a width learning system to generate a spectral fusion feature vector. Based on a dynamic risk threshold, a three-level decision is made to drive the pneumatic nozzle to achieve physical separation.
It enables accurate removal of high-risk samples under complex working conditions, ensuring real-time online sorting efficiency, reducing computational redundancy, and improving target segmentation accuracy and impurity removal accuracy.
Smart Images

Figure CN122116009A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to an agricultural seed screening method and system based on data analysis. Background Technology
[0002] The quality of seeds directly determines the yield and quality of crops. With the development of smart agriculture, traditional methods relying on manual visual inspection or simple mechanical screening can no longer meet the modern seed industry's refined requirements for seed germination rate, purity, and health. Currently, non-destructive testing technology based on machine vision has been gradually applied to the field of seed screening, aiming to replace manual labor with image processing methods to achieve automated grading of seed appearance quality.
[0003] Currently, Chinese invention patent application number 202210431082.X discloses a peanut seed screening method. This method involves acquiring peanut images, extracting edge lines using the Canny operator, calculating the germ line and the distance from each pixel on the edge line to the germ line to construct a distance model that characterizes the fullness of the peanut. The sharpness of the germ tip is characterized by calculating the angle between the mutation point near the germ tip on the edge line and the germ tip line, as well as the angle between the minimum circumscribed ellipse tangent point and the germ tip line. Combining these two geometric indicators—fullness and sharpness—and using a preset threshold, it determines whether the peanut is suitable as seed. However, this technique has the following shortcomings: First, it relies solely on external geometric morphology and lacks internal quality detection capabilities. Seed vigor and quality are often closely related to their internal biochemical components; many seeds may appear intact on the outside but have undergone internal changes. First, moldy, hollow, or frozen seeds of similar shape and poor quality cannot be effectively eliminated based solely on geometric morphology analysis of RGB images, resulting in an inability to fundamentally guarantee the germination rate of the selected seeds. Second, geometric feature extraction algorithms rely on manually designed fixed rules, which have poor robustness and require complex geometric modeling. They have extremely high requirements for image quality and target morphology. If the surface of the seed to be tested has slight stains, wear, or if the seed morphology deviates from the standard model, it is very easy to cause feature point localization failure, leading to misjudgment. Third, the threshold decision method is too simple to deal with complex classification boundaries. Seed quality data often exhibits a non-linear distribution in high-dimensional space. Simple linear threshold segmentation is difficult to solve the problem of fuzzy samples near the classification boundary, which can easily lead to the wrong elimination of high-value seeds or the omission of poor-quality seeds. Summary of the Invention
[0004] The technical problem solved by this invention is that existing technologies are unable to effectively eliminate complex grid background noise and edge diffraction interference generated by the conveying mechanism in the transmitted light imaging mode. Furthermore, single spectral or image detection methods cannot simultaneously solve the problem of confusion between objects with the same spectrum and objects with different textures in the same image. They also cannot reduce the computational redundancy brought by full-band data while retaining the high accuracy of deep learning. As a result, existing screening methods have poor target segmentation accuracy and high misjudgment rate of impurity removal in industrial applications. Moreover, the detection system is difficult to meet the requirements of low cost and real-time online sorting.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: an agricultural seed screening method based on data analysis, comprising the following steps: Step S1: Obtain the transmission mode hyperspectral image of the seed to be tested, obtain the optimal contrast reference map based on the maximum inter-class variance method and generate a global binarization mask, obtain the effective connected regions based on the global binarization mask, and perform full-band data cropping on the transmission mode hyperspectral image according to the effective connected regions to generate the region of interest. Step S2: Determine the key feature wavelengths using a one-dimensional deep fully convolutional neural network model and a class activation mapping algorithm; calculate the geometric morphological feature data of the seed to be tested within the region of interest; and obtain the preferred spectral feature vector of the seed to be tested based on the key feature wavelengths. Step S3: Construct original geometric feature vectors and original spectral feature vectors based on geometric morphological feature data and optimized spectral feature vectors; perform normalization processing on the original geometric feature vectors and original spectral feature vectors to generate spectral fusion feature vectors. Step S4: Construct a dynamic classification model based on the width learning system, calculate the dynamic risk threshold and construct a three-level decision interval, calculate the predicted probability value of the seed to be tested, and if it is determined to fall into the unqualified area or risk buffer zone, drive the pneumatic nozzle to achieve physical separation.
[0006] Preferably, step S1 includes the following sub-steps: Step S101: Obtain the transmission mode hyperspectral image of the seed to be tested. Traverse all spectral bands of the transmission mode hyperspectral image. Calculate the inter-class variance value of the image pixel matrix under each spectral band based on the maximum inter-class variance method. Compare the inter-class variance values of all bands. Define the band image corresponding to the maximum inter-class variance value as the optimal contrast reference image. Obtain the global optimal segmentation threshold corresponding to the optimal contrast reference image. Perform binarization processing on the optimal contrast reference image based on the global optimal segmentation threshold. Mark pixels with gray values less than the global optimal segmentation threshold as foreground targets and pixels with gray values greater than the global optimal segmentation threshold as background, generating a global binarization mask.
[0007] Preferably, step S1 further includes the following sub-steps: Step S102: Perform morphological opening operation on the global binary mask, use structuring elements of a preset size to eliminate fine isolated noise points generated by the conveyor belt grid background, and disconnect weakly connected regions caused by diffraction effect. Use a connected component labeling algorithm to traverse the processed global binary mask, identify several independent connected regions that are not connected to each other, and use an area filtering strategy to remove connected regions with an area smaller than a preset noise threshold, retaining the effective connected regions that represent the seed to be tested. Step S103: Perform full-band data cropping on the transmission mode hyperspectral image based on the effective connected regions to generate the region of interest. The specific logic is as follows: Traverse each effective connected region, calculate the coordinates of the minimum bounding rectangle of each effective connected region, and perform full-band data cropping in the transmission mode hyperspectral image based on the minimum bounding rectangle coordinates to generate several independent regions of interest.
[0008] Preferably, step S2 includes the following sub-steps: Step S201: Select several seeds to be tested as standard samples, collect transmission hyperspectral data of the standard samples, perform physicochemical analysis on the transmission hyperspectral data to obtain physicochemical indicators, map the physicochemical indicators into discrete quality grade labels according to the preset grading standard, and use the quality grade labels as true value labels. Based on the transmission hyperspectral data of standard samples, the average spectral transmittance vector of the entire band is calculated. The average spectral transmittance vector of the entire band is converted into the average spectral absorbance vector of the entire band using the Lambert-Beer law. The average spectral absorbance vector of the entire band is used as input data and the true value label is used as output data to construct a labeled sample set. A one-dimensional deep fully convolutional neural network model is constructed, comprising an input layer, several stacked dilated convolutional layers, a global average pooling layer at the end, and a fully connected classification output layer. The dilated convolutional layers employ a zigzag recurrent strategy to set their dilation rate, and the dilation rates of consecutively stacked dilated convolutional layers are set as a recurrent sequence, wherein the greatest common divisor of two adjacent dilation rates in the recurrent sequence is 1. By eliminating the grid effect generated by dilated convolution, a receptive field coverage without blind spots across the entire spectrum is achieved while maintaining the same length of the output feature map as the input data.
[0009] Preferably, step S2 further includes the following sub-steps: Step S202: Iteratively train the one-dimensional deep fully convolutional neural network model using the labeled sample set until the loss function converges, and extract the multi-channel feature map output by the last dilated convolutional layer in the trained one-dimensional deep fully convolutional neural network model. Obtain the weight vector corresponding to the target classification category in the fully connected classification output layer. The elements in the weight vector are the connection weights between each output node of the global average pooling layer and the corresponding node of the classification output layer. The activation mapping algorithm is used to take the elements in the weight vector as the weighting coefficients of the corresponding channel feature maps, and the multi-channel feature maps are weighted and summed to generate a one-dimensional spectral sensitivity heatmap. Retrieve the peak positions in the one-dimensional spectral sensitivity heatmap where the response value is greater than a preset response threshold, and map the spectral channels corresponding to the peak positions as key feature wavelengths based on receptive field center alignment. The peak response intensity at the peak position of the one-dimensional spectral sensitivity heatmap is extracted, and the peak response intensity is normalized to obtain the spectral feature confidence level. Step S203: Calculate the area, perimeter, major axis, minor axis, and roundness of the seed to be tested within the region of interest. Based on the area, perimeter, major axis, minor axis, and roundness, obtain the geometric morphological feature data of the seed to be tested. The spectral transmittance of the seed to be tested at the key characteristic wavelength is read, the spectral transmittance is converted into spectral absorbance data, and the spectral absorbance data corresponding to all key characteristic wavelengths are combined to obtain the preferred spectral feature vector of the seed to be tested.
[0010] Preferably, step S3 includes the following sub-steps: Step S301: Based on the geometric shape feature data, the area, perimeter, major axis, minor axis and roundness are arranged in a preset order to construct the original geometric feature vector; The spectral absorbance data contained in the preferred spectral feature vector are sorted in order of increasing wavelength to construct the original spectral feature vector; Step S302: Addressing the dimensional differences between the original geometric feature vector and the original spectral feature vector, a range normalization algorithm is used to perform dimensionless processing, mapping the values of each component in the original geometric feature vector to... The interval is used to obtain the normalized geometric feature vector, and the original spectral feature vector is mapped to... The interval yields the normalized spectral eigenvectors; Step S303: A feature layer concatenation fusion strategy is adopted for the normalized geometric feature vector and the normalized spectral feature vector. The normalized geometric feature vector and the normalized spectral feature vector are concatenated end to end to generate a spectral fusion feature vector.
[0011] Preferably, step S4 includes the following sub-steps: Step S401: Based on the width learning system, construct a dynamic classification model, map the graph fusion feature vector to feature nodes, perform nonlinear transformation on the feature nodes to generate enhancement nodes, and horizontally concatenate the feature nodes and enhancement nodes to construct a system state matrix. Training a dynamic classification model based on the ridge regression algorithm specifically includes: Calculate the pseudo-inverse of the system state matrix, and use the pseudo-inverse to solve for the output weights.
[0012] Preferably, step S4 further includes the following sub-steps: Step S402: Calculate the dynamic risk threshold based on the spectral feature confidence level. The mathematical expression for the dynamic risk threshold is: ; in, For dynamic risk thresholds, The preset base buffer width, The preset adjustment coefficient, is the base of the natural logarithm. Confidence level for spectral features; The spectral fusion feature vector of the seed to be tested is input into the trained dynamic classification model. The predicted probability value of the seed belonging to the qualified product is calculated based on the output weights. Based on the dynamic risk threshold, the range of the predicted probability value is divided into three decision intervals: a non-qualified zone, a risk buffer zone, and a qualified zone. The probability interval corresponding to the non-qualified zone is... The probability interval corresponding to the risk buffer is The probability interval corresponding to the qualified area is .
[0013] Preferably, step S4 further includes the following sub-steps: Step S403, determining the interval position where the predicted probability value falls, specifically includes: When the predicted probability value falls into the unqualified area, the seed to be tested is determined to be unqualified. When the predicted probability value falls into the risk buffer, the seed to be tested is determined to be a high-risk sample; When the predicted probability value falls into the qualified area, the seed to be tested is determined to be a qualified seed; If the determination result is a non-qualified area or a risk buffer zone, a rejection instruction is generated; The system reads the real-time conveying speed of the seed under test on the conveyor belt, obtains the optical axis center coordinates of the image acquisition device as the imaging position, obtains the installation coordinates of the pneumatic nozzle as the execution position, calculates the physical distance between the imaging position and the execution position, takes the moment when the seed under test passes through the imaging position and the image is acquired as the timing reference zero point, calculates the lag time based on the ratio of the physical distance to the real-time conveying speed, monitors the system time in real time, and when the elapsed time of the system time relative to the timing reference zero point reaches the lag time, sends an opening pulse signal to the pneumatic nozzle to drive the pneumatic nozzle to spray high-pressure airflow, change the movement trajectory of the seed under test, and perform physical separation.
[0014] An agricultural seed screening system based on data analysis includes a data acquisition module, a processing module, an analysis module, and a screening module. The acquisition module is used to acquire the transmission mode hyperspectral image of the seed to be tested, obtain the optimal contrast reference map based on the maximum inter-class variance method and generate a global binarization mask, obtain the effective connected region based on the global binarization mask, and perform full-band data cropping on the transmission mode hyperspectral image according to the effective connected region to generate the region of interest. The processing module is used to determine key feature wavelengths through a one-dimensional deep fully convolutional neural network model and a class activation mapping algorithm, calculate the geometric morphological feature data of the seed to be tested in the region of interest, and obtain the preferred spectral feature vector of the seed to be tested based on the key feature wavelengths. The analysis module is used to construct the original geometric feature vector and the original spectral feature vector based on the geometric morphological feature data and the preferred spectral feature vector, and to perform normalization processing on the original geometric feature vector and the original spectral feature vector to generate the spectral fusion feature vector. The screening module is used to construct a dynamic classification model, calculate a dynamic risk threshold and construct a three-level decision interval, calculate the predicted probability value of the seed to be tested, and drive the pneumatic nozzle to achieve physical separation if it is determined to fall into the unqualified area or risk buffer zone.
[0015] The beneficial effects of this invention are as follows: Background noise is effectively filtered out and regions of interest are accurately extracted using the maximum inter-class variance method and morphological operations, providing clean spectral input for subsequent processing. A one-dimensional deep fully convolutional neural network model with a sawtooth-shaped cyclic strategy for setting the dilation rate is constructed. By ensuring that the greatest common divisor of adjacent dilation rates is 1, the grid effect is eliminated, achieving full-spectrum receptive field coverage without blind spots. Spectral fusion feature vectors are used to achieve joint characterization of external morphology and internal biochemistry. An adaptive feedback mechanism is constructed by extracting spectral feature confidence. A three-level decision interval is established by combining a width learning system and a dynamic risk threshold. When front-end features are ambiguous, the risk buffer is automatically widened. While ensuring real-time online sorting efficiency, accurate removal of high-risk samples under complex working conditions is achieved. Attached Figure Description
[0016] Figure 1 A flowchart illustrating the steps of an agricultural seed screening method based on data analysis, provided as an embodiment of the present invention; Figure 2 This is a schematic diagram of the basic process of an agricultural seed screening system based on data analysis, provided as an embodiment of the present invention. Detailed Implementation
[0017] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0018] Example 1, referring to Figure 1 This paper provides a data analysis-based method for agricultural seed screening, which includes the following steps: Step S1: Obtain the transmission mode hyperspectral image of the seed to be tested, obtain the optimal contrast reference map based on the maximum inter-class variance method and generate a global binarization mask, obtain the effective connected regions based on the global binarization mask, and perform full-band data cropping on the transmission mode hyperspectral image according to the effective connected regions to generate the region of interest.
[0019] Step S2: Determine the key feature wavelengths using a one-dimensional deep fully convolutional neural network model and a class activation mapping algorithm; calculate the geometric morphological feature data of the seed to be tested within the region of interest; and obtain the preferred spectral feature vector of the seed to be tested based on the key feature wavelengths.
[0020] Step S3: Construct original geometric feature vectors and original spectral feature vectors based on geometric morphological feature data and optimized spectral feature vectors. Perform normalization processing on the original geometric feature vectors and original spectral feature vectors to generate spectral fusion feature vectors.
[0021] Step S4: Construct a dynamic classification model based on the width learning system, calculate the dynamic risk threshold and construct a three-level decision interval, calculate the predicted probability value of the seed to be tested, and if it is determined to fall into the unqualified area or risk buffer zone, drive the pneumatic nozzle to achieve physical separation.
[0022] This invention effectively filters out background noise and accurately extracts regions of interest by using the maximum inter-class variance method and morphological operations, providing clean spectral input for subsequent processing. It constructs a one-dimensional deep fully convolutional neural network model that sets the dilation rate using a sawtooth cyclic strategy. By ensuring that the greatest common divisor of adjacent dilation rates is 1, it eliminates the grid effect and achieves full-spectrum receptive field coverage without blind spots without downsampling. It uses spectral fusion feature vectors to achieve joint characterization of external morphology and internal biochemistry, and constructs an adaptive feedback mechanism by extracting spectral feature confidence. It establishes a three-level decision interval by combining a width learning system and a dynamic risk threshold, automatically widening the risk buffer when front-end features are ambiguous. While ensuring real-time online sorting efficiency, it achieves accurate removal of high-risk samples under complex working conditions.
[0023] Step S1 includes the following sub-steps: Step S101: Obtain the transmission mode hyperspectral image of the seed to be tested. Traverse all spectral bands of the transmission mode hyperspectral image. Calculate the inter-class variance value of the image pixel matrix under each spectral band based on the maximum inter-class variance method. Compare the inter-class variance values of all bands. Define the band image corresponding to the maximum inter-class variance value as the optimal contrast reference image. Obtain the global optimal segmentation threshold corresponding to the optimal contrast reference image. Perform binarization processing on the optimal contrast reference image based on the global optimal segmentation threshold. Mark pixels with gray values less than the global optimal segmentation threshold as foreground targets and pixels with gray values greater than the global optimal segmentation threshold as background. Generate a global binarized mask containing the contours of all seeds to be tested.
[0024] Step S102: Perform morphological opening operation on the global binary mask, use structuring elements of preset size to eliminate fine isolated noise points generated by the conveyor belt grid background, and disconnect weakly connected regions caused by diffraction effect. Use connected component labeling algorithm to traverse the processed global binary mask to identify several independent connected regions that are not connected to each other. Use area filtering strategy to remove connected regions with an area smaller than the preset noise threshold, and retain the effective connected regions that represent the seeds to be tested.
[0025] Step S103: Traverse each effective connected region, calculate the minimum bounding rectangle coordinates of each effective connected region, and perform full-band data cropping in the transmission mode hyperspectral image based on the minimum bounding rectangle coordinates to generate several independent regions of interest that correspond one-to-one and contain complete spectral information.
[0026] This invention addresses the technical challenges of inaccurate seed contour extraction and difficulty in segmenting weakly connected regions during transmission mode hyperspectral image acquisition, which are caused by complex conveyor belt grid backgrounds and the resulting edge diffraction effects and fine isolated noise points. It employs an traversal strategy to calculate the inter-class variance values of each band to locate the optimal contrast reference image. Morphological opening operations are used to specifically break the adhesion caused by diffraction effects and filter out grid noise, thereby accurately locking the effective connected regions. Through full-band data cropping, the conveyor belt grid background and invalid optical path interference are physically isolated at the data source, generating only a pure region of interest containing the seed to be tested. This not only provides a noise-free, pure spectral input for the subsequent one-dimensional deep fully convolutional neural network model but also avoids computational redundancy for invalid background pixels, fundamentally improving the robustness of target segmentation under complex conditions.
[0027] Step S2 includes the following sub-steps: Step S201: Select several representative seeds to be tested as standard samples, collect transmission hyperspectral data of the standard samples and obtain physicochemical indicators through physicochemical analysis, map the physicochemical indicators into discrete quality grade labels according to the preset grading standards, and use the quality grade labels as true value labels.
[0028] Based on the transmission hyperspectral data of standard samples, the average spectral transmittance vector across the entire wavelength range is calculated. Then, using the Lambert-Beer law, the average spectral transmittance vector is converted into the average spectral absorbance vector across the entire wavelength range. The mathematical expression for the average spectral absorbance vector across the entire wavelength range is as follows: ; in, This represents the average spectral absorbance vector across the entire wavelength range. This is the average spectral transmittance vector across the entire wavelength range.
[0029] A labeled sample set is constructed by using the average spectral absorbance vector across the entire band as input data and the true value label as output data.
[0030] A one-dimensional deep fully convolutional neural network model adapted to one-dimensional spectral data is constructed. The one-dimensional deep fully convolutional neural network model includes an input layer, several stacked dilated convolutional layers, a global average pooling layer at the end, and a fully connected classification output layer. The dilation rate of the dilated convolutional layers is set using a zigzag recurrent strategy. The dilation rates of the consecutively stacked dilated convolutional layers are set as a set of recurrent sequences, and the greatest common divisor of two adjacent dilation rates in the recurrent sequence is 1.
[0031] To better implement this invention, the specific network parameters of the constructed one-dimensional deep fully convolutional neural network are shown below, taking an input spectrum length of 200 dimensions as an example: Input layer: dimension .
[0032] HDC module layer 1: Kernel size expansion rate , with 64 output channels and ReLU activation function.
[0033] HDC module layer 2: Convolutional kernel size expansion rate , Output channel 64.
[0034] HDC module layer 3: Convolutional kernel size expansion rate Output channel 128.
[0035] HDC module layer 4: Kernel size expansion rate (Loop begins), output channel 128, subsequent layers repeat the loop.
[0036] Fully connected classification layer: The number of output nodes corresponds to the number of seed categories, such as 2 categories: qualified / unqualified. Note the kernel size. In conjunction with the above-mentioned dilatation rate sequence, the receptive field coverage is ensured to be greater than 100% and free of holes.
[0037] In this embodiment, the dilation rate of the dilated convolutional layer is set to not grow exponentially, but rather using a sawtooth-shaped recurrent strategy, for example, a set of recurrent sequences. This design satisfies the greatest common divisor. The conditions effectively eliminate the grid effect caused by traditional dilated convolution, ensuring that the convolution kernel can cover continuous spectral bands without any omission of spectral information. This allows the feature map output by the last layer to maintain the same length as the original spectral input while theoretically covering the entire band, thus enabling precise positioning of nanometer-scale feature wavelengths.
[0038] Step S202: Iteratively train the one-dimensional deep fully convolutional neural network model using a labeled sample set until the loss function converges, and extract the multi-channel feature map output from the last dilated convolutional layer in the trained one-dimensional deep fully convolutional neural network model. Since the multi-channel feature map is output from the dilated convolutional layer, its length is consistent with the length of the input data.
[0039] Obtain the weight vector corresponding to the target classification category in the fully connected classification output layer. The elements in the weight vector are the connection weights between each output node of the global average pooling layer and the corresponding node of the classification output layer.
[0040] The activation mapping algorithm is used to take the elements in the weight vector as the weighting coefficients of the corresponding channel feature maps, and the multi-channel feature maps are weighted and summed to generate a one-dimensional spectral sensitivity heatmap.
[0041] The peak positions with response values greater than a preset response threshold are retrieved from the one-dimensional spectral sensitivity heatmap, and the spectral channels corresponding to the peak positions are mapped to key feature wavelengths based on the center alignment of the receptive field.
[0042] The preset response threshold is 60% of the maximum response value of the heatmap, which can effectively filter out false activation points caused by spectral noise and retain only the spectral channels that are most sensitive to the internal biochemical components of the seed (such as protein and fat absorption peaks).
[0043] The peak response intensity at the peak position of the one-dimensional spectral sensitivity heatmap is extracted, and the peak response intensity is normalized to obtain the spectral feature confidence level. The spectral feature confidence level is used to characterize the degree of confidence of the one-dimensional deep fully convolutional neural network model in the current key feature wavelength.
[0044] It should be noted that the normalization process performed on the peak response intensity specifically employs a Min-Max normalization strategy to ensure that the range of spectral feature confidence values is strictly limited to within a certain range. between.
[0045] The mathematical expression for the confidence level of spectral features is: ; in, Confidence level for spectral features Peak response intensity The maximum peak response intensity in the one-dimensional spectral sensitivity thermogram. This represents the minimum peak response intensity in a one-dimensional spectral sensitivity thermogram. If... A value close to 1 indicates that the one-dimensional deep fully convolutional neural network model pays extremely high attention to the current key feature wavelength, resulting in high confidence. A value close to 0 indicates a weak characteristic response at the key characteristic wavelength, resulting in low confidence.
[0046] Step S203: Calculate the area, perimeter, major axis, minor axis, and roundness of the seed to be tested within the region of interest. Based on the area, perimeter, major axis, minor axis, and roundness, obtain the geometric morphological feature data of the seed to be tested.
[0047] The spectral transmittance of the seed to be tested at key characteristic wavelengths is read, and the spectral transmittance is converted into spectral absorbance data. The spectral absorbance data corresponding to all key characteristic wavelengths are combined to obtain the preferred spectral feature vector of the seed to be tested. The spectral feature confidence is then passed to the subsequent classification model as the weight basis for dynamic decision-making.
[0048] This invention addresses the problem in existing deep learning models that rely on downsampling pooling layers, leading to a sharp decrease in spectral resolution, resulting in blurred key feature wavelength localization and redundant computation across the entire spectral band. It constructs a one-dimensional deep fully convolutional neural network model and employs a sawtooth-shaped recurrent strategy to set the dilation rate of dilated convolutional layers, ensuring that the greatest common divisor of adjacent dilation rates is 1. This completely eliminates the grid effect caused by traditional dilated convolutions while abandoning pooling operations. This design achieves blind-spot-free receptive field coverage across the entire spectral band, ensuring that the output multi-channel feature map maintains strict consistency with the original input length. This allows for precise localization of nanometer-level feature wavelength positions. The spectral feature confidence extracted through the class activation mapping algorithm not only quantifies the model's confidence in wavelength discrimination but also provides precise weighting criteria for adaptive risk control in subsequent dynamic classification models.
[0049] Step S3 includes the following sub-steps: Step S301: Based on the geometric shape feature data, the area, perimeter, major axis, minor axis and roundness are arranged in a preset order to construct the original geometric feature vector.
[0050] The spectral absorbance data contained in the preferred spectral feature vector are sorted in ascending order of wavelength to construct the original spectral feature vector.
[0051] Step S302: Addressing the dimensional differences between the original geometric feature vector and the original spectral feature vector, a range normalization algorithm is used to perform dimensionless processing, mapping the values of each component in the original geometric feature vector to... The interval is used to obtain the normalized geometric eigenvector, and the original spectral eigenvector is mapped to... The interval is used to obtain a normalized spectral eigenvector to eliminate the interference of physical units on the eigenvalue weights.
[0052] Step S303: The normalized geometric feature vector and the normalized spectral feature vector are fused together using a feature layer concatenation strategy. The normalized geometric feature vector and the normalized spectral feature vector are concatenated end to end to construct a high-dimensional spectral fusion feature vector. The spectral fusion feature vector is a joint representation of the external morphology and internal biochemical information of the seed to be tested.
[0053] This invention addresses the problem that a single feature cannot distinguish between homogeneous seeds that appear intact but are internally moldy or hollow, and that a significant difference in the dimensions of geometric morphological features and spectral feature vectors leads to large numerical features masking the weights of smaller numerical features during direct fusion. The invention employs a range normalization algorithm to perform dimensionless processing on multi-source heterogeneous data, strictly mapping all components to the [0,1] interval to completely eliminate the interference of physical units on feature weights. A high-dimensional spectral fusion feature vector is constructed using a feature layer concatenation fusion strategy, achieving a joint representation of the external morphology and internal biochemical information of the seed under test. This enables subsequent classification models to simultaneously capture minute morphological distortions and spectral absorption differences, effectively solving the problem that relying solely on RGB images cannot eliminate latent inferior seeds.
[0054] Step S4 includes the following sub-steps: Step S401: Based on the width learning system, construct a dynamic classification model, map the graph fusion feature vector to feature nodes, perform nonlinear transformation on the feature nodes to generate augmentation nodes, and horizontally concatenate the feature nodes and augmentation nodes to construct the system state matrix.
[0055] Training a dynamic classification model based on the ridge regression algorithm specifically includes: Calculate the pseudo-inverse of the system state matrix, and solve for the output weights using the pseudo-inverse matrix.
[0056] It should be noted that the logic for constructing a dynamic classification model is as follows: Fuse the input map feature vector Mapped to feature nodes This embodiment employs a linear mapping strategy, feature nodes The mathematical expression is: ; in, The input weight matrix is randomly initialized. For random bias, It is a linear activation function. To prevent feature degradation, the input weight matrix is... Fine-tuning is performed using a sparse autoencoder.
[0057] For feature nodes Perform nonlinear transformations to generate enhanced nodes To improve the model's ability to fit nonlinear spectral data, the hyperbolic tangent function is preferred as the activation function when generating enhancement nodes, because the hyperbolic tangent function... The output characteristics between them can accelerate the solution process of the pseudo-inverse matrix and prevent numerical divergence. The feature nodes and enhancement nodes are horizontally concatenated to form the system state matrix. When calculating the output weights, the pseudo-inverse of the system state matrix is solved using the ridge regression algorithm to address the multicollinearity problem and prevent overfitting.
[0058] When calculating the pseudo-inverse matrix based on the ridge regression algorithm, the regularization coefficient is preferably set to... This solves the singularity problem that may exist in the system state matrix and significantly improves the generalization ability of the dynamic classification model when dealing with high-dimensional map fusion features.
[0059] Step S402: Calculate the dynamic risk threshold based on the spectral feature confidence level, and construct an adaptive feedback mechanism that drives the severity of the decision based on feature quality. The mathematical expression for the dynamic risk threshold is: ; in, For dynamic risk thresholds, The preset base buffer width, The preset adjustment coefficient, is the base of the natural logarithm. Confidence level for spectral features.
[0060] In a preferred configuration of this embodiment, The value is 0.1, and the risk buffer expands to a probability range of 0.1 at most. The range of values is In this embodiment, 2.0 is preferred, when the confidence level of the spectral features is... When (the characteristics are very strong), At this point, the buffer is very narrow, and it almost only removes samples that are extremely close to 0.5. When the feature is very weak, The buffer zone has been widened to strictly control risks.
[0061] The spectral fusion feature vector of the seed to be tested is input into a trained dynamic classification model. The predicted probability value of the seed belonging to the qualified product is calculated based on the output weights. Based on a dynamic risk threshold, the range of the predicted probability value is divided into three decision intervals: a non-qualified zone, a risk buffer zone, and a qualified zone. The probability interval corresponding to the non-qualified zone is... The probability interval corresponding to the risk buffer is The probability interval corresponding to the qualified area is .
[0062] The higher the confidence level of the spectral features, the smaller the dynamic risk threshold and the narrower the risk buffer. Conversely, the lower the confidence level of the spectral features, the larger the dynamic risk threshold and the wider the risk buffer.
[0063] Step S403, determining the interval where the predicted probability value falls, specifically includes: When the predicted probability value falls into the unqualified area, the seed to be tested is deemed unqualified.
[0064] When the predicted probability value falls into the risk buffer, the seed to be tested is determined to be a high-risk sample.
[0065] When the predicted probability value falls within the qualified zone, the seed to be tested is determined to be a qualified seed.
[0066] If the determination result is a non-qualified area or a risk buffer zone, a rejection instruction is generated.
[0067] The system reads the real-time conveying speed of the seed under test on the conveyor belt, obtains the optical axis center coordinates of the image acquisition device as the imaging position, obtains the installation coordinates of the pneumatic nozzle as the execution position, calculates the physical distance between the imaging position and the execution position, takes the moment when the seed under test passes through the imaging position and the image is acquired as the timing reference zero point, calculates the lag time based on the ratio of the physical distance to the real-time conveying speed, monitors the system time in real time, and when the elapsed time of the system time relative to the timing reference zero point reaches the lag time, sends an opening pulse signal to the pneumatic nozzle to drive the pneumatic nozzle to spray high-pressure airflow, change the movement trajectory of the seed under test, and perform physical separation.
[0068] This invention addresses the problems of low efficiency in iterative training of traditional deep networks and the inability of fixed thresholds to effectively handle high-risk samples near classification boundaries. It utilizes a width learning system to construct a dynamic classification model, and replaces complex gradient descent with output weights obtained by solving a pseudo-inverse matrix, meeting the requirements of real-time online sorting. It constructs an adaptive feedback mechanism that drives the severity of decision based on feature quality, and dynamically adjusts the dynamic risk threshold based on the confidence level of spectral features, thereby constructing a three-level decision interval. This allows the system to automatically widen the risk buffer when the feature ambiguity and confidence level are low, and strictly removes seeds whose predicted probability values meet the standard but have not crossed the safety boundary, effectively solving the problem of missing selection of heterogeneous seeds in the same graph under complex working conditions.
[0069] Example 2, refer to Figure 2 This paper presents an agricultural seed screening system based on data analysis, which includes a data acquisition module, a processing module, an analysis module, and a screening module.
[0070] The acquisition module is used to acquire the transmission mode hyperspectral image of the seed to be tested, obtain the optimal contrast reference map based on the maximum inter-class variance method and generate a global binarization mask, obtain the effective connected regions based on the global binarization mask, and perform full-band data cropping on the transmission mode hyperspectral image based on the effective connected regions to generate the region of interest.
[0071] The processing module is used to determine key feature wavelengths through a one-dimensional deep fully convolutional neural network model and a class activation mapping algorithm, calculate the geometric morphological feature data of the seed to be tested within the region of interest, and obtain the preferred spectral feature vector of the seed to be tested based on the key feature wavelengths.
[0072] The analysis module is used to construct the original geometric feature vector and the original spectral feature vector based on the geometric morphological feature data and the optimized spectral feature vector, and to perform normalization processing on the original geometric feature vector and the original spectral feature vector to generate the spectral fusion feature vector.
[0073] The screening module is used to build a dynamic classification model, calculate the dynamic risk threshold and construct a three-level decision interval, calculate the predicted probability value of the seed to be tested, and drive the pneumatic nozzle to achieve physical separation if it is determined to fall into the unqualified area or risk buffer.
[0074] To address the problems of existing screening systems being severely affected by the background interference of conveyor belt grids during transmission mode hyperspectral image acquisition, and the difficulty in real-time removal of heterogeneous seeds within the same image due to poor hardware and software coordination, this system utilizes the maximum inter-class variance method and a full-band data cropping strategy in the acquisition module to physically isolate invalid background noise at the source and generate a clean region of interest. Combined with the one-dimensional deep fully convolutional neural network model integrated in the processing module and the spectral fusion feature vector constructed by the analysis module, it achieves lossless extraction and joint representation of the internal and external features of the seeds. The screening module constructs a three-level decision interval based on the predicted probability value calculated by the dynamic classification model and the dynamic risk threshold, accurately judging high-risk samples falling into the risk buffer and driving the pneumatic nozzle. Thus, through deep coupling of various modules, it achieves real-time online high-precision physical separation under complex working conditions.
[0075] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0076] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the protection scope of the present invention.
Claims
1. A data analysis-based method for agricultural seed screening, characterized in that, Includes the following steps: Step S1: Obtain the transmission mode hyperspectral image of the seed to be tested, obtain the optimal contrast reference map based on the maximum inter-class variance method and generate a global binarization mask, obtain the effective connected regions based on the global binarization mask, and perform full-band data cropping on the transmission mode hyperspectral image according to the effective connected regions to generate the region of interest. Step S2: Determine the key feature wavelengths using a one-dimensional deep fully convolutional neural network model and a class activation mapping algorithm; calculate the geometric morphological feature data of the seed to be tested within the region of interest; and obtain the preferred spectral feature vector of the seed to be tested based on the key feature wavelengths. Step S3: Construct original geometric feature vectors and original spectral feature vectors based on geometric morphological feature data and optimized spectral feature vectors; perform normalization processing on the original geometric feature vectors and original spectral feature vectors to generate spectral fusion feature vectors. Step S4: Construct a dynamic classification model based on the width learning system, calculate the dynamic risk threshold and construct a three-level decision interval, calculate the predicted probability value of the seed to be tested, and if it is determined to fall into the unqualified area or risk buffer zone, drive the pneumatic nozzle to achieve physical separation.
2. The agricultural seed screening method based on data analysis as described in claim 1, characterized in that, Step S1 includes the following sub-steps: Step S101: Obtain the transmission mode hyperspectral image of the seed to be tested. Traverse all spectral bands of the transmission mode hyperspectral image. Calculate the inter-class variance value of the image pixel matrix under each spectral band based on the maximum inter-class variance method. Compare the inter-class variance values of all bands. Define the band image corresponding to the maximum inter-class variance value as the optimal contrast reference image. Obtain the global optimal segmentation threshold corresponding to the optimal contrast reference image. Perform binarization processing on the optimal contrast reference image based on the global optimal segmentation threshold. Mark pixels with gray values less than the global optimal segmentation threshold as foreground targets and pixels with gray values greater than the global optimal segmentation threshold as background, generating a global binarization mask.
3. The agricultural seed screening method based on data analysis as described in claim 2, characterized in that, Step S1 further includes the following sub-steps: Step S102: Perform morphological opening operation on the global binary mask, use structuring elements of a preset size to eliminate fine isolated noise points generated by the conveyor belt grid background, and disconnect weakly connected regions caused by diffraction effect. Use a connected component labeling algorithm to traverse the processed global binary mask, identify several independent connected regions that are not connected to each other, and use an area filtering strategy to remove connected regions with an area smaller than a preset noise threshold, retaining the effective connected regions that represent the seed to be tested. Step S103: Perform full-band data cropping on the transmission mode hyperspectral image based on the effective connected regions to generate the region of interest. The specific logic is as follows: Traverse each effective connected region, calculate the coordinates of the minimum bounding rectangle of each effective connected region, and perform full-band data cropping in the transmission mode hyperspectral image based on the minimum bounding rectangle coordinates to generate several independent regions of interest.
4. The agricultural seed screening method based on data analysis as described in claim 3, characterized in that, Step S2 includes the following sub-steps: Step S201: Select several seeds to be tested as standard samples, collect transmission hyperspectral data of the standard samples, perform physicochemical analysis on the transmission hyperspectral data to obtain physicochemical indicators, map the physicochemical indicators into discrete quality grade labels according to the preset grading standard, and use the quality grade labels as true value labels. Based on the transmission hyperspectral data of standard samples, the average spectral transmittance vector of the entire band is calculated. The average spectral transmittance vector of the entire band is converted into the average spectral absorbance vector of the entire band using the Lambert-Beer law. The average spectral absorbance vector of the entire band is used as input data and the true value label is used as output data to construct a labeled sample set. A one-dimensional deep fully convolutional neural network model is constructed, comprising an input layer, several stacked dilated convolutional layers, a global average pooling layer at the end, and a fully connected classification output layer. The dilated convolutional layers employ a zigzag recurrent strategy to set their dilation rate, and the dilation rates of consecutively stacked dilated convolutional layers are set as a recurrent sequence, wherein the greatest common divisor of two adjacent dilation rates in the recurrent sequence is 1. By eliminating the grid effect generated by dilated convolution, a receptive field coverage without blind spots across the entire spectrum is achieved while maintaining the same length of the output feature map as the input data.
5. The agricultural seed screening method based on data analysis as described in claim 4, characterized in that, Step S2 further includes the following sub-steps: Step S202: Iteratively train the one-dimensional deep fully convolutional neural network model using the labeled sample set until the loss function converges, and extract the multi-channel feature map output by the last dilated convolutional layer in the trained one-dimensional deep fully convolutional neural network model. Obtain the weight vector corresponding to the target classification category in the fully connected classification output layer. The elements in the weight vector are the connection weights between each output node of the global average pooling layer and the corresponding node of the classification output layer. The activation mapping algorithm is used to take the elements in the weight vector as the weighting coefficients of the corresponding channel feature maps, and the multi-channel feature maps are weighted and summed to generate a one-dimensional spectral sensitivity heatmap. Retrieve the peak positions in the one-dimensional spectral sensitivity heatmap where the response value is greater than a preset response threshold, and map the spectral channels corresponding to the peak positions as key feature wavelengths based on receptive field center alignment. The peak response intensity at the peak position of the one-dimensional spectral sensitivity heatmap is extracted, and the peak response intensity is normalized to obtain the spectral feature confidence level. Step S203: Calculate the area, perimeter, major axis, minor axis, and roundness of the seed to be tested within the region of interest. Based on the area, perimeter, major axis, minor axis, and roundness, obtain the geometric morphological feature data of the seed to be tested. The spectral transmittance of the seed to be tested at the key characteristic wavelength is read, the spectral transmittance is converted into spectral absorbance data, and the spectral absorbance data corresponding to all key characteristic wavelengths are combined to obtain the preferred spectral feature vector of the seed to be tested.
6. The agricultural seed screening method based on data analysis as described in claim 5, characterized in that, Step S3 includes the following sub-steps: Step S301: Based on the geometric shape feature data, the area, perimeter, major axis, minor axis and roundness are arranged in a preset order to construct the original geometric feature vector; The spectral absorbance data contained in the preferred spectral feature vector are sorted in order of increasing wavelength to construct the original spectral feature vector; Step S302: Addressing the dimensional differences between the original geometric feature vector and the original spectral feature vector, a range normalization algorithm is used to perform dimensionless processing, mapping the values of each component in the original geometric feature vector to... The interval is used to obtain the normalized geometric feature vector, and the original spectral feature vector is mapped to... The interval yields the normalized spectral eigenvectors; Step S303: A feature layer concatenation fusion strategy is adopted for the normalized geometric feature vector and the normalized spectral feature vector. The normalized geometric feature vector and the normalized spectral feature vector are concatenated end to end to generate a spectral fusion feature vector.
7. The agricultural seed screening method based on data analysis as described in claim 6, characterized in that, Step S4 includes the following sub-steps: Step S401: Based on the width learning system, construct a dynamic classification model, map the graph fusion feature vector to feature nodes, perform nonlinear transformation on the feature nodes to generate enhancement nodes, and horizontally concatenate the feature nodes and enhancement nodes to construct a system state matrix. Training a dynamic classification model based on the ridge regression algorithm specifically includes: Calculate the pseudo-inverse of the system state matrix, and use the pseudo-inverse to solve for the output weights.
8. The agricultural seed screening method based on data analysis as described in claim 7, characterized in that, Step S4 further includes the following sub-steps: Step S402: Calculate the dynamic risk threshold based on the spectral feature confidence level. The mathematical expression for the dynamic risk threshold is: ; in, For dynamic risk thresholds, The preset base buffer width, The preset adjustment coefficient, is the base of the natural logarithm. Confidence level for spectral features; The spectral fusion feature vector of the seed to be tested is input into the trained dynamic classification model. The predicted probability value of the seed belonging to the qualified product is calculated based on the output weights. Based on the dynamic risk threshold, the range of the predicted probability value is divided into three decision intervals: a non-qualified zone, a risk buffer zone, and a qualified zone. The probability interval corresponding to the non-qualified zone is... The probability interval corresponding to the risk buffer is The probability interval corresponding to the qualified area is .
9. The agricultural seed screening method based on data analysis as described in claim 8, characterized in that, Step S4 further includes the following sub-steps: Step S403, determining the interval position where the predicted probability value falls, specifically includes: When the predicted probability value falls into the unqualified area, the seed to be tested is determined to be unqualified. When the predicted probability value falls into the risk buffer, the seed to be tested is determined to be a high-risk sample; When the predicted probability value falls into the qualified area, the seed to be tested is determined to be a qualified seed; If the determination result is a non-qualified area or a risk buffer zone, a rejection instruction is generated; The system reads the real-time conveying speed of the seed under test on the conveyor belt, obtains the optical axis center coordinates of the image acquisition device as the imaging position, obtains the installation coordinates of the pneumatic nozzle as the execution position, calculates the physical distance between the imaging position and the execution position, takes the moment when the seed under test passes through the imaging position and the image is acquired as the timing reference zero point, calculates the lag time based on the ratio of the physical distance to the real-time conveying speed, monitors the system time in real time, and when the elapsed time of the system time relative to the timing reference zero point reaches the lag time, sends an opening pulse signal to the pneumatic nozzle to drive the pneumatic nozzle to spray high-pressure airflow, change the movement trajectory of the seed under test, and perform physical separation.
10. A data analysis-based agricultural seed screening system, applied in any one of the data analysis-based agricultural seed screening methods as described in claims 1-9, characterized in that, It includes a data acquisition module, a processing module, an analysis module, and a filtering module; The acquisition module is used to acquire the transmission mode hyperspectral image of the seed to be tested, obtain the optimal contrast reference map based on the maximum inter-class variance method and generate a global binarization mask, obtain the effective connected region based on the global binarization mask, and perform full-band data cropping on the transmission mode hyperspectral image according to the effective connected region to generate the region of interest. The processing module is used to determine key feature wavelengths through a one-dimensional deep fully convolutional neural network model and a class activation mapping algorithm, calculate the geometric morphological feature data of the seed to be tested in the region of interest, and obtain the preferred spectral feature vector of the seed to be tested based on the key feature wavelengths. The analysis module is used to construct the original geometric feature vector and the original spectral feature vector based on the geometric morphological feature data and the preferred spectral feature vector, and to perform normalization processing on the original geometric feature vector and the original spectral feature vector to generate the spectral fusion feature vector. The screening module is used to construct a dynamic classification model, calculate a dynamic risk threshold and construct a three-level decision interval, calculate the predicted probability value of the seed to be tested, and drive the pneumatic nozzle to achieve physical separation if it is determined to fall into the unqualified area or risk buffer zone.