Soil nutrient inversion method based on multi-source physical constraint and multi-scale attention network

By employing a multi-source physical constraint and multi-scale attention network approach, the problems of insufficient data and lack of consideration of spatial autocorrelation in remote sensing soil nutrient inversion are solved, achieving high-precision soil nutrient inversion. The generated distribution map has good spatial texture and geographical continuity, supporting variable fertilization in precision agriculture.

CN121960198APending Publication Date: 2026-05-01HARBIN INST OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HARBIN INST OF TECH
Filing Date
2026-02-02
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing remote sensing-based soil nutrient inversion methods lack sufficient ground truth data and do not consider the spatial autocorrelation and physical imaging patterns of soil nutrients in geographic space, resulting in biased inversion values ​​and a lack of spatial texture constraints and geographic continuity in the generated distribution maps.

Method used

A multi-source physical constraint and multi-scale attention network approach is adopted. By acquiring the true values ​​of soil nutrients, soil moisture content, temperature and remote sensing images, feature subsets are generated using Pearson correlation coefficient and co-kriging interpolation algorithm. A sample augmentation adversarial model and a multi-scale residual attention inversion model are constructed. Soil nutrient prediction is performed by combining multi-scale feature parallel extraction and CBAM attention mechanism.

Benefits of technology

It achieves high-precision and robust soil nutrient inversion, and the generated distribution map is excellent in terms of spatial texture constraints and geographical continuity, providing variable fertilization decision support in precision agriculture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121960198A_ABST
    Figure CN121960198A_ABST
Patent Text Reader

Abstract

The invention discloses a soil nutrient inversion method based on multi-source physical constraint and a multi-scale attention network, and aims to solve the problems that a soil nutrient inversion method based on remote sensing lacks enough truth value marking data and does not consider spatial autocorrelation of soil nutrients in geographic space and a physical imaging rule influenced by a microenvironment and an earth surface structure. Therefore, the problems of deviation of the inversion value and lack of spatial texture constraint and geographical continuity of the soil nutrient content distribution map generated by inversion are solved. According to the method, the collaborative Kriging trend and soil microenvironment and earth surface structure characteristics are introduced as physical constraints, a sample expansion confrontation model is constructed, sample expansion is performed by a scientific method integrating a physical environment and a spatial law, the physical imaging law of soil nutrients is fully considered, and the accuracy of the sample expansion confrontation model is improved. In combination with a designed multi-scale residual attention inversion model for extracting key information from a spectrum, the generated soil nutrient content distribution map is relatively excellent in spatial texture constraint and geographical continuity.
Need to check novelty before this filing date? Find Prior Art

Description

Soil nutrient inversion method based on multi-source physical constraints and multi-scale attention network Technical Field

[0001] This invention relates to the fields of remote sensing information processing and intelligent sensing technology, specifically to a method for soil nutrient inversion based on multi-source physical constraints and multi-scale attention networks. Background Technology

[0002] Soil nutrients in arable land are essential for crops to complete their life cycle, providing both material and energy. Accurate acquisition of spatial distribution information on soil nutrients is crucial for guiding variable-rate fertilization and achieving sustainable agricultural development. Traditional soil nutrient monitoring relies on high-density field sampling and laboratory chemical analysis, offering high precision but suffering from issues such as poor timeliness, spatial discontinuity, and destructive sampling, making it difficult to meet the practical needs of large-area, rapid monitoring.

[0003] To overcome the inherent limitations of traditional soil nutrient monitoring, utilizing remote sensing technology for large-area, rapid, and non-contact soil property inversion has become a research area for developing quantitative soil property inversion. Existing remote sensing-based soil nutrient inversion methods face two major technical bottlenecks in practical applications: First, while deep learning models possess nonlinear fitting capabilities, they rely on a large amount of ground-valued data. In agricultural remote sensing applications, obtaining ground samples with high-precision laboratory test results is difficult and the data volume is limited. Directly training deep networks using sparse, small samples easily leads to overfitting and poor model generalization ability. Second, current mainstream data augmentation methods mostly perform numerical interpolation or generation in feature space, ignoring the spatial autocorrelation of soil nutrients in geographic space and the physical imaging patterns influenced by microenvironment and surface structure. The model learns incorrect feature mapping relationships, resulting in physical and logical conflicts and missing spatial information in the generated samples, leading to biased inversion values. The generated nutrient distribution maps lack spatial texture constraints and geographic continuity. Summary of the Invention

[0004] To address the problems of insufficient ground truth data and failure to consider the spatial autocorrelation of soil nutrients in geographic space, as well as the physical imaging laws influenced by microenvironment and surface structure, which lead to deviations in inverted values ​​and a lack of spatial texture constraints and geographic continuity in the generated soil nutrient content distribution maps, this invention proposes a soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks.

[0005] The technical solution adopted in this invention is:

[0006] It includes the following steps:

[0007] S1. Obtain the true values ​​of soil nutrients, soil moisture content, soil temperature, latitude and longitude coordinates and remote sensing images of each sampling point in a certain farmland area. Based on the soil moisture content, soil temperature and remote sensing images of each sampling point, obtain the multidimensional feature matrix of each sampling point.

[0008] S2. Based on the latitude and longitude coordinates of each sampling point, align the true soil nutrient values ​​and the multidimensional feature matrix of each sampling point. Calculate the correlation coefficient between the true soil nutrient values ​​and each corresponding feature using the Pearson correlation coefficient formula. Calculate the degree of linear correlation based on the correlation coefficient and perform a two-tailed t-test to obtain the feature subsets of each sampling point that are significantly related to the true soil nutrient values.

