Leaf nitrogen element detection method and system based on random leapfrog feature extraction

Through the random frog jumping feature extraction method and near-infrared spectroscopy technology, the nitrogen content of leaves is analyzed in real time, which solves the problems of poor timeliness and waste of human resources in traditional detection methods, and achieves fast and economical nitrogen detection.

CN118675641APending Publication Date: 2024-09-20JILIN COFCO BIOCHEM +3
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310251670.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Traditional leaf nitrogen detection methods have poor timeliness, are difficult to achieve continuous detection, and consume a lot of human resources and chemical reagents.

Method used

Using a method based on random leapfrog feature extraction, leaf spectral data were collected through near-infrared spectroscopy technology, normalized and denoised, and a prediction model was established to analyze nitrogen content in real time, reducing labor costs and chemical reagent consumption.

Benefits of technology

It achieves real-time acquisition of leaf nitrogen content results, improves detection speed, saves labor costs, reduces chemical reagent consumption, and solves the problems of poor timeliness and waste of human resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118675641A
    Figure CN118675641A
Patent Text Reader

Abstract

The invention provides a leaf nitrogen element detection method and system based on random leapfrog feature extraction, and belongs to the field of organic matter content analysis. Collecting spectral data of a to-be-detected leaf sample; carrying out normalization processing on the spectral data; performing de-noising processing on the normalized data by adopting an S-G convolution smoothing method; and inputting the de-noised data into a prediction model established based on a random leapfrog feature extraction method for prediction to obtain the nitrogen content of the to-be-detected leaf sample. According to the method, the spectral data of the leaves are acquired by adopting a spectrum technology to perform real-time analysis and obtain the nitrogen content result of the leaves in real time, so that the labor cost is saved, and the consumption of chemical reagents is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of organic matter content analysis, and in particular to a leaf nitrogen detection method based on random frog leaping feature extraction, a leaf nitrogen detection system based on random frog leaping feature extraction, a computer device and a computer-readable storage medium. Background Art

[0002] Nitrogen plays an extremely important role in plant growth and is one of the indispensable elements for plant growth. The detection of nitrogen content in plant leaves plays an important role in judging the growth of plants and the amount of fertilizer to be applied, and has an important impact on the development of the national economy.

[0003] Traditional methods often involve manually collecting leaf samples, and then using laboratory chemical reagents to analyze the nitrogen content in the leaf samples. The test results are easily affected by the leaf samples collected, which requires a lot of human resources and has poor timeliness. Multiple tests are often separated by a long time, making it impossible to conduct continuous tests. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a leaf nitrogen detection method and system based on random frog leaping feature extraction, so as to at least solve the problems of poor timeliness, difficulty in continuous detection, and high labor cost in manual nitrogen content detection.

[0005] In order to achieve the above object, the present invention provides a method for detecting nitrogen in leaves based on random frog jumping feature extraction in a first aspect, the method comprising:

[0006] Collecting spectral data of the leaf sample to be tested;

[0007] Normalize the spectral data;

[0008] The SG convolution smoothing method is used to denoise the normalized data;

[0009] The denoised data is input into the prediction model established based on the random frog leaping feature extraction method to predict the nitrogen content of the leaf sample to be tested. This method uses spectral technology to collect leaf spectral data for real-time analysis and obtains the leaf nitrogen content results in real time, saving labor costs and reducing the consumption of chemical reagents.

[0010] In the embodiment of the present application, the spectral data is normalized, including:

[0011] The min-max standardization method is used to linearize the spectral data so that the result value is mapped to [0,1]. The calculation formula is as follows:

[0012] Where x is the measured value in the spectral data, min is the minimum value of each identical feature point in the spectral data, and max is the maximum value of each identical feature point in the spectral data.

[0013] In the embodiment of the present application, the prediction model is established by the following method:

[0014] Collect spectral data of leaf samples with different nitrogen content to form a spectral data set;

[0015] The SPXY method is used to divide the spectral dataset into training set and test set;

[0016] Preprocessing the spectral data in the spectral data set;

[0017] The random frog leaping feature extraction algorithm is used to screen the features of the preprocessed training set to obtain the training bands;

[0018] The training bands are input into the partial least squares method for modeling, and the resulting fitting model is the prediction model.

[0019] In the embodiment of the present application, the spectral data in the spectral data set are preprocessed, including:

[0020] Normalizing the spectral data in the spectral data set;

[0021] The principal component analysis method was used to reduce the dimension of the normalized spectral data;

[0022] Calculate the Mahalanobis distance of the spectral data after dimension reduction, and remove the spectral data whose Mahalanobis distance is greater than a preset value;

[0023] The remaining spectral data were denoised using the SG convolution smoothing method.

[0024] In the embodiment of the present application, the Mahalanobis distance is calculated by the following formula:

[0025]

[0026] Among them, t i is the score of the spectrum of sample i in the training set; T is the score matrix of all samples in the training set; is the average score vector of T; T cen is the mean centering matrix of T, that is MD i is the Mahalanobis distance of sample i in the training set.

[0027] In the embodiment of the present application, the SG convolution smoothing method is set to 9-point smoothing. 9-point smoothing can effectively remove interference spectra such as noise, sample background and stray light.

[0028] In the embodiment of the present application, the number of principal components of the random frog leaping feature extraction algorithm is 22. Setting the number of principal components to 22 can avoid overfitting during the model fitting process and improve the accuracy of the fitting model generated subsequently.

[0029] A second aspect of the present invention provides a computer device for leaf nitrogen detection, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the leaf nitrogen detection method based on random frog jumping feature extraction when executing the program.

[0030] The third aspect of the present invention provides a leaf nitrogen detection system based on random frog jumping feature extraction, comprising:

[0031] Spectral data acquisition and / or input device, used for acquiring and / or inputting spectral data of the leaf sample to be tested;

[0032] Computer equipment is used to analyze spectral data and obtain results of leaf nitrogen content.

[0033] In another aspect, the present invention provides a computer readable storage medium.

[0034] A computer program is stored thereon, and the computer program is used to implement the leaf nitrogen element detection method based on random frog jumping feature extraction.

[0035] Through the above technical solution, spectral technology is used to collect leaf spectral data for real-time analysis and obtain leaf nitrogen content results in real time, which greatly improves the speed of nitrogen element content detection, saves labor costs, and reduces the consumption of chemical reagents.

[0036] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0038] Figure 1 It is a flow chart of a leaf nitrogen detection method based on random frog jumping feature extraction provided by an embodiment of the present invention;

[0039] Figure 2 is a near infrared spectrum of a training set provided by one embodiment of the present invention;

[0040] Figure 3This is a schematic diagram of PCA+Mahalanobis distance discrimination of abnormal spectra provided by one embodiment of the present invention;

[0041] Figure 4 It is a schematic diagram of the probability of band selection by the random frog leaping algorithm provided by one embodiment of the present invention;

[0042] Figure 5 It is a schematic diagram of prediction of a test set by a trained model provided in one embodiment of the present invention. DETAILED DESCRIPTION

[0043] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.

[0044] The study found that the combination of near-infrared spectroscopy and optimization algorithm can effectively and accurately detect the nitrogen content, replacing traditional detection methods.

[0045] Among them, near-infrared spectroscopy is a non-destructive testing method that can quickly perform quantitative detection and analysis on the content of various organic substances in leaves. The wavelength range of near-infrared light is 700nm to 2500nm. Its spectrum is mainly generated when the non-resonant nature of molecular vibration causes the molecular vibration to transition from the ground state to the high energy level, and mainly reflects the double frequency and combined frequency absorption of the vibration of hydrogen-containing groups XH (such as CH, NH, OH, etc.). The near-infrared absorption wavelength and intensity of different groups or the same group in different chemical environments are different, which is very suitable for the determination of organic content in agricultural products, chemical products, etc.

[0046] The present invention provides a leaf nitrogen detection method based on random frog jumping feature extraction, such as Figure 1 As shown, the method includes:

[0047] S1: Collecting spectral data of the leaf sample to be tested. In the embodiment of the present application, near infrared spectroscopy technology is used to collect spectral data of the leaf sample to be tested.

[0048] S2: Normalize the spectral data.

[0049] In the embodiment of the present application, the spectral data is normalized, including:

[0050] The min-max standardization method is used to linearize the spectral data so that the result value is mapped to [0,1]. The calculation formula is as follows:

[0051] Where x is the measured value in the spectral data, min is the minimum value of each identical feature point in the spectral data, and max is the maximum value of each identical feature point in the spectral data.

