Trusted seed identification method and system based on hyperspectral data and machine learning

By using the trusted k-nearest neighbor classification method of hyperspectral data and machine learning in crop seed variety identification, the problem of ignoring the credibility of seed classification results in the existing technology is solved, and a higher identification accuracy and credibility are achieved, which enhances the practical application value of the method.

CN117953379BActive Publication Date: 2025-04-08HARBIN INST OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410164245.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-05
Publication Date
2025-04-08
Estimated Expiration
2044-02-05

AI Technical Summary

Technical Problem

Although the existing machine learning methods based on hyperspectral data can improve the accuracy of the identification in crop seed variety identification, the credibility of the classification results of each seed is ignored, resulting in the problem of misclassification or increasing time overhead in applications with high interclass similarity.

Method used

The trusted k-nearest neighbor classification method based on hyperspectral data and machine learning is adopted to collect and preprocess the hyperspectral images of crop seeds, extract spectral characteristic data, and use the trusted k-nearest neighbor classification method to classify varieties to improve the credibility of each seed classification result.

Benefits of technology

It improves the accuracy of crop seed variety identification and the credibility of each seed classification result, ensuring that if the seeds can be correctly classified by most classification algorithms, they will also be correctly classified by this method, increasing the practical application value of the method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117953379B_ABST
    Figure CN117953379B_ABST
Patent Text Reader

Abstract

The present invention discloses a trusted seed identification method and system based on hyperspectral data and machine learning, the method comprising: collecting original hyperspectral images of crop seeds and preprocessing the same, the crop seeds including seeds to be predicted and seeds of known varieties; extracting features from the original hyperspectral images of all preprocessed crop seeds to obtain spectral feature data, the spectral feature data including spatial features, average spectral features and variance spectral features of the entire seed region; preprocessing the spectral feature data; and classifying the crop seeds based on the preprocessed spectral feature data using a trusted k-nearest neighbor classification method to obtain the variety category of the seeds to be predicted. The present invention realizes an automatic, simple, efficient and trustworthy crop seed variety identification method, improves the discriminability of spectral features, improves the accuracy of identification of crop seed varieties, and improves the credibility of each seed classification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of crop seed variety identification, and in particular relates to a trusted seed identification method and system based on hyperspectral data and machine learning. Background Art

[0002] Crop seed variety identification or classification is of vital importance to the development of agriculture. At present, many regions still use traditional methods, including morphological identification, chemical analysis and biological analysis. Although these methods can accurately identify the purity of seeds, they are destructive, time-consuming and dangerous. They not only require the support of large-scale equipment or professional technology, but also cannot be processed in batches. Therefore, in recent years, many researchers have been exploring some safer, faster and more reliable methods for seed variety classification and identification.

[0003] With the continuous development of emerging technologies, some scholars use machine learning technology based on digital image processing technology to quickly and automatically classify and identify seeds, which is safe and low-cost. However, ordinary color images cannot utilize the internal information of seeds and it is difficult to distinguish varieties with similar appearances. In order to make full use of the characteristics of seeds, hyperspectral technology has been introduced into the field of crop seed identification as an emerging rapid non-destructive detection technology. Its unified feature of images and spectra improves the accuracy of identification. Although many machine learning identification methods based on hyperspectral data have achieved good performance, they all focus on the average accuracy of the entire data set and ignore the credibility of the classification results of each seed. This may lead to two undesirable situations in reality. One is that the classifier with high average accuracy misclassifies seeds that are correctly classified by many classifiers. The other is that in order to avoid the inaccuracy of a single classifier, it is necessary to consider multiple classifier results at the same time, which increases the time cost. These two situations occur especially in the application of crop seed variety identification with high inter-class similarity, which is an important factor affecting practical application. Summary of the invention

[0004] In view of the above problems, the present invention proposes a reliable method based on hyperspectral data and machine learning technology to identify crop seed varieties, so as to solve the problems arising in the prior art.

[0005] To achieve the above object, the present invention adopts the following technical solution:

[0006] The trusted seed identification method based on hyperspectral data and machine learning includes the following steps:

[0007] Collect raw hyperspectral images of crop seeds and perform preprocessing;

[0008] Extracting features from the preprocessed original hyperspectral image to obtain spectral feature data, wherein the spectral feature data includes spatial features, average spectral features, and variance spectral features of the entire seed region;