[0009] S3. Based on the vegetation index of a farmland area in S1 and the true values ​​of soil nutrients, soil moisture content and soil temperature at each sampling point, the nutrient spatial trend field matrix, soil moisture field and soil temperature field are generated using the co-kriging interpolation algorithm.

[0010] An adversarial model for sample augmentation was constructed, and the Monte Carlo method was used to randomly generate samples from remote sensing images of a farmland area in S1. The geographic coordinates of each expanded sampling point are used to obtain the target nutrient trend value, soil moisture trend value, and soil temperature trend value in the nutrient spatial trend field matrix, soil moisture field, and soil temperature field based on the geographic coordinates. These values ​​are then input into the sample expansion adversarial model, which outputs the feature vector of the expanded sampling point. The geographic coordinates, target nutrient trend value, and feature vector of each expanded sampling point are aligned to obtain each expanded sample. An expanded dataset is generated based on all the expanded samples.

[0011] S4. Based on the feature subsets of S2, select the feature subsets for each expanded sampling point from the expanded dataset;

[0012] A multi-scale residual attention inversion model is constructed, and the feature subset of each expanded sampling point is input into the multi-scale residual attention inversion model to output the predicted soil nutrient value of each expanded sampling point.

[0013] S5. Generate a soil nutrient content distribution map of a certain farmland area in S1 based on the predicted soil nutrient values ​​of each expanded sampling point.

[0014] The beneficial effects of this invention are as follows:

[0015] This invention utilizes limited ground-based measured data and introduces co-kriging trends, soil microenvironment, and surface structure characteristics as physical constraints to construct a sample expansion adversarial model. It incorporates scientific methods that integrate physical environment and spatial patterns to expand the sample, fully considering the physical imaging laws of soil nutrients. Combined with a multi-scale residual attention inversion model designed to extract key information from the spectrum, it achieves high-precision and robust soil nutrient inversion. The generated soil nutrient content distribution map is excellent in terms of spatial texture constraints and geographical continuity.

[0016] This invention proposes a sample augmentation adversarial model with microenvironment-structure co-constraints. The macroscopic spatial trends extracted by co-kriging, the soil temperature and humidity microenvironment field, and the ridge structure characteristics are injected into the sample augmentation process as physical prior constraints. The resulting augmented samples are more consistent with geoscientific laws, solve the problem of physical distortion in small sample remote sensing inversion, and improve the reliability of data augmentation.

[0017] This invention constructs a multi-scale residual attention inversion model. Through a multi-scale feature parallel extraction module, it simultaneously captures point details and local spatial dependencies of soil nutrients using convolutional kernels of different sizes. Combined with the CBAM attention mechanism, it adaptively enhances the feature channel weights sensitive to nitrogen, phosphorus, and potassium, and eliminates background noise interference. This enables in-depth mining of spectral, spatial, and textural multi-dimensional features, providing intuitive and reliable data support for variable fertilization decisions in precision agriculture, and has production application benefits. Attached Figure Description

[0018] Figure 1 is a flowchart of the present invention;

[0019] Figure 2 is a schematic diagram of the optimal selection of nitrogen, phosphorus, and potassium feature subsets;

[0020] Figure 3 is a schematic diagram of the sample augmentation adversarial model generating augmented samples;

[0021] Figure 4 is a schematic diagram of the multi-scale residual attention inversion model;

[0022] Figure 5 is a spatial distribution map of nitrogen content in the study area;

[0023] Figure 6 is a spatial distribution map of phosphorus content in the study area;

[0024] Figure 7 is a spatial distribution map of potassium content in the study area; Detailed Implementation

[0025] Specific Implementation Method 1: This implementation method, illustrated in Figures 1-7, is a soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks. It includes the following steps:

[0026] This embodiment selects a typical farmland plot located within the Jiansanjiang Reclamation Area in Northeast China as the study area. The geographical coordinates of the study area are defined as 47.105146°N to 47.295778°N and 132.536244°E to 132.993036°E. Data collection will be conducted simultaneously during the critical crop growth period in June 2025 to verify the effectiveness of the invention.

[0027] S1. Obtain the true values ​​of soil nutrients, soil moisture content, soil temperature, latitude and longitude coordinates, and remote sensing imagery for each sampling point in a certain farmland area (study area). Based on the soil moisture content, soil temperature, and remote sensing imagery for each sampling point, obtain the multidimensional feature matrix for each sampling point. The specific process is as follows:

[0028] A grid-based sampling method was used to conduct field sampling in the study area, collecting soil mixtures from the top 0-20 cm of soil at each sampling point. The true values ​​of soil nutrients at each sampling point were obtained through standard chemical analysis in the laboratory. True values ​​of soil nutrients This includes the content of available nitrogen (AN), available phosphorus (AP), and available potassium (AK). Soil moisture content at each sampling point was then measured using a portable sensor. With soil temperature The latitude and longitude coordinates of each sampling point were obtained. At the same time, Gaofen-1 remote sensing images synchronized with the ground sampling time window were acquired. The remote sensing images were radiometrically calibrated, FLAASH atmospherically corrected, and RPC orthorectified using SNAP or ENVI to obtain the processed remote sensing images. The spatial mapping relationship between the processed remote sensing images and the study area was established based on the latitude and longitude coordinates of each sampling point.