[0052] S3: De-noising the normalized data using the SG convolution smoothing method. In the embodiment of the present application, the SG convolution smoothing method is set to 9-point smoothing. 9-point smoothing can effectively remove interference spectra such as noise, sample background and stray light.

[0053] S4: The denoised data is input into the prediction model established based on the random frog leaping feature extraction method to perform prediction, and the nitrogen content of the leaf sample to be tested is obtained.

[0054] The method uses spectral technology to collect leaf spectral data for real-time analysis and obtains leaf nitrogen content results in real time, saving labor costs and reducing the consumption of chemical reagents.

[0055] In the embodiment of the present application, the prediction model is established by the following method:

[0056] Step 1: Collect spectral data of leaf samples with different nitrogen contents to form a spectral data set.

[0057] Step 2: Use the SPXY method to divide the spectral data set into a training set and a test set. The near infrared spectrum of the training set in one embodiment is as follows: Figure 2 described.

[0058] Step 3: Preprocess the spectral data in the spectral dataset, including:

[0059] The spectral data in the spectral data set are normalized. In the embodiment of the present application, the normalization process of the spectral data set also adopts the min-max normalization method.

[0060] The principal component analysis method is used to reduce the dimension of the normalized spectral data. Specifically, the spectral data is transformed into a new coordinate system so that the first largest variance of any spectral data projection is on the first coordinate (first principal component), the second largest variance is on the second coordinate (second principal component), and so on.

[0061] The Mahalanobis distance of the spectral data after dimension reduction is calculated, and the spectral data whose Mahalanobis distance is greater than a preset value is eliminated. The Mahalanobis distance is calculated by the following formula:

[0062]

[0063] Among them, t i is the score of the spectrum of sample i in the training set; T is the score matrix of all samples in the training set; is the average score vector of T; T cen is the mean centering matrix of T, that is MD iis the Mahalanobis distance of the i-th sample in the training set. If the Mahalanobis distance is greater than the preset value, it means that the sample is quite different from other samples and has a high probability of being abnormal data. Therefore, it is removed. In one embodiment of the present application, the result of identifying abnormal spectrograms through PCA + Mahalanobis distance is as Figure 3 shown, and the abnormal spectral samples are outside the ellipse in the figure.

[0064] The S-G convolutional smoothing method is used to denoise the remaining spectral data.

[0065] In the embodiment of the present application, by comparing the processing effects of various denoising methods and the degree of performance improvement compared to the original spectrum, the S-G convolutional smoothing method is finally determined.

[0066] Step 4: Use the random frog leaping feature extraction algorithm to screen the features of the preprocessed training set to obtain the training bands. In the embodiment of the present application, it specifically includes:

[0067] Define the spectral data set as V, initialize the function, randomly select an initial spectral variable subset V0 within the band range, the number of spectral variables it contains is Q, and set the required number of iterations N;

[0068] Based on V0, select a candidate subset V * containing Q * random spectral variables as V1, use V1 to replace V0, and loop the steps until N iterations are completed. Specifically:

[0069] Randomly select an integer Q* from a normal distribution with a mean of Q and a variance of 0.3Q, and compare Q* with Q;

[0070] If Q* = Q, then let V* = V0;

[0071] If Q* < Q, then establish a PLS model for V0, calculate the regression coefficients of each selected variable, remove the relevant variables with the Q - Q* smallest regression coefficients from V0, and the remaining Q* variables are used as the candidate subset V*;

[0072] If Q* > Q, then randomly select ω(Q* - Q) variables from V - V0 to generate a subset T, combine V0 and T, establish a PLS model, and retain the Q* variables with the largest PLS regression coefficients as the candidate subset V*;

[0073] Use the candidate subset V* as V1, use V1 to replace V0, and loop the steps until N iterations are completed. Due to the characteristic of random search in the interval of the random frog leaping feature extraction algorithm, the optimal band can be selected. In one embodiment of the present application, the schematic diagram of the probability of the random frog leaping algorithm selecting bands is as Figure 4 shown.

[0074] After the iteration is completed, the selected bands of the spectrum in each iteration are counted and brought into the PLS model to calculate the determination coefficient R 2 and root mean square error RMSE, calculating the probability of each spectral band being selected during the entire iteration process;

