Method and System for Rapid Detection of Field Fertility Based on Transfer Learning of Soil Two-Dimensional Spectrum Data

Through soil two-dimensional spectrum data transfer learning, short-term Fourier transform and improved Inception-v4 neural network model are used to solve the data requirements and universality problems of deep neural networks when detecting in different regions, and achieve fast and accurate field fertility detection.

CN116205147BActive Publication Date: 2025-07-18SOUTHEAST UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310318143.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2025-07-18
Estimated Expiration
2043-03-29

AI Technical Summary

Technical Problem

In the prior art, deep neural networks need to establish a huge data set every time they replace the target area to be tested, resulting in complex model training and poor versatility, which cannot meet the needs of rapid detection of large-scale soil samples.

Method used

The soil two-dimensional spectrum data transfer learning method is adopted, and the one-dimensional spectrum is converted into a two-dimensional spectrum map through short-time Fourier transform and bicubital interpolation. Combined with SS-MSC preprocessing and improved Inception-v4 neural network model, adaptive tuning is performed to realize the transfer learning of the model.

Benefits of technology

It improves the efficiency and accuracy of field fertility detection, solves the problems of excessive demand for model training data and poor versatility, and achieves fast and accurate detection of all nitrogen, all phosphorus and all potassium content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116205147B_ABST
    Figure CN116205147B_ABST
Patent Text Reader

Abstract

The invention discloses a method and system for rapid detection of field fertility based on soil two-dimensional spectrum data migration learning. Firstly, spectrum data is input into a spectrum data two-dimensionalization module, and bicubic interpolation is performed according to short-time Fourier transform to convert a one-dimensional spectrum into a two-dimensional spectrum graph; the processed two-dimensional spectrum graph is input into an SS-MSC preprocessing module, and two-dimensional standardization processing and two-dimensional multivariate scattering correction processing are performed on the image in sequence; based on an improved Inception-v4 soil nitrogen, phosphorus and potassium content detection network model, pre-training of a neural network is completed according to a pre-training data set; finally, the neural network model is adaptively tuned according to soil nitrogen, phosphorus and potassium content data of a field standard sample point, migration of the neural network model is completed, and rapid detection of field fertility is realized; the problems of too much priori data of a farmland to be tested required for training a prediction model in an existing method and poor universality of the model for different soil types are solved, and the efficiency and accuracy of field fertility detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of soil detection and plant nutrition, and mainly relates to a method and system for rapid detection of field fertility based on transfer learning of soil two-dimensional spectral data. Background Art

[0002] Precision agriculture requires that the nitrogen, phosphorus, and potassium contents in farmland soil be relatively balanced with the needs of crops. Rapid and accurate measurement of the nitrogen, phosphorus, and potassium contents in soil has become an inevitable trend in the development of precision agriculture.

[0003] Traditional chemical detection methods detect the nitrogen, phosphorus, and potassium components in soil by preparing the soil into a solution and adding a series of chemical reagents. The detection time is up to several hours, and the operation is complex, which cannot meet the requirements of rapid detection of large-scale soil samples under the conditions of precision agriculture. In recent years, with the development of computer technology and spectral detection technology, using soil spectral information and machine learning to establish a prediction model for the nitrogen, phosphorus, and potassium components in soil provides a rapid and accurate technical method for soil detection. However, traditional machine learning methods such as Partial Least Squares Regression (PLSR), Support Vector Machine Regression (SVR), and Random Forest Regression (RFR) can only establish a linear regression model between the spectrum and the nitrogen, phosphorus, and potassium content information. Ignoring the non-linear relationship between variables will result in a low model accuracy; while deep learning network models such as convolutional neural networks can establish a non-linear mapping relationship between variables, but they need to establish a large training data set for the target land to be measured, and the model can only predict the soil in a certain fixed area, with poor generality. Every time the target area to be measured is changed, a large training data set needs to be re-established. Summary of the Invention