[0029] In the spatially mapped remote sensing image, each sampling point is used as the center pixel. Multiple 3×3 neighborhoods are established centered on each center pixel. The average spectral reflectance of each neighborhood is calculated. Based on the average spectral reflectance of each neighborhood, the vegetation index and Normalized Difference Water Index (NDWI) are calculated. The vegetation indices include Normalized Difference Vegetation Index (NDVI), Green Normalized Difference Vegetation Index (GNDVI), Ratio Vegetation Index (RVI), Difference Vegetation Index (DVI), Soil-Adjusted Vegetation Index (SAVI), and Enhanced Vegetation Index (EVI). The calculation formulas are as follows:

[0030] (1)

[0031] (2)

[0032] (3)

[0033] (4)

[0034] (5)

[0035] (6)

[0036] (7)

[0037] in, These represent the average spectral reflectance in the near-infrared band, red, green, and blue, respectively. To prevent constants with a denominator of zero.

[0038] Calculate the gray-level co-occurrence matrix for each neighborhood. ( (The value represents the pixel's brightness). Based on the gray-level co-occurrence matrix and average spectral reflectance of each neighborhood, the texture and spatial structure features of the bands within that neighborhood are calculated. These features include the mean, standard deviation, and neighborhood statistical features. The neighborhood statistical features include contrast, homogeneity, energy, and correlation texture features for the R-band and NIR band. Based on these texture and spatial structure features, the image gradient covariance matrix of the neighborhood is constructed. It captures the linear structure information of the Earth's surface, and the calculation formula is as follows:

[0039] (8)

[0040] in, For Gaussian smoothing kernel, This represents the convolution operation. The image gradient vector, , for transpose, The image pixel position is represented as , For horizontal gradient, , For vertical gradient, , Indicates multiplication. , , The components of the structure tensor matrix are the smoothed horizontal gradient energy, gradient correlation, and vertical gradient energy, respectively.

[0041] Based on the image gradient covariance matrix The surface structure features (ridge orientation constraint) of the neighborhood are obtained, and the ridge orientation constraint is normalized to the interval [0, 1] to obtain the normalized ridge orientation constraint. :

[0042] (9)

[0043] The average spectral reflectance (4-dimensional), vegetation index (6-dimensional), water index (1-dimensional), and soil moisture content of each neighborhood were used to calculate the average spectral reflectance (4-dimensional), vegetation index (6-dimensional), water index (1-dimensional), and soil moisture content of each neighborhood. (1-dimensional) Soil temperature (1-dimensional) Normalized monotropic constraint Z-score normalization is performed on the 1D and texture and spatial structure features (12D) data. Based on the normalized data, a multidimensional feature matrix for each neighborhood is obtained. (26 dimensions).

[0044] S2. Based on the latitude and longitude coordinates of each sampling point, align the true soil nutrient values ​​with the multidimensional feature matrix for each sampling point. Calculate the correlation coefficient between the true soil nutrient values ​​and each corresponding feature using the Pearson correlation coefficient formula. Calculate the degree of linear correlation based on the correlation coefficients and perform a two-tailed t-test to obtain the feature subset that is significantly correlated with the true soil nutrient values. The specific process is as follows:

[0045] Align the true values ​​of soil nutrients at each sampling point with the latitude and longitude coordinates. With the multidimensional feature matrix of the corresponding neighborhood The multidimensional feature matrix and soil nutrient ground truth values ​​of each sampling point are used as a single sample. Samples with a spectral response value of 0 in the eigenvectors of the multidimensional feature matrix are defined as outliers (invalid samples), and these outliers are removed. The original dataset is then constructed using all samples after removing the outliers. , This represents the total number of samples after removing outliers. For the first The multidimensional feature vector of each sample For the first The true values ​​of soil nutrient content for each sample. This embodiment... This indicates that the original dataset contains 158 valid samples.

[0046] Based on the original dataset For each feature and its corresponding true value of soil nutrients, the correlation coefficient between the true value of soil nutrients and each feature is calculated using the Pearson correlation coefficient formula:

[0047] (10)

[0048] in, For the first Features True values ​​of soil nutrients The correlation coefficient, , This is the true value of nitrogen. For the true value of phosphorus, This is the true value for potassium. For the first The sampling point of the first sampling point 1 eigenvalue, For the first The mean of the eigenvalues, For the first True values ​​of soil nutrients at each sampling point This represents the mean of the true values ​​of soil nutrients.

[0049] The linear correlation is calculated based on the correlation coefficient, and a two-tailed t-test is performed (in this embodiment). ), retaining the true values ​​of soil nutrients Based on the significant correlation features, feature subsets corresponding to nitrogen, phosphorus, and potassium are obtained, respectively. , , As shown in Figure 2, in this embodiment, the feature subsets of nitrogen, phosphorus, and potassium are set to 22 dimensions, 17 dimensions, and 11 dimensions, respectively, based on the correlation analysis results.

[0050] S3. Based on the vegetation index of a farmland area in S1 and the true values ​​of soil nutrients, soil moisture content, and soil temperature at each sampling point, a nutrient spatial trend field matrix, a soil moisture field, and a soil temperature field are generated using the co-kriging interpolation algorithm; a sample augmentation adversarial model is constructed, and the Monte Carlo method is used to randomly generate samples from the remote sensing image of the farmland area in S1. The geographic coordinates of each expanded sampling point are used to obtain the target nutrient trend value, soil moisture trend value, and soil temperature trend value in the nutrient spatial trend field matrix, soil moisture field, and soil temperature field based on the geographic coordinates. These values ​​are then input into the sample expansion adversarial model, which outputs the feature vector of the expanded sampling point. The geographic coordinates, target nutrient trend value, and feature vector of each expanded sampling point are aligned to obtain each expanded sample. An expanded dataset is generated based on all expanded samples. The specific process is as follows:

[0051] S31. Obtain the Gaofen-1 NDVI vegetation index (16m resolution) for the study area. Using the true values ​​of soil nutrients, soil moisture content, soil temperature, and normalized row orientation constraints at each sampling point as main variables, and the Gaofen-1 NDVI vegetation index for the study area as a covariate, the cross-sigma semivariogram of the main and covariates was analyzed using the geostatistical co-kriging interpolation algorithm. Specifically, the dense distribution of covariates is used to compensate for the sparsity of the main variables, and interpolation prediction is performed across the entire study area to generate a nutrient spatial trend field matrix. Soil moisture content field Soil temperature field and the value field of the monopoly The multidimensional physical environment constraint field matrix is ​​formed.

[0052] S32. Construct a sample expansion adversarial model that coordinates constraints between soil microenvironment and structure. The sample expansion adversarial model includes a deep condition generator, a discriminator, and an auxiliary regressor. The deep condition generator captures the complex nonlinear relationship between spectral features and environmental factors for feature mapping and reconstruction. The first four layers of the deep condition generator are all "fully connected layers + BN layers (negative slope)". The deep conditional generator uses a combination of a "full connected layer + Leaky ReLU activation function layer" structure, followed by a "fully connected layer + Tanh activation function layer" structure. The processing layer is then followed by a computation module and a normalization layer. The number of neurons in the first, second, and third fully connected layers increases sequentially to 256, 512, and 1024 respectively. This narrow-to-wide design helps decouple physical constraints and spectral representation in the higher-dimensional latent space. The fourth fully connected layer reduces the number of neurons to 512 for feature compression and reconstruction, ensuring the density of the information flow. Batch normalization (BN) layers are used to accelerate convergence and alleviate gradient vanishing, while Leaky ReLU activation function layers are used for other functions. The ReLU activation function layer provides non-linear expressive capabilities for the deep conditional generator. The fully connected processing layer contains 16 neurons, mapping latent features to 16-dimensional basic spectral features (average spectral reflectance of R, G, B, and NIR within a 3×3 neighborhood, and 12-dimensional texture and spatial structure features, respectively). A linear activation function is used to output continuous values ​​with true physical dimensions. The average spectral reflectance of R, G, B, and NIR within the 3×3 neighborhood of the processing layer is used as input to the computation module. Six-dimensional vegetation indices (NDVI, GNDVI, RVI, DVI, SAVI, EVI) and a one-dimensional water index (NDWI) are calculated according to the spectral index formula. A normalization layer is embedded at the end of the network to uniformly perform Z-score normalization on the 16-dimensional basic spatial spectral features, the six-dimensional vegetation indices, and the one-dimensional water index, outputting a 26-dimensional normalized feature matrix that conforms to the data distribution. The input to the depth condition generator is a 104-dimensional blend vector. , Including computer-generated 100-dimensional dimensions that follow a standard normal distribution random noise vector (used to introduce random diversity in sample generation), 1D true values ​​of soil nutrients at each sampling point and the real environment constraint vector for each 3D sampling point Output feature matrix As shown in Figure 3.

[0053] During the deep conditional generator processing, a pre-trained GAN discriminator network (discriminator) and an auxiliary regression network are used. (Auxiliary regressor) constructs the joint loss constraints for the sample augmentation adversarial model. The GAN discriminator network is responsible for calculating the GAN adversarial loss. This ensures the authenticity of the generated distribution. (Auxiliary regression network) As a physical consistency checker, the spectral features output by the depth condition generator are used. The soil nutrient values, soil moisture content (humidity), soil temperature, and normalized ridge orientation constraints are remapped back to their corresponding true values ​​to obtain the attribute regression prediction values ​​for each sampling point. These attribute regression prediction values ​​include the predicted soil nutrient values. Soil temperature prediction value Predicted soil moisture content and monopoly value Auxiliary regression network Responsible for calculating the loss function that minimizes physical environment consistency. Trend Consistency Loss Function By minimizing the difference between the input soil nutrient labels and the attribute regression predictions, the features learned by the generator are forced to conform to specific physical attribute constraints. In this embodiment, the total loss of the sample augmentation adversarial model... The function is defined as:

[0054] (11)

[0055] (12)

[0056] (13)

[0057] The sample augmentation adversarial model was trained using the above process. During training, the Adam optimizer was used for iterative optimization with a learning rate of 0.0002, 1000 iterations, and a batch size of 128. The gradients of 128 sampling points were calculated simultaneously with each parameter update. Furthermore, to balance adversarial distribution learning with physical consistency constraints, ablation experiments were conducted to optimize the hyperparameters of the sample augmentation adversarial model. After multiple rounds of testing, the trend consistency weights were optimized. Set to 1.0, physical environment constraint weight Setting the value to 0.5 ensures that the deep conditional generator approximates the true spectral distribution, resulting in the most stable performance of the sample augmentation adversarial model. During adversarial training, the discriminator and auxiliary regressor jointly constrain the multi-source environment deep conditional generator, forcing it to learn the consistency and trend characteristics of the physical environment. Through continuous iterative optimization, the sample augmentation adversarial model with optimal parameters is obtained. .

[0058] S33. Randomly generate data from remote sensing images of the study area using the Monte Carlo method. (This embodiment is) =1800) geographical coordinates (two-dimensional coordinates) of expanded sampling points, based on the geographical coordinates in the nutrient space trend field matrix. The target nutrient trend value is obtained from In the soil moisture field Soil temperature field and the value field of the monopoly The environmental constraint trend value is obtained. ,in, This represents the trend value of soil moisture content. This represents the soil temperature trend value. This represents the monopolistic trend value. It incorporates 100-dimensional random noise. Target nutrient trend value and environmental constraint trend value Optimal Sample Augmentation Adversarial Model with Optimal Input Parameters Internally, through forward inference, feature vectors (feature matrices) of expanded sampling points with soil physicochemical properties are output in batches, aligning the geographic coordinates and target nutrient trend values ​​of each expanded sampling point. By combining the feature vectors, we obtain each augmented sample, and construct an augmented dataset based on all augmented samples.