[0009] Preprocessing the spectral characteristic data;

[0010] Based on the preprocessed spectral feature data, the crop seeds are classified into varieties using a trusted k-nearest neighbor classification method to obtain the variety category of the seeds to be predicted.

[0011] Preferably, the method for preprocessing the original hyperspectral image comprises:

[0012] The original hyperspectral image is corrected by using a black reference image and a white reference image to eliminate the influence of uneven light intensity distribution and dark current.

[0013] Preferably, the method for extracting features from the preprocessed original hyperspectral image includes:

[0014] Segment the background to eliminate the influence of its color, and preliminarily find the location of the seed through adaptive threshold segmentation operation;

[0015] The binary image is denoised using closing and opening operations to determine the overall outline of the seed;

[0016] According to the region of interest of the entire seed, the spatial characteristics, average spectral characteristics and variance spectral characteristics of the entire seed area are extracted respectively.

[0017] Preferably, the method for preprocessing the spectral characteristic data includes:

[0018] The seeds with abnormal average spectral characteristics are eliminated;

[0019] The linear discriminant analysis method is used to perform feature dimension reduction operation on the spectral feature data, so that the spatial feature and the spectral feature are integrated.

[0020] Preferably, the method for performing variety identification on the crop seeds using the trusted k-nearest neighbor classification method comprises:

[0021] Establish crop seed training set D = {(x 1 ,y 1 ),(x 2 ,y 2 ),...,(x m ,y m )}, where m represents the number of seeds, in units of grains, including C varieties, and each seed x i It has n features, that is, the sum of the number of features after spectral features and spatial features are reduced is n, yi ∈{1,2,...,C} represents the category label of each seed;

[0022] Sort the seeds in the training set according to the Euclidean distance and put the two seeds x i and x j The Euclidean distance between i ,x j ),but:

[0023]

[0024] Among them, a r (x) represents the seed x i The rth eigenvalue of ; sort the Euclidean distances between the seed to be predicted and the various seeds in the training set from small to large to obtain X q , and then according to X q Select the first k similar labeled target neighbor seeds to form a new data set D'={(x 1 ',y 1 '),(x 2 ',y 2 '),...,(x k ',y k ')}, where (x i ',y i ') is the i-th seed after sorting;

[0025] Assign corresponding weights to the k nearest neighbor seeds. The weights are related to the difficulty of seed classification. The formal expression of seed classification difficulty is as follows:

[0026]

[0027]

[0028] Among them, the symbol ζ i Represents seed x i The seed classification difficulty, symbol M represents the total number of classifiers, symbol C j (x i )(i=1,2,...,mj=1,2,...M) indicates that the classifier C j To Seed x i The class label obtained by prediction, function ΙΙ(Ω) is an indicator function; an exponential function is used to increase the difference between different weights, and the final weight function is:

[0029]

[0030] Then the weight matrix of the k target neighbor seeds of the seed to be predicted is W = [w1 ,w 2 ,...,w k ], where w i represents the weight of the i-th target neighbor seed;

[0031] Perform a majority weighted vote on the k target neighbor seeds, and the variety with the largest sum of weights is the variety to be predicted, that is:

[0032]

[0033] y_predict is the final identification result of the unknown seed.

[0034] The present invention also provides a trusted seed identification system based on hyperspectral data and machine learning, including: a spectrum acquisition module, a spectrum feature extraction module, a spectrum feature processing module and a variety identification module;

[0035] The spectrum acquisition module is used to collect original hyperspectral images of crop seeds and perform preprocessing;

[0036] The spectral feature extraction module is used to extract features from the preprocessed original hyperspectral image to obtain spectral feature data, wherein the spectral feature data includes spatial features, average spectral features and variance spectral features of the entire seed area;

[0037] The spectral feature processing module is used to pre-process the spectral feature data;

[0038] The variety identification module is used to identify the variety of the crop seeds based on the preprocessed spectral feature data using a trusted k-nearest neighbor classification method.

[0039] Preferably, the spectrum acquisition module includes a spectrum image acquisition unit and an image correction unit;

[0040] The spectral image acquisition unit is used to collect original hyperspectral images of crop seeds;

[0041] The image correction unit is used to correct the original hyperspectral image through a black reference image and a white reference image to eliminate the influence of uneven light intensity distribution and dark current.

