A method, system, device, medium and product for detecting nitrogen content in corn leaves

By combining convolutional neural networks and random forest models, the destructiveness and inefficiency of traditional chemical analysis methods were solved, and non-destructive and efficient detection of nitrogen content in corn leaves was achieved.

CN120275306BActive Publication Date: 2025-09-23CHINA AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510724262.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-09-23
Estimated Expiration
2045-06-03

AI Technical Summary

Technical Problem

Traditional chemical analysis methods for detecting nitrogen content in corn leaves require destroying the leaves and are inefficient, making it impossible to achieve non-destructive and timely detection.

Method used

A corn leaf nitrogen content detection model trained with a convolutional neural network was used, combined with a random forest model to screen characteristic wavelengths, and non-destructive testing was performed using leaf spectra, moisture content, and environmental data.

Benefits of technology

While achieving non-destructive testing, the detection efficiency is improved, and the combined effects of leaf spectrum, moisture content and soil moisture content are comprehensively considered.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120275306B_ABST
    Figure CN120275306B_ABST
Patent Text Reader

Abstract

This application discloses a method, system, device, medium, and product for detecting nitrogen content in corn leaves, relating to the technical field of corn leaf nutrient detection technology. The method comprises: obtaining test data of corn leaves to be tested; the test data includes leaf spectral data at multiple characteristic wavelengths, leaf moisture content, and environmental data for each date within a testing period, where the testing period extends from the start testing date to the current testing date; inputting the test data of the corn leaves to be tested into a corn leaf nitrogen content detection model to obtain a detection value of the nitrogen content of the corn leaves to be tested on the current testing date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network. This application achieves non-destructive testing while improving detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of corn leaf nutrient detection, and in particular to a method, system, device, medium and product for detecting the nitrogen content of corn leaves. Background Art

[0002] During growth and development, corn leaves absorb nutrients from the soil and nitrogen from applied fertilizers, using photosynthesis to synthesize proteins and nucleic acids, promoting their own growth. Corn leaves have varying nitrogen requirements at different stages of growth, and their nitrogen content exhibits dynamic changes. Therefore, measuring the nitrogen content of corn leaves and accurately assessing their nitrogen needs are extremely important.

[0003] Traditional methods rely on chemical analysis to determine nitrogen content in corn leaves, such as the Kjeldahl method and the Dumas combustion method. Chemical analysis requires destructive sampling in the field, and nitrogen content is measured indoors, which hinders timely acquisition of new data. Furthermore, chemical analysis requires the preparation of chemical solutions, resulting in a high time cost for measuring each initial sample. Consequently, chemical analysis suffers from the need to destroy leaves and low detection efficiency. Summary of the Invention

[0004] The purpose of this application is to provide a method, system, device, medium and product for detecting the nitrogen content of corn leaves, so as to solve the problems of needing to destroy the leaves and low detection efficiency.

[0005] To achieve the above objectives, this application provides the following solutions.

[0006] In a first aspect, the present application provides a method for detecting nitrogen content in corn leaves, comprising:

[0007] Acquire test data of the corn leaves to be tested; the test data includes: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths on each date in a test period, wherein the test period includes the start test date to the current test date;

[0008] The detection data of the corn leaves to be tested are input into a corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be tested on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.

[0009] In one embodiment, the environmental data includes soil moisture content.

[0010] In one embodiment, the process of determining each characteristic wavelength includes:

[0011] Acquire first sample data of a plurality of first sample corn leaves; the first sample data include: actual values ​​of first sample independent variables on each date in a first sample period and actual values ​​of nitrogen content on a first current sample date; the first sample period includes a first starting sample date to a first current sample date; the first sample independent variables include: leaf raw spectral data, leaf moisture content, and environmental data; the leaf raw spectral data includes leaf spectral data at each wavelength within a preset band range;

[0012] Determining the actual value of the screening independent variable for each first sample corn leaf based on the actual value of the first sample independent variable on each date in the first sample period of each first sample corn leaf;

[0013] Determine the actual values ​​of the screening independent variables of all first sample corn leaves and the actual value of the nitrogen content of the first current sample date as a screening data set;

