Corn variety identification method based on convolutional neural network and hyperspectral imaging
By using convolutional neural networks and hyperspectral imaging technology, a maize variety identification model was established, which solved the problems of low efficiency and low accuracy in maize variety identification and achieved rapid and accurate maize variety identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-27
- Publication Date
- 2026-04-07
AI Technical Summary
Existing methods for identifying maize varieties are inefficient, susceptible to human factors, and prone to mixing during seed harvesting, resulting in low accuracy and posing challenges to breeding efforts for businesses and farmers.
A method based on convolutional neural networks and hyperspectral imaging was adopted. Maize seed images were acquired using a hyperspectral imager, feature bands were extracted, and a recognition model was established using a convolutional neural network to achieve rapid and accurate maize variety identification.
It achieves rapid, accurate, and non-destructive detection of maize varieties, with an identification accuracy of 96.65% and a detection frame rate of up to 1000 Fps/s, solving the problems of low efficiency and low accuracy in traditional methods.
Smart Images

Figure CN116718553B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of crop seed variety identification technology, specifically to a method for identifying maize varieties based on convolutional neural networks and hyperspectral imaging. Background Technology
[0002] Maize is one of my country's important food crops, and the Huang-Huai-Hai maize-producing region plays a vital role in my country's grain production. Selecting suitable maize varieties is crucial for achieving high yields. However, in actual agricultural production, maize varieties are difficult to distinguish accurately by visual inspection. Therefore, accurate, efficient, and rapid identification of maize varieties has significant research and application value.
[0003] Currently, the seed market in my country is experiencing an increasing variety of varieties, leading to unscrupulous merchants engaging in counterfeiting and selling inferior products as superior ones. Traditional seed variety identification methods include manual identification, field planting identification, electrophoresis detection, and physiological and chemical identification. However, these methods suffer from low detection efficiency and high labor intensity. Furthermore, the results are easily affected by various factors, such as subjective judgment based on human experience, objective factors like seed color, seed shape, and texture characteristics, making it impossible to guarantee the accuracy of identification. Moreover, the lack of isolation zones between different corn varieties during corn seed harvesting leads to seed mixing during agricultural machinery operations, posing significant challenges to breeding work for both enterprises and farmers. Summary of the Invention
[0004] The purpose of this invention is to provide a method for identifying maize varieties based on convolutional neural networks and hyperspectral imaging. By acquiring hyperspectral data through an acquisition system, mapping the feature bands to a high-dimensional space, and reshaping them into three-dimensional image features, a convolutional neural network is used to identify the three-dimensional image features. By changing the input feature dimension and the model layer depth factor, a maize variety identification network model is established, which can quickly and accurately identify maize seeds and achieve rapid, effective, and non-destructive detection of maize varieties.
[0005] The technical solution adopted by the present invention to achieve the above objectives is as follows:
[0006] A method for identifying maize varieties based on convolutional neural networks and hyperspectral imaging includes the following steps:
[0007] Step 1, Sample Image Acquisition: Arrange corn seeds neatly on a self-stabilizing scanning platform and acquire sample images of the corn seeds using a hyperspectral imager;
[0008] Step 2, Region of Interest Selection: The corn seed sample images obtained in Step 1 are corrected, and a rectangular region of interest is selected in the center of the embryo surface of each seed sample image. The average spectrum within this region is extracted as the original spectral data.
[0009] Step 3: Spectral data preprocessing: The effective spectral band of the original spectral data is determined as 949.43-1709.49 nm. The effective spectral band is preprocessed by SG smoothing and maximum normalization in sequence to obtain the preprocessed sample.
[0010] Step 4, Data Dimensionality Reduction: The preprocessed samples from Step 3 are used to extract feature wavelengths using the continuous projection algorithm and the competitive adaptive reweighting algorithm, respectively. The extracted feature wavelengths are then combined to obtain the feature bands of corn seeds.
[0011] Step 5: Modeling and Maize Variety Identification
[0012] The identification model is constructed from three parts: data reshaping, convolutional layer extraction, and result prediction. The corn seed feature bands obtained in step 4 are used as the input of the identification model, and the corn variety is used as the output of the identification model to obtain the corn variety identification result. In the data reshaping part, a fully connected layer is used to map the corn seed feature bands obtained in step 4 into high-dimensional features of different sizes, and then reshaping them into image shapes. The convolutional layer extraction part uses a multi-layer convolutional neural network, and the result prediction part uses adaptive max pooling and Softmax to output the prediction result.
[0013] As a preferred embodiment of the present invention, in step 1, during the process of acquiring corn seed sample images using a hyperspectral imager: before acquisition, the hyperspectral imager is preheated for 30 minutes, and system parameters are set, including an exposure time of 8.50 ms, a data acquisition frequency of 50 Hz, and a distance of 32 cm between the hyperspectral camera lens and the self-stabilizing scanning platform.
[0014] In a preferred embodiment of the present invention, the number of smoothing points of SG smoothing is set to 3 in step 3.
[0015] As a preferred embodiment of the present invention, in step 4, when using the competitive adaptive reweighting algorithm to extract feature wavelengths, the number of Monte Carlo samplings is set to 50; when using the 5-fold cross-validation method to extract feature wavelengths, and when using the continuous projection algorithm to extract feature wavelengths, the preferred maximum number of wavelengths is set to 20.
[0016] In a preferred embodiment of the present invention, in step 5, the input feature dimension of the discrimination model is 768 and the layer depth factor is 1.
[0017] As a preferred embodiment of the present invention, in step 5, before establishing the identification model, the corn seed feature bands obtained in step 4 are divided into a training set and a test set in a 2:1 ratio.
[0018] As a preferred embodiment of the present invention, in step 5, the convolutional layer extraction part adopts a 5-layer convolutional neural network.
[0019] Beneficial effects of this invention:
[0020] This invention utilizes a high-dimensional feature mapping method to map feature bands to a high-dimensional space and reshape them into three-dimensional image features. A multi-layer convolutional neural network is then used to identify these three-dimensional image features. By changing the input feature dimension and the model layer depth factor, a qualitative identification network model for maize varieties is established, resulting in a model with optimal maize variety identification performance. When the model input feature dimension = 768 and the layer depth factor d = 1.0, the maize variety identification accuracy is 96.65%, and the detection frame rate can reach 1000 Fps / s in a GPU environment. This enables rapid, effective, and non-destructive detection of maize varieties, providing a new approach and method for the rapid and accurate identification of maize seeds and other crop seeds. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the detection device used in this invention;
[0022] Figure 2 This is a flowchart of the data analysis method used in this invention;
[0023] Figure 3 This is the overall network structure of the CNN model of the present invention;
[0024] Figure 4 A graph showing the comparison of Recall and Precision for different models;
[0025] Figure 5 The confusion matrix diagram for identifying the model input feature dimension = 768 and layer depth factor d = 1.0.
[0026] The following are labeled in the diagram: 1. Dark box; 2. Hyperspectral camera; 3. Light source; 4. Crop seeds; 5. Self-stabilizing scanning platform; 6. Base; 7. Fiber optic cable; 8. Computer. Detailed Implementation
[0027] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. In the description of the present invention, it should be noted that, unless otherwise stated, "a plurality of" means two or more; the terms "upper", "lower", "left", "right", "inner", "outer", "front end", "rear end", "head", "tail", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention.
[0028] Please see Figures 1 to 5As shown, the present invention provides a method for identifying maize varieties based on convolutional neural networks and hyperspectral imaging, comprising the following steps.
[0029] Step 1, Sample Image Acquisition: Arrange corn seeds neatly on a self-stabilizing scanning platform and acquire sample images of the corn seeds using a hyperspectral imager. When acquiring sample images, use... Figure 1 The acquisition device shown mainly includes a hyperspectral camera 2, a light source 3, a self-stabilizing scanning platform 5, an optical fiber 7, a dark box 1, and a computer 8 equipped with Lumo Scanner image acquisition software that is compatible with the hyperspectral camera 2. The image acquisition software is Lumo Scanner, the image correction and region of interest selection software is ENVI 5.3 data processing software, the data analysis software is MATLAB 2018b and The Unscrambler X10.4, the classification model is built using the PyTorch framework, the hardware platform is an Intel(R) Xeon(R) Silver4210R with a main frequency of 3.5GHz, 32GB of memory, an NVIDIA GeForce RTX 2080Ti GPU with 16GB of video memory, and the software platform is PyCharm 2020.2, CUDNN 7.4.1.5, Python 3.8, and PyTorch 1.2.
[0030] During data acquisition, one end of fiber optic cable 7 is connected to hyperspectral camera 2, and the other end is connected to computer 3. The self-stabilized scanning platform 5 is directly connected to computer 3. The system parameters designed using the image acquisition software Lumo Scanner are as follows: exposure time is 8.50ms, data acquisition frequency is 50Hz, platform movement speed is 22.43mm / s, and the distance between hyperspectral camera 2 and self-stabilized scanning platform 5 is 32cm. Before acquiring sample images, hyperspectral camera 2 needs to be aligned with the calibration white board to acquire reference spectra. The reference spectrum can be kept at the same level for each acquisition by adjusting the exposure time or acquisition frequency, ensuring that the data acquired each time is based on the same reference value. Before image acquisition, corn seeds are placed neatly on the self-stabilized scanning platform with the embryo side facing up. Sample images of one variety are acquired at a time. The spectrometer is preheated for 30 minutes before each acquisition.
[0031] Step 2, Region of Interest Selection: The corn seed sample images obtained in Step 1 are corrected, and a rectangular region of interest is selected at the center of the embryo surface of each seed sample image. The average spectrum within this region is extracted as the original spectral data.
[0032] After image acquisition, the images are imported into ENVI software for image correction. The correction formula is as follows:
[0033]
[0034] Where R represents the sample corrected image, and I represents the original sample image. AN Representing a dark image, I B Represents a whiteboard image.
[0035] Then, select the largest possible rectangular region of interest at the center of the embryo surface of the seed sample, and export the spectral information within this region to obtain the average spectral value of each seed.
[0036] Step 3: Since the acquired spectral data, in addition to containing the information to be measured from the sample, is also susceptible to interference from stray light, noise, and other irrelevant information, the spectral data is preprocessed before model building to reduce the influence of various non-target factors on the detection signal information and improve the model accuracy. The spectral data preprocessing process is as follows: 949.43~1709.49nm is selected as the effective band of the original spectrum. The SG smoothing method (Savitzky-Golay Smoothing) and the maximum normalization method (MN) are used to preprocess the effective band of the spectrum in sequence. First, the SG smoothing method with 3 smoothing points is selected to smooth and denoise the spectral data in the region of interest (ROI). Then, the maximum normalization method is used to map the spectral data to the [0,1] interval to eliminate the error caused by different dimensions.
[0037] Step 4, Data Dimensionality Reduction: Feature wavelengths were extracted from the preprocessed samples in Step 3 using the Continuous Projection Algorithm (SPA) and the Competitive Adaptive Reweighting Algorithm (CARS), respectively, yielding 5 and 52 feature wavelength variables. The extracted feature wavelengths were combined to obtain the feature bands of corn seeds. The Monte Carlo sampling number was set to 50, and the 5-fold cross-validation method was used to extract feature wavelengths. The maximum number of wavelengths to be selected by SPA was set to 20. To address the problem of missing effective information when extracting feature variables by SPA and CARS, the feature wavelengths extracted by the two methods were combined to select a total of 56 feature wavelengths.
[0038] Step 5: Modeling and Maize Variety Identification
[0039] The identification model is constructed from three parts: data reshaping, convolutional layer extraction, and result prediction. The corn seed feature bands obtained in step 4 are used as the input of the identification model, and the corn variety is used as the output of the identification model to obtain the corn variety identification result. In the data reshaping part, a fully connected layer is used to map the corn seed feature bands obtained in step 4 into high-dimensional features of different sizes, and then reshaping them into image shapes. The convolutional layer extraction part uses a multi-layer convolutional neural network, and the result prediction part uses adaptive max pooling and Softmax to output the prediction result.
[0040] In this study, a Convolutional Neural Network (CNN) model was built in PyCharm 2020.2. To address the issue that CNNs cannot directly process feature band data, fully connected layers were used to map high-dimensional features of the maize seed feature band data. This reshaped the mapped feature band data into high-dimensional image features, enabling the CNN to process the reshaped data. Considering the dimensionality of the maize seed feature bands, the number of convolutional layers should not be too deep to avoid overfitting and poor robustness. Therefore, a 5-layer CNN was used to build the maize variety identification model to improve its generalization performance and reduce redundancy in spatial features. Specific model parameters are shown in Table 1.
[0041] The overall maize variety identification model is constructed using 3×3 standard convolutions. To improve the model's spatial feature extraction performance for maize seed characteristic bands, a sampling method of first increasing dimensionality and then decreasing dimensionality is adopted to effectively fuse the features. Three common scaling factors (d) of 1.25, 1.0, and 0.75 are used to scale the number of layers of the maize variety identification model to different degrees. The relevant parameters are listed in Table 1. In addition, to explore the influence of different high-dimensional feature resolutions on the adaptability of the maize variety identification model and to find the optimal adaptation resolution, three different feature mapping relationships of 192, 768, and 3072 are used to generate corresponding spatial feature resolutions of 8×8×3, 16×16×3, and 32×32×3. For the prediction part, adaptive max pooling and Softmax are mainly used to output the prediction results.
[0042] Using 56 feature wavelengths as input variables, a 3-fold cross-validation method was employed to train and test the (SG+MN)-(CARS+SPA)-CNN model. To comprehensively evaluate the detection performance of the maize variety classification model, the following metrics were used: training set accuracy, test set accuracy, detection frame rate (FPS), model weight, model computational cost (Flops), model parameter count, precision, and recall. The specific calculation formulas are shown below:
[0043]
[0044]
[0045]
[0046] In the formula, TP represents the number of positive samples that match the model's prediction and the true label, FP represents the number of samples that do not match the model's prediction and the actual positive samples, FN represents the number of samples that do not match the model's prediction and the actual negative samples, and TN represents the number of samples that match the model's prediction and the actual negative samples.
[0047] Since the maize variety classification model is a multi-class model, this experiment uses the CrossEntropyLoss function to regress and train the maize variety identification model, as shown in the following formula.
[0048]
[0049] In the formula y j This represents the one-hot encoding form corresponding to the true category, o j This represents the probability that the network predicts for a certain category.
[0050] Table 1 CNN Model Parameter Metrics
[0051]
[0052] Experiments showed that the maize variety classification model performed best when the input feature dimension = 768 and the layer depth factor d = 1.0, achieving a test set accuracy of 96.65% and a detection frame rate of 1000 Fps / s in a GPU environment. It demonstrated good identification performance for all varieties, enabling rapid, effective, and non-destructive detection of maize varieties. The model cross-validation comparison results are shown in Table 2.
[0053] Table 2. Comparison results of model cross-validation
[0054]
[0055]
[0056]
[0057] Note: MVI m D n This represents different corn variety classification models. Here, m represents the model layer depth factor, which can take values of 0.75, 1.0, and 1.25. n represents different input feature dimensions, which can take values of 0, 1, and 2, representing input feature dimensions of 192, 768, and 3072 respectively. Train represents the accuracy of the corn variety classification model on the training set, and Test represents the accuracy of the corn variety classification model on the test set. Fps g Represents frame detection speed in a GPU environment, Fps c This represents the frame detection speed under CPU conditions.
[0058] This invention can identify crop seed varieties, enabling rapid, accurate, efficient, and non-destructive screening of seed varieties. It allows enterprises and farmers to identify seed varieties without isolation zones, select superior varieties for cultivation, and achieve high crop yields.
[0059] It should be noted that the parts not described in detail in this article are prior art. The above embodiments are only used to illustrate the present invention, but the present invention is not limited to the above embodiments. Any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A method for identifying maize varieties based on convolutional neural networks and hyperspectral imaging, characterized in that, Includes the following steps, Step 1, Sample Image Acquisition: Arrange corn seeds neatly on a self-stabilizing scanning platform and acquire sample images of the corn seeds using a hyperspectral imager; Step 2, Region of Interest Selection: The corn seed sample images obtained in Step 1 are corrected, and a rectangular region of interest is selected in the center of the embryo surface of each seed sample image. The average spectrum within this region is extracted as the original spectral data. Step 3: Spectral data preprocessing: The effective spectral band of the original spectral data is determined as 949.43~1709.49nm. The effective spectral band is preprocessed by SG smoothing method and maximum normalization method in sequence to obtain the preprocessed sample. Step 4, Data Dimensionality Reduction: The preprocessed samples from Step 3 are used to extract feature wavelengths using the continuous projection algorithm and the competitive adaptive reweighting algorithm, respectively. The extracted feature wavelengths are combined to obtain the feature bands of corn seeds. When using the competitive adaptive reweighting algorithm to extract feature wavelengths, the number of Monte Carlo sampling times is set to 50, and the 5-fold cross-validation method is used to extract feature wavelengths. When using the continuous projection algorithm to extract feature wavelengths, the maximum number of wavelengths is set to 20. Step 5: Modeling and Maize Variety Identification The identification model is constructed from three parts: data reshaping, convolutional layer extraction, and result prediction. The corn seed feature bands obtained in step 4 are used as the input of the identification model, and the corn variety is used as the output of the identification model to obtain the corn variety identification result. The input feature dimension of the identification model is 768, and the layer depth factor is 1. In the data reshaping part, a fully connected layer is used to map the corn seed feature bands obtained in step 4 into three-dimensional high-dimensional features, and then reshaping them into image shapes. The convolutional layer extraction part uses a multi-layer convolutional neural network, and the result prediction part uses adaptive max pooling and Softmax to output the prediction result.
2. The maize variety identification method based on convolutional neural networks and hyperspectral imaging as described in claim 1, characterized in that, In step 1, during the process of acquiring corn seed sample images using a hyperspectral imager: before acquisition, the hyperspectral imager is preheated for 30 minutes, and system parameters are set, including an exposure time of 8.50 ms, a data acquisition frequency of 50 Hz, and a distance of 32 cm between the hyperspectral camera lens and the self-stabilizing scanning platform.
3. The maize variety identification method based on convolutional neural networks and hyperspectral imaging as described in claim 1, characterized in that, In step 3, the number of smoothing points for SG smoothing is set to 3.
4. The maize variety identification method based on convolutional neural networks and hyperspectral imaging as described in claim 1, characterized in that, In step 5, before establishing the identification model, the corn seed feature bands obtained in step 4 are divided into training and test sets in a 2:1 ratio.
5. The maize variety identification method based on convolutional neural networks and hyperspectral imaging as described in claim 1, characterized in that, In step 5, the convolutional layer extraction part uses a 5-layer convolutional neural network.
Citation Information
Patent Citations
Wheat seed variety identification method based on lightweight convolutional neural network
CN113920376A