[0042] Preferably, the spectral feature extraction module includes a positioning unit, a shape unit and an extraction unit;

[0043] The positioning unit is used to segment the background stage to eliminate the influence of its color and preliminarily find the position of the seed through an adaptive threshold segmentation operation;

[0044] The shape unit is used to remove noise from the binary image by using closing and opening operations to determine the overall outline of the seed;

[0045] The extraction unit is used to extract the spatial features, average spectral features and variance spectral features of the entire seed area according to the region of interest of the entire seed.

[0046] Preferably, the spectral feature processing module includes an abnormality distinguishing unit and a dimension reduction unit;

[0047] The abnormal distinguishing unit is used to remove seeds with abnormal average spectral characteristics;

[0048] The dimension reduction unit is used to perform a feature dimension reduction operation on the spectral feature data by a linear discriminant analysis method, so that the spatial feature and the spectral feature are integrated.

[0049] Preferably, the variety identification module includes a data set unit, a sorting unit, a weighting unit and an identification unit:

[0050] The data set unit is used to establish a crop seed training set D = {(x 1 ,y 1 ),(x 2 ,y 2 ),...,(x m ,y m )}, where m represents the number of seeds, in units of grains, including C varieties, and each seed x i It has n features, that is, the sum of the number of features after spectral features and spatial features are reduced is n, y i ∈{1,2,...,C} represents the category label of each seed;

[0051] The sorting unit is used to sort the seeds in the training set according to the Euclidean distance. i and x j The Euclidean distance between i ,x j ),but:

[0052]

[0053] Among them, a r (x) represents the seed x i The rth eigenvalue of ; sort the Euclidean distances between the seed to be predicted and the various seeds in the training set from small to large to obtain X q , and then according to X q Select the first k similar labeled target neighbor seeds to form a new data set D'={(x 1 ',y 1'),(x 2 ',y 2 '),...,(x k ',y k ')}, where (x i ',y i ') is the i-th seed after sorting;

[0054] The weight unit is used to assign corresponding weights to the k nearest neighbor seeds. The weight is related to the seed classification difficulty. The formal expression of seed classification difficulty is as follows:

[0055]

[0056]

[0057] Among them, the symbol ζ i Represents seed x i The seed classification difficulty, symbol M represents the total number of classifiers, symbol C j (x i )(i=1,2,...,mj=1,2,...M) indicates that the classifier C j To Seed x i The class label obtained by prediction, function ΙΙ(Ω) is an indicator function; an exponential function is used to increase the difference between different weights, and the final weight function is:

[0058]

[0059] Then the weight matrix of the k target neighbor seeds of the seed to be predicted is W = [w 1 ,w 2 ,...,w k ], where w i represents the weight of the i-th target neighbor seed;

[0060] The identification unit is used to perform a majority weighted vote on the k target neighbor seeds, and the variety with the largest sum of weights is the variety to be predicted, that is:

[0061]

[0062] y_predict is the final identification result of the unknown seed.

[0063] The beneficial effects of the present invention are as follows:

[0064] The present invention realizes an automatic, simple, efficient and reliable method for identifying crop seed varieties based on hyperspectral data and machine learning technology, which mainly produces three technical effects. First, the introduction of variance spectral features improves the discriminability of spectral features. Second, the new method provided improves the accuracy of identifying crop seed varieties. Third, the new method provided improves the credibility of each seed classification result. If the seed can be correctly classified by most classification algorithms, it will definitely be correctly classified by the new method provided, thereby increasing the practical application value of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative labor:

[0066] Figure 1 This is a flow chart of a trusted seed identification method based on hyperspectral data and machine learning according to Embodiment 1 of the present invention;

[0067] Figure 2 Schematic diagram of the process of feature extraction in the first embodiment of the present invention;

[0068] Figure 3 This is a schematic diagram of the verification experiment flow of the second embodiment of the present invention;

[0069] Figure 4 This is a schematic diagram of a trusted seed identification system based on hyperspectral data and machine learning according to Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

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

[0072] Embodiment 1

[0073] like Figure 1 FIG. 1 is a flow chart of a trusted seed identification method based on hyperspectral data and machine learning according to Embodiment 1 of the present invention, which mainly includes the following steps:

[0074] In the first step, original hyperspectral images of crop seeds are collected and preprocessed, wherein the crop seeds include seeds to be predicted and seeds of known varieties.