[0004] In view of the problem that a huge dataset needs to be established every time the target area to be measured is changed in the existing deep neural network, the present invention provides a method and system for rapid detection of field fertility based on transfer learning of soil two-dimensional spectrum data. First, the spectral data is input into the spectral data two-dimensionalization module, and according to the short-time Fourier transform, the spectral data is converted into a spectrogram, and then bicubic interpolation is performed to convert the one-dimensional spectrum into a two-dimensional spectrogram. The processed two-dimensional spectrogram is input into the SS-MSC preprocessing module, and the image is sequentially subjected to two-dimensional standardization processing and two-dimensional multiplicative scatter correction processing. Based on the improved Inception-v4 soil nitrogen, phosphorus, and potassium content detection network model, the neural network is pre-trained according to the pre-training dataset, and finally, the neural network model is adaptively optimized according to the soil nitrogen, phosphorus, and potassium content data of the field standard sample points to complete the transfer of the neural network model and realize the rapid detection of field fertility. The problems of excessive prior data of the measured farmland required for training the prediction model in the existing method and poor universality of the model for different soil types are solved, and the detection efficiency and accuracy of total nitrogen, total phosphorus, and total potassium content in the field are improved.

[0005] To achieve the above object, the technical solution adopted by the present invention is: A rapid detection system for field fertility based on transfer learning of soil two-dimensional spectrum data, at least including: a spectral data two-dimensionalization module, an SS-MSC preprocessing module, and an improved Inception-v4-based soil nitrogen, phosphorus, and potassium content detection network model.

[0006] The spectral data two-dimensionalization module: realized by short-time Fourier transform and bicubic interpolation, converting the one-dimensional spectrum into a two-dimensional spectrogram.

[0007] The SS-MSC preprocessing module: performs two-dimensional standardization on the spectrogram processed in the spectral data two-dimensionalization module, and then performs two-dimensional multiplicative scatter correction processing.

[0008] The improved Inception-v4-based soil nitrogen, phosphorus, and potassium content detection network model: includes two stages, a main path and a branch path. The main path contains 1 stem module, 4 Inception-A modules, and 1 Reduction-A module connected in sequence, responsible for identifying the common features of total nitrogen, total phosphorus, and total potassium. The branch path is composed of 3 identical links, including 7 Inception-B modules, 1 Reduction-B module, 3 Inception-C modules, a Dropout module, 1 Flatten layer, and 2 InnerProduct connected in sequence. The three branch paths are responsible for identifying the individual features of total nitrogen, total phosphorus, and total potassium.

[0009] The system completes pre-training on a pre-training dataset of the spectra and nitrogen, phosphorus, and potassium content information of different types of field soils through a soil nitrogen, phosphorus, and potassium content detection network model based on the improved Inception-v4. Then, it uses a transfer training algorithm for adaptive tuning based on the soil content information of standard sample points in the field to complete the transfer of the two-dimensional neural network model and achieve rapid detection of field fertility.

[0010] As an improvement of the present invention, in the soil nitrogen, phosphorus, and potassium content detection network model based on the improved Inception-v4,

[0011] In the main path stage, first, the two-dimensional spectrogram is input into the stem module and then outputs a feature map. The feature map is sequentially input into 4 Inception-A modules and a Reduction-A module and then enters the branch for processing. Among them, the Inception-A module does not change the size and number of channels of the feature map; the Reduction-A module reduces the size of the feature map and increases the number of channels.

[0012] In the branch stage, the feature map enters 7 consecutive Inception-B modules after passing through the main path, and after recognition, it outputs a feature map. Then it enters the Redunction-B module, and after reducing the size, it outputs a new feature map. Then it enters 3 consecutive Inception-C modules to further extract features in different scale feature fields. Subsequently, the feature map enters a Dropout module with a dropout rate of 20%, randomly losing 20% of the neurons during each training to prevent overfitting of the model. The feature map is input into the Flatten layer, and all feature map matrices are stretched and spliced into a one-dimensional vector. It is input into a fully connected layer with an output of 1×100, and finally input into the last fully connected layer to respectively output the content values of total nitrogen, total phosphorus, and total potassium.

[0013] To achieve the above object, the technical solution adopted by the present invention is: a method for rapid detection of field fertility based on transfer learning of soil two-dimensional spectral data, including the following steps:

[0014] S1: Input the spectral data into the spectral data two-dimensionalization module. According to the short-time Fourier transform and using the Hamming window as the window function, convert the spectral data into a spectrogram, and then perform bicubic interpolation to convert the one-dimensional spectrum into a two-dimensional spectrogram.

[0015] S2: Input the two-dimensional spectrogram processed in step S1 into the SS-MSC preprocessing module, and sequentially perform two-dimensional standardization processing and two-dimensional multiplicative scatter correction processing on the picture.