[0014] Initialize the random forest model;

[0015] Based on the screening data set and the random forest model, each wavelength within the preset band is screened to obtain each characteristic wavelength.

[0016] In one embodiment, determining the actual value of the screening independent variable for each first sample corn leaf based on the actual value of the first sample independent variable on each date in the first sample period of each first sample corn leaf comprises:

[0017] determining any first sample corn leaf as a current leaf;

[0018] Determine the weight of each date in the first sample period of the current leaf based on the actual value of the leaf moisture content on each date in the first sample period of the current leaf;

[0019] Determine the actual value of the mixed spectral data of the current leaf based on the weight of each date in the first sample period of the current leaf and the actual value of the original spectral data of the leaf;

[0020] The actual value of the mixed spectrum data of the current leaf is preprocessed using the multivariate scatter correction-SG filtering method to obtain the actual value of the preprocessed mixed spectrum data;

[0021] The actual value of the preprocessed mixed spectrum data of the current leaf is determined as the actual value of the screening independent variable of the current leaf.

[0022] In one embodiment, based on the screening data set and the random forest model, each wavelength within the preset wavelength range is screened to obtain each characteristic wavelength, including:

[0023] Divide the screening data set into a pre-set ratio to obtain a screening training set and a screening test set;

[0024] The random forest model is trained using the actual value of the screening independent variable of each first sample corn leaf in the screening training set as input and the actual value of the nitrogen content of the first current sample date of each first sample corn leaf in the screening training set as output to obtain a pre-trained random forest model;

[0025] Using the screening test set, determine the baseline value of the negative mean squared error of the pre-trained random forest model;

[0026] Determine any wavelength within the preset wavelength range as the current wavelength;

[0027] Performing multiple shuffling on the actual values ​​of the screening independent variables of all first sample corn leaves corresponding to the current wavelength in the screening test set to obtain multiple shuffled screening test sets corresponding to the current wavelength;

[0028] Determine initial values ​​of negative mean square errors of the pre-trained random forest model at each wavelength within the preset band using a plurality of shuffled screening test sets corresponding to each wavelength within the preset band;

[0029] Determine an average value of the negative mean square error of the pre-trained random forest model at each wavelength based on the initial value of each negative mean square error of the pre-trained random forest model at each wavelength within the preset band range;

[0030] Determine the difference between the baseline value of the negative mean square error of the pre-trained random forest model and the average value of the negative mean square error of the pre-trained random forest model at each wavelength, and obtain the importance contribution value corresponding to each wavelength;

[0031] Based on the importance contribution value corresponding to each wavelength, it is determined to screen each wavelength within the preset band to obtain each characteristic wavelength.

[0032] In one embodiment, the process of determining the corn leaf nitrogen content detection model includes:

[0033] Acquire second sample data of a plurality of second sample corn leaves; the second sample data include: actual values ​​of the second sample independent variables on each date in a second sample period and actual values ​​of nitrogen content on a second current sample date; the second sample period includes a second starting sample date to a second current sample date; the second sample independent variables include: leaf spectral data at a plurality of characteristic wavelengths, leaf moisture content, and environmental data;

[0034] Initialize the convolutional neural network;

[0035] The actual value of the second sample independent variable of each date in the second sample period of each second sample corn leaf is used as input, and the actual value of the nitrogen content of the second current sample date of each second sample corn leaf is used as output, and a convolutional neural network is trained to obtain the corn leaf nitrogen content detection model.

[0036] In a second aspect, the present application provides a corn leaf nitrogen content detection system to implement any of the above corn leaf nitrogen content detection methods, the corn leaf nitrogen content detection system comprising:

[0037] A data acquisition module is used to obtain test data of the corn leaves to be tested; the test data includes: leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date in a test period, and the test period includes the start test date to the current test date;

[0038] The nitrogen content detection module is used to input the detection data of the corn leaves to be tested into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be tested on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.

[0039] In a third aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the above-described methods for detecting nitrogen content in corn leaves.

[0040] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-mentioned methods for detecting nitrogen content in corn leaves.

[0041] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-mentioned methods for detecting nitrogen content in corn leaves.