[0059] S4. Based on the feature subsets of S2, select the feature subsets for each expanded sampling point from the expanded dataset, construct a multi-scale residual attention inversion model, input the feature subsets of each expanded sampling point into the multi-scale residual attention inversion model, and output the predicted soil nutrient values ​​for each expanded sampling point. The specific process is as follows:

[0060] S41. Based on the dimension of the nitrogen, phosphorus, and potassium feature subsets in S2, select the nitrogen, phosphorus, and potassium feature subsets for each expanded sampling point from the expanded dataset.

[0061] S42. As shown in Figure 4, a multi-scale residual attention inversion model is constructed. The multi-scale residual attention inversion model includes a multi-scale feature parallel extraction module, a deep residual coding layer module, a CBAM attention weighted layer embedding module, and a regression prediction module.

[0062] S43. Train the multi-scale residual attention inversion model using the feature subset of each expanded sampling point, and output the predicted soil nutrient value for each expanded sampling point. The specific process is as follows:

[0063] The S431 multi-scale feature parallel extraction module includes three parallel one-dimensional convolutions (Conv1D) and a multi-scale feature layer. The three parallel one-dimensional convolutional structures are used to capture feature patterns under different receptive fields, and the multi-scale feature layer is used to concatenate features. The first one-dimensional convolution has a kernel size of 1 and is used to capture point-to-point band features. The second one-dimensional convolution has a kernel size of 3 and is used to capture the correlation between locally adjacent bands. The third one-dimensional convolution has a kernel size of 5 and is used to obtain spectral patterns under a larger receptive field. All three parallel one-dimensional convolutions use 16 kernels. The feature subset at each expanded sampling point... , , As input , ,in, For the number of channels, Given the sequence length, The inputs are given to each one-dimensional convolution, and the corresponding feature maps are output. Take the three feature maps Input multi-scale feature layers, output high-dimensional multi-scale feature tensors The specific process is as follows:

[0064] (14)

[0065] (15)

[0066] in, For ranking one-dimensional convolutions, , representing the first one-dimensional convolution, the second one-dimensional convolution, and the third one-dimensional convolution, respectively. For the first The weight matrix of a one-dimensional convolution. For the first The bias term of a one-dimensional convolution. This represents a one-dimensional convolution operation. This represents the activation function. This indicates a splicing operation along the channel dimension. This is the feature map output by the first one-dimensional convolution. This is the feature map output by the second one-dimensional convolution. This is the feature map output by the third one-dimensional convolution.

[0067] S432, the deep residual coding layer module includes three sequentially connected deep residual units, consisting of a main path and skip connections. Each deep residual unit is defined as follows:

[0068] (16)

[0069] in, The original information (input) passed to the skip connection. It is a main path residual mapping function that includes convolution, activation function, and normalized function. As weight, This is the output.

[0070] Multiscale feature tensors The input is processed sequentially through each deep residual unit within the deep residual coding layer module, outputting a feature tensor containing deep semantic information. , where 48 is the number of feature channels.

[0071] The S433 CBAM attention-weighted layer embedding module sequentially includes a channel attention layer (CAM) and a spatial feature attention layer (SAM). The channel attention layer uses a multilayer perceptron to learn the weight coefficients of each feature channel, while the spatial feature attention layer uses one-dimensional convolution (Kernel Size=7) to capture the local correlations of the feature sequence. The output of the deep residual coding layer module is input into the channel attention layer, and the processing is as follows:

[0072] (16)

[0073] in, For channel weights, The activation function is AvgPool, which is global average pooling, MaxPool is global max pooling, and MLP is multilayer perceptron.

[0074] Then adjust the channel weights With feature tensor Multiply to generate channel-weighted features. ;

[0075] Spatial feature attention layer for features Average pooling and max pooling are performed separately along the channel dimension. The pooling results are then concatenated and processed using a one-dimensional algorithm. Convolution generates spatial weights Adaptive enhancement is performed on key sensitive regions in the spectral sequence. The processing procedure is as follows:

[0076] (17)

[0077] in, Spatial weights, express convolution, For channel average pooling, Max pooling of channels;

[0078] Multiply each result element-wise to obtain the final attention-weighted feature. The dimension remains unchanged. The specific calculation is as follows:

[0079] (18)

[0080] in, This indicates element-wise multiplication;