[0016] S3: Based on the improved Inception-v4 soil nitrogen, phosphorus, and potassium content detection network model, complete the pre-training of the neural network according to the pre-training dataset. The network model includes two stages: the main path and the branch path, and simultaneously predict the total nitrogen, total phosphorus, and total potassium content of the soil.

[0017] S4: According to the soil nitrogen, phosphorus, and potassium content data of the standard sample points in the field, perform adaptive tuning on the neural network model in step S3, complete the migration of the neural network model, and achieve rapid detection of field fertility. The migration of the neural network model is specifically as follows: Use the neural network model generated in step S3 to detect the soil at the standard sample points in the field, calculate the detection error at this point, and continuously update the output layer and the last hidden layer of the neural network model using the gradient descent of the error loss function.

[0018] As an improvement of the present invention, the conversion of the spectral data into a spectrogram according to the short-time Fourier transform in step S1 is specifically as follows:

[0019]

[0020] where x[n] is the spectral sequence, w[n] is the window function, the length of the window function is N, l is the frame number, and H represents the hop size between different frames.

[0021] Among them, the Hamming window function is:

[0022]

[0023] As another improvement of the present invention, after step S1 undergoes bicubic interpolation, the image is expanded to a size of 300×300 pixels. The bicubic interpolation is specifically as follows:

[0024]

[0025] where F is the interpolated image, v and u are the relative coordinates of the interpolated points, f is the image before interpolation, r and c are the row and column numbers around the original pixel points respectively, and S is the convolution kernel.

[0026] As another improvement of the present invention, step S2 specifically includes:

[0027] S21: Perform two-dimensional standardization on the two-dimensional spectrogram image generated in step S1. The standardization method is:

[0028]

[0029] where X is the two-dimensional spectrogram generated in step S1, S is the spectrogram generated after standardization, μ is the mean of all pixels, σ is the standard deviation of all pixels, and N is the number of pixels in each image.

[0030] S22: Then perform two-dimensional multiplicative scatter correction processing on it: First, generate a standard spectrum n is the number of spectra, and the average value of its j-th row is The selected standard fitting function is: where b j is the baseline translation amount, and m j is the offset amount, and their values are:

[0031]