[0042] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0043] The present application discloses a method, system, device, medium, and product for detecting the nitrogen content of corn leaves. First, detection data of the corn leaves to be tested is obtained; the detection data includes: leaf spectrum data, leaf moisture content, and environmental data at multiple characteristic wavelengths for each date in a detection period, and the detection period includes the starting detection date to the current detection date; then, the detection data of the corn leaves to be tested is input into a corn leaf nitrogen content detection model to obtain a detection value of the nitrogen content of the corn leaves to be tested on the current detection date; wherein the corn leaf nitrogen content detection model is obtained by training a convolutional neural network. The present application inputs the detection data of the corn leaves to be tested into the corn leaf nitrogen content detection model obtained by training a convolutional neural network to obtain a detection value of the nitrogen content, comprehensively considering the combined effects of leaf spectrum, leaf moisture content, and soil moisture content on leaf nitrogen content. Compared with traditional methods, the method of the present application improves detection efficiency while achieving non-destructive testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0045] Figure 1 This is a diagram of the application environment of a method for detecting nitrogen content in corn leaves in one embodiment of the present application.

[0046] Figure 2 This is a flow chart of a method for detecting nitrogen content in corn leaves provided in one embodiment of the present application.

[0047] Figure 3 Schematic diagram of mixed spectral data.

[0048] Figure 4 Schematic diagram of mixed spectral data after preprocessing.

[0049] Figure 5 Schematic diagram of the characteristic wavelength distribution of leaf nitrogen content.

[0050] Figure 6 Schematic diagram of the convolutional neural network structure.

[0051] Figure 7 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

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

[0053] The purpose of this application is to provide a method, system, device, medium and product for detecting the nitrogen content of corn leaves, aiming to achieve non-destructive testing while improving detection efficiency.

[0054] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0055] The method for detecting nitrogen content in corn leaves provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 via the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, or it can be integrated on the server 104, or it can be placed on the cloud or other servers. The terminal 102 can send the detection data of the corn leaves to be tested to the server 104. After the server 104 receives the detection data of the corn leaves to be tested, the server 104 inputs the detection data of the corn leaves to be tested into the corn leaf nitrogen content detection model for the detection data of the corn leaves to be tested, and obtains the detection value of the nitrogen content of the corn leaves to be tested on the current detection date. The server 104 can feed back the obtained detection value of the nitrogen content of the corn leaves to be tested on the current detection date to the terminal 102. In addition, in some embodiments, the method for detecting the nitrogen content of corn leaves can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly perform the detection of the nitrogen content of the corn leaves based on the detection data of the corn leaves to be tested, or the server 104 can obtain the detection data of the corn leaves to be tested from the data storage system and perform the detection of the nitrogen content of the corn leaves based on the detection data of the corn leaves to be tested.

[0056] In an exemplary embodiment, Figure 2 As shown, a method for detecting nitrogen content in corn leaves is provided, comprising steps 1 and 2.

[0057] Step 1: Obtain the test data of the corn leaf to be tested.

[0058] The detection data includes: leaf spectrum data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date in the detection period, and the detection period includes the start detection date to the current detection date.

[0059] Specifically, when obtaining leaf spectral data, the middle part of the corn leaf is used as the measurement point, and the hyperspectral data (i.e., reflectivity) of the corn leaf is obtained using a hyperspectral instrument.

[0060] To obtain leaf moisture content, after daily observation, a small area of ​​corn leaves was cut, and their fresh weight was first weighed, and then their dry weight was weighed after drying, and the leaf moisture percentage was calculated to obtain the leaf moisture content.

[0061] As an optional implementation, the environmental data includes: soil moisture content.

[0062] Specifically, soil moisture content is collected using a soil sensor.

[0063] As an optional implementation manner, the process of determining each characteristic wavelength includes steps 11 to 15.

[0064] Step 11: Obtain first sample data of multiple first sample corn leaves; the first sample data include: the actual value of the first sample independent variable on each date in the first sample period and the actual value of the nitrogen content on the first current sample date; the first sample period includes the first starting sample date to the first current sample date; the first sample independent variable includes: leaf original spectral data, leaf moisture content and environmental data, and the leaf original spectral data includes leaf spectral data at each wavelength within a preset band range.

