Deep learning network-based corn seed quality evaluation method
Through the image quantity balance processing and feature extraction unit of the deep learning network, combined with the acceleration module and the data enhancement module, the accuracy and efficiency problems of traditional corn seed quality detection methods are solved, and more efficient corn seed quality evaluation is achieved.
Patent Information
- Application Number
- CN202411100438.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-11-29
AI Technical Summary
Traditional corn seed quality detection methods rely on manual visual inspection, which is time-consuming and labor-intensive, with poor accuracy and repeatability. It is difficult for deep learning networks to achieve stable and efficient processing when computing resources are limited.
The corn seed quality evaluation method based on deep learning network is adopted, and features are extracted through image quantity balance processing, PConvEncoder and SpeedyEncoder units, and acceleration modules and data enhancement modules are introduced to optimize the model training time and effect.
It enhances the robustness and generalization of the detection model, improves feature extraction refinement and global expression, shortens iterative training time, and improves classification ability and training effect.
Smart Images

Figure CN119048812A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of corn seed quality detection, and in particular to a corn seed quality evaluation method based on a deep learning network. Background Art
[0002] Corn is one of the most important food crops in the world, and the quality of its seeds is directly related to the quality and efficiency of agricultural output. Traditional corn seed quality testing mainly relies on manual visual inspection and simple physical methods, which are not only time-consuming and labor-intensive, but also have poor accuracy and repeatability and are greatly affected by human factors. In the field of deep learning technology, the capabilities of computer vision and image processing provide a new way for automated and intelligent corn seed quality testing.
[0003] However, although traditional convolutional neural networks can extract spatial features of images and have high computational efficiency, they cannot accurately capture the subtle differences of seed images. In addition, the self-attention mechanism significantly improves the model's ability to perceive and process global context information, but due to the high demand for computing resources, it is difficult to achieve stable and efficient processing in a limited environment. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a corn seed quality evaluation method based on a deep learning network, which enhances the robustness and generalization of the detection model by performing image quantity balancing processing on training images; realizes feature refinement and extraction of global expression through PConvEncoder unit and SpeedyEncoder unit to improve the classification ability of the model; introduces an acceleration module and a data enhancement module to shorten the training time of iteration and improve the training effect.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A corn seed quality evaluation method based on a deep learning network, comprising:
[0007] Collect images of corn seeds to be evaluated;
[0008] Inputting the corn seed image to be evaluated into a preset corn seed quality detection model to obtain a target evaluation result;
[0009] The construction process of the corn seed quality detection model includes:
[0010] Performing quantity balancing and normalization operations on preset corn seed images of different categories in a preset data set to obtain preprocessed images;
[0011] Determine a model structure; the model structure includes: a patch embedding layer, four feature extraction layers, four downsampling layers and a feature conversion layer; the feature extraction layer and the downsampling layer are cross-distributed; the feature extraction layer includes: a PConvEncoder unit and a SpeedyEncoder unit;
[0012] Introducing the acceleration module, data enhancement module, AdamW optimizer and cross entropy loss function;
[0013] Using the patch embedding layer to reduce the dimension of the preprocessed image and extract features of the preprocessed image to obtain original features;
[0014] Extracting multi-scale features of the original features using the feature extraction layer to obtain a first intermediate feature;
[0015] Using the downsampling layer to reduce the spatial size of the first intermediate feature and increase the number of channels of the first intermediate feature;
[0016] Using the feature conversion layer to enhance the features of the first intermediate features output by the last feature extraction layer to obtain a classification probability;
[0017] Based on the classification probability and the true quality data of the preprocessed image in the preset data set, calculating the loss value using the cross entropy loss function;
[0018] According to the loss value, the parameters of the model structure are optimized and iterated using the acceleration module, the data enhancement module and the AdamW optimizer to obtain the iteratively completed corn seed quality detection model.
[0019] Preferably, performing quantity balancing and normalization operations on preset corn seed images of different categories in a preset data set to obtain preprocessed images includes:
[0020] Constructing a generative adversarial network; the generative adversarial network includes: a generator and a discriminator; the parameters of the generative adversarial network include: epoch, generation learning rate, discriminator learning rate and batch size;
[0021] Passing random noise and the label of the preset corn seed image to the generator, and obtaining a generated image through alternating training of the generator and the discriminator;
[0022] Mixing the generated image with the preset corn seed image to obtain a class-balanced sample data set;
[0023] A normalization operation is performed on the sample data set to obtain the preprocessed image.
[0024] Preferably, the multi-scale features of the original features are extracted using the feature extraction layer to obtain the first intermediate features, including:
[0025] Extracting local fine features of the original features using the PConvEncoder unit;
[0026] The SpeedyEncoder unit is used to extract local-global representation features of the original features.
[0027] Preferably, the patch embedding layer adopts a ReLU activation function; and the feature extraction layer adopts a GeLU activation function.
[0028] Preferably, the parameter settings of the data enhancement module include: MixUp is 1, CutMix is 0.8, color jitter ratio is 0.4, RandAugment amplitude is 9, standard deviation is 0.5, label smoothing is 0.1, and gradient clipping upper limit is 0.01.
[0029] Preferably, it also includes:
[0030] Calculate the precision, recall rate, F1 score and accuracy of the corn seed quality detection model to obtain model performance parameters;
[0031] The corn seed quality detection model is evaluated using the model performance parameters to obtain model performance and generalization evaluation results.
[0032] Preferably, the optimization strategy for generating the learning rate and the discriminating learning rate adopts a cosine annealing strategy; the optimization formula of the cosine annealing strategy is: lr(t) is the target learning rate for the tth iteration; lr min is the minimum value of the target learning rate; lr max is the maximum value of the target learning rate; T max is the number of iterations experienced by the target learning rate to reach the minimum value; t is the current iteration number; the target learning rate includes: any one of the generation learning rate and the discrimination learning rate.
[0033] Preferably, extracting the local-global representation features of the original features using the SpeedyEncoder unit comprises:
[0034] Based on the self-attention algorithm, the embedding matrix input into the SpeedyEncoder unit is converted into a query matrix and a key matrix using two initialization matrices;
[0035] The query matrix and the learnable parameter vector of the SpeedyEncoder unit are calculated to obtain a global attention query vector; the calculation formula of the global attention query vector is: α is the global attention query vector; Q is the query matrix; W a is the learnable parameter vector; d is the dimension of the embedding matrix;
[0036] The global attention query vector is pooled to obtain a global query vector; the pooling calculation formula of the global query vector is: q is the global query vector; α i is the i-th global attention query vector; Q i is the i-th query matrix; n is the number of embedding matrices;
[0037] The interaction between the global query vector and the key matrix is encoded using the element-by-element product method to obtain the local-global representation feature; the encoding formula of the local-global representation feature is: is the local-global representation feature; K is the key matrix; q is the query vector; is the normalized query matrix; T is the linear transformation calculation.
[0038] The present invention discloses the following technical effects:
[0039] The present invention provides a corn seed quality evaluation method based on a deep learning network. By performing image quantity balancing processing on training images, the problem of small amount of training data for a detection model is solved, and the robustness and generalization of the detection model are enhanced. By using a PConvEncoder unit and a SpeedyEncoder unit, the problem of poor feature extraction effect is solved, and feature refinement and extraction of global expression are achieved. By introducing an acceleration module and a data enhancement module, the problem of slow model training is solved, and the iteration time and training effect are optimized. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0041] Figure 1 A schematic diagram of the evaluation process provided for this embodiment;
[0042] Figure 2 A schematic diagram of the structure of a generative adversarial network provided in this embodiment;
[0043] Figure 3 A schematic diagram of the quality inspection model structure provided for this embodiment;
[0044] Figure 4 A schematic diagram of the PConvEncoder unit structure provided in this embodiment;
[0045] Figure 5 A schematic diagram of the SpeedyEncoder unit structure provided in this embodiment;
[0046] Figure 6 Schematic diagram of the efficient self-attention structure provided for this embodiment;
[0047] Figure 7 A schematic diagram of a partial convolution structure provided for this embodiment;
[0048] Figure 8 A schematic diagram of the context broadcast module calculation process provided in this embodiment;
[0049] Fig. 9 The confusion matrix of the corn seed image prediction results provided in this embodiment. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in this embodiment to clearly and completely describe the technical solution in this embodiment. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0051] The purpose of the present invention is to provide a corn seed quality evaluation method based on a deep learning network, which enhances the robustness and generalization of the detection model by performing image quantity balancing processing on training images; realizes feature refinement and extraction of global expression through PConvEncoder units and SpeedyEncoder units to improve the classification ability of the model; introduces an acceleration module and a data enhancement module to shorten the training time of iteration and improve the training effect.
[0052] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0053] Figure 1 The evaluation process diagram provided for this embodiment is as follows: Figure 1As shown, the present invention provides a method for evaluating corn seed quality based on a deep learning network, comprising:
[0054] Step 100: Collect corn seed images to be evaluated;
[0055] Step 200: inputting the corn seed image to be evaluated into a preset corn seed quality detection model to obtain a target evaluation result;
[0056] The construction process of corn seed quality detection model includes:
[0057] Performing quantity balancing and normalization operations on preset corn seed images of different categories in a preset data set to obtain preprocessed images;
[0058] Determine the model structure; the model structure includes: a patch embedding layer, four feature extraction layers, four downsampling layers, and a feature conversion layer; the feature extraction layer and the downsampling layer are cross-distributed; the feature extraction layer includes: a PConvEncoder unit and a SpeedyEncoder unit;
[0059] Introducing the acceleration module, data enhancement module, AdamW optimizer and cross entropy loss function;
[0060] Use the patch embedding layer to reduce the dimension of the preprocessed image and extract the features of the preprocessed image to obtain the original features;
[0061] The feature extraction layer is used to extract multi-scale features of the original features to obtain the first intermediate features;
[0062] Using a downsampling layer to reduce the spatial size of the first intermediate feature and increase the number of channels of the first intermediate feature;
[0063] The feature conversion layer is used to enhance the features of the first intermediate features output by the last feature extraction layer to obtain the classification probability;
[0064] Based on the classification probability and the real quality data of the preprocessed images in the preset data set, the loss value is calculated using the cross entropy loss function;
[0065] According to the loss value, the acceleration module, data enhancement module and AdamW optimizer are used to optimize and iterate the parameters of the model structure to obtain an iterative corn seed quality detection model.
[0066] Specifically, the preset corn seed images of different categories in the preset data set are subjected to quantity balancing processing and normalization operations to obtain preprocessed images, including:
[0067] Construct a generative adversarial network; the generative adversarial network includes: generator and discriminator; the parameters of the generative adversarial network include: epoch, generation learning rate, discriminator learning rate and batch size;
[0068] The random noise and the labels of the preset corn seed images are passed to the generator. After alternating training of the generator and the discriminator, the generated image is obtained.
[0069] Mix the generated images with the preset corn seed images to obtain a class-balanced sample dataset;
[0070] The sample data set is normalized to obtain a preprocessed image.
[0071] Furthermore, the multi-scale features of the original features are extracted using the feature extraction layer to obtain the first intermediate features, including:
[0072] The PConvEncoder unit is used to extract local fine features of the original features;
[0073] SpeedyEncoder unit is used to extract local-global representation features of original features.
[0074] Optionally, the patch embedding layer adopts a ReLU activation function; the feature extraction layer adopts a GeLU activation function.
[0075] Preferably, the parameter settings of the data enhancement module include: MixUp is 1, CutMix is 0.8, color jitter ratio is 0.4, RandAugment amplitude is 9, standard deviation is 0.5, label smoothing is 0.1, and gradient clipping upper limit is 0.01.
[0076] Furthermore, it also includes:
[0077] Calculate the precision, recall, F1 score, and accuracy of the corn seed quality detection model to obtain the model performance parameters;
[0078] The corn seed quality detection model was evaluated using model performance parameters, and the model performance and generalization evaluation results were obtained.
[0079] Specifically, the optimization strategy for generating learning rate and discriminating learning rate adopts cosine annealing strategy; the optimization formula of cosine annealing strategy is: lr(t) is the target learning rate for the tth iteration; lr min is the minimum value of the target learning rate; lr max is the maximum value of the target learning rate; T max is the number of iterations after which the target learning rate reaches the minimum value; t is the current iteration number; the target learning rate includes: any one of the generative learning rate and the discriminative learning rate.
[0080] Furthermore, the SpeedyEncoder unit is used to extract local-global representation features of the original features, including:
[0081] Based on the self-attention algorithm, two initialization matrices are used to convert the embedding matrix of the input SpeedyEncoder unit into a query matrix and a key matrix;
[0082] Calculate the query matrix and the learnable parameter vector of the SpeedyEncoder unit to obtain the global attention query vector; the calculation formula of the global attention query vector is: α is the global attention query vector; Q is the query matrix; W a is the learnable parameter vector; d is the dimension of the embedding matrix;
[0083] The global attention query vector is pooled to obtain a global query vector. The pooling calculation formula of the global query vector is: q is the global query vector; α i is the i-th global attention query vector; Q i is the i-th query matrix; n is the number of embedding matrices;
[0084] The interaction between the global query vector and the key matrix is encoded using the element-by-element product method to obtain the local-global representation feature; the encoding formula of the local-global representation feature is: is the local-global representation feature; K is the key matrix; q is the query vector; is the normalized query matrix; T is the linear transformation calculation.
[0085] refer to Figure 2 , the corn seed images in the dataset are preprocessed to obtain a new dataset, specifically including: the corn seeds of different categories (damaged, discolored, pure color, and shredded) in the dataset are processed in quantity balance through a generative adversarial network; the structure of the generative adversarial network is as follows Figure 2 As shown in the figure, it includes a generator and a discriminator; the adversarial network includes: 500 epochs, the learning rates of the generator and the discriminator are set to 5e-5 and 2e-4 respectively, and the batch size is 128. By passing random noise and labels to the generator and obtaining realistic corn seed generated images under continuous alternating training, the generated images that conform to the real corn seed morphology are mixed with the original corn seed dataset to obtain a class-balanced sample dataset. The images after quantity balance are normalized to obtain pre-processed images that can be finally input into the network model.
[0086] refer to Figure 3, a lightweight model for corn seed quality detection combining convolutional neural network and self-attention mechanism is constructed; the specific structure of the quality detection model includes 1 patch embedding layer, 4 feature extraction layers, 4 downsampling layers and 1 feature conversion layer. In the entire network model, the patch embedding layer at the first layer is implemented by two 3*3 convolutions with a step size of 2, which is used to reduce the spatial size of the input corn seed image and extract the original features. The four feature extraction layers capture features from local to global through different configurations. Each layer contains a specific number of PConvEncoder and SpeedyEncoder units with scales of 3, 3, 6, and 4, respectively, to effectively improve the model's ability to understand multi-scale features in corn seed images.
[0087] refer to Figure 4 , PConvEncoder is responsible for local fine feature extraction and consists of partial convolution and two point-by-point convolutions. Figure 5 , SpeedyEncoder is responsible for learning rich local-global representations, which consists of partial convolutions, efficient attention modules and linear layers.
[0088] Furthermore, there is a downsampling layer between adjacent feature extraction layers to reduce the spatial size of the data and increase the number of feature channels. Finally, the comprehensive expression ability of the features is further improved through the feature conversion layer, especially the context broadcast module. The features processed by the context broadcast module are sent to the final classifier, which outputs the final category probability and predicts the quality classification of corn seeds.
[0089] Specifically, as a supplement to the above-mentioned network structure, the self-attention mechanism, partial convolution and context broadcast module play a vital role; compared with the self-attention mechanism, this embodiment adopts efficient self-attention and uses the integrated linear projection layer of query key interaction to effectively encode and learn the association between tags to improve the processing speed and enhance the context capture capability, which not only maintains the model performance but also optimizes the use of computing resources.
[0090] refer to Figure 6 , the model calculation process includes:
[0091] Using two initialization matrices W q , W K Convert the input embedding matrix x into query (Q) and key (K); where, ( represents the set of all n×d dimensional real matrices), ( represents the set of all d×d dimensional real number matrices), n is the token length, d is the dimension of the embedding vector; multiply the query matrix Q by the learnable parameter vector ( represents the set of all d-dimensional real number vectors) to learn the query attention weight and generate the global attention query vector ( represents the set of all n-dimensional real vectors), and its calculation formula is as follows:
[0092]
[0093] The query matrix is pooled according to the learned attention weights to produce a single global query vector The calculation formula is as follows:
[0094]
[0095] Use element-wise product to search the global query vector and key matrix to encode the interactions between The calculation formula is as follows:
[0096]
[0097] refer to Figure 7 ,Partial convolution further improves computational efficiency by performing selective convolutions across specific input channels and minimizing memory accesses, optimizing the number of floating-point operations per second.
[0098] refer to Figure 8 ,The context broadcast module enhances the model's feature representation ability and optimizes the understanding and classification performance of complex images by uniformly pooling the features and broadcasting the global information back to the original features. The calculation process is as follows:
[0099] Suppose there is a sequence of N tokens ( represents the set of all N×d-dimensional real number matrices), the context broadcast module returns the average pooled token to the token:
[0100]
[0101] CB() indicates the use of the context broadcast module for calculation; N indicates the number of assumed tokens, X i represents the i-th token in X.
[0102] Specifically, the training of the corn seed quality detection model includes:
[0103] The newly obtained corn seed dataset after preprocessing is divided into a training set and a validation set according to a ratio of 8:2; the training set processed by data enhancement technology (MixUp is set to 1, CutMix is set to 0.8, the color jitter ratio is set to 0.4, the RandAugment amplitude is set to 9, the standard deviation is 0.5, the label smoothing is set to 0.1, and the gradient clipping upper limit is 0.01) is input into the corn seed quality detection model and the acceleration module is introduced to achieve training acceleration through unbiased dynamic data pruning technology, and finally a set of output vectors is obtained; Among them, the MixUp technology combines the features and labels of two training samples by linear interpolation at the image and label levels to generate new training samples. The calculation process is as follows:
[0104] 1) Set two data points (x i ,y i ) and (x j ,y j ); x i represents the i-th image; y i represents the label of the i-th image;
[0105] 2) Through x new =λx i +(1-λ)x j ,y new =λy i +(1-λ)y j Generate new data points (x new ,y new ), λ is randomly drawn from a Beta distribution in the range [0, 1].
[0106] The CutMix technology cuts and pastes part of an image from one image into another, and adjusts the ratio of the label to reflect the content ratio of the image. During the training process, the cosine annealing strategy is used to dynamically adjust the learning rate, and the learning rate is gradually reduced according to the cosine curve to promote smoother model convergence and improve efficiency. The calculation formula is as follows:
[0107]
[0108] Where lr(t) is the learning rate of the tth iteration; lr min is the minimum value of the learning rate; lr max is the maximum learning rate, usually the initial learning rate at the beginning of training; t is the current number of generations; T max is the number of iterations before the learning rate reaches its minimum.
[0109] The AdamW optimizer is used for model optimization. This optimizer integrates weight decay into the optimization process to enhance training stability and alleviate the problems that may be caused by overly aggressive weight decay. The optimization process includes:
[0110] 1) Calculate the first (m) and second (v) moment estimates of the gradient;
[0111] m t =β1m t-1 +(1-β1)g t
[0112]
[0113] Among them, g t is the gradient at iteration t, β1 and β2 are estimated decay rates (usually close to 1); m t is the moving average of the first moment estimated gradient, representing the direction of the gradient; v t It is the moving average of the second moment estimated gradient, representing the variance of the gradient; β1 controls the decay rate of the gradient moving average; β2 controls the decay rate of the gradient variance moving average;
[0114] 2) Correct the deviation of m and v;
[0115]
[0116] The bias-corrected first moment estimate, which is the corrected moving average of the gradients and is used for weight updates; The bias-corrected second moment estimate, which is a moving average of the corrected gradient variance and is used to adjust the learning rate when the weights are updated; The t-th power represents the weight decay at the t-th iteration;
[0117] 3) Update weights, including weight decay;
[0118]
[0119] Among them, w t is the weight at the tth iteration, η t is the learning rate for the tth iteration, ∈ is a very small number to prevent division by zero (usually 10 -8 ), σ is the weight decay coefficient;
[0120] To ensure that the predicted probability distribution output by the model is consistent with the actual label, the distance between the predicted probability distribution output by the model and the unique hot encoding of the actual label is calculated through the cross entropy loss function, and this distance is continuously minimized. The calculation formula is as follows:
[0121]
[0122] L avg represents the cross entropy loss value of the sample; C represents the number of categories; y i,j represents the unique hot encoding value of the target label of the i-th category of the j-th sample, the actual category is 1, and other categories are 0; p i,j represents the probability that the jth sample predicted by the model belongs to the i-th category; N1 represents the number of samples in the data set; L j Represents the cross entropy loss of the jth sample.
[0123] Through evaluation indicators such as precision, recall rate, F1 score and accuracy, the performance of the model is comprehensively evaluated and continuously optimized to ensure the accuracy and reliability of the model in corn seed quality assessment.
[0124] refer to Fig. 9 , the test set is input into the mature quality detection model to obtain the prediction output. The accuracy of the detection model in this embodiment reaches 84.12%; the confusion matrix of corn seed image prediction is as follows Fig. 9 shown.
[0125] Optionally, the quality detection model of this embodiment is compared with other eight classification networks to evaluate the classification performance and generalization of the model; the balanced data set is input into the AlexNet, VGG16, ResNet18, ResNet34, ResNet50, ResNet101, MobileNetV2 and SqueezeNet network models respectively, and each network adopts an accelerated training strategy of 200 epochs. The number of neurons in the classification layer of all comparison networks is standardized to 4. While the backbone structure of each network remains unchanged, transfer learning is used to train the backbone to ensure the reliability of the experimental results. The experimental results are shown in Table 1 below:
[0126] Table 1
[0127] Model Accuracy (%) F1 score Parameter size (MB) AlexNet 68.07 68.32 57.02 VGG16 77.58 77.13 134.28 MobileNetv2 76.45 76.34 2.23 SqueezeNet 67.67 67.31 0.74 ResNet18 80.99 80.94 11.18 ResNet34 81.85 81.76 21.29 ResNet50 82.16 82.03 23.52 ResNet101 81.93 81.93 42.51 This embodiment 84.12 84.03 3.66
[0128] Furthermore, it can be seen from Table 1 that this embodiment has achieved a good balance in terms of recognition accuracy, F1 score and parameter quantity. Compared with other models, this embodiment not only maintains a high classification performance, but also significantly reduces the parameter quantity, demonstrating superior efficiency and generalization ability.
[0129] Specifically, experiments were conducted using the initial dataset and a balanced dataset generated by a generative adversarial network to ensure the effectiveness of the quality detection model on the balanced dataset. The experimental results of the initial dataset are shown in Table 2, and the experimental results of the balanced dataset are shown in Table 3; where broken: physically damaged seeds; discolored: seeds with abnormal color; pure: high-quality seeds; silkcut: a defect characterized by cracks on the top or side of the corn kernel with filaments embedded in these cracked areas.
[0130] Table 2
[0131]
[0132] Table 3
[0133]
[0134]
[0135] Furthermore, it can be seen from Tables 2 and 3 that the present embodiment is significantly better than the initial dataset in terms of recall, precision and F1 score of the balanced dataset, which further verifies the effectiveness of the balanced dataset and enhances the performance of the quality detection model.
[0136] Preferably, different key structures of the quality inspection model are subjected to ablation tests to obtain the impact of each component on the model performance indicators; the experiment is conducted on a balanced dataset of 200 epochs, focusing on key structures including efficient self-attention mechanism, partial convolution, context broadcasting and accelerated training. The statistical results are shown in Table 4:
[0137] Table 4
[0138]
[0139] Furthermore, with the gradual integration of components, both accuracy and F1 score show an upward trajectory, and the synergistic interaction between components effectively improves the performance of the model.
[0140] The beneficial effects of the present invention are as follows:
[0141] The present invention enhances the robustness and generalization of the detection model by performing image quantity balancing processing on training images; realizes feature refinement and extraction of global expression through PConvEncoder unit and SpeedyEncoder unit, and improves the classification ability of the model; and shortens the training time of iteration and improves the training effect by introducing acceleration module and data enhancement module.
[0142] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0143] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for evaluating corn seed quality based on a deep learning network, characterized in that: include: Collect images of corn seeds to be evaluated; Inputting the corn seed image to be evaluated into a preset corn seed quality detection model to obtain a target evaluation result; The construction process of the corn seed quality detection model includes: Performing quantity balancing and normalization operations on preset corn seed images of different categories in a preset data set to obtain preprocessed images; Determine a model structure; the model structure includes: a patch embedding layer, four feature extraction layers, four downsampling layers and a feature conversion layer; the feature extraction layer and the downsampling layer are cross-distributed; the feature extraction layer includes: a PConvEncoder unit and a SpeedyEncoder unit; Introducing the acceleration module, data enhancement module, AdamW optimizer and cross entropy loss function; Using the patch embedding layer to reduce the dimension of the preprocessed image and extract features of the preprocessed image to obtain original features; Extracting multi-scale features of the original features using the feature extraction layer to obtain a first intermediate feature; Using the downsampling layer to reduce the spatial size of the first intermediate feature and increase the number of channels of the first intermediate feature; Using the feature conversion layer to enhance the features of the first intermediate features output by the last feature extraction layer to obtain a classification probability; Based on the classification probability and the true quality data of the preprocessed image in the preset data set, calculating the loss value using the cross entropy loss function; According to the loss value, the parameters of the model structure are optimized and iterated using the acceleration module, the data enhancement module and the AdamW optimizer to obtain the iteratively completed corn seed quality detection model.
2. The method for evaluating corn seed quality based on a deep learning network according to claim 1, characterized in that: The preset corn seed images of different categories in the preset data set are subjected to quantity balancing and normalization operations to obtain preprocessed images, including: Constructing a generative adversarial network; the generative adversarial network includes: a generator and a discriminator; the parameters of the generative adversarial network include: epoch, generation learning rate, discriminator learning rate and batch size; Passing random noise and the label of the preset corn seed image to the generator, and obtaining a generated image through alternating training of the generator and the discriminator; Mixing the generated image with the preset corn seed image to obtain a class-balanced sample data set; A normalization operation is performed on the sample data set to obtain the preprocessed image.
3. The method for evaluating corn seed quality based on a deep learning network according to claim 1, characterized in that: The multi-scale features of the original features are extracted by the feature extraction layer to obtain a first intermediate feature, including: Extracting local fine features of the original features using the PConvEncoder unit; The SpeedyEncoder unit is used to extract local-global representation features of the original features.
4. The method for evaluating corn seed quality based on a deep learning network according to claim 1, characterized in that: The patch embedding layer adopts the ReLU activation function; the feature extraction layer adopts the GeLU activation function.
5. The method for evaluating corn seed quality based on a deep learning network according to claim 1, characterized in that: The parameter settings of the data enhancement module include: MixUp is 1, CutMix is 0.8, color jitter ratio is 0.4, RandAugment amplitude is 9, standard deviation is 0.5, label smoothing is 0.1, and gradient clipping upper limit is 0.
01.
6. The method for evaluating corn seed quality based on a deep learning network according to claim 1, characterized in that: Also includes: Calculate the precision, recall rate, F1 score and accuracy of the corn seed quality detection model to obtain model performance parameters; The corn seed quality detection model is evaluated using the model performance parameters to obtain model performance and generalization evaluation results.
7. The method for evaluating corn seed quality based on a deep learning network according to claim 2, characterized in that: The optimization strategy for the generation learning rate and the discrimination learning rate adopts the cosine annealing strategy; the optimization formula of the cosine annealing strategy is: lr(t) is the target learning rate for the tth iteration; lr min is the minimum value of the target learning rate; lr max is the maximum value of the target learning rate; T max The number of iterations required for the target learning rate to reach the minimum value; t is the current iteration number; The target learning rate includes: any one of the generation learning rate and the discrimination learning rate.
8. The method for evaluating corn seed quality based on a deep learning network according to claim 3, characterized in that: Extracting local-global representation features of the original features using the SpeedyEncoder unit includes: Based on the self-attention algorithm, the embedding matrix input into the SpeedyEncoder unit is converted into a query matrix and a key matrix using two initialization matrices; The query matrix and the learnable parameter vector of the SpeedyEncoder unit are calculated to obtain a global attention query vector; the calculation formula of the global attention query vector is: α is the global attention query vector; Q is the query matrix; W a is the learnable parameter vector; d is the dimension of the embedding matrix; The global attention query vector is pooled to obtain a global query vector; the pooling calculation formula of the global query vector is: q is the global query vector; α i is the i-th global attention query vector; Q i is the i-th query matrix; n is the number of embedding matrices; The interaction between the global query vector and the key matrix is encoded using the element-by-element product method to obtain the local-global representation feature; the encoding formula of the local-global representation feature is: is the local-global representation feature; K is the key matrix; q is the query vector; is the normalized query matrix; T is the linear transformation calculation.
Citation Information
Cited By
Rape seed quality evaluation model based on big data
CN120196911A
A rapeseed seed quality evaluation system based on big data
CN120196911B
Method for detecting grain number per ear, row number per ear and grain number per row per ear of corn
CN120298713A