[0075] In this embodiment, after collecting the original hyperspectral images of crop seeds, the original data is corrected by black reference images and white reference images to eliminate the influence of uneven light intensity distribution and dark current. At the same time, in the process of collecting hyperspectral images, it is necessary to avoid adhesion between seeds and ensure the accuracy of the variety of each seed.

[0076] In the second step, feature extraction is performed on the original hyperspectral images of all crop seeds after preprocessing to obtain spectral feature data, which includes the spatial features, average spectral features and variance spectral features of the entire seed area.

[0077] In this embodiment, the background is first segmented to eliminate the influence of its color, and the position of the seed is preliminarily found through the adaptive threshold segmentation operation. Then, the binary image is denoised by the closing operation and the opening operation respectively to solve the black spot problem and the tail effect, so as to determine the overall outline of the seed. Finally, the spatial characteristics, average spectral characteristics and variance spectral characteristics of the entire seed area are extracted according to the region of interest of the entire seed. Figure 2 The number of spectral features is determined by the number of bands of the hyperspectral imaging machine. The present invention introduces variance spectral features to make up for the deficiency of average spectral features, so that the features of seeds are more discriminative.

[0078] The third step is to preprocess the spectral feature data.

[0079] In this embodiment, the first step is to preprocess the spectral data, remove the seeds with abnormal average spectral curves, and avoid discrete samples affecting the quality of the training set. The second step is feature dimensionality reduction, which uses the linear discriminant analysis method to reduce the dimensionality of the features, so that the spatial features and spectral features are integrated, avoiding the dimensionality disaster and overfitting problems, and enhancing the separability between classes.

[0080] The fourth step is to classify all crop seeds into varieties based on the preprocessed spectral feature data using the trusted k-nearest neighbor classification method to obtain the predicted seed variety category.

[0081] In this embodiment, a classification algorithm specifically used for crop seed variety identification is provided, which is called a Credible k-Nearest Neighbor classification method based on seed classification difficulty (CKNN). The algorithm does not require training, is fast and easy to understand, and can ensure that the classification result of each seed has a high degree of credibility while maintaining a relatively high overall classification accuracy, and overcomes the sensitivity of hyperparameters to a certain extent. The specific application process is as follows:

[0082] After processing the hyperspectral data of crop seeds according to the above steps, a crop seed training set D = {(x 1 ,y 1 ),(x 2 ,y 2 ),...,(x m ,y m )}, there are m seeds in total, which contain C varieties (or categories). Each seed x i It has n features, that is, the sum of the number of features after dimensionality reduction of spectral features and spatial features is n, symbol y i ∈{1,2,...,C} represents the category label of each seed. When predicting which variety an unknown seed x_new belongs to, first, we need to sort the seeds in the training set according to the Euclidean distance. Considering any seed x i can be described by an n-dimensional feature vector, that is, [a 1 (x),a 2 (x),...,a n (x),], where a r (x) represents the seed x i The rth eigenvalue of , then the two seeds x i and x j The Euclidean distance between i ,x j ), the specific form is as follows:

[0083]

[0084] Secondly, sort the Euclidean distances between the seed to be predicted and the various seeds in the training set from small to large to obtain X q , and then according to X q Select the first k similar labeled target neighbor seeds to form a new data set D'={(x 1 ',y 1 '),(x 2 ',y 2 '),...,(x k ',y k ')}, where (x i ',y i ') is the i-th seed after sorting. Next, we need to assign corresponding weights to the k nearest neighbor seeds. The weight is related to the seed classification difficulty, which is formally expressed as follows:

[0085]

[0086]

[0087] Among them, the symbol ζ i Represents seed x i The seed classification difficulty, symbol M represents the total number of classifiers, symbol C j (x i )(i=1,2,...,mj=1,2,...M) indicates that the classifier C j To Seed x i The class label obtained by prediction, function ΙΙ(Ω) is an indicator function. In formula (2), if the predicted result is different from the actual label, the function is 1. Conversely, if the predicted result is the same as the actual label, the function is 0. Intuitively speaking, if a seed is misclassified by most classifiers, the value of its seed classification difficulty is large; if a seed is correctly classified by most classifiers, the value of its seed classification difficulty is small. It should be emphasized that the more classifiers there are, the more statistically significant the value of seed classification difficulty is.