[0065] Specifically, the preset wavelength range is 900 nm to 1700 nm. The nitrogen content is obtained by sampling, drying, grinding and measuring the nitrogen content of the first sample corn leaves using the Kjeldahl method.

[0066] The first sample data was collected between 12:00 PM and 2:00 PM daily, using a spectrometer to contact-measure the surface of corn leaves. Using the length of the corn vein as a reference, the measurement range was selected within a ±5 cm radius from the midpoint of the vein. The spectrometer measured two points on either side of the vein, repeating each measurement point three times. This yielded six hyperspectral data points. The average of these six hyperspectral data points served as the raw spectral data for the leaf.

[0067] Cut a circular leaf sample with a diameter of 1 cm from the spectral measurement area and weigh it using an analytical balance (sensitivity 0.001 g). Record the fresh weight. Dry the leaf in an oven at 75°C until completely dehydrated, and then weigh its dry weight.

[0068] Leaf moisture content The calculation formula is:

[0069] .

[0070] in, For fresh weight; For dry weight.

[0071] Step 12: Determine the actual value of the screening independent variable of each first sample corn leaf based on the actual value of the first sample independent variable on each date in the first sample period of each first sample corn leaf.

[0072] As an optional implementation, step 12 includes steps 121 to 125.

[0073] Step 121: Determine any first sample corn leaf as the current leaf.

[0074] Step 122: Determine the weight of each date in the first sample period of the current leaf based on the actual value of the leaf moisture content on each date in the first sample period of the current leaf.

[0075] Step 123: Determine the actual value of the mixed spectral data of the current leaf based on the weight of each date in the first sample period of the current leaf and the actual value of the original spectral data of the leaf.

[0076] Specifically, the mixed spectrum data calculation formula is used to determine the actual value of the mixed spectrum data of the current leaf based on the weights of each date in the first sample period of the current leaf and the actual value of the leaf's original spectrum data. The mixed spectrum data calculation formula is:

[0077] .

[0078] .

[0079] in, is mixed spectral data; is the total number of dates in the first sample period, i.e. the total number of days; is the original spectral data of leaves on day i; is the weight of the i-th day; is the leaf moisture content on day i.

[0080] Step 124: Preprocess the actual value of the mixed spectrum data of the current leaf using a Multiplicative Scatter Correction (MSC)-SG (Savitzky-Golay) filtering method to obtain the actual value of the preprocessed mixed spectrum data.

[0081] Specifically, the mixed spectral data and the preprocessed mixed spectral data are respectively as follows: Figure 3 and Figure 4 shown. Figure 3 and Figure 4 In the figure, the horizontal axis is wavelength and the vertical axis is reflectivity.

[0082] Step 125: Determine the actual value of the preprocessed mixed spectrum data of the current leaf as the actual value of the screening independent variable of the current leaf.

[0083] Step 13: The actual values ​​of the screening independent variables of all first sample corn leaves and the actual value of the nitrogen content on the first current sample date are determined as a screening data set.

[0084] Step 14: Initialize the Random Forest (RF) model.

[0085] Step 15: Based on the screening data set and the random forest model, each wavelength within the preset band is screened to obtain each characteristic wavelength.

[0086] As an optional implementation, step 15 includes steps 151 to 159.

[0087] Step 151: Divide the screening data set according to a preset ratio to obtain a screening training set and a screening test set.

[0088] Step 152: The actual value of the screening independent variable of each first sample corn leaf in the screening training set is used as input, and the actual value of the nitrogen content of the first current sample date of each first sample corn leaf in the screening training set is used as output to train the random forest model to obtain a pre-trained random forest model.

[0089] Step 153: Using the screening test set, determine the baseline value of the negative mean square error of the pre-trained random forest model.

[0090] Step 154: Determine any wavelength within the preset wavelength range as the current wavelength.

[0091] Step 155: Perform multiple shuffling operations on the actual values ​​of the screening independent variables of all first sample corn leaves corresponding to the current wavelength in the screening test set to obtain multiple shuffled screening test sets corresponding to the current wavelength.

