Corn leaf nitrogen content detection method, system and device, medium and product
Through the combination of convolutional neural network and random forest model, the problem of destructive detection of traditional chemical analysis methods is solved, and the lossless and efficient detection of nitrogen content in corn leaves is achieved, which improves detection efficiency and accuracy.
Patent Information
- Application Number
- CN202510724262.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-06-03
AI Technical Summary
Traditional chemical analysis methods to detect the nitrogen content of corn leaves require damage to the leaves and the detection efficiency is low, making it impossible to achieve a timely and efficient nitrogen demand assessment.
The nitrogen content detection model of corn leaf trained by convolutional neural network is used to combine leaf spectral data, moisture content and environmental data to obtain nitrogen content through non-destructive detection methods, and the characteristic wavelength is screened using a random forest model, and pre-processed with multivariate scattering correction and SG filtering methods.
The non-destructive detection of the nitrogen content of corn leaves is achieved, the detection efficiency is improved, and the combined influence of spectrum, moisture content and soil moisture content is comprehensively considered, which improves the accuracy and efficiency of the detection.
Smart Images

Figure CN120275306A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of nutrient detection of corn leaves, and particularly to a method, system, device, medium and product for detecting the nitrogen content of corn leaves. Background Art
[0002] During the growth and development process of corn leaves, through the absorption of nutrients in the soil and the absorption of nitrogen in the applied fertilizers, photosynthesis is utilized to synthesize proteins and nucleic acids to promote its own growth. The demand for nitrogen in corn leaves varies at different growth stages, and the nitrogen content in its body shows dynamic changes. Therefore, the determination of the nitrogen content in corn leaves and the accurate assessment of the nitrogen demand are very important.
[0003] In traditional methods, the detection of the nitrogen content in corn leaves mostly relies on chemical analysis methods, such as the Kjeldahl method and the Dumas combustion method. Chemical analysis methods require destructive sampling in the field and measuring the nitrogen content indoors, and cannot obtain new and timely data. At the same time, chemical analysis methods require the preparation of chemical solutions, and the time cost of measuring each first sample is relatively high. In summary, chemical analysis methods have the problems of requiring leaf destruction 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 to solve the problems of requiring leaf destruction and low detection efficiency.
[0005] To achieve the above purpose, the following solutions are provided in this application.
[0006] In the first aspect, this application provides a method for detecting the nitrogen content of corn leaves, including: Obtaining the detection data of the corn leaves to be measured; the detection data includes: the leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date during the detection period, and the detection period includes the starting detection date to the current detection date; Inputting the detection data of the corn leaves to be measured into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be measured on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.
[0007] In one embodiment, the environmental data includes: soil moisture content.
[0008] In one embodiment, the determination process of each characteristic wavelength includes: Obtain the first sample data of multiple first sample corn leaves; the first sample data includes: the actual values of the first sample independent variables 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 variables include: original leaf spectral data, leaf moisture content, and environmental data, and the original leaf spectral data includes the leaf spectral data at each wavelength within a preset wavelength range; Based on the actual values of the first sample independent variables on each date in the first sample period of each first sample corn leaf, determine the actual values of the independent variables for screening of each first sample corn leaf; Determine the actual values of the independent variables for screening of all first sample corn leaves and the actual value of the nitrogen content on the first current sample date as the dataset for screening; Initialize the random forest model; Based on the dataset for screening and the random forest model, screen each wavelength within the preset wavelength range to obtain each characteristic wavelength.
[0009] In one embodiment, based on the actual values of the first sample independent variables on each date in the first sample period of each first sample corn leaf, determining the actual values of the independent variables for screening of each first sample corn leaf includes: Determine any first sample corn leaf as the current leaf; Based on the actual values of the leaf moisture content on each date in the first sample period of the current leaf, determine the weights on each date in the first sample period of the current leaf; Based on the weights on each date in the first sample period of the current leaf and the actual values of the original leaf spectral data, determine the actual values of the mixed spectral data of the current leaf; Use the multiplicative scatter correction-Savitzky-Golay filtering method to preprocess the actual values of the mixed spectral data of the current leaf to obtain the actual values of the preprocessed mixed spectral data; Determine the actual values of the preprocessed mixed spectral data of the current leaf as the actual values of the independent variables for screening of the current leaf.
[0010] In one embodiment, based on the dataset for screening and the random forest model, screening each wavelength within the preset wavelength range to obtain each characteristic wavelength includes: Divide the dataset for screening according to a preset ratio to obtain a training set for screening and a test set for screening; Use the actual values of the independent variables for screening of each first sample corn leaf in the training set for screening as the input, and use the actual values of the nitrogen content on the first current sample date of each first sample corn leaf in the training set for screening as the output to train the random forest model to obtain a pre-trained random forest model; Using a test set for screening, determine the benchmark value of the negative mean squared error of the pre-trained random forest model; Determine any wavelength within a preset wavelength range as the current wavelength; Perform multiple shuffles on the actual values of the screening independent variables of all the first sample corn leaves corresponding to the current wavelength in the test set for screening, to obtain multiple shuffled test sets for screening corresponding to the current wavelength; Respectively use the multiple shuffled test sets for screening corresponding to each wavelength within the preset wavelength range to determine multiple initial values of the negative mean squared error of the pre-trained random forest model at each wavelength within the preset wavelength range; Respectively based on the initial values of the negative mean squared error of the pre-trained random forest model at each wavelength within the preset wavelength range, determine the average value of the negative mean squared error of the pre-trained random forest model at each wavelength; Respectively determine the difference between the benchmark value of the negative mean squared error of the pre-trained random forest model and the average value of the negative mean squared error of the pre-trained random forest model at each wavelength, to obtain the importance contribution value corresponding to each wavelength; Based on the importance contribution values corresponding to each wavelength, determine the screening of each wavelength within the preset wavelength range to obtain each characteristic wavelength.
[0011] In one embodiment, the determination process of the corn leaf nitrogen content detection model includes: Obtain the second sample data of multiple second sample corn leaves; the second sample data includes: the actual values of the second sample independent variables 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 variables include: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths; Initialize the convolutional neural network; Using the actual values of the second sample independent variables on each date in the second sample period of each second sample corn leaf as the input, and using the actual value of the nitrogen content on the second current sample date of each second sample corn leaf as the output, train the convolutional neural network to obtain the corn leaf nitrogen content detection model.
[0012] In a second aspect, the present application provides a corn leaf nitrogen content detection system to implement the corn leaf nitrogen content detection method described in any one of the above, and the corn leaf nitrogen content detection system includes: A data acquisition module for obtaining the detection data of the corn leaf to be measured; the detection data includes: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths on each date in the detection period, and the detection period includes the starting detection date to the current detection date; A nitrogen content detection module is used to input the detection data of the corn leaves to be measured into a corn leaf nitrogen content detection model, so as to obtain the detection value of the nitrogen content of the corn leaves to be measured on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.
[0013] In a third aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to implement the corn leaf nitrogen content detection method described in any one of the above.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the corn leaf nitrogen content detection method described in any one of the above.
[0015] In a fifth aspect, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the corn leaf nitrogen content detection method described in any one of the above.
[0016] According to the specific embodiments provided by the present application, the following technical effects are disclosed in the present application: The present application discloses a method, system, device, medium and product for detecting the nitrogen content of corn leaves. First, the detection data of the corn leaves to be measured is obtained; the detection data includes: leaf spectral data, leaf moisture content and environmental data at multiple characteristic wavelengths on each date during the 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 measured is input into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be measured 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 measured into the corn leaf nitrogen content detection model obtained by training a convolutional neural network, and the detection value of the nitrogen content can be obtained. 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 the detection efficiency while realizing non-destructive detection. Description of the Drawings
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0018] Figure 1This is an application environment diagram of a method for detecting nitrogen content in corn leaves in an embodiment of the present application.
[0019] Figure 2 This is a schematic flow diagram of a method for detecting nitrogen content in corn leaves provided in an embodiment of the present application.
[0020] Figure 3 This is a schematic diagram of mixed spectral data.
[0021] Figure 4 This is a schematic diagram of the preprocessed mixed spectral data.
[0022] Figure 5 This is a schematic diagram of the characteristic wavelength distribution of leaf nitrogen content.
[0023] Figure 6 This is a schematic diagram of the convolutional neural network structure.
[0024] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Detailed implementation manners
[0025] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0026] The purpose of the present application is to provide a method, system, device, medium and product for detecting nitrogen content in corn leaves, aiming to improve the detection efficiency while realizing non-destructive detection.
[0027] To make the above objects, features and advantages of the present application more obvious and understandable, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0028] The method for detecting nitrogen content in corn leaves provided in the embodiments of the present application can be applied as Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set separately, integrated on the server 104, placed on the cloud or other servers. The terminal 102 can send the detection data of the corn leaf to be measured to the server 104. After the server 104 receives the detection data of the corn leaf to be measured, for the detection data of the corn leaf to be measured, the server 104 inputs the detection data of the corn leaf to be measured into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaf to be measured on the current detection date. The server 104 can feedback the obtained detection value of the nitrogen content of the corn leaf to be measured on the current detection date to the terminal 102. In addition, in some embodiments, the corn leaf nitrogen content detection method can also be implemented by the server 104 or the terminal 102 alone. For example, the terminal 102 can directly perform the corn leaf nitrogen content detection on the detection data of the corn leaf to be measured, or the server 104 can obtain the detection data of the corn leaf to be measured from the data storage system and perform the corn leaf nitrogen content detection on the detection data of the corn leaf to be measured.
[0029] In an exemplary embodiment, as Figure 2 shown, a method for detecting the nitrogen content of corn leaves is provided, including step 1-step 2.
[0030] Step 1: Obtain the detection data of the corn leaf to be measured.
[0031] Among them, the detection data includes: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths on each date during the detection period. The detection period includes the starting detection date to the current detection date.
[0032] Specifically, when obtaining the leaf spectral data, the middle part of the corn leaf is used as the measurement point, and a hyperspectrometer is used to obtain the leaf hyperspectral data (i.e., reflectance) of the corn.
[0033] When obtaining the leaf moisture content, after daily observation, a small area of corn leaf is cut, its fresh weight is first weighed, and its dry weight is weighed after drying, and the leaf moisture percentage is calculated to obtain the leaf moisture content.
[0034] As an optional implementation manner, the environmental data includes: soil moisture content.
[0035] Specifically, a soil sensor is used to collect the soil moisture content.
[0036] As an optional implementation manner, the determination process of each characteristic wavelength includes steps 11-15.
[0037] Step 11: Obtain the first sample data of multiple first sample maize leaves; the first sample data includes: the actual values of the first sample independent variables for 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 variables include: original leaf spectral data, leaf moisture content, and environmental data, and the original leaf spectral data includes the leaf spectral data at each wavelength within a preset wavelength range.
[0038] Specifically, the preset wavelength range is 900nm - 1700nm. The nitrogen content is obtained by sampling, drying, grinding, and measuring with the Kjeldahl method on the first sample maize leaves.
[0039] Collect the first sample data at 12:00 - 14:00 every day, and measure the surface of the maize leaves in a contact manner using a spectrometer. Taking the length of the maize leaf vein as a reference, select the area of ±5 cm from the midpoint of the leaf vein as the measurement range. The spectrometer selects two points on both sides of the leaf vein for measurement respectively, and each measurement point is measured three times repeatedly, and a total of six hyperspectral data are obtained. Take the average of the six hyperspectral data as the original leaf spectral data.
[0040] Cut a circular leaf sample with a diameter of 1 cm in the spectral measurement area, weigh the leaf sample using an analytical balance (sensitivity 0.001 g), and record its fresh weight data. Put the leaf into an oven and dry it at a constant temperature of 75°C, and weigh its dry weight data after the leaf is completely dehydrated.
[0041] Leaf moisture content The calculation formula is: .
[0042] Wherein, is the fresh weight; is the dry weight.
[0043] Step 12: Based on the actual values of the first sample independent variables for each date in the first sample period of each first sample maize leaf, determine the actual values of the independent variables for screening of each first sample maize leaf.
[0044] As an optional implementation manner, step 12 includes step 121 - step 125.
[0045] Step 121: Determine any one of the first sample maize leaves as the current leaf.
[0046] Step 122: Based on the actual values of the leaf moisture content for each date in the first sample period of the current leaf, determine the weights for each date in the first sample period of the current leaf.
[0047] Step 123: Determine the actual value of the mixed spectral 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 original spectral data of the leaf.
[0048] Specifically, use the mixed spectral data calculation formula to determine the actual value of the mixed spectral data of the current leaf according to the weights of each date in the first sample period of the current leaf and the actual value of the original spectral data of the leaf. The mixed spectral data calculation formula is: 。
[0049] 。
[0050] Among them, is the mixed spectral data; is the total number of dates in the first sample period, that is, the total number of days; is the original spectral data of the leaf on the i-th day; is the weight on the i-th day; is the moisture content of the leaf on the i-th day.
[0051] Step 124: Use the multiplicative scatter correction (MSC)-Savitzky-Golay (SG) filtering method to preprocess the actual value of the mixed spectral data of the current leaf to obtain the actual value of the preprocessed mixed spectral data.
[0052] Specifically, the mixed spectral data and the preprocessed mixed spectral data are respectively as Figure 3 and Figure 4 shown. Figure 3 and Figure 4 In, the horizontal axis is the wavelength and the vertical axis is the reflectance.
[0053] Step 125: Determine the actual value of the independent variable for screening of the current leaf as the actual value of the preprocessed mixed spectral data of the current leaf.
[0054] Step 13: Determine the actual value of the independent variable for screening of all the first sample maize leaves and the actual value of the nitrogen content of the first current sample date as the dataset for screening.
[0055] Step 14: Initialize the random forest (RF) model.
[0056] Step 15: Based on the dataset for screening and the random forest model, screen each wavelength within the preset wavelength range to obtain each characteristic wavelength.
[0057] As an optional implementation manner, Step 15 includes Step 151 - Step 159.
[0058] Step 151: Divide the dataset for screening according to a preset ratio to obtain a training set for screening and a test set for screening.
[0059] Step 152: Use the actual values of the independent variables for screening of each first-sample corn leaf in the training set for screening as the input, and use the actual values of the nitrogen content of the first current sample date of each first-sample corn leaf in the training set for screening as the output to train the random forest model to obtain a pre-trained random forest model.
[0060] Step 153: Use the test set for screening to determine the benchmark value of the negative mean squared error of the pre-trained random forest model.
[0061] Step 154: Determine any wavelength within the preset wavelength range as the current wavelength.
[0062] Step 155: Shuffle the actual values of the independent variables for screening of all first-sample corn leaves corresponding to the current wavelength in the test set for screening multiple times to obtain multiple shuffled test sets for screening corresponding to the current wavelength.
[0063] Step 156: Use the multiple shuffled test sets for screening corresponding to each wavelength within the preset wavelength range to determine multiple initial values of the negative mean squared error of the pre-trained random forest model at each wavelength within the preset wavelength range.
[0064] Step 157: Based on the initial values of the negative mean squared error of the pre-trained random forest model at each wavelength within the preset wavelength range, determine the average value of the negative mean squared error of the pre-trained random forest model at each wavelength.
[0065] Step 158: Determine the difference between the benchmark value of the negative mean squared error of the pre-trained random forest model and the average value of the negative mean squared error of the pre-trained random forest model at each wavelength to obtain the importance contribution value corresponding to each wavelength.
[0066] Step 159: Based on the importance contribution values corresponding to each wavelength, determine the screening of each wavelength within the preset wavelength range to obtain each characteristic wavelength. Specifically, it includes: sorting each wavelength within the preset wavelength range in descending order according to the importance contribution value; based on the preset cumulative contribution threshold and the sorted wavelengths within the preset wavelength range, determine each characteristic wavelength.
[0067] Specifically, the number of decision trees in 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 independent variables for screening and the actual value of the nitrogen content of the current sample date for the test sample corn leaves. The values of the first sample period at a certain wavelength in the spectrum of the test set are randomly sorted. If the prediction of leaf nitrogen content is highly dependent on the randomly shuffled wavelength column, the prediction accuracy of the random forest model will be significantly attenuated. After shuffling the order of the spectral values at a certain wavelength (the spectral values of a certain wavelength column are randomly shuffled, and the values of other wavelength columns and the leaf nitrogen column remain unchanged), 10 repetitions are set, and the nMSEs of the random forest models obtained from the 10 repetitions are averaged to obtain , to avoid the existence of contingency. Based on the nMSE, the importance contribution value is determined , and the formula is: .
[0068] Among them, is the benchmark value of the negative mean squared error of the pre-trained random forest model; is the average value of the negative mean squared errors of the pre-trained random forest models at each wavelength.
[0069] The characteristic wavelengths are sorted from largest to smallest according to importance. With 85% as the preset cumulative contribution threshold, the first j characteristic wavelengths are obtained, and the characteristic wavelength indexes are obtained by combining the wavelength data. The number of finally selected characteristic wavelengths is 8, corresponding to 933.92nm, 1405.53nm, 1408.81nm, 1413.18nm, 1416.46nm, 1419.74nm, 1519.03nm, 1532.58nm respectively. The characteristic wavelength distribution is as Figure 5 shown. Figure 5 In it, the horizontal axis is the wavelength and the vertical axis is the reflectance.
[0070] Step 2: Input the detection data of the corn leaves to be measured into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be measured on the current detection date.
[0071] Among them, the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.
[0072] Specifically, after combining the leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths in the detection period of the detection data of the corn leaves to be measured in parallel, they are input into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be measured on the current detection date.
[0073] As an alternative implementation, the process of determining the corn leaf nitrogen content detection model includes steps 21 - 23.
[0074] Step 21: Obtain the second sample data of multiple second sample corn leaves; the second sample data includes: the actual values of the second sample independent variables 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 variables include: leaf spectral data at multiple characteristic wavelengths, leaf moisture content, and environmental data.
[0075] Step 22: Initialize the convolutional neural network.
[0076] Specifically, as Figure 6 shown, the convolutional neural network includes: an input layer, a first batch normalization layer, a first one-dimensional convolutional layer (with 64 convolutional kernels and a kernel size of 3, and the padding mode is selected as same), a second batch normalization layer, a first ReLu activation function, a first max pooling layer (with a pooling window size set to 2 and a stride set to 2), a second one-dimensional convolutional layer (with 31 convolutional kernels and a kernel size of 3, and the padding mode is selected as same), a third batch normalization layer, a second ReLu activation function, a third one-dimensional convolutional layer (with 16 convolutional kernels and a kernel size of 3, and the padding mode is selected as same), a second max pooling layer (with a pooling window size set to 2 and a stride set to 2), a third ReLu activation function, a random dropout layer (with a dropout rate set to 0.02), a first fully connected layer (with an output dimension of 32), a second fully connected layer (with an output dimension of 16), and an output layer.
[0077] Specifically, after inputting the leaf spectral data at multiple characteristic wavelengths, leaf moisture content, and environmental data into the convolutional neural network, the processing process of the input layer for the forward features (including leaf spectral data) and the reverse features (including leaf moisture content and environmental data) includes: (1) The processing process for the forward features is: First, perform min-max normalization according to the importance contribution value to obtain the weight coefficients of each characteristic wavelength. The formula is: .
[0078] Where, is the weight coefficient of the kth characteristic wavelength; is the importance contribution value of the kth characteristic wavelength, is the minimum value among the importance contribution values of all characteristic wavelengths, is the maximum value among the importance contribution values of all characteristic wavelengths.
[0079] Then, perform non - linear transformation on the mixed spectral data corresponding to each characteristic wavelength to amplify the positive contribution of positive characteristics to the detection of corn leaves. The formula is: .
[0080] Where, is the non - linearly transformed mixed spectral data corresponding to the k - th characteristic wavelength; is the mixed spectral data corresponding to the k - th characteristic wavelength; is the natural constant.
[0081] (2) The processing process for any reverse characteristic is as follows: Perform transformation on the reverse characteristic to achieve compression of characteristic data. The transformation formula for the reverse characteristic is as follows: .
[0082] Where, is the transformed leaf moisture content or environmental data on the i - th day; is the leaf moisture content or environmental data on the i - th day.
[0083] Leaf spectrum is a comprehensive reflection of the leaf growth state, which characterizes the interaction of soil moisture content, leaf moisture content and leaf nitrogen content. Therefore, in the detection of leaf nitrogen content, positive and reverse characteristics should be considered comprehensively. The advanced characteristics and correlation relationships of leaf spectrum, leaf moisture content and soil moisture content are further explored in the convolutional neural network.
[0084] Step 23: Use the actual values of the second - sample independent variables on each date in the second - sample period of each second - sample corn leaf as input, and the actual value of the nitrogen content on the second - current - sample date of each second - sample corn leaf as output to train the convolutional neural network to obtain a corn - leaf nitrogen - content detection model.
[0085] Specifically, during training, among the hyperparameters of the convolutional neural network, the initial learning rate is set to 0.001, the total number of training times is set to 200. The loss function is set to MSE, the optimizer is selected as Adam, and the weight decay coefficient of L2 regularization is set to 1e - 6. Construct a learning rate scheduler to monitor the loss value of the convolutional neural network, set the monitoring index to the minimum validation loss. When the validation loss does not improve after 10 Epochs, trigger a learning rate decrease and halve the learning rate. Given the minimum learning rate, if the learning rate is less than 1e - 6, the learning rate is not adjusted. Initialize the early - stopping mechanism to avoid overfitting of the network on the training set. When the learning rate remains unchanged for 20 training processes, trigger the early - stopping mechanism to end the network training.
[0086] Use the validation set to determine the mean absolute percentage error of the corn leaf nitrogen content detection model. The formula for the mean absolute percentage error is as follows: .
[0087] Wherein, is the mean absolute percentage error; is the number of sample corn leaves in the validation set; is the detected value of the nitrogen content of the a-th sample corn leaf; is the actual value of the nitrogen content of the a-th sample corn leaf.
[0088] Using the method of the present application, it is possible to determine the detected value of the nitrogen content of the corn leaf to be measured on the N-th day (i.e., the current detection date) by using 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 N-th day of the corn leaf to be measured.
[0089] In an exemplary embodiment, a corn leaf nitrogen content detection system is provided to implement the corn leaf nitrogen content detection method. The corn leaf nitrogen content detection system includes: A data acquisition module for acquiring the detection data of the corn leaf to be measured; the detection data includes: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths on each date during the detection period, and the detection period includes the starting detection date to the current detection date.
[0090] A nitrogen content detection module for inputting the detection data of the corn leaf to be measured into the corn leaf nitrogen content detection model to obtain the detected value of the nitrogen content of the corn leaf to be measured on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.
[0091] In an exemplary embodiment, a computer device is provided, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to implement the corn leaf nitrogen content detection method.
[0092] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the corn leaf nitrogen content detection method is implemented.
[0093] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the corn leaf nitrogen content detection method is implemented.
[0094] In an exemplary embodiment, a computer device is provided. The computer device can be a server or a terminal, and its internal structure diagram can be as shown in Figure 7 The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, 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 the 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 external devices. 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, it implements a method for detecting the nitrogen content in corn leaves.
[0095] Those skilled in the art can understand that Figure 7 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0096] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing 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 embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0097] The databases involved in the various embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the various embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0098] 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 for analysis, stored data, displayed data, etc.) involved in the present application are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0099] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, 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, it should be considered to be within the scope described in this specification.
[0100] In this text, specific examples are used to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. At the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. To sum up, the content of this specification should not be construed as a limitation to this application.
Claims
1. A method for detecting the nitrogen content in corn leaves, characterized in that The method for detecting the nitrogen content of corn leaves includes: Obtaining the detection data of the corn leaves to be measured; the detection data includes: the leaf spectral data at multiple characteristic wavelengths, the leaf moisture content, and the environmental data on each date during the detection period, and the detection period includes the starting detection date to the current detection date; Inputting the detection data of the corn leaves to be measured into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaves to be measured on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.
2. The method for detecting the 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 The determination process of each characteristic wavelength includes: Obtaining the first sample data of multiple first sample corn leaves; the first sample data includes: the actual values of the first sample independent variables on each date during 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 variables include: the original leaf spectral data, the leaf moisture content, and the environmental data, and the original leaf spectral data includes the leaf spectral data at each wavelength within a preset wavelength range; Respectively determining the actual values of the selected independent variables of each first sample corn leaf based on the actual values of the first sample independent variables on each date during the first sample period of each first sample corn leaf; Determining the actual values of the selected independent variables of all first sample corn leaves and the actual value of the nitrogen content on the first current sample date as the selected data set; Initializing a random forest model; Based on the selected data set and the random forest model, screening each wavelength within the preset wavelength range to obtain each characteristic wavelength.
4. The method for detecting the nitrogen content in corn leaves according to claim 3, wherein Respectively determining the actual values of the selected independent variables of each first sample corn leaf based on the actual values of the first sample independent variables on each date during the first sample period of each first sample corn leaf, including: Determining any first sample corn leaf as the current leaf; Based on the actual values of the leaf moisture content on each date during the first sample period of the current leaf, determining the weights on each date during the first sample period of the current leaf; Based on the weights on each date during the first sample period of the current leaf and the actual values of the original leaf spectral data, determining the actual values of the mixed spectral data of the current leaf; Using the multiplicative scatter correction-Savitzky-Golay filtering method to preprocess the actual values of the mixed spectral data of the current leaf to obtain the actual values of the preprocessed mixed spectral data; Determining the actual values of the preprocessed mixed spectral data of the current leaf as the actual values of the selected independent variables of the current leaf.
5. The method for detecting nitrogen content in corn leaves according to claim 3, wherein Based on the selected data set and the random forest model, screening each wavelength within the preset wavelength range to obtain each characteristic wavelength, including: Dividing the selected data set according to a preset ratio to obtain a selected training set and a selected test set; Using the actual values of the selected independent variables of each first sample corn leaf in the selected training set as the input and the actual values of the nitrogen content on the first current sample date of each first sample corn leaf in the selected training set as the output to train the random forest model to obtain a pre-trained random forest model; Using a test set for screening, determine the baseline value of the negative mean squared error of the pre-trained random forest model; Determine any wavelength within a preset wavelength range as the current wavelength; Perform multiple shuffles on the actual values of the screening independent variables of all the first sample corn leaves corresponding to the current wavelength in the test set for screening, to obtain multiple shuffled test sets for screening corresponding to the current wavelength; Respectively use the multiple shuffled test sets for screening corresponding to each wavelength within the preset wavelength range to determine multiple initial values of the negative mean squared error of the pre-trained random forest model at each wavelength within the preset wavelength range; Based on the initial values of the negative mean squared error of the pre-trained random forest model at each wavelength within the preset wavelength range, respectively determine the average value of the negative mean squared error of the pre-trained random forest model at each wavelength; Respectively determine the difference between the baseline value of the negative mean squared error of the pre-trained random forest model and the average value of the negative mean squared error of the pre-trained random forest model at each wavelength, to obtain the importance contribution value corresponding to each wavelength; Based on the importance contribution values corresponding to each wavelength, determine the screening of each wavelength within the preset wavelength range to obtain each characteristic wavelength.
6. The method for detecting the nitrogen content of corn leaves according to claim 1, wherein, The determination process of the corn leaf nitrogen content detection model includes: Obtain the second sample data of multiple second sample corn leaves; the second sample data includes: the actual values of the second sample independent variables 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 from the second starting sample date to the second current sample date; the second sample independent variables include: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths; Initialize the convolutional neural network; Using the actual values of the second sample independent variables on each date in the second sample period of each second sample corn leaf as the input, and the actual value of the nitrogen content on the second current sample date of each second sample corn leaf as the output, train the convolutional neural network to obtain the corn leaf nitrogen content detection model.
7. A corn leaf nitrogen content detection system for implementing the corn leaf nitrogen content detection method according to any one of claims 1-6, characterized in that, The corn leaf nitrogen content detection system includes: A data acquisition module for obtaining detection data of the corn leaf to be measured; the detection data includes: leaf spectral data, leaf moisture content, and environmental data at multiple characteristic wavelengths on each date in the detection period, and the detection period includes from the starting detection date to the current detection date; A nitrogen content detection module for inputting the detection data of the corn leaf to be measured into the corn leaf nitrogen content detection model to obtain the detection value of the nitrogen content of the corn leaf to be measured on the current detection date; the corn leaf nitrogen content detection model is obtained by training a convolutional neural network.
8. A computer device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the corn leaf nitrogen content detection method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the corn leaf nitrogen content detection method according to any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the corn leaf nitrogen content detection method according to any one of claims 1-6.
Citation Information
Patent Citations
Crop yield estimation method combining machine vision and crop model
CN113705937A
Corn water nitrogen content inversion method based on unmanned aerial vehicle multispectral remote sensing
CN115372286A
Corn planting soil nitrogen nutrient content measuring and calculating method based on satellite remote sensing data
CN118070245A
Method, device and equipment for predicting nitrogen content of field tobacco leaves and storage medium
CN118243634A
Inversion method of SPAD value and nitrogen concentration of leaves in whole growth period of rice based on hyperspectral technology
CN119666758A