[0088] In order to reduce the time cost of calculating the seed classification difficulty, this algorithm uses approximate difficulty instead of calculating the seed classification difficulty. The specific method is that the data set contains m seeds, and each seed x i Each corresponds to an x i A hypersphere π with center r as radius i , set S i ={(x p ,y p )|p=1,2,...,P}(i=1,2,...,m) contains all the i The hypersphere π of the seed itself i All seeds in the set, the total number of seeds in the set |S i |It is usually set to 1%-2% of the total number of seeds in the data set, so that the calculation of radius r can be avoided. Seed x i RKS approximate difficulty The formal representation of is as follows:

[0089]

[0090] Since the seed classification difficulty is inversely proportional to the weight, the seed x i The weight w i , formally expressed as follows:

[0091]

[0092] It can be seen that the greater the probability that a seed is misclassified by the classifier, the higher the approximate classification difficulty of the seed, the lower the weight of the seed, and the smaller the influence of the seed. On the contrary, the greater the probability that a seed is correctly classified by the classifier, the lower the approximate classification difficulty of the seed, the higher the weight of the seed, and the greater the influence of the seed. Therefore, in order to make the classifier pay more attention to the correct classification of relatively easy seeds and reduce the influence of relatively difficult seeds, the method selects an exponential function to increase the gap between different weights. The final weight function is:

[0093]

[0094] The weight matrix W of the k target neighbor seeds of the seed to be predicted can be obtained by formula (6): 1 ,w 2 ,...,w k ], where w i represents the weight of the i-th target neighbor seed. Finally, a majority weighted vote is performed on the k target neighbor seeds, that is, the variety with the largest sum of weights among the k target neighbor seeds is predicted to which variety the unknown seed belongs. y_predict is the final identification result of the seed to be predicted, which is formally expressed as follows:

[0095]

[0096] Through the above four steps, hyperspectral data and machine learning technology can be used to reliably identify the varieties of unknown crop seeds.

[0097] Embodiment 2

[0098] This embodiment provides a reliable crop seed identification method based on hyperspectral data and machine learning. Figure 3 As shown, the following steps are included:

[0099] Step 1, selection and preprocessing of data sets. The method of the present invention is verified on a data set containing 6 categories (i.e., total number of varieties C = 6) of rice seeds and 10,000 rice seeds of each category. Each time, two-thirds of the rice seeds of each category are randomly selected as training sets, and one-third of the rice seeds are used as test sets. The seeds in this data set were harvested in 2020. The varieties include five rice varieties, Dongdao No. 4, Dongdao 9, Dongdao 12, Dongdao 122, and Dongdao 144, cultivated by the Northeast Institute of Geography and Agricultural Ecology, Chinese Academy of Sciences, and one rice variety, Jijing 816, cultivated by Jilin Academy of Agricultural Sciences. After feature extraction, a total of 59,840 rice seeds were used for the experiment, and each seed contained 462 average spectral features, 462 variance spectral features, and 6 morphological spatial features.

[0100] Step 2: Experimental setup. Each algorithm was repeated ten times in the experiment, and the average value was taken as the result. All algorithms were implemented in Python 3.8.4 on the Pycharm platform under Linux system, and their hyperparameters were selected by ten-fold grid cross validation.

[0101] Step 3: Evaluation indicators. The experiment uses the average classification accuracy and average credibility indicators for evaluation. The closer the two indicators are to 1, the better. Among them, the credibility indicator is a classifier performance metric for the classification difficulty of each seed. The higher the value, the more credible it is. If two classifiers have similar error rates on the same data set, the classifier with higher value has a lower probability of misclassification on relatively simple seeds.

[0102] Step 4, evaluation of classification results. The CKNN method of the present invention is compared with 10 algorithms, including k-nearest neighbor (k-Nearest Neighbor, KNN) algorithm, distance weighted k-nearest neighbor (WKNN) algorithm, double distance weighted k-nearest neighbor (DWKNN) algorithm, support vector machine (Support Vector Machine, SVM) algorithm, logistic regression (Logist Regression, LR) algorithm, Gaussian Bayes (Gaussian Naive Bayes, GNB) algorithm, decision tree (Decision Tree, DT) algorithm, random forest (Random Forest, RF) algorithm, AdaBoost algorithm, back propagation neural network (Back Propagation Neural Network, BPNN) algorithm. The classification results of the three feature data sets are shown in Table 1, wherein the bold data is the optimal result. It can be seen that the data set introducing variance spectral features has increased the accuracy of seed identification by about 2%, indicating that variance spectral features can indeed improve the discrimination ability of spectral features and make up for the defect of average spectral features blurring seed difference features. At the same time, the trusted classification algorithm CKNN provided by the present invention achieved the highest average classification accuracy and the highest average credibility on the three feature data sets, indicating that the CKNN algorithm can obtain higher accuracy on relatively easy seeds under similar misclassification rates, so that more relatively easy-to-classify rice seeds are correctly classified, and the influence of relatively difficult-to-classify seeds on the classification results is reduced. Compared with the KNN, WKNN and DWKNN algorithms, although the CKNN algorithm has only a slight improvement in accuracy, it still has higher practical value.