[0092] Step 156: Determine initial values ​​of multiple negative mean square errors of the pre-trained random forest model at each wavelength within the preset band using the multiple shuffled screening test sets corresponding to each wavelength within the preset band.

[0093] Step 157: Determine the average value of the negative mean square error of the pre-trained random forest model at each wavelength based on the initial value of the negative mean square error of the pre-trained random forest model at each wavelength within the preset band range.

[0094] Step 158: Determine the difference between the baseline value of the negative mean square error of the pre-trained random forest model and the average value of the negative mean square error of the pre-trained random forest model at each wavelength, and obtain the importance contribution value corresponding to each wavelength.

[0095] Step 159: Based on the importance contribution value corresponding to each wavelength, determine to screen the wavelengths within the preset wavelength range to obtain the characteristic wavelengths. Specifically, the steps include: sorting the wavelengths within the preset wavelength range in descending order of their importance contribution values; and determining the characteristic wavelengths based on a preset cumulative contribution threshold and the sorted wavelengths within the preset wavelength range.

[0096] Specifically, the number of decision trees of the random forest model is set to 50. The negative mean squared error (nMSE) of the random forest model is determined using a test set that includes the actual values ​​of the screening independent variables of the test sample corn leaves and the actual values ​​of the nitrogen content of the current sample date for the test, and the values ​​of the first sample period at a certain wavelength in the spectrum in the test set are randomly sorted. If the prediction of leaf nitrogen content is highly dependent on the randomly disrupted wavelength column, the prediction accuracy of the random forest model will be greatly attenuated. After disrupting the order of the spectral values ​​at a certain wavelength (the spectral values ​​of a certain wavelength column are randomly disrupted, and the values ​​of other wavelength columns and leaf nitrogen columns remain unchanged), 10 repetitions are set, and the nMSE of the random forest model obtained from the 10 repetitions is averaged to obtain , to avoid the existence of accidental factors. Determine the importance contribution value based on nMSE , the formula is:

[0097] .

[0098] in, is the baseline value of the negative mean square error of the pre-trained random forest model; is the average of the negative mean squared errors of the pre-trained random forest model at each wavelength.

[0099] The characteristic wavelengths are sorted from most important to least important, and 85% is used as the preset cumulative contribution threshold to obtain the first j characteristic wavelengths. The characteristic wavelength index is obtained by combining the wavelength data. The number of characteristic wavelengths finally selected is 8, corresponding to 933.92nm, 1405.53nm, 1408.81nm, 1413.18nm, 1416.46nm, 1419.74nm, 1519.03nm, 1532.58nm, and the characteristic wavelength distribution is as follows: Figure 5 shown. Figure 5 In the figure, the horizontal axis is wavelength and the vertical axis is reflectivity.

[0100] Step 2: Input the test data of the corn leaves to be tested into the corn leaf nitrogen content detection model to obtain the test value of the nitrogen content of the corn leaves to be tested on the current test date.

[0101] Among them, the corn leaf nitrogen content detection model is obtained by training the convolutional neural network.

[0102] Specifically, the leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date in the detection period in the detection data of the corn leaves to be tested are combined in parallel and input into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be tested on the current detection date.

[0103] As an optional implementation manner, the process of determining the corn leaf nitrogen content detection model includes steps 21 to 23.

[0104] Step 21: Obtain second sample data of multiple second sample corn leaves; the second sample data include: the actual value of the second sample independent variable on each date in the second sample period and the actual value of the nitrogen content on the second current sample date; the second sample period includes the second starting sample date to the second current sample date; the second sample independent variable includes: leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths.

[0105] Step 22: Initialize the convolutional neural network.