[0075] Sort the spectral variables from high to low according to the probability of selection, use partial least squares method PLS or multivariate linear regression method MLR for regression analysis, add one variable each time, build a regression model, bring the model into the test set, and obtain the prediction root mean square error RMSEP and R 2 The band selected when optimal is used as the training band.

[0076] In the embodiment of the present application, the number of principal components of the random frog leaping feature extraction algorithm is 22. Setting the number of principal components to 22 can avoid overfitting during the model fitting process and improve the accuracy of the fitting model generated subsequently.

[0077] Step 5: Input the training bands into the partial least squares method for modeling, and the resulting fitting model is the prediction model.

[0078] In some other embodiments, the spectral data in the spectral data set may be preprocessed first, and then the preprocessed spectral data set may be divided into a training set and a test set using the SPXY method.

[0079] In the process of establishing the prediction model, the spectral data in the spectral data set are processed by different preprocessing methods, such as smoothing denoising, first-order derivative method, second-order derivative method, multivariate scattering correction method, standard normal variable transformation method, etc., in order to remove noise, sample background and stray light, etc. After obtaining the spectral data preprocessed by different processing methods, the 10-fold cross-validation method is used to reduce the dimension of the spectral data with different preprocessing methods, using the random frog leaping algorithm RF, the minimum angle regression algorithm LAR, the Monte Carlo sampling method CARS, the uninformation variable elimination method UVE, etc., to screen the bands, eliminate irrelevant characteristic variables, and reduce the dimension of the modeling data set, so as to obtain a better prediction model.

[0080] The specific processing of the 10-fold cross validation method is as follows: During the processing, the training set and the test set are first divided into 10 parts, and one data set is taken out each time as the test set, and the rest is used as the training set. A total of 10 divisions are performed, and each division is used for training and evaluation. RMSE and R are calculated once for each division. 2 Finally, we get the evaluation results after 10 divisions, and then we average the 10 evaluation results to get the final score.

[0081]

[0082]

[0083]

[0084]

[0085] Among them, y is the measured label value and f(x) is the model prediction value.

[0086] Finally, the optimal preprocessing method and band screening method are determined based on the final score.

[0087] The modeling effects of different variable screening methods are shown in Table 1.

[0088]

[0089] In the process of modeling using partial least squares, overfitting is easy to occur. Therefore, in the process of function fitting, it is necessary to optimize the number of principal components n_components in the PLS (partial least squares regression) model, and use the number of principal components with the smallest RMSECV (root mean square error of cross validation) in the training set as the model parameter to obtain the model with the best accuracy. Among them, the best number of principal components for the random frog leaping (RF) algorithm with the highest modeling accuracy is 22.

[0090] By comparing the above five methods, the random frog leaping (RF) algorithm has the smallest RMSECV (cross validation root mean square error) of cross validation on the training set, and the RMSEP (prediction root mean square error) and R 2 (coefficient of determination) performed best. Therefore, the feature extraction method based on random frog leaping has a good effect on nitrogen element prediction. Its performance on the test set is as follows Figure 5 shown.

[0091] In the process of establishing the above prediction model, the SPXY method is used to divide the data set for the collected spectral data, and then the spectral data is normalized, and the PCA+Mahalanobis distance method is used to remove abnormal spectral data. Then, the preprocessing method is used to preprocess the training set and the test set to find a preprocessing method with better effect. After the preprocessing is completed, the 10-fold cross-validation method is used to screen the features of the training set, and the bands that have a greater impact on the model accuracy are removed. The cross-validation and traversal search for the best parameters are used to improve the model accuracy. Then the model is brought into the test set and the R 2 The model was fitted with RMSEP and RT-PCR to evaluate the model's fitting accuracy. The established model has a good prediction effect, greatly improving the detection speed of nitrogen content and reducing the consumption of chemical reagents during the detection process. This method can also be used for the detection of other substances.

[0092] A second aspect of the present invention provides a computer device for leaf nitrogen detection, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the leaf nitrogen detection method based on random frog jumping feature extraction when executing the program.

[0093] The third aspect of the present invention provides a leaf nitrogen detection system based on random frog jumping feature extraction, comprising:

[0094] Spectral data acquisition and / or input device, used for acquiring and / or inputting spectral data of the leaf sample to be tested;

[0095] Computer equipment is used to analyze spectral data and obtain results of leaf nitrogen content.

[0096] On the other hand, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is used to implement the leaf nitrogen detection method based on random frog jumping feature extraction.