[0103] Table 1

[0104]

[0105]

[0106] Embodiment 3

[0107] like Figure 4 As shown, it is a schematic diagram of the structure of a trusted seed identification system based on hyperspectral data and machine learning according to the third embodiment of the present invention, including: a spectral acquisition module, a spectral feature extraction module, a spectral feature processing module and a variety identification module. Among them, the spectral acquisition module is used to collect the original hyperspectral images of crop seeds and perform preprocessing. The crop seeds include seeds to be predicted and seeds of known varieties. The spectral feature extraction module is used to extract features from the original hyperspectral images of all crop seeds after preprocessing to obtain spectral feature data. The spectral feature data includes spatial features, average spectral features and variance spectral features of the entire seed area. The spectral feature processing module is used to preprocess the spectral feature data. The variety identification module is used to classify all crop seeds into varieties based on the preprocessed spectral feature data using a trusted k-nearest neighbor classification method to obtain the variety category of the predicted seeds.

[0108] Specifically, in this embodiment:

[0109] The spectrum acquisition module includes a spectrum image acquisition unit and an image correction unit.

[0110] The spectral image acquisition unit is used to collect original hyperspectral images of crop seeds.

[0111] The image correction unit is used to correct the original hyperspectral image through a black reference image and a white reference image to eliminate the influence of uneven light intensity distribution and dark current.

[0112] Specifically, in this embodiment:

[0113] The spectral feature extraction module includes a positioning unit, a shape unit and an extraction unit.

[0114] The positioning unit is used to segment the background stage to eliminate the influence of its color and preliminarily find the position of the seed through an adaptive threshold segmentation operation.

[0115] The shape unit is used to denoise the binary image using closing and opening operations to determine the overall outline of the seed.

[0116] The extraction unit is used to extract the spatial features, average spectral features and variance spectral features of the entire seed area according to the region of interest of the entire seed.

[0117] Specifically, in this embodiment:

[0118] The spectral feature processing module includes an anomaly distinguishing unit and a dimension reduction unit.

[0119] The abnormal differentiation unit is used to remove the seeds with abnormal average spectral characteristics.

[0120] The dimension reduction unit is used to perform feature dimension reduction operation on spectral feature data through a linear discriminant analysis method, so that the spatial features are integrated with the spectral features.

[0121] Specifically, in this embodiment:

[0122] The variety identification module includes a data set unit, a sorting unit, a weighting unit, and an identification unit:

[0123] The data set unit is used to establish a training set D = {(x 1 ,y 1 ),(x 2 ,y 2 ),...,(x m ,y m )}, where m represents the number of seeds, in units of grains, including C varieties, and each seed x i It has n features, that is, the sum of the number of features after spectral features and spatial features are reduced is n, y i ∈{1,2,...,C} represents the category label of each seed.

[0124] The sorting unit is used to sort the seeds in the training set according to the Euclidean distance. i and x j The Euclidean distance between i ,x j ),but:

[0125]

[0126] Among them, a r (x) represents the seed x i The Euclidean distances between the seed to be predicted and the various seeds in the training set are sorted from small to large to obtain X q , and then according to X q Select the first k similar labeled target neighbor seeds to form a new data set D'={(x 1 ',y 1 '),(x 2 ',y 2 '),...,(x k ',y k ')}, where (x i ',y i ') is the i-th seed after sorting.

[0127] The weight unit is used to assign corresponding weights to the k nearest neighbor seeds. The weight is related to the seed classification difficulty. The formal expression of seed classification difficulty is as follows:

[0128]

[0129]