[0106] Specifically, such as Figure 6 As shown in Figure 1, the convolutional neural network includes: an input layer connected in sequence, a first batch of normalized layers, a first one-dimensional convolutional layer (the number of convolution kernels is 64, the size of the convolution kernel is 3, and the padding method is the same), a second batch of normalized layers, a first ReLu activation function, a first maximum pooling layer (the pooling window size is set to 2, the step size is set to 2), a second one-dimensional convolutional layer (the number of convolution kernels is 31, the size of the convolution kernel is 3, and the padding method is the same), a third batch of normalized layers, a second ReLu activation function, a third one-dimensional convolutional layer (the number of convolution kernels is 16, the size of the convolution kernel is 3, and the padding method is the same), a second maximum pooling layer (the pooling window size is set to 2, the step size is set to 2), a third ReLu activation function, a random dropout layer (the dropout rate is set to 0.02), a first fully connected layer (the output dimension is 32), a second fully connected layer (the output dimension is 16), and an output layer.

[0107] Specifically, after the leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths are input into the convolutional neural network, the input layer processes the forward features (including the leaf spectral data) and the reverse features (including the leaf moisture content and environmental data) in the following manner:

[0108] (1) The processing process of positive features is:

[0109] First, perform maximum and minimum normalization based on the importance contribution value to obtain the weight coefficient of each characteristic wavelength. The formula is:

[0110] .

[0111] in, is the weight coefficient of the kth characteristic wavelength; is the importance contribution value of the kth characteristic wavelength, is the minimum value of the importance contribution of all characteristic wavelengths, The minimum value among the importance contributions of all characteristic wavelengths.

[0112] Then, a nonlinear transformation is performed on the mixed spectral data corresponding to each characteristic wavelength to amplify the positive contribution of the positive feature to corn leaf detection. The formula is:

[0113] .

[0114] in, is the mixed spectrum data after nonlinear change corresponding to the kth characteristic wavelength; is the mixed spectrum data corresponding to the kth characteristic wavelength; is a natural constant.

[0115] (2) The processing process for any reverse feature is:

[0116] The reverse feature is changed to achieve feature data compression. The transformation formula of the reverse feature is as follows:

[0117] .

[0118] in, is the transformed leaf moisture content or environmental data on day i; is the leaf moisture content or environmental data on day i.

[0119] Leaf spectra are a comprehensive reflection of leaf growth status, characterizing the interaction between soil moisture, leaf moisture, and leaf nitrogen content. Therefore, both positive and negative features should be considered when determining leaf nitrogen content. High-level features and correlations between leaf spectra, leaf moisture, and soil moisture are further mined using a convolutional neural network.

[0120] Step 23: Using the actual value of the second sample independent variable of each date in the second sample period of each second sample corn leaf as input and the actual value of the nitrogen content of the second current sample date of each second sample corn leaf as output, the convolutional neural network is trained to obtain a corn leaf nitrogen content detection model.

[0121] Specifically, during training, the convolutional neural network's hyperparameters set the initial learning rate to 0.001 and the total number of training epochs to 200. The loss function was set to MSE, the Adam optimizer was chosen, and the weight decay coefficient for L2 regularization was set to 1e-6. A learning rate scheduler was constructed to monitor the convolutional neural network's loss value, with the monitoring metric set to minimize validation loss. When validation loss showed no improvement after 10 epochs, the learning rate was triggered to decrease by half. A minimum learning rate was set; if the learning rate was less than 1e-6, it was not adjusted. An early stopping mechanism was initialized to prevent the network from overfitting the training set. When the learning rate remained unchanged after 20 training steps, the early stopping mechanism was triggered, terminating network training.

[0122] The validation set was used to determine the mean absolute percentage error of the maize leaf nitrogen content detection model. The formula for calculating the mean absolute percentage error is:

[0123] .

[0124] in, is the mean absolute percentage error; To verify the number of corn leaves in the sample set; is the detection value of nitrogen content in corn leaves of sample a; is the actual value of nitrogen content in the corn leaves of the ath sample.

[0125] The method of the present application can be used to determine the detection value of the nitrogen content of the corn leaves to be tested on the Nth day by utilizing the leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths from the 1st day (i.e., the starting detection date) to the Nth day (i.e., the current detection date) of the corn leaves to be tested.

[0126] In an exemplary embodiment, a corn leaf nitrogen content detection system is provided to implement a corn leaf nitrogen content detection method. The corn leaf nitrogen content detection system includes:

[0127] The data acquisition module is used to obtain the test data of the corn leaves to be tested; the test data includes: leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date in the test period, and the test period includes the starting test date to the current test date.