[0081] S434, Attention-weighted features Within the input regression prediction module, the data is transformed into a one-dimensional feature vector through a global average pooling layer and a flattening layer. The mathematical expression is as follows:

[0082] (20)

[0083] in, To output feature vectors No. The value of each channel, For the first The first channel in the Attention-weighted feature values ​​for each band position, .

[0084] One-dimensional feature vector The input is a fully connected layer (F1) with 64 neurons. The 48-dimensional features of the input are up-mapped to a 64-dimensional latent space. Then, the Mish activation function is applied to enhance the non-linear expressive power. This is the weight matrix. If it is a bias, the processing procedure is as follows:

[0085] (twenty one)

[0086] Next, After passing through the Dropout regularization layer, the input is then fed into the output layer (F2). The output layer contains a single output neuron, responsible for mapping the feature regression to the final predicted soil nutrient value. .

[0087] S435. Repeat S431-S434 to train the multi-scale residual attention inversion model. The training process uses the AdamW optimizer (learning rate of 0.001) and Huber Loss loss function, with a dropout rate of 0.2. 1800 generated samples are trained iteratively for 1000 rounds with a batch size of 128 to obtain the trained multi-scale residual attention inversion model, and it is saved as a pth file.

[0088] S5. Generate a soil nutrient content distribution map of a certain farmland area in S1 based on the predicted soil nutrient values ​​of each expanded sampling point. The specific process is as follows:

[0089] The original dataset was used as the test dataset and input into the multi-scale residual attention inversion model trained with S4 to verify the effectiveness of the model. The evaluation metrics mainly include the coefficient of determination (COP). ), root mean square error ( Mean Absolute Error (MAE) and Mean Absolute Percentage Error (MAPE) are defined as follows:

[0090] (twenty two)

[0091] (twenty three)

[0092] (twenty four)

[0093] (25)

[0094] In the formula, This represents the total number of samples in the test dataset. , , Indicates the first True values ​​of soil nutrients for each sample. The multi-scale residual attention inversion model representing the optimal weights is applied to the first... Predicted soil nutrient values ​​for each sample. This represents the arithmetic mean of the true values ​​of soil nutrients in all test samples.

[0095] After verification, the determination coefficients for nitrogen, phosphorus, and potassium were 0.69, 0.66, and 0.51, respectively; the root mean square errors were 7.89, 9.95, and 71.74, respectively; the mean absolute errors were 4.15, 4.66, and 32.51, respectively; and the mean absolute percentage errors were 12.82%, 14.72%, and 15.80%, respectively. This verifies the high-precision inversion capability of the present invention in complex farmland environments.

[0096] The 100-dimensional dimension follows a standard normal distribution. random noise vector The optimal sample augmentation adversarial model is obtained by inputting the true soil nutrient values ​​at each sampling point in 1D and the true environmental constraint vector at each sampling point in 3D into S32. Within the model, sample features of the entire study area are generated to obtain a global dataset. The global dataset is then input into a trained multi-scale residual attention inversion model to output the predicted values ​​of soil nitrogen, phosphorus, and potassium nutrient content for each grid cell. Based on the predicted values ​​of soil nitrogen, phosphorus, and potassium nutrient content for each grid cell, a distribution map of soil nitrogen, phosphorus, and potassium nutrient content in the study area is generated, as shown in Figures 5-7.

[0097] This invention may have other embodiments. Without departing from the spirit and essence of this invention, those skilled in the art can make various corresponding changes and modifications according to this invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.

Claims

1. A soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks, characterized in that: It includes the following steps: S1. Obtain the true values ​​of soil nutrients, soil moisture content, soil temperature, latitude and longitude coordinates and remote sensing images of each sampling point in a certain farmland area. Based on the soil moisture content, soil temperature and remote sensing images of each sampling point, obtain the multidimensional feature matrix of each sampling point. S2. Based on the latitude and longitude coordinates of each sampling point, align the true soil nutrient values ​​and the multidimensional feature matrix of each sampling point. Calculate the correlation coefficient between the true soil nutrient values ​​and each corresponding feature using the Pearson correlation coefficient formula. Calculate the degree of linear correlation based on the correlation coefficient and perform a two-tailed t-test to obtain the feature subsets of each sampling point that are significantly related to the true soil nutrient values. S3. Based on the vegetation index of a farmland area in S1 and the true values ​​of soil nutrients, soil moisture content, and soil temperature at each sampling point, a nutrient spatial trend field matrix, a soil moisture field, and a soil temperature field are generated using the co-kriging interpolation algorithm; a sample augmentation adversarial model is constructed, and the Monte Carlo method is used to randomly generate samples from the remote sensing image of the farmland area in S1. The geographic coordinates of each expanded sampling point are used to obtain the target nutrient trend value, soil moisture trend value, and soil temperature trend value in the nutrient spatial trend field matrix, soil moisture field, and soil temperature field. These values ​​are then input into the sample expansion adversarial model, which outputs the feature vector of the expanded sampling point. The geographic coordinates, target nutrient trend value, and feature vector of each expanded sampling point are aligned to obtain each expanded sample. An expanded dataset is generated based on all expanded samples. S4: Based on the feature subset of S2, a feature subset of each expanded sampling point is selected from the expanded dataset. A multi-scale residual attention inversion model is constructed, and the feature subset of each expanded sampling point is input into the multi-scale residual attention inversion model to output the predicted soil nutrient value of each expanded sampling point. S5: Based on the predicted soil nutrient value of each expanded sampling point, a soil nutrient content distribution map of a certain farmland area in S1 is generated.

2. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 1, characterized in that: The specific process of S1 is as follows: A farmland area is acquired, and samples are taken from the farmland area using a grid sampling method to obtain the true values ​​of soil nutrients at each sampling point. These true values ​​include the contents of nitrogen, phosphorus, and potassium. Then, a portable sensor is used to measure the soil moisture content at each sampling point. With soil temperature The latitude and longitude coordinates of each sampling point were obtained, along with remote sensing images synchronized with the ground sampling time window. SNAP was used to perform radiometric calibration, FLAASH atmospheric correction, and RPC orthorectification on the remote sensing images to obtain processed images. A spatial mapping relationship between the processed remote sensing images and the study area was established based on the latitude and longitude coordinates of each sampling point. Each sampling point in the spatially mapped remote sensing image was used as the center pixel, and multiple 3×3 neighborhoods were established centered on the center pixel. The average spectral reflectance of each neighborhood was calculated, and the vegetation index and normalized difference water index of the neighborhood were calculated based on the average spectral reflectance of each neighborhood. The gray-level co-occurrence matrix of each neighborhood is calculated. Based on the gray-level co-occurrence matrix and average spectral reflectance of each neighborhood, the texture and spatial structure features of the bands within the neighborhood are calculated. Based on the texture and spatial structure features, the image gradient covariance matrix of the neighborhood is constructed. Based on the image gradient covariance matrix, the ridge constraint of the neighborhood is obtained, and the ridge constraint is normalized to the [0,1] interval to obtain the normalized ridge constraint. The average spectral reflectance, vegetation index, water index, soil moisture content, soil temperature, normalized ridge constraint, and texture and spatial structure features of each neighborhood are subjected to Z-Score normalization to obtain the multidimensional feature matrix of each neighborhood.

3. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 2, characterized in that: The vegetation indices include the Normalized Difference Vegetation Index (NDVI), the Green Normalized Vegetation Index (GDI), the Ratio Vegetation Index, the Difference Vegetation Index, the Soil-Regulating Vegetation Index, and the Enhanced Vegetation Index, and the calculation formulas are as follows: (1) (2) (3) (4) (5) (6) Among them, Normalized Difference Vegetation Index (NDVI) These represent the average spectral reflectance in the near-infrared band, red, green, and blue, respectively. It is a constant. The green normalized vegetation index, The ratio is the vegetation index. The difference vegetation index, To regulate the vegetation index in the soil, To enhance the vegetation index.

4. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 3, characterized in that: The formula for calculating the normalized difference water index is as follows: (7) Among them, This is the normalized differential water index.

5. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 4, characterized in that: The texture and spatial structure features include mean, standard deviation, and neighborhood statistical features. The neighborhood statistical features include contrast, homogeneity, energy, and correlation texture features of the R-band and NIR band.

6. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 5, characterized in that: The image gradient covariance matrix is: (8) Among them, The image gradient covariance matrix is... For Gaussian smoothing kernel, This represents the convolution operation. The image gradient vector, , for transpose, The image pixel position is represented as , For horizontal gradient, , For vertical gradient, , Indicates multiplication. , , The components of the structure tensor matrix are the smoothed horizontal gradient energy, gradient correlation, and vertical gradient energy, respectively.

7. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 6, characterized in that: The normalized monotropic constraint for: (9)。 8. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 7, characterized in that: The specific process of S2 is as follows: Based on the latitude and longitude coordinates of each sampling point, align the true value of soil nutrients at each sampling point with the multidimensional feature matrix of the corresponding neighborhood. Treat the multidimensional feature matrix and the true value of soil nutrients at each sampling point as a sample. Define samples with a spectral response value of 0 in the feature vector of the multidimensional feature matrix as abnormal samples. Delete abnormal samples and construct the original dataset based on all samples after deleting abnormal samples. , This represents the total number of samples after removing outliers. For the first Multidimensional feature vectors of each sample For the first True values ​​of soil nutrient content for each sample; based on the original dataset. For each feature and its corresponding true value of soil nutrients, the correlation coefficient between the true value of soil nutrients and each feature is calculated using the Pearson correlation coefficient formula: (10) Among them, For the first Features True values ​​of soil nutrients The correlation coefficient, , This is the true value of nitrogen. For the true value of phosphorus, This is the true value for potassium. For the first The sampling point of the first sampling point 1 eigenvalue, For the first The mean of the eigenvalues, For the first True values ​​of soil nutrients at each sampling point The mean of the true values ​​of soil nutrients is given. The degree of linear correlation is calculated based on the correlation coefficient and a two-tailed t-test is performed to screen features that are significantly correlated with the true values ​​of soil nutrients, thus obtaining feature subsets corresponding to nitrogen, phosphorus, and potassium.

9. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 8, characterized in that: The specific process of S3 is as follows: S31, obtain the vegetation index of a certain farmland area in S1, using the true value of soil nutrients, soil moisture content, soil temperature and normalized row orientation constraint of each sampling point as the main variables, and the vegetation index of a certain farmland area as the covariance variable, and use the co-kriging interpolation algorithm to analyze the cross semivariogram of the main variables and covariance variables to generate the nutrient spatial trend field matrix. Soil moisture field Soil temperature field and the value field of the monopoly S32. Construct a sample augmentation adversarial model, which includes a deep condition generator, a discriminator, and an auxiliary regressor. The deep condition generator consists of four repeated composite structures, a processing layer, a computation module, and a normalization layer. Each composite structure consists of a fully connected layer, a BN layer, and a Leaky ReLU activation function layer. The processing layer consists of a fully connected layer and a Tanh activation function layer. The number of neurons in the fully connected layers of the first, second, third, and fourth fully connected layers and the output layer are 256, 512, 1024, 512, and 16, respectively. Obtain a standard normal distribution. The random noise vector, along with the true soil nutrient values ​​at each sampling point, is used to represent the random noise vector. and the environment constraint vector for each sampling point Within the depth condition generator, the data passes through four layers of repeated combined structures and processing layers to obtain the average spectral reflectance and texture and spatial structure features of each neighborhood after feature mapping. The average spectral reflectance of each neighborhood after feature mapping is input into the calculation module, which outputs the vegetation index and normalized differential water index for each neighborhood. The vegetation index and normalized differential water index of each neighborhood, along with the average spectral reflectance and texture and spatial structure features of each neighborhood after feature mapping, are then input into a normalization layer for Z-score normalization, outputting the feature matrix for each sampling point. During the deep condition generator processing, the discriminator calculates the GAN adversarial loss. Meanwhile, the auxiliary regressor will generate the feature matrix output by the generator. By remapping back to the corresponding true values ​​of soil nutrients, soil moisture content, soil temperature, and normalized ridge orientation constraints, the predicted soil nutrient values ​​for each sampling point can be obtained. Soil temperature prediction value Predicted soil moisture content and monopoly value And calculate the physical environment consistency loss function. Trend Consistency Loss Function The total loss of the sample augmentation adversarial model is obtained. for: (11) (12) (13) Among them, 、 All are weights; S33, repeat S32 to train the sample augmentation adversarial model, using the Adam optimizer with a learning rate of 0.0002, iteratively training for 1000 rounds with a batch size of 128, and using ablation experiments to optimize the hyperparameters of the sample augmentation adversarial model to obtain the sample augmentation adversarial model with optimal parameters. S34. Using the Monte Carlo method, randomly generate remote sensing images of a certain farmland area in S1. The geographical coordinates of the expanded sampling points are used to determine the nutrient spatial trend field matrix. The target nutrient trend value is obtained from In the soil moisture field Soil temperature field and the value field of the monopoly The environmental constraint trend value is obtained. ,in, This represents the trend value of soil moisture content. This represents the soil temperature trend value. The trend value is the random noise and target nutrient trend value obtained. and environmental constraint trend value Optimal Sample Augmentation Adversarial Model with Optimal Input Parameters Internally, through forward inference, feature vectors of expanded sampling points with soil physicochemical properties are output in batches, aligning the geographic coordinates and target nutrient trend values ​​of each expanded sampling point. By combining the feature vectors, we obtain each augmented sample, and construct an augmented dataset based on all augmented samples.

10. The soil nutrient inversion method based on multi-source physical constraints and multi-scale attention networks according to claim 9, characterized in that: The specific process of S4 is as follows: S41. Based on the feature subset of S2, select the feature subset of each expanded sampling point from the expanded dataset; S42. Construct a multi-scale residual attention inversion model, which includes a multi-scale feature parallel extraction module, a deep residual coding layer module, a CBAM attention weighted layer embedding module, and a regression prediction module; S43. Train the multi-scale residual attention inversion model using the feature subset of each expanded sampling point, and output the predicted soil nutrient value for each expanded sampling point. Specifically, the process is as follows: S431. The multi-scale feature parallel extraction module includes three parallel one-dimensional convolutions and multi-scale feature layers, using the feature subset of each expanded sampling point as input. The following processing should be performed: (14) (15) Among them, , representing the first one-dimensional convolution, the second one-dimensional convolution, and the third one-dimensional convolution. This is the feature map output by the first one-dimensional convolution. This is the feature map output by the second one-dimensional convolution. The feature map output by the third one-dimensional convolution. For the first The weight matrix of a one-dimensional convolution. For the first The bias term of a one-dimensional convolution. This represents the convolution operation. For activation function, This indicates a splicing operation along the channel dimension. For multi-scale feature tensors; S432, the deep residual coding layer module includes three sequentially connected deep residual units. The deep residual coding layer module consists of a main path and skip connections, which encode the multi-scale feature tensor. Input deep residual coding layer module, output feature tensor The S433 and CBAM attention weighting layer embedding modules sequentially include a channel attention layer and a spatial feature attention layer. The processing procedure of the channel attention layer is as follows: (16) Among them, For channel weights, For global average pooling, For global max pooling, For a multilayer perceptron; then the channel weights are... With feature tensor Multiply to generate channel-weighted features. The processing procedure of the spatial feature attention layer is as follows: (17) Among them, Spatial weights, express convolution, For channel average pooling, Max pooling of channels; (18) Among them, For attention-weighted features, This indicates element-wise multiplication; S434, the regression prediction module, sequentially includes a global average pooling layer, a flattening layer, a fully connected layer, a Mish activation function layer, a Dropout regularization layer, and an output layer, which weights attention features. The input regression prediction module outputs the predicted soil nutrient values ​​for each expanded sampling point. S435. Repeat S431-S434 to obtain the trained multi-scale residual attention inversion model.

Citation Information

Cited By

  • An agricultural nitrogen and phosphorus full flux assimilation and scenario difference potential accounting method

    CN122196939A