[0130] Among them, the symbol ζ i Represents seed x i The seed classification difficulty, symbol M represents the total number of classifiers, symbol C j (x i )(i=1,2,...,mj=1,2,...M) indicates that the classifier C j To Seed x i The class label obtained by prediction, function ΙΙ(Ω) is an indicator function. Then an exponential function is used to increase the difference between different weights, and the final weight function is:

[0131]

[0132] Then the weight matrix of the k target neighbor seeds of the seed to be predicted is W = [w 1 ,w 2 ,...,w k ], where w i represents the weight of the i-th target neighbor seed.

[0133] The identification unit is used to perform a majority weighted vote on the k target neighbor seeds. The variety with the largest sum of weights is the variety to be predicted, that is:

[0134]

[0135] y_predict is the final identification result of the unknown seed.

[0136] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. A trusted seed identification method based on hyperspectral data and machine learning, characterized in that: The steps include: Collecting original hyperspectral images of crop seeds and performing preprocessing, wherein the crop seeds include seeds to be predicted and seeds of known varieties; Extracting features from the preprocessed original hyperspectral images of all the crop seeds to obtain spectral feature data, wherein the spectral feature data includes spatial features, average spectral features, and variance spectral features of the entire seed region; Preprocessing the spectral characteristic data; Based on the preprocessed spectral feature data, using a trusted k-nearest neighbor classification method to classify the crop seeds, to obtain the variety category of the seeds to be predicted; The method of using the trusted k-nearest neighbor classification method to classify the crop seeds into varieties and obtaining the predicted seed variety category includes: Establishing a training set of the crop seeds ,in Indicates the number of seeds, in units of grains, including Varieties, each seed have features, that is, the sum of the number of features after dimensionality reduction of spectral features and spatial features is , Indicates the category label of each seed; Sort the seeds in the training set according to the Euclidean distance and put the two seeds and The Euclidean distance between ,but: , in, Indicates seed No. eigenvalues, Indicates seed The rth eigenvalue of ; the Euclidean distances of the seed to be predicted and the various seeds in the training set are sorted in ascending order to obtain , and then according to Select the first k similar labeled target neighbor seeds to form a new data set ,in is the sorted seeds; Assign corresponding weights to the k nearest neighbor seeds. The weights are related to the difficulty of seed classification. The formal expression of seed classification difficulty is as follows: Among them, the symbol Representative Seed The seed classification difficulty, symbol Represents the total number of classifiers, symbol Indicates that the classifier Seeds The class label obtained by prediction, function is an indicator function; an exponential function is used to increase the difference between different weights, and the final weight function is: , Then the weight matrix of the k target neighbor seeds of the seed to be predicted is ,in Indicates The weight of the target neighbor seeds; Indicates seed RKS approximate difficulty; The RKS approximate difficulty method for calculating the difficulty of seed classification specifically includes: The dataset consists of m seeds. Consider each seed x i Each corresponds to an x i A hypersphere with center r as radius ,gather Contains all except x i The hypersphere of the seed itself All seeds in the set, the total number of seeds in the set Set to 1%-2% of the total number of seeds in the dataset, seed x i The formal expression of the RKS approximation difficulty is: , Perform a majority weighted vote on the k target neighbor seeds, and the variety with the largest sum of weights is the variety of the seed to be predicted, that is: , This is the final identification result of the unknown seed.

2. The trusted seed identification method based on hyperspectral data and machine learning according to claim 1, characterized in that: The method for preprocessing the original hyperspectral image includes: The original hyperspectral image is corrected by using a black reference image and a white reference image to eliminate the influence of uneven light intensity distribution and dark current.

3. The trusted seed identification method based on hyperspectral data and machine learning according to claim 1, characterized in that: The method for extracting features from the preprocessed original hyperspectral image includes: The background stage of the hyperspectral imaging instrument in the image is segmented to eliminate the influence of its color, and the location of the seeds is preliminarily found through adaptive threshold segmentation operation; The binary image is denoised using closing and opening operations to determine the overall outline of the seed; According to the region of interest of the entire seed, the spatial characteristics, average spectral characteristics and variance spectral characteristics of the entire seed area are extracted respectively.

4. The trusted seed identification method based on hyperspectral data and machine learning according to claim 1, characterized in that: The method for preprocessing the spectral characteristic data includes: The seeds with abnormal average spectral characteristics are eliminated; The linear discriminant analysis method is used to perform feature dimension reduction operation on the spectral feature data, so that the spatial feature and the spectral feature are integrated.

5. A trusted seed identification system based on hyperspectral data and machine learning, characterized in that: include: Spectrum acquisition module, spectral feature extraction module, spectral feature processing module and variety identification module; The spectrum acquisition module is used to collect original hyperspectral images of crop seeds and perform preprocessing, wherein the crop seeds include seeds to be predicted and seeds of known varieties; The spectral feature extraction module is used to extract features from the original hyperspectral images of all the crop seeds after preprocessing to obtain spectral feature data, wherein the spectral feature data includes spatial features, average spectral features and variance spectral features of the entire seed area; The spectral feature processing module is used to pre-process the spectral feature data; The variety identification module is used to classify the crop seeds based on the preprocessed spectral feature data using a trusted k-nearest neighbor classification method to obtain the variety category of the seeds to be predicted; The method of using the trusted k-nearest neighbor classification method to classify the crop seeds into varieties and obtaining the predicted seed variety category includes: Establishing a training set of the crop seeds ,in Indicates the number of seeds, in units of grains, including Varieties, each seed have features, that is, the sum of the number of features after dimensionality reduction of spectral features and spatial features is , Indicates the category label of each seed; Sort the seeds in the training set according to the Euclidean distance and put the two seeds and The Euclidean distance between ,but: , in, Indicates seed No. eigenvalues, Indicates seed The rth eigenvalue of ; the Euclidean distances of the seed to be predicted and the various seeds in the training set are sorted in ascending order to obtain , and then according to Select the first k similar labeled target neighbor seeds to form a new data set ,in is the sorted seeds; Assign corresponding weights to the k nearest neighbor seeds. The weights are related to the difficulty of seed classification. The formal expression of seed classification difficulty is as follows: Among them, the symbol Representative Seed The seed classification difficulty, symbol Represents the total number of classifiers, symbol Indicates that the classifier Seeds The class label obtained by prediction, function is an indicator function; an exponential function is used to increase the difference between different weights, and the final weight function is: , Then the weight matrix of the k target neighbor seeds of the seed to be predicted is ,in Indicates The weight of the target neighbor seeds; Indicates seed RKS approximate difficulty; The RKS approximate difficulty method for calculating the difficulty of seed classification specifically includes: The dataset consists of m seeds. Consider each seed x i Each corresponds to an x i A hypersphere with center r as radius ,gather Contains all except x i The hypersphere of the seed itself All seeds in the set, the total number of seeds in the set Set to 1%-2% of the total number of seeds in the dataset, seed x i The formal expression of the RKS approximation difficulty is: , Perform a majority weighted vote on the k target neighbor seeds, and the variety with the largest sum of weights is the variety of the seed to be predicted, that is: , This is the final identification result of the unknown seed.

6. The trusted seed identification system based on hyperspectral data and machine learning according to claim 5, characterized in that: The spectrum acquisition module includes a spectrum image acquisition unit and an image correction unit; The spectral image acquisition unit is used to collect original hyperspectral images of crop seeds; The image correction unit is used to correct the original hyperspectral image through a black reference image and a white reference image to eliminate the influence of uneven light intensity distribution and dark current.

7. The trusted seed identification system based on hyperspectral data and machine learning according to claim 5, characterized in that: The spectral feature extraction module includes a positioning unit, a shape unit and an extraction unit; The positioning unit is used to segment the background stage to eliminate the influence of its color and preliminarily find the position of the seed through an adaptive threshold segmentation operation; The shape unit is used to remove noise from the binary image by using closing and opening operations to determine the overall outline of the seed; The extraction unit is used to extract the spatial features, average spectral features and variance spectral features of the entire seed area according to the region of interest of the entire seed.

8. The trusted seed identification system based on hyperspectral data and machine learning according to claim 5, characterized in that: The spectral feature processing module includes an abnormality distinguishing unit and a dimension reduction unit; The abnormal distinguishing unit is used to remove seeds with abnormal average spectral characteristics; The dimension reduction unit is used to perform a feature dimension reduction operation on the spectral feature data by a linear discriminant analysis method, so that the spatial feature and the spectral feature are integrated.

Citation Information

Patent Citations

  • Seed variety quality detection method and system based on hyperspectrum

    CN114882249A

  • Seed Imaging

    US20190281781A1