[0128] The nitrogen content detection module is used to input the detection data of the corn leaves to be tested into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be tested on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.

[0129] In an exemplary embodiment, a computer device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a method for detecting nitrogen content in corn leaves.

[0130] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, a method for detecting nitrogen content in corn leaves is implemented.

[0131] In an exemplary embodiment, a computer program product is provided, comprising a computer program, which implements a method for detecting nitrogen content in corn leaves when executed by a processor.

[0132] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for detecting nitrogen content in corn leaves is implemented.

[0133] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0134] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0135] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.

[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0137] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0138] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A method for detecting nitrogen content in corn leaves, characterized in that: The method for detecting nitrogen content in corn leaves comprises: Acquire test data of the corn leaves to be tested; the test data includes: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths on each date in a test period, wherein the test period includes the start test date to the current test date; Inputting the test data of the corn leaves to be tested into a corn leaf nitrogen content detection model to obtain a test value of the nitrogen content of the corn leaves to be tested on the current test date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network; The process of determining each characteristic wavelength includes: Acquire first sample data of a plurality of first sample corn leaves; the first sample data include: actual values ​​of first sample independent variables on each date in a first sample period and actual values ​​of nitrogen content on a first current sample date; the first sample period includes a first starting sample date to a first current sample date; the first sample independent variables include: leaf original spectral data, leaf moisture content, and environmental data; the leaf original spectral data includes leaf spectral data at each wavelength within a preset band range; Determining the actual value of the screening independent variable for each first sample corn leaf based on the actual value of the first sample independent variable on each date in the first sample period of each first sample corn leaf; comprising: determining any first sample corn leaf as a current leaf; Determine the weight of each date in the first sample period of the current leaf based on the actual value of the leaf moisture content on each date in the first sample period of the current leaf; Based on the weights of each date in the first sample period of the current leaf and the actual value of the leaf's original spectral data, the actual value of the mixed spectral data of the current leaf is determined; the mixed spectral data calculation formula is: ; ; in, is mixed spectral data; is the total number of dates in the first sample period, i.e. the total number of days; is the original spectral data of leaves on day i; is the weight of the i-th day; is the leaf moisture content on day i; The actual value of the mixed spectrum data of the current leaf is preprocessed using the multivariate scatter correction-SG filtering method to obtain the actual value of the preprocessed mixed spectrum data; Determine the actual value of the preprocessed mixed spectrum data of the current leaf as the actual value of the screening independent variable of the current leaf; Determine the actual values ​​of the screening independent variables of all first sample corn leaves and the actual value of the nitrogen content of the first current sample date as a screening data set; Initialize the random forest model; Based on the screening data set and the random forest model, each wavelength within the preset band is screened to obtain each characteristic wavelength; There are 8 characteristic wavelengths, corresponding to 933.92nm, 1405.53nm, 1408.81nm, 1413.18nm, 1416.46nm, 1419.74nm, 1519.03nm, and 1532.58nm.

2. The method for detecting nitrogen content in corn leaves according to claim 1, wherein The environmental data includes: soil moisture content.

3. The method for detecting nitrogen content in corn leaves according to claim 1, wherein Based on the screening data set and the random forest model, each wavelength within the preset band is screened to obtain each characteristic wavelength, including: Divide the screening data set into a pre-set ratio to obtain a screening training set and a screening test set; The random forest model is trained using the actual value of the screening independent variable of each first sample corn leaf in the screening training set as input and the actual value of the nitrogen content of the first current sample date of each first sample corn leaf in the screening training set as output to obtain a pre-trained random forest model; Using the screening test set, determine the baseline value of the negative mean squared error of the pre-trained random forest model; Determine any wavelength within the preset wavelength range as the current wavelength; Performing multiple shuffling on the actual values ​​of the screening independent variables of all first sample corn leaves corresponding to the current wavelength in the screening test set to obtain multiple shuffled screening test sets corresponding to the current wavelength; Determine initial values ​​of negative mean square errors of the pre-trained random forest model at each wavelength within the preset band using a plurality of shuffled screening test sets corresponding to each wavelength within the preset band; Determine an average value of the negative mean square error of the pre-trained random forest model at each wavelength based on the initial value of each negative mean square error of the pre-trained random forest model at each wavelength within the preset band range; Determine the difference between the baseline value of the negative mean square error of the pre-trained random forest model and the average value of the negative mean square error of the pre-trained random forest model at each wavelength, and obtain the importance contribution value corresponding to each wavelength; Based on the importance contribution value corresponding to each wavelength, it is determined to screen each wavelength within the preset band to obtain each characteristic wavelength.