[0032] Let B i = [b i,1 b i,2 … b i,j T , then the i-th image generated after correction is:

[0033]

[0034] As another improvement of the present invention, in the soil nitrogen, phosphorus, and potassium content detection network model based on the improved Inception-v4 in step S3,

[0035] In the main path stage, first, the two-dimensional frequency spectrum diagram is input into the stem module and then outputs a feature map. The feature map is sequentially input into 4 Inception-A modules and the Reduction-A module and then enters the branch for processing; among them, the Inception-A module does not change the size and number of channels of the feature map; the Reduction-A module reduces the size of the feature map and increases the number of channels;

[0036] In the branch stage, the feature map enters 7 consecutive Inception-B modules after passing through the main path, and after recognition, it outputs a feature map. Then it enters the Redunction-B module and outputs a new feature map after reducing the size. Then it enters 3 consecutive Inception-C modules to further extract features in different scale feature fields; then the feature map enters the Dropout module with a dropout rate of 20%, randomly losing 20% of the neurons each time training, so as to prevent overfitting of the model; the feature map is input into the Flatten layer, and all feature map matrices are stretched and spliced into a one-dimensional vector; input into a fully connected layer with an output of 1×100, and finally input into the last fully connected layer, and the content values of total nitrogen, total phosphorus, and total potassium are output respectively.

[0037] As another improvement of the present invention, in step S4, record the error vectors of the output layer and the last hidden layer as:

[0038]

[0039] where, δ * ​is the output layer error, is the loss function, is the predicted value of the output, y is the true value of the verification point, σ(z * ) is the activation function, z * The neuron input of the output layer; δ is the error of the last hidden layer, w is the weight matrix of the last hidden layer, and z is the input matrix of the last hidden layer;

[0040] The parameters of each neuron in the above two layers are updated in reverse until the output error is less than the set value and the deviation b of the output layer is * and weight w * The update method is as follows:

[0041]

[0042] The b bias and w weights of the last hidden layer are updated as follows:

[0043]

[0044] Among them, α is the learning rate and a is the output vector of the last hidden layer.

[0045] Compared with the prior art, the present invention provides a method and system for rapid detection of field fertility based on soil two-dimensional spectrum data transfer learning, which has the following beneficial effects:

[0046] 1. This law integrates soil testing technology and plant nutrition technology from multiple fields, and has strong versatility and excellent transferability.

[0047] 2. Before using the neural network for prediction, the method in this case first converts the one-dimensional spectral data into a two-dimensional spectrum diagram, thereby expanding the spectral features to the frequency domain and spectral domain, increasing the feature dimensions that the neural network can recognize, and improving the network's convergence speed and detection accuracy.

[0048] 3. In this method, the network model is first pre-trained with a large-scale source domain data set, and then the training parameters on the main path of the model are fixed. Only the standard sample point data of the target field to be tested is needed to complete the modeling of the prediction model of the fertility of the target field to be tested. This solves the problem of needing to collect a large number of target soil samples to establish an accurate field fertility prediction model, improves modeling efficiency, and effectively reduces detection costs.

[0049] 4. This method solves the problems of excessive prior data of the farmland to be tested required for training the prediction model of the existing methods and poor versatility of the model for different soil types, thereby improving the efficiency and accuracy of detecting total nitrogen, total phosphorus and total potassium content in the field. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is the flowchart of the steps of the method of the present invention;

[0051] Figure 2 is the structural diagram of the soil nitrogen, phosphorus and potassium content detection network model based on the improved Inception-v4 of the present method;

[0052] Figure 3 is the schematic diagram of data flow of the method of the present invention;

[0053] Figure 4 is the comparison diagram of the prediction errors of the total nitrogen content detected by using the traditional PLSR model and the method of the present invention respectively in the test example of the present invention;

[0054] Figure 5 is the comparison diagram of the prediction errors of the total phosphorus content detected by using the traditional PLSR model and the method of the present invention respectively in the test example of the present invention;

[0055] Figure 6 is the comparison diagram of the prediction errors of the total potassium content detected by using the traditional PLSR model and the method of the present invention respectively in the test example of the present invention. Detailed implementation manners

[0056] The present invention will be further clarified below in conjunction with the accompanying drawings and specific implementation manners. It should be understood that the following specific implementation manners are only used to illustrate the present invention and not to limit the scope of the present invention.

[0057] Example 1

[0058] A rapid field fertility detection system based on soil two-dimensional spectrum data transfer learning includes at least: a spectrum data two-dimensionalization module, an SS-MSC preprocessing module, and a soil nitrogen, phosphorus and potassium content detection network model based on the improved Inception-v4. The spectrum data two-dimensionalization module: is implemented by short-time Fourier transform and bicubic interpolation, and converts one-dimensional spectrum into two-dimensional spectrum diagram; the SS-MSC preprocessing module: performs two-dimensional standardization on the spectrum diagram processed by the spectrum data two-dimensionalization module, and then performs two-dimensional multiplicative scatter correction processing; the soil nitrogen, phosphorus and potassium content detection network model based on the improved Inception-v4: includes two stages of a main path and a branch path. The main path contains 1 stem module, 4 Inception-A, and 1 Reduction-A connected in sequence, and is responsible for identifying the common features of total nitrogen, total phosphorus, and total potassium; the branch path is 3 links with the same structure, including 7 Inception-B modules, 1 Reduction-B module, 3 Inception-C modules, Dropout module, 1 Flatten layer, and 2 Inner Product connected in sequence. The three branch paths are responsible for identifying the individual features of total nitrogen, total phosphorus, and total potassium;

[0059] In this system, the spectral two-dimensionalization module based on short-time Fourier transform is used to convert the one-dimensional spectral data representing the nitrogen, phosphorus and potassium content of the soil into a two-dimensional spectrum graph; the spectrum is then preprocessed by the two-dimensional SS-MSC (Standard Scalar, Multiplicative Scatter Correction) module to eliminate the baseline shift and drift caused by different scattering levels in the data; then, based on the improved Inception-v4 regression network model, pre-training is completed on a pre-training data set containing spectra and nitrogen, phosphorus and potassium content information of different types of field soils; finally, the soil content information of standard sample points in the target field is used to perform an adaptively tuned migration training algorithm to complete the migration of the two-dimensional neural network model from the source domain to the target domain, and a regression prediction model for the total nitrogen, total phosphorus and total potassium content of the target field to be tested is established to achieve rapid detection of field fertility.

[0060] This system is highly versatile and has excellent transferability. In actual use, it only requires soil content information of standard sample points in the target field to complete the migration from the source domain to the target domain. It solves the problems of excessive prior data of the farmland to be tested required for training the prediction model of the existing method and poor versatility of the model for different soil types, and improves the detection efficiency and accuracy of total nitrogen, total phosphorus and total potassium content in the field.

[0061] Example 2

[0062] The rapid detection of field fertility based on soil two-dimensional spectrum data transfer learning specifically includes the following steps:

[0063] S1: Input the spectral data into the spectral data two-dimensionalization module, convert the spectral data into a spectrum diagram according to the short-time Fourier transform and use the Hamming window as the window function, and then perform bicubic interpolation to convert the one-dimensional spectrum into a two-dimensional spectrum diagram;

[0064] The spectral data two-dimensionalization module is implemented by short-time Fourier transform and bicubic interpolation. First, the near-infrared spectral sequence with a sequence length of 900 is transformed into a two-dimensional spectrum with a size of 100×100 by short-time Fourier transform; then the spectrum is expanded to a picture with a size of 300×300 by bicubic interpolation; finally, the salt and pepper noise is removed by bilateral filtering while preserving the edge information of the spectrum without distortion. The details are as follows:

[0065] S11: Design a two-dimensional module for the spectrum. According to the short-time Fourier transform, use the Hamming window as the window function to convert the spectrum data into a spectrum diagram. Define the formula:

[0066]

[0067] Among them, x[n] is the spectral sequence, w[n] is the window function, the length of the window function is N, l is the frame number, and H represents the jump step between different frames; the Hamming window function selected in this embodiment is:

[0068]

[0069] S12: Perform bicubic interpolation on the two-dimensional spectrogram generated by the short-time Fourier transform in step S11, and expand the picture to a size of 300×300 pixels; the bicubic interpolation formula is as follows:

[0070]

[0071] Among them, F is the interpolated image, v and u are the relative coordinates of the interpolation points, f is the picture before interpolation, r and c are the row and column numbers around the original pixel points respectively, and S is the convolution kernel. The convolution kernel selected in this embodiment is as follows:

[0072]

[0073] After the one-dimensional spectral data is processed by the spectral two-dimensionalization module, a 300×300 two-dimensional spectrogram will be generated, and this module will be used as the pre-stage for the training and detection of the subsequent neural network.

[0074] S2: Input the two-dimensional spectrogram processed in step S1 into the SS-MSC preprocessing module, and perform two-dimensional standardization processing and two-dimensional multiplicative scatter correction processing on the picture in sequence; the SS-MSC (Standard Scalar, standardization; Multiplicative Scatter Correction, multiplicative scatter correction) preprocessing module can remove the errors caused by different water contents of different samples and eliminate the baseline shift and drift phenomena due to different scattering levels in the dataset.

[0075] S21: First, perform two-dimensional standardization on the picture generated in step S1. The standardization method is:

[0076]

[0077] Among them, X is the two-dimensional spectrogram generated in step S1, S is the spectrogram generated after standardization, μ is the mean of all pixels, σ is the standard deviation of all pixels, and N is the number of pixels in each picture.

[0078] S22: After the standardization is completed, perform two-dimensional multiplicative scatter correction processing on it: First, generate the standard spectrum n is the number of spectra, and the average value of its j-th row is The selected standard fitting function is: Among them, b j is the baseline shift amount, mj is the offset, and the values of the two are:

[0079]

[0080] Let B i = [b i,1 b i,2 … b i,j T , then the i-th image generated after calibration is:

[0081]

[0082] S3: Based on the improved Inception-v4 soil nitrogen, phosphorus, and potassium content detection network model, complete the pre-training of the neural network according to the pre-training dataset. The network model includes two stages: the main path and the branch path, and simultaneously predicts the total nitrogen, total phosphorus, and total potassium content of the soil;

[0083] The soil nitrogen, phosphorus, and potassium content detection model based on the improved Inception-v4 in this step is divided into two parts: the main path and the branch path. As Figure 2 shown, the main path includes 1 stem module, 4 Inception-A modules, and 1 Reduction-A module connected in sequence, which is responsible for identifying the common features of total nitrogen, total phosphorus, and total potassium. First, the two-dimensional spectrogram is input into the stem module, and after significantly reducing the size of the feature map, a feature map of 35×35×288 is output; then the feature map is sequentially input into 4 Inception-A modules, which do not change the size and number of channels of the feature map, and the output size is still 35×35×288; then it is input into the Reduction-A module to reduce the size of the feature map to 17×17 and increase the number of channels to 1024; finally, the feature map is input into the subsequent branch path for further processing.

[0084] ​The branch consists of 3 identically structured links, including 7 consecutive Inception-B modules, 1 Reduction-B module, 3 consecutive Inception-C modules, a Dropout module, 1 Flatten layer, and 2 Inner Product modules, which are responsible for identifying the individual characteristics of total nitrogen, total phosphorus, and total potassium. The feature map enters the branch after passing through the main path and then enters 7 consecutive Inception-B modules. This module identifies the features in different feature fields and outputs a feature map of 17×17×1024; subsequently, the feature map enters the Reduction-B module, and after further reducing the size, it outputs a feature map of 8×8×1536; then it enters 3 consecutive Inception-C modules to further extract the features in different scale feature fields; then the feature map enters the Dropout module with a dropout rate of 20%, randomly losing 20% of the neurons during each training to prevent overfitting of the model; then the feature map is input into the Flatten layer, and all the feature map matrices are stretched and spliced into a one-dimensional vector; then it is input into a fully connected layer with an output of 1×100, and finally input into the last fully connected layer to output the content values of total nitrogen, total phosphorus, and total potassium respectively.

[0085] S4: Adaptive optimization of the neural network model in step S3 is performed according to the soil nitrogen, phosphorus, and potassium content data of the standard sample points in the field, completing the migration of the neural network model and realizing rapid detection of field fertility;

[0086] The neural network tuning training method based on the target domain is as follows: The neural network model generated in step S3 is used to detect the soil at the standard sample points in the field, and the detection error at this point is calculated. The output layer and the last hidden layer of the neural network model are continuously updated using the gradient descent of the error loss function.

[0087] The error vectors of the output layer and the last hidden layer are respectively denoted as:

[0088]

[0089] where, δ * is the output layer error, is the loss function, is the predicted value of the output, y is the true value of the verification point, σ(z * ) is the activation function, z * is the input of the neurons in the output layer; δ is the error of the last hidden layer, w is the weight matrix of the last hidden layer, and z is the input matrix of the last hidden layer.

[0090] Furthermore, the parameters of each neuron in the above two layers are updated backward until the output error is less than the set value. The bias b of the output layer *and weight w * The update method is as follows:

[0091]

[0092] The update methods for the b bias and w weight of the last hidden layer are as follows:

[0093]

[0094] Where α is the learning rate and a is the output vector of the last hidden layer.

[0095] As Figure 3 shown, by collecting the spectral information of any soil to be measured in the target field and inputting it into the spectral two-dimensionalization module, the SS-MSC preprocessing module, and the migrated model in sequence, the nitrogen, phosphorus, and potassium content information can be measured.

[0096] Test case

[0097] A soil detection experiment was conducted on the detection of field fertility, and a comparison was made between the traditional PLSR model and the model proposed by the method of the present invention.

[0098] We selected 40 sampling points in a certain field and measured the standard contents of total nitrogen, total phosphorus, and total potassium of all sample points using the wet chemistry method. The spectral information of all the collected sampling points was input into the PLSR prediction model after one-dimensional multiplicative scatter correction and standardization processing. The PLSR model used 5-fold cross-validation to optimize the number of latent variables (LV) from 2 to 40. In addition, the same spectral data was processed using the method of the present invention.

[0099] Figures 4 - 6 Respectively, they are the comparison charts of the prediction errors of the total nitrogen, total phosphorus, and total potassium contents of the soil samples to be measured in the target domain farmland. Figures 4 to 6 In the figure, the dotted line represents the prediction error of PLSR, and the solid line is the error curve of the method of the present invention. It can be seen from the attached figure that the method of the present invention has a higher prediction accuracy for soil fertility parameters than the PLSR model.

[0100] The following table shows the comparison of the R 2 values between this method and the PLSR model.

[0101] model total nitrogen total phosphorus total potassium the present invention 0.9461146795689653 0.9371705356554558 0.9282419519501438 PLSR 0.79600269205333 0.8527734700654919 0.8162309009767026

[0102] It can be seen from the above table that in terms of the three indicators of total nitrogen, total phosphorus, and total potassium, the R 2 value of the present invention is significantly better than that of PLSR, and the maximum increase can reach nearly 20%. This shows that the model established by this method can more accurately describe the fertility information of the soil.

[0103] It should be noted that the above content only illustrates the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. For those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements all fall within the protection scope of the claims of the present invention.

Claims

1. A rapid detection system for field fertility based on transfer learning of soil two-dimensional spectrum data, characterized in that, It at least includes: a two-dimensional spectral data module, an SS-MSC preprocessing module, and a soil nitrogen, phosphorus, and potassium content detection network model based on improved Inception-v4. The two-dimensional spectral data module: It is implemented by short-time Fourier transform and bicubic interpolation, converting one-dimensional spectra into two-dimensional spectrograms. The SS-MSC preprocessing module: It performs two-dimensional standardization on the processed spectrograms in the two-dimensional spectral data module, and then performs two-dimensional multiplicative scatter correction processing. The soil nitrogen, phosphorus, and potassium content detection network model based on improved Inception-v4: It includes two stages, the main path and the branch path. The main path contains 1 stem module, 4 Inception-A modules, and 1 Reduction-A module connected in sequence, responsible for identifying the common features of total nitrogen, total phosphorus, and total potassium. The branch path consists of 3 identical links, including 7 Inception-B modules, 1 Reduction-B module, 3 Inception-C modules, a Dropout module, 1 Flatten layer, and 2 InnerProduct layers connected in sequence. The three branch paths are responsible for identifying the individual features of total nitrogen, total phosphorus, and total potassium. The system completes pre-training on a pre-training dataset of spectra and nitrogen, phosphorus, and potassium content information of different types of field soils through the soil nitrogen, phosphorus, and potassium content detection network model based on improved Inception-v4, and then uses an adaptive tuning transfer training algorithm based on the soil content information of standard sample points in the field to complete the transfer of the two-dimensional neural network model, realizing rapid detection of field fertility.

2. The rapid detection system for field fertility based on transfer learning of soil two-dimensional spectrum data according to claim 1, characterized in that: In the soil nitrogen, phosphorus, and potassium content detection network model based on improved Inception-v4, In the main path stage, first, the two-dimensional spectrogram is input into the stem module and then outputs a feature map. The feature map is sequentially input into 4 Inception-A modules and the Reduction-A module and then enters the branch path for processing. Among them, the Inception-A module does not change the size and number of channels of the feature map; the Reduction-A module reduces the size of the feature map and increases the number of channels. In the branch path stage, the feature map enters 7 consecutive Inception-B modules after passing through the main path, and after recognition, it outputs a feature map. Subsequently, it enters the Reduction-B module, and after reducing the size, it outputs a new feature map, and then enters 3 consecutive Inception-C modules to further extract features in different scale feature fields. Subsequently, the feature map enters the Dropout module with a dropout rate of 20%, randomly losing 20% of the neurons during each training, thereby preventing overfitting of the model. The feature map is input into the Flatten layer to stretch and splice all the feature map matrices into a one-dimensional vector. It is input into a fully connected layer with an output of 1×100, and finally input into the last fully connected layer to respectively output the content values of total nitrogen, total phosphorus, and total potassium.

3. A rapid detection method for field fertility based on transfer learning of soil two-dimensional spectrum data, characterized in that, It includes the following steps: S1: Input the spectral data into the spectral data two-dimensionalization module. According to the short-time Fourier transform and using the Hamming window as the window function, convert the spectral data into a spectrogram, and then perform bicubic interpolation to convert the one-dimensional spectrum into a two-dimensional spectrogram; S2: Input the two-dimensional spectrogram processed in step S1 into the SS-MSC preprocessing module, and perform two-dimensional standardization processing and two-dimensional multiplicative scatter correction processing on the picture in sequence; S3: Based on the improved Inception-v4 soil nitrogen, phosphorus, and potassium content detection network model, complete the pre-training of the neural network according to the pre-training dataset. The network model includes two stages: the main path and the branch path, and simultaneously predict the total nitrogen, total phosphorus, and total potassium content of the soil. Among them, the main path includes 1 stem module, 4 Inception-A modules, and 1 Reduction-A module connected in sequence, which is responsible for identifying the common features of total nitrogen, total phosphorus, and total potassium; the branch path is 3 links with the same structure, including 7 Inception-B modules, 1 Reduction-B module, 3 Inception-C modules, Dropout module, 1 Flatten layer, and 2 Inner Product connected in sequence. The three branch paths are responsible for identifying the individual features of total nitrogen, total phosphorus, and total potassium; S4: Adaptively optimize the neural network model in step S3 according to the soil nitrogen, phosphorus, and potassium content data of the field standard sample points, complete the migration of the neural network model, and realize the rapid detection of field fertility; the migration of the neural network model is specifically: use the neural network model generated in step S3 to detect the soil at the field standard sample points, and calculate the detection error at this point, and continuously update the output layer and the last hidden layer of the neural network model by using the gradient descent of the error loss function.

4. The rapid detection method for field fertility based on transfer learning of soil two-dimensional spectrum data according to claim 3, characterized in that: In step S1, according to the short-time Fourier transform, converting the spectral data into a spectrogram is specifically: Among them, x[n] is the spectral sequence, w[n] is the window function, the length of the window function is N, l is the frame number, and H represents the jump step between different frames; Among them, the Hamming window function is:

5. The rapid detection method for field fertility based on transfer learning of soil two-dimensional spectrum data according to claim 4, characterized in that: After step S1 undergoes bicubic interpolation, the picture is expanded to a size of 300×300 pixels. The bicubic interpolation is specifically: Among them, F is the interpolated image, v and u are the relative coordinates of the interpolated points, f is the picture before interpolation, r and c are the row and column numbers around the original pixel points respectively, and S is the convolution kernel.

6. The rapid detection method for field fertility based on transfer learning of soil two-dimensional spectrum data according to claim 3, characterized in that: Step S2 specifically includes: S21: Perform two-dimensional standardization on the two-dimensional spectrogram generated in step S1. The standardization method is: Among them, X is the two-dimensional spectrogram generated in step S1, S is the spectrogram generated after standardization, μ is the mean of all pixels, σ is the standard deviation of all pixels, and N is the number of pixels in each picture; S22: Then perform two-dimensional multi-scattering correction processing on it: First, generate a standard spectrum n is the number of spectra, and the average value of its j-th row is The selected standard fitting function is: where b j is the baseline shift amount, and m j is the offset amount, and their values are: Let B i = [b i,1 b i,2 … b i,j T , then the i-th image generated after calibration is:​ 7. The rapid detection method for field fertility based on transfer learning of soil two-dimensional spectrum data according to claim 3, wherein: In the improved Inception-v4 soil nitrogen, phosphorus, and potassium content detection network model in step S3, In the main path stage, first, the two-dimensional spectrum diagram is input into the stem module and then the feature map is output. The feature map is sequentially input into 4 Inception-A modules and a Reduction-A module and then enters the branch to be processed. Among them, the Inception-A module does not change the size and number of channels of the feature map; the Reduction-A module reduces the size of the feature map and increases the number of channels. In the branch stage, the feature map enters 7 consecutive Inception-B modules after passing through the main path. After recognition, the feature map is output, and then enters the Redunction-B module. After reducing the size, a new feature map is output. Then it enters 3 consecutive Inception-C modules to further extract features in different scale feature fields. Subsequently, the feature map enters the Dropout module with a dropout rate of 20%. 20% of the neurons are randomly dropped during each training to prevent overfitting of the model. The feature map is input into the Flatten layer to stretch and splice all the feature map matrices into a one-dimensional vector. It is input into a fully connected layer with an output of 1×100, and finally input into the last fully connected layer to output the content values of total nitrogen, total phosphorus, and total potassium respectively.

8. The rapid detection method for field fertility based on transfer learning of soil two-dimensional spectrum data according to claim 3, characterized in that: In step S4, the error vectors of the output layer and the last hidden layer are denoted as follows: δ = [w T δ * ⊙ σ′(z) Among them, δ * is the output layer error, is the loss function, is the predicted value of the output, y is the true value of the verification point, σ(z * ) is the activation function, z * is the neuron input of the output layer; δ is the error of the last hidden layer, w is the weight matrix of the last hidden layer, and z is the input matrix of the last hidden layer; Backward update the parameters of each neuron in the above two layers until the output error is less than the set value, and the bias b * and the weight w * The update method is as follows: The update methods of the b bias and w weight of the last hidden layer are as follows: Among them, α is the learning rate, and a is the output vector of the last hidden layer.

Citation Information

Cited By

  • Corn field nitrogen element visualization method and platform based on unreal engine

    CN121392143A