[0097] Through the above technical solution, spectral technology is used to collect leaf spectral data for real-time analysis and obtain leaf nitrogen content results in real time, which greatly improves the speed of nitrogen element content detection, saves labor costs, and reduces the consumption of chemical reagents.

[0098] Those skilled in the art will understand that all or part of the steps in the method for implementing the above-mentioned embodiments can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions for making a single-chip microcomputer, a chip or a processor (processor) perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0099] The optional embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details in the above embodiments. Within the technical concept of the embodiments of the present invention, the technical scheme of the embodiments of the present invention can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the embodiments of the present invention. It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the embodiments of the present invention will not further describe various possible combinations.

[0100] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the embodiments of the present invention, they should also be regarded as the contents disclosed in the embodiments of the present invention.

Claims

1. A leaf nitrogen detection method based on random frog leaping feature extraction is characterized in that: The method comprises: Collecting spectral data of the leaf sample to be tested; Normalize the spectral data; The SG convolution smoothing method is used to denoise the normalized data; The denoised data is input into the prediction model established based on the random frog leaping feature extraction method to predict the nitrogen content of the leaf sample to be tested.

2. The leaf nitrogen detection method based on random frog leaping feature extraction according to claim 1 is characterized in that: Normalize the spectral data, including: The min-max standardization method is used to linearize the spectral data so that the result value is mapped to [0,1]. The calculation formula is as follows: Where x is the measured value in the spectral data, min is the minimum value of each identical feature point in the spectral data, and max is the maximum value of each identical feature point in the spectral data.

3. The leaf nitrogen detection method based on random frog leaping feature extraction according to claim 1 is characterized in that: The prediction model is established by the following method: Collect spectral data of leaf samples with different nitrogen content to form a spectral data set; The SPXY method is used to divide the spectral dataset into training set and test set; Preprocessing the spectral data in the spectral data set; The random frog leaping feature extraction algorithm is used to screen the features of the preprocessed training set to obtain the training bands; The training bands are input into the partial least squares method for modeling, and the resulting fitting model is the prediction model.

4. The leaf nitrogen detection method based on random frog leaping feature extraction according to claim 3 is characterized in that: Preprocess the spectral data in the spectral dataset, including: Normalizing the spectral data in the spectral data set; The principal component analysis method was used to reduce the dimension of the normalized spectral data; Calculate the Mahalanobis distance of the spectral data after dimension reduction, and remove the spectral data whose Mahalanobis distance is greater than a preset value; The remaining spectral data were denoised using the SG convolution smoothing method.

5. The leaf nitrogen detection method based on random frog leaping feature extraction according to claim 4 is characterized in that: The Mahalanobis distance is calculated by the following formula: Among them, t i is the score of the spectrum of sample i in the training set; T is the score matrix of all samples in the training set; t is the average score vector of T; T cen is the mean centering matrix of T, that is MD i is the Mahalanobis distance of sample i in the training set.

6. The leaf nitrogen detection method based on random frog leaping feature extraction according to claim 1 is characterized in that: The SG convolution smoothing method is set to 9-point smoothing.

7. The leaf nitrogen detection method based on random frog leaping feature extraction according to claim 3 is characterized in that: The number of principal components of the random frog leaping feature extraction algorithm is 22.

8. A computer device for detecting nitrogen in leaves, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the leaf nitrogen detection method based on random frog leaping feature extraction described in any one of claims 1 to 7 is implemented.

9. A leaf nitrogen detection system based on random frog jumping feature extraction, characterized in that: include: Spectral data acquisition and / or input device, used for acquiring and / or inputting spectral data of the leaf sample to be tested; The computer device described in claim 8 is used to analyze spectral data to obtain the results of nitrogen content in leaves.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to implement the leaf nitrogen detection method based on random frog jumping feature extraction as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method for detecting content of trace elements in milk powder on basis of laser-induced breakdown spectroscopy

    CN108333171A

  • Spectral data analysis method and spectral data analysis apparatus

    CN109115692A

  • A near-infrared-band hyperspectral diagnosis method for detecting content of nitrogen in rubber tree leaves

    CN110082310A

  • Apple tree canopy scale nitrogen content diagnosis method

    CN112129709A

  • Infrared spectroscopic analysis method for soil total nitrogen

    CN113702329A