4. The method for detecting nitrogen content in corn leaves according to claim 1, wherein The process of determining the corn leaf nitrogen content detection model includes: Acquire second sample data of a plurality of second sample corn leaves; the second sample data include: actual values ​​of the second sample independent variables on each date in a second sample period and actual values ​​of nitrogen content on a second current sample date; the second sample period includes a second starting sample date to a second current sample date; the second sample independent variables include: leaf spectral data at a plurality of characteristic wavelengths, leaf moisture content, and environmental data; Initialize the convolutional neural network; The actual value of the second sample independent variable of each date in the second sample period of each second sample corn leaf is used as input, and the actual value of the nitrogen content of the second current sample date of each second sample corn leaf is used as output, and a convolutional neural network is trained to obtain the corn leaf nitrogen content detection model.

5. A system for detecting nitrogen content in corn leaves, for implementing the method for detecting nitrogen content in corn leaves according to any one of claims 1 to 4, characterized in that: The corn leaf nitrogen content detection system comprises: A data acquisition module is used to obtain test data of the corn leaves to be tested; the test data includes: leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date in a test period, and the test period includes the start test date to the current test date; A nitrogen content detection module is used to input the detection data of the corn leaves to be tested into a corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be tested on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network; The process of determining each characteristic wavelength includes: Acquire first sample data of a plurality of first sample corn leaves; the first sample data include: actual values ​​of first sample independent variables on each date in a first sample period and actual values ​​of nitrogen content on a first current sample date; the first sample period includes a first starting sample date to a first current sample date; the first sample independent variables include: leaf original spectral data, leaf moisture content, and environmental data; the leaf original spectral data includes leaf spectral data at each wavelength within a preset band range; Determining the actual value of the screening independent variable for each first sample corn leaf based on the actual value of the first sample independent variable on each date in the first sample period of each first sample corn leaf; comprising: determining any first sample corn leaf as a current leaf; Determine the weight of each date in the first sample period of the current leaf based on the actual value of the leaf moisture content on each date in the first sample period of the current leaf; Based on the weights of each date in the first sample period of the current leaf and the actual value of the leaf's original spectral data, the actual value of the mixed spectral data of the current leaf is determined; the mixed spectral data calculation formula is: ; ; in, is mixed spectral data; is the total number of dates in the first sample period, i.e. the total number of days; is the original spectral data of leaves on day i; is the weight of the i-th day; is the leaf moisture content on day i; The actual value of the mixed spectrum data of the current leaf is preprocessed using the multivariate scatter correction-SG filtering method to obtain the actual value of the preprocessed mixed spectrum data; Determine the actual value of the preprocessed mixed spectrum data of the current leaf as the actual value of the screening independent variable of the current leaf; Determine the actual values ​​of the screening independent variables of all first sample corn leaves and the actual value of the nitrogen content of the first current sample date as a screening data set; Initialize the random forest model; Based on the screening data set and the random forest model, each wavelength within the preset band is screened to obtain each characteristic wavelength; There are 8 characteristic wavelengths, corresponding to 933.92nm, 1405.53nm, 1408.81nm, 1413.18nm, 1416.46nm, 1419.74nm, 1519.03nm, and 1532.58nm.

6. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for detecting nitrogen content in corn leaves according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for detecting nitrogen content in corn leaves according to any one of claims 1 to 4 is implemented.

8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for detecting nitrogen content in corn leaves according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Corn water nitrogen content inversion method based on unmanned aerial vehicle multispectral remote sensing

    CN115372286A

  • Method, device and equipment for predicting nitrogen content of field tobacco leaves and storage medium

    CN118243634A