A hyperspectral remote sensing image prediction method based on partition attention network

By using a partitioned attention network and an improved loss function, Huber Loss, combined with SNV+SG+FD preprocessing and CARS algorithm, a CNN+Transformer encoder hybrid architecture was constructed. This solved the problems of noise interference and model overfitting in hyperspectral remote sensing data, and achieved high-precision inversion of soil organic matter content.

CN122221698BActive Publication Date: 2026-08-25KUNMING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610684309.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-18
Publication Date
2026-08-25
Estimated Expiration
2046-05-18

AI Technical Summary

Technical Problem

In existing technologies, hyperspectral remote sensing data is susceptible to noise interference, models are prone to overfitting under small sample conditions, and the Transformer architecture has high computational complexity, which affects the accuracy and efficiency of soil organic matter inversion.

Method used

We employ a partitioned attention network (SpecPAT-Net) combined with an improved loss function, Huber Loss. By introducing a partitioned attention mechanism and an improved loss function, we reduce computational overhead and improve the robustness of the model in complex environments. We use a combination of SNV+SG+FD preprocessing and CARS algorithm to extract feature bands and construct a hybrid architecture of CNN+Transformer encoder.

Benefits of technology

It achieves high-precision and low-cost inversion of soil organic matter content in complex mountainous environments, improves the model's predictive performance under small sample and noisy data, and enhances the accuracy and efficiency of remote sensing data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122221698B_ABST
    Figure CN122221698B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of based on partition attention network's hyperspectral remote sensing image prediction method, belong to hyperspectral remote sensing image prediction technical field.The method includes: obtaining the hyperspectral data of remote sensing image and soil organic matter content data and carries out initial pretreatment;The hyperspectral data of remote sensing image after initial pretreatment is corrected, again and after initial pretreatment soil organic matter content data is divided according to preset proportion using SNV+SG+FD combination and carries out secondary pretreatment;Using CARS algorithm extracts the characteristic wave band in the soil sample data after secondary pretreatment;Design partition attention mechanism, based on characteristic wave band constructs SpecPAT-Net model, and based on improved loss function Huber Loss carries out training;The hyperspectral data of remote sensing image is input into SpecPAT-Net trained, obtains soil organic matter prediction result.The present application is aimed at solving the technical problems that the existing technology has strong noise interference of hyperspectral remote sensing data, model is prone to overfitting under small sample condition and the high computational complexity of Transformer architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a hyperspectral remote sensing image prediction method based on a partitioned attention network, belonging to the field of hyperspectral remote sensing image prediction technology. Background Technology

[0002] Soil organic matter (SOM) is a crucial indicator of soil fertility and health, closely related to soil structure, water retention capacity, nutrient cycling, and microbial activity. Compared to traditional laboratory methods, hyperspectral technology supports the rapid acquisition of soil spectral data in the field or laboratory. By establishing quantitative models of spectral data and organic matter content, it enables large-scale non-destructive detection of soil organic matter, rapid prediction, and mapping, significantly improving monitoring efficiency. With the increasingly mature hyperspectral technology, soil information can be acquired quickly, non-destructively, and over a wide area, allowing for the identification and quantitative analysis of soil properties. Current soil research combines hyperspectral data acquisition technologies such as UAVs, satellite remote sensing, and Geographic Information Systems (GIS) with deep learning to construct universal prediction models applicable to different soil types, regions, and climatic conditions, continuously improving the accuracy and scale of soil organic matter monitoring and enhancing the scientific rigor and reliability of inversion algorithms.

[0003] Extensive research has demonstrated that soil spectral reflectance is highly susceptible to moisture influences. Higher moisture levels lead to a decrease in overall spectral reflectance and also generate strong absorption characteristics in specific spectral bands, altering the shape, slope, and absorption depth of the soil spectrum, masking important spectral features, and thus affecting spectral-based soil organic matter retrieval. Before using remote sensing data for soil property analysis, it is usually necessary to correct the remote sensing soil spectral data or limit sampling and modeling to controlled soil moisture standards. However, most current research focuses on using basic remote sensing data processing methods or single spectral correction algorithms such as Direct Normalization (DS) and Piecewise Direct Normalization (PDS). Current preprocessing methods for spectral data are also relatively limited; traditional preprocessing methods such as SG smoothing, Standard Normal Transform (SNV), and First Derivative (FD) are insufficient for handling complex spectral data. Furthermore, most studies rely solely on extensive experimental comparisons for verification rather than selecting and combining methods to address data-related issues. Combining the advantages of multiple algorithms to correct the spectrum, along with the targeted selection and combination of common preprocessing algorithms, could further improve the predictive performance of subsequent models.

[0004] The same problem exists in modeling. Research often focuses on processing data using a single deep learning model, relying on prior conclusions from previous experiments or extensive comparative studies to arrive at the optimal model, thus neglecting the individual strengths and weaknesses of each model. CNN networks are simpler, have stronger capabilities for analyzing local information, and can converge quickly and extract meaningful features even with limited data, making them more widely used in current research. Transformers, on the other hand, lack this prior knowledge and are prone to overfitting or difficulty learning effective features when data is insufficient. Using CNNs as a pre-module can provide Transformer encoders with more stable and semantically meaningful input. Combining the advantages of both can build a more powerful network, improving the overall model's robustness in small samples, noisy data, and complex scenarios, resulting in a more comprehensive feature representation. This will lead to more accurate and valuable analysis of satellite remote sensing data. Summary of the Invention

[0005] The purpose of this invention is to provide a hyperspectral remote sensing image prediction method based on a partitioned attention network, which aims to solve the technical problems of strong noise interference in hyperspectral remote sensing data, easy overfitting of models under small sample conditions, and high computational complexity of the Transformer architecture in existing technologies.

[0006] To achieve the above objectives, the technical solution of this invention is: a hyperspectral remote sensing image prediction method based on a partitioned attention network. This method, by introducing a partitioned attention mechanism and an improved loss function, significantly reduces computational overhead while ensuring the model's robustness to noisy data. It achieves high-precision, low-cost inversion of soil organic matter content in complex mountainous environments, possessing good practical application value and development potential. The method includes the following steps:

[0007] Step 1: Collect soil samples from sampling points in the target area, obtain ground hyperspectral data of the sampling points, and determine the soil organic matter content of the field data to obtain soil organic matter content data;

[0008] Step 2: Acquire remote sensing image data of the target area and determine the band values ​​of the corresponding pixels in the remote sensing image data based on the geographical location data to obtain the hyperspectral data of the remote sensing image;

[0009] Step 3: Perform initial preprocessing on the hyperspectral data of the remote sensing image and the soil organic matter content data;

[0010] Step 4: Correct the hyperspectral data of the pre-processed remote sensing image based on ground hyperspectral data;

[0011] Step 5: Divide the hyperspectral data of the corrected remote sensing image and the soil organic matter content data after the initial preprocessing into training set and test set according to a preset ratio to obtain the divided soil sample data.

[0012] Step 6: Use the SNV+SG+FD combination to perform secondary preprocessing on the segmented soil sample data;

[0013] Step 7: Use the CARS algorithm to extract feature bands from the soil sample data after secondary preprocessing;

[0014] Step 8: Design a partitioned attention mechanism and construct a partitioned attention network model SpecPAT-Net based on the CNN+Transformerencoder hybrid architecture based on the feature bands;

[0015] Step 9: Train SpecPAT-Net based on the improved loss function Huber Loss;

[0016] Step 10: Input the hyperspectral data of the remote sensing image to be predicted into the trained SpecPAT-Net to obtain the soil organic matter prediction results.

[0017] Optionally, the partition attention mechanism specifically includes:

[0018] First, the hyperspectral data was divided into three regions in a 1:1:1 ratio, and different weights were assigned to each region.

[0019] Then, interval embedding is introduced to explicitly encode the interval information to which the band belongs into the feature representation, so that the model can distinguish the band features of different intervals during the attention calculation process and adaptively learn the weight of each region during the training process, and use different weights to process the bands.

[0020] Finally, the spectral sequence is input into the Transformer encoder for encoding, and a learnable Query vector is introduced to perform attention-weighted aggregation of the spectral sequence features after Transformer encoding to obtain a global context representation, while also obtaining the attention weights corresponding to each band.

[0021] Optionally, Step 8 specifically includes:

[0022] A CNN-Transformer encoder hybrid architecture is established. First, the features of the soil sample data that have undergone secondary preprocessing are downsampled using CNN, and then the features are input into the Transformer encoder.

[0023] The SpecPAT-Net model is built based on a CNN-Transformer encoder hybrid architecture and bound to band values. This provides the SpecPAT-Net model with additional interval identity information for the interval to which each band belongs, enabling the model to distinguish band information from different sources.

[0024] Unique location identification information is generated for each band using sine and cosine functions. The sine function is used when the dimension index is even, and the cosine function is used when the dimension index is odd. The expression is:

[0025]

[0026]

[0027] in, This indicates the location and identity information of the specific spectral wavelength corresponding to an even-numbered dimension index. This indicates the location and identity information of the specific spectral wavelength corresponding to an odd-numbered dimension index. The position index of the band corresponds to the wavelength of the spectrum; i represents the current dimension index, with a value ranging from 0 to 1. , It is the dimension of the location encoding.

[0028] Optionally, the SpecPAT-Net model includes a local feature extraction module, a feature mapping and sequence construction module, a positional encoding module, a partition information embedding module, a Transformer encoding module, a partition attention aggregation module, and an output prediction module, specifically:

[0029] The local feature extraction module extracts features from the input spectral sequence using a one-dimensional convolutional neural network; wherein the one-dimensional convolutional neural network includes convolutional layers, normalization layers, and pooling layers;

[0030] The feature mapping and sequence construction module converts the features output by the CNN into a fixed-dimensional representation through linear mapping and constructs them into a sequence form that conforms to the Transformer input format.

[0031] The location coding module introduces sine and cosine location coding based on the physical location of the band, providing unique location identification information for each band.

[0032] The partition information embedding module divides the spectral band into several intervals according to a preset ratio and assigns a corresponding embedding vector to each interval to introduce the regional information to which the band belongs.

[0033] The Transformer encoding module performs global modeling of the input sequence and learns the long-distance dependencies between different bands through a multi-head self-attention mechanism;

[0034] The partitioned attention aggregation module introduces a learnable query vector to perform weighted aggregation on the Transformer-encoded sequence, generating a global context representation and obtaining the attention weights for each band.

[0035] The output prediction module performs regression prediction on the aggregated features through a fully connected layer and outputs the target variable.

[0036] Optionally, the improved loss function Huber Loss is specifically:

[0037] Based on the partitioned attention mechanism, the original Huber Loss function is improved by dividing the samples into low-value, medium-value, and high-value intervals, and assigning different weights to each interval. The expression is as follows:

[0038]

[0039] in, Let y be the weighted piecewise function, and y represent the true value. Indicates the weight of the low-value interval; Indicates the weight of the median interval; Indicates the weight of the high-value interval; Indicates the low value range. Indicates the high value range;

[0040] An error enhancement mechanism is introduced to amplify the gradient of error samples. The error enhancement mechanism involves squaring the loss value.

[0041] By combining partition weights with an error enhancement mechanism, an improved loss function, Huber Loss, is obtained, expressed as:

[0042]

[0043] in, This represents the improved loss function, Huber Loss. This represents the model's predicted value. This represents hyperparameters.

[0044] The beneficial effects of this invention are as follows: This invention proposes using ZY1-02D ​​satellite hyperspectral images as the data source in complex scenarios. It addresses existing problems by combining DS+PDS for data correction, employs SNV+SG+FD combined preprocessing, and utilizes CARS to select feature bands. Furthermore, it innovatively proposes a model with a partitioned attention mechanism, SpecPAT-Net, for SOM content inversion. Specifically, SpecPAT-Net incorporates a partitioned attention mechanism on top of a CNN+Transformer encoder hybrid architecture for small-scale data, and optimizes the Huber Loss loss function using a partitioned weighting approach, thereby improving the accuracy and performance of the inversion model. This invention enables rapid and accurate prediction using remote sensing satellite data, providing strong technical support for related research on soil organic matter prediction. Attached Figure Description

[0045] Figure 1 This is a flowchart of the steps of the present invention;

[0046] Figure 2 This is a schematic diagram of the sampling environment in the research area of ​​this invention;

[0047] Figure 3 The following are examples of spectral effects before and after DS+PDS correction according to the present invention, wherein (a) is the original laboratory spectrum; (b) is the original ZY1-02D ​​spectrum; and (c) is the ZY1-02D ​​spectrum after DS+PDS correction.

[0048] Figure 4 This is a diagram showing the overall structure of the CNN-Transformer fusion network of this invention;

[0049] Figure 5 This is a scatter plot of the predicted and actual values ​​of each soil SOM on the training and test sets for the best prediction model using PLSR as the modeling method in this embodiment of the invention.

[0050] Figure 6 This is a scatter plot of the predicted and actual values ​​of each soil SOM on the training and test sets for the best prediction model using GBM as the modeling method in this embodiment of the invention.

[0051] Figure 7 This is a scatter plot of the predicted and actual values ​​of each soil SOM on the training and test sets for the best prediction model using Transformer as the modeling method in this embodiment of the invention.

[0052] Figure 8 Scatter plot of the predicted and actual SOM values ​​of each soil type for the optimal prediction model of the present invention on the training and test sets.

[0053] Figure 9This is a soil SOM inversion map of the study area in this embodiment of the invention. Detailed Implementation

[0054] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but this does not limit the scope of the present invention.

[0055] Example 1: As Figure 1 As shown, a hyperspectral remote sensing image prediction method based on a partitioned attention network includes the following steps:

[0056] Step 1: Collect soil samples from sampling points in the target area, obtain ground hyperspectral data of the sampling points, and determine the soil organic matter content of the field data to obtain soil organic matter content data;

[0057] Optionally, in this embodiment, the soil sample was collected from a mountainous red soil area with sparse vegetation, severe soil erosion, and an environment such as... Figure 2 As shown. Multiple soil sampling points were set up in the target area, and the number of each sample was recorded and the corresponding geographical location information was collected. The soil organic matter content data of each soil sampling point was measured in the laboratory. After removing impurities, the collected soil samples were air-dried and ground through a 100-mesh sieve. Then, the hyperspectral data of the collected soil samples were measured using an ASD (Artificial Spectrometer for Soil and Environment).

[0058] Step 2: Acquire remote sensing image data of the target area and determine the band values ​​of the corresponding pixels in the remote sensing image data based on the geographical location data to obtain the hyperspectral data of the remote sensing image;

[0059] Optionally, download ZY1-02D ​​remote sensing images covering the sampling points within a time window of ±5 days from the sampling time. The time window can be adjusted according to the actual environment. Ensure that the cloud cover is less than 10%, the weather is clear, and there are no clouds over the target area. The acquired ZY1-02D ​​remote sensing images are preprocessed using ENVI software for radiometric calibration, atmospheric correction, and orthorectification. Using ground hyperspectral data as the standard, the hyperspectral band range of the ZY1-02D ​​remote sensing images is resampled to 400–2450 nm. Finally, based on the GPS coordinates of the sampling points, ENVI 5.3 software is used to extract the hyperspectral data of the soil at the corresponding locations in the image.

[0060] Step 3: Perform initial preprocessing on the hyperspectral data of the remote sensing image and the soil organic matter content data;

[0061] Optionally, the ZY1-02D ​​hyperspectral remote sensing image file is read in ENVI 5.3, and the hyperspectral data of the remote sensing image is subjected to initial preprocessing of radiometric calibration and atmospheric correction; Python is used to perform initial preprocessing of soil organic matter content data for outlier removal and downsampling.

[0062] Understandably, Step 3 in this embodiment improves data quality and accuracy through initial preprocessing, providing a solid foundation for subsequent model construction and analysis.

[0063] Step 4: Correct the hyperspectral data of the pre-processed remote sensing image based on ground hyperspectral data;

[0064] Optionally, this embodiment combines the DS+PDS algorithm to correct the hyperspectral data of the initially preprocessed remote sensing image, such as... Figure 3 As shown, the spectral curves before and after DS+PDS correction are displayed respectively. Among them, (a) is the original laboratory spectrum, (b) is the original ZY1-02D ​​spectrum, and (c) is the ZY1-02D ​​spectrum after DS+PDS correction.

[0065] Specifically, the ZY1-02D ​​remote sensing image hyperspectral data is first subjected to direct standardization (DS) correction, including: using partial least squares regression (PLSR), taking the satellite spectrum as input and the laboratory spectrum as output, a linear mapping is learned to correct the satellite spectrum to a representation consistent with the laboratory spectrum, ultimately obtaining the DS-corrected remote sensing image hyperspectral data, expressed as:

[0066]

[0067]

[0068]

[0069] in, This represents the hyperspectral data of the ZY1-02D ​​remote sensing image after DS conversion. This represents the hyperspectral data of the ZY1-02D ​​remote sensing image. For the original ground hyperspectral data of the sample points and The transformation matrix is ​​the regression coefficient extracted from the PLSR model; The residual matrix is... This represents the average residual, used to correct for systematic errors. This represents the coefficient matrix obtained from partial least squares regression (PLS); This represents the transpose operation; n represents the total number of samples; Indicates the first Ground hyperspectral data for each sample; Indicates the first Hyperspectral data of ZY1-02D ​​remote sensing images for one sample.

[0070] Furthermore, segmented direct normalization (PDS) correction is performed on the hyperspectral data of remote sensing images that have only undergone DS correction to overcome the limitations of a single correction method and obtain more accurate hyperspectral data. This includes: calculations based on ground hyperspectral data, first dividing the total number of bands into 5 intervals and handling possible non-divisible cases, with each interval containing several continuous bands, then applying DS to each interval separately, and finally stitching together the data of all segments to obtain the PDS-corrected hyperspectral data of the remote sensing images, expressed as:

[0071]

[0072]

[0073] in, This represents the final hyperspectral data after DS+PDS processing; This represents a concatenation function used to merge multiple matrices into a larger matrix along the column direction. Indicates the first The starting index of the segment; Indicates the first End index of the segment; For the first The spectrum after DS correction, The number of intervals to be divided is 5 in this embodiment; For the first Each band interval.

[0074] Step 5: Divide the hyperspectral data of the corrected remote sensing image and the soil organic matter content data after the initial preprocessing into training set and test set according to a preset ratio to obtain the divided soil sample data.

[0075] Optionally, in this embodiment, a statistical algorithm is used for partitioning. Specifically, the Kennard-Stone (KS) algorithm is used to partition the collected 266 sample points and 127 bands of soil hyperspectral data into two parts, a training set and a test set, in a 7:3 ratio. The training set consists of 187 samples, and the validation set consists of 79 samples.

[0076] Step 6: Use the combination of SNV+SG+FD to perform secondary preprocessing on the segmented soil sample data to eliminate noise and highlight spectral features.

[0077] Specifically, in this embodiment, the segmented soil sample data undergoes secondary preprocessing. First, Standard Normal Transform (SNV), Savitzky-Golay Smoothing (SG), First Derivative Processing (FD), SNV+SG, SNV+FD, SG+FD, and SNV+SG+FD are used to preprocess the training and validation sets respectively, verifying the effectiveness of the SNV+SG+FD combination. Under the same feature wavelength selection algorithm and modeling method, using the proposed SpecPAT-Net as the model, the final model metrics are shown in Table 1.

[0078] Table 1: Comparison of model metrics for different preprocessing methods under the SNV+SG+FD combination.

[0079]

[0080] As shown in Table 1, the SNV+SG+FD preprocessing method achieves better results under the same modeling approach, demonstrating the significant advantages of this combination for preprocessing hyperspectral remote sensing imagery. Compared to using SNV, SG, and FD individually, or combining them according to their algorithmic characteristics, this combination fully leverages the strengths of each preprocessing method, enhancing spectral features while correcting scattering effects. It better adapts to the complex hyperspectral data of remote sensing images, providing a solid foundation for subsequent feature band extraction.

[0081] Step 7: Use the CARS algorithm to extract feature bands from the soil sample data after secondary preprocessing;

[0082] Optionally, in this embodiment, the Competitive Adaptive Reweighted Sampling (CARS) algorithm was used to extract 10 feature bands from the soil sample data after secondary preprocessing.

[0083] Step 8: Design a partitioned attention mechanism and construct a partitioned attention network model SpecPAT-Net based on the CNN+Transformerencoder hybrid architecture based on the feature bands;

[0084] Optionally, to address the problem of uneven data distribution and to overcome the limitation of traditional self-attention mechanisms treating all bands equally in hyperspectral remote sensing data, this embodiment designs a partitioned attention mechanism based on the concept of partitioning. Specifically, the partitioned attention mechanism is as follows:

[0085] First, the hyperspectral data was divided into three regions in a 1:1:1 ratio, and different weights were assigned to each region.

[0086] Then, interval embedding is introduced to explicitly encode the interval information to which the band belongs into the feature representation, so that the model can distinguish the band features of different intervals during the attention calculation process and adaptively learn the weight of each region during the training process, thereby achieving automatic focusing on key bands and using different weights to process the bands.

[0087] Finally, the spectral sequence is input into the Transformer encoder for encoding to model the global dependencies between bands. At the same time, to enhance the model's ability to understand the global context, a learnable Query vector is introduced to perform attention-weighted aggregation on the features of the spectral sequence after Transformer encoding to obtain a global context representation and obtain the attention weights corresponding to each band.

[0088] It is understandable that this embodiment uses a partitioned attention mechanism to enable the model to adaptively learn the importance of different intervals during training, thereby enhancing its ability to focus on key bands, improving the modeling effect on unevenly distributed data, and ultimately achieving targeted improvement in poorly performing areas and dynamically adjusting attention weights to improve the overall accuracy of the model.

[0089] Optionally, Step 8 specifically includes:

[0090] A CNN-Transformer encoder hybrid architecture is established. First, the features of the soil sample data after secondary preprocessing are downsampled using CNN. Then, the features are input into the Transformer encoder for further detailed feature analysis.

[0091] The SpecPAT-Net model is built based on a CNN-Transformer encoder hybrid architecture and bound to band values. This provides the SpecPAT-Net model with additional interval identity information for each band, enabling the model to distinguish band information from different sources and providing a basis for interval division.

[0092] Unique location identification information is generated for each band using sine and cosine functions. The sine function is used when the dimension index is even, and the cosine function is used when the dimension index is odd. The expression is:

[0093]

[0094]

[0095] in, This indicates the location and identity information of the specific spectral wavelength corresponding to an even-numbered dimension index. This indicates the location and identity information of the specific spectral wavelength corresponding to an odd-numbered dimension index. The position index represents the band, and in this embodiment, it represents the actual wavelength value, corresponding to the wavelength of the spectrum; i represents the current dimension index, with a value range of 0. , The dimension of the location encoding (i.e., the dimension of the token embedding) is 64 in this embodiment; 10000 in the formula is a hyperparameter used to control the frequency attenuation in different dimensions, which enables the model to learn multi-scale location information.

[0096] It is understandable that this embodiment generates unique location information for each band by using sine and cosine functions, which is more in line with the actual tasks of remote sensing hyperspectral imaging, enhances the model's ability to understand the band structure, and has greater domain interpretability.

[0097] Optionally, the SpecPAT-Net model includes a local feature extraction module, a feature mapping and sequence construction module, a positional encoding module, a partition information embedding module, a Transformer encoding module, a partition attention aggregation module, and an output prediction module, specifically:

[0098] The local feature extraction module extracts features from the input spectral sequence using a one-dimensional convolutional neural network; wherein the one-dimensional convolutional neural network includes convolutional layers, normalization layers, and pooling layers;

[0099] The feature mapping and sequence construction module converts the features output by the CNN into a fixed-dimensional representation through linear mapping and constructs them into a sequence form that conforms to the Transformer input format.

[0100] The location coding module introduces sine and cosine location coding based on the physical location of the band, providing unique location identification information for each band.

[0101] The partition information embedding module divides the spectral band into several intervals according to a preset ratio and assigns a corresponding embedding vector to each interval to introduce the regional information to which the band belongs.

[0102] The Transformer encoding module performs global modeling of the input sequence and learns the long-distance dependencies between different bands through a multi-head self-attention mechanism;

[0103] The partitioned attention aggregation module introduces a learnable query vector to perform weighted aggregation on the Transformer-encoded sequence, generating a global context representation and obtaining the attention weights for each band.

[0104] The output prediction module performs regression prediction on the aggregated features through a fully connected layer and outputs the target variable.

[0105] Step 9: Train SpecPAT-Net based on the improved loss function Huber Loss;

[0106] Optionally, the improved loss function Huber Loss is specifically:

[0107] Based on the partitioned attention mechanism, the original Huber Loss function is improved by dividing the samples into low-value, medium-value, and high-value intervals and assigning different weights to each interval. This mitigates the impact of uneven data distribution and prevents the model from tending towards the median value during prediction. The expression is as follows:

[0108]

[0109] in, Let y be the weighted piecewise function, and y represent the true value. Indicates the weight of the low-value interval; Indicates the weight of the median interval; Indicates the weight of the high-value interval; Indicates the low value range. Indicates the high value range;

[0110] To enhance the model's ability to predict difficult samples, an error enhancement mechanism is introduced to amplify the gradient of error samples. This error enhancement mechanism involves squaring the loss value.

[0111]

[0112] in, This is the original Huber Loss function;

[0113] It is understandable that this embodiment uses an error enhancement mechanism to make the model pay more attention to difficult samples during training, thus strengthening the loss in the high-value range. The difficult samples are defined as samples with a large absolute value of prediction error, i.e., samples that satisfy... Samples with a difference greater than a preset threshold are considered high-error samples. An error enhancement mechanism can be used to increase the model's attention to high-error samples during training.

[0114] By combining partition weights with an error enhancement mechanism, an improved loss function, Huber Loss, is obtained to enhance the model's ability to fit samples from different intervals. The expression is as follows:

[0115]

[0116] in, This represents the improved loss function, Huber Loss. This represents the model's predicted value. This represents a hyperparameter used to control the threshold for switching from MSE to MAE. When The smaller the value, the more sensitive the loss function is to outliers, and the closer it is to the MSE. The larger the value, the more robust the function is to outliers and the closer it is to MAE. In this embodiment, Set to 1.0.

[0117] Furthermore, the model is trained using the preprocessed and feature-extracted training set, and then the regression index R is calculated on the trained SpecPAT-Net using the test set. 2 RMSE, RPD, and RPIQ are used to validate the prediction model.

[0118] It is understandable that this embodiment, through the improved Huber Loss loss function, can ensure robustness to outliers while enabling the model to not only effectively fit samples in the middle range during training, but also enhance the model's learning ability for samples in the low-value and high-value ranges, thereby improving the overall prediction accuracy and model generalization performance.

[0119] Step 10: Input the hyperspectral data of the remote sensing image to be predicted into the trained SpecPAT-Net to obtain the soil organic matter prediction results and draw the soil organic matter inversion map.

[0120] Furthermore, the technical solutions provided in Steps 8-10 of this embodiment will be further explained below through a specific implementation example and experiment.

[0121] Specifically, a soil organic matter prediction model is established using a training set that has undergone preprocessing and feature band extraction. First, a hybrid architecture of CNN and Transformer encoder is built. The CNN downsamples the preprocessed soil feature data and inputs it into the Transformer encoder for further detailed feature analysis, combining the advantages of CNN and Transformer to handle noisy hyperspectral image data. The pre-processing CNN module first uses a two-layer 1D convolutional neural network (CNN) to extract and downsample the local features of the input soil spectral data feature sequence. Each convolutional layer includes convolution operations (kernel size=3, padding=1), batch normalization, ReLU activation, and max pooling (stride=2). Subsequently, the multi-channel sequence features output by the CNN are compressed into a fixed-dimensional feature vector through flattening operations and linear mapping layers to adapt to the input requirements of the subsequent Transformer encoder module. Figure 4 The diagram shown is an overall structural diagram of the CNN-Transformer fusion network in the embodiment.

[0122] Furthermore, by generating a unique positional representation for each band using sine and cosine functions, the positional encoding in the Transformer module, originally targeting word positions, is improved to embedding positions at the band level. This allows the model to perceive the implicit information between bands and uncover the connections between different bands. To address the uneven data distribution, the spectral data is divided into three regions in a 1:1:1 ratio, with different weights assigned to regions exhibiting different performance characteristics. This allows the self-attention mechanism in the Transformer encoder to learn different weight information based on the specific characteristics of each region. Based on the partitioned attention mechanism, the HuberLoss function is improved to enhance the overall model performance. First, the model is divided into three regions and assigned different weights, allowing it to learn not only the middle range during training but also extreme ranges. Taking the proposed SpecPAT-Net model as an example, the process involves the following steps:

[0123] First, the preprocessed training set data with dimensions (266, 10) is input into the input layer, where 266 represents 266 training samples and 10 represents 10 spectral features. The spectral features are used to build a model to predict soil organic matter.

[0124] Then, the training set is sequentially passed through the designed SpecPAT-Net, and the soil SOM content of the sample points is output in the output layer. Throughout the training process, the model is continuously adjusted and the network weights are updated through repeated iterations in each round of training to minimize the value of the loss function and find the optimal model;

[0125] Furthermore, under the same preprocessing and feature selection algorithms, the experimental results were compared with the best prediction models of other modeling methods. Table 2 shows the results, where the proposed SpecPAT-Net model showed the best performance, demonstrating the effectiveness of the proposed model. Scatter plot results for all models are shown below. Figures 5-8 As shown.

[0126] Table 2: Optimal model results under three different modeling methods

[0127]

[0128] Finally, the optimal model with the minimum loss function during iterative training was saved for the overall soil SOM inversion of the study area. The inversion results are as follows: Figure 9 As shown.

[0129] In summary, this invention first collects soil samples from sampling points in the target area, obtains remote sensing image data of the target area, and measures the soil organic matter content in the field data. The remote sensing image data is then corrected using a combined DS+PDS algorithm to remove extreme values ​​before downsampling. Next, a statistical algorithm is used to proportionally divide the processed soil sample data into training and testing sets. Data preprocessing is performed using a combination of SNV+SG+FD, and feature bands are extracted from the preprocessed spectral data using CARS. Finally, a CNN+Transformer hybrid architecture using a partitioned attention mechanism is proposed, and the Huber Loss loss function is optimized using a partitioned weighting approach to obtain the SpecPAT-Net soil SOM inversion model for remote sensing data. The model is trained using the training set, and finally, the test set is used in conjunction with the regression index R. 2 RMSE, RPD, and RPIQ are used to comprehensively evaluate the model. This invention achieves high-precision modeling and zonal adaptive learning under complex satellite remote sensing data, enabling rapid and accurate prediction of soil organic matter content in large-scale scenarios using remote sensing image data, providing strong technical support for soil organic matter research and monitoring.

[0130] The specific embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.

Claims

1. A method for predicting hyperspectral remote sensing images based on a partitioned attention network, characterized in that, The method includes the following steps: Step 1: Collect soil samples from sampling points in the target area, obtain ground hyperspectral data of the sampling points, and determine the soil organic matter content of the field data to obtain soil organic matter content data; Step 2: Acquire remote sensing image data of the target area and determine the band values ​​of the corresponding pixels in the remote sensing image data based on the geographical location data to obtain the hyperspectral data of the remote sensing image; Step 3: Perform initial preprocessing on the hyperspectral data of the remote sensing image and the soil organic matter content data; Step 4: Correct the hyperspectral data of the pre-processed remote sensing image based on ground hyperspectral data; Step 5: Divide the hyperspectral data of the corrected remote sensing image and the soil organic matter content data after the initial preprocessing into training set and test set according to a preset ratio to obtain the divided soil sample data. Step 6: Perform secondary preprocessing on the divided soil sample data using a combination of standard normal transformation, Savitzky-Golay smoothing, and first derivative processing. Step 7: Use the CARS algorithm to extract feature bands from the soil sample data after secondary preprocessing; Step 8: Design a partitioned attention mechanism and construct a partitioned attention network model SpecPAT-Net based on the CNN+Transformerencoder hybrid architecture based on the feature bands; Step 9: Train SpecPAT-Net based on the improved loss function Huber Loss; Step 10: Input the hyperspectral data of the remote sensing image to be predicted into the trained SpecPAT-Net to obtain the soil organic matter prediction results; The SpecPAT-Net model includes a local feature extraction module, a feature mapping and sequence construction module, a positional encoding module, a partition information embedding module, a Transformer encoding module, a partition attention aggregation module, and an output prediction module, specifically: The local feature extraction module extracts features from the input spectral sequence using a one-dimensional convolutional neural network; wherein the one-dimensional convolutional neural network includes convolutional layers, normalization layers, and pooling layers; The feature mapping and sequence construction module converts the features output by the CNN into a fixed-dimensional representation through linear mapping and constructs them into a sequence form that conforms to the Transformer input format. The location coding module introduces sine and cosine location coding based on the physical location of the band, providing unique location identification information for each band. The partition information embedding module divides the spectral band into several intervals according to a preset ratio and assigns a corresponding embedding vector to each interval to introduce the regional information to which the band belongs. The Transformer encoding module performs global modeling of the input sequence and learns the long-distance dependencies between different bands through a multi-head self-attention mechanism; The partitioned attention aggregation module introduces a learnable query vector to perform weighted aggregation on the Transformer-encoded sequence, generating a global context representation and obtaining the attention weights for each band. The output prediction module performs regression prediction on the aggregated features through a fully connected layer and outputs the target variable. The improved loss function Huber Loss is specifically as follows: Based on the partitioned attention mechanism, the original Huber Loss function is improved by dividing the samples into low-value, medium-value, and high-value intervals, and assigning different weights to each interval. The expression is as follows: ; in, Let y be the piecewise weighting function, and y represent the true value. Indicates the weight of the low-value interval; Indicates the weight of the median interval; Indicates the weight of the high-value interval; Indicates the low value range. Indicates the high value range; An error enhancement mechanism is introduced to amplify the gradient of error samples. The error enhancement mechanism involves squaring the loss value. By combining partition weights with an error enhancement mechanism, an improved loss function, Huber Loss, is obtained, expressed as: ; in, This represents the improved loss function, Huber Loss. This represents the model's predicted value. This represents hyperparameters.

2. The hyperspectral remote sensing image prediction method based on a partitioned attention network according to claim 1, characterized in that, The specific partition attention mechanism is as follows: First, the hyperspectral data was divided into three regions in a 1:1:1 ratio, and different weights were assigned to each region. Then, interval embedding is introduced to explicitly encode the interval information to which the band belongs into the feature representation, so that the model can distinguish the band features of different intervals during the attention calculation process and adaptively learn the weight of each region during the training process, and use different weights to process the bands. Finally, the spectral sequence is input into the Transformer encoder for encoding, and a learnable Query vector is introduced to perform attention-weighted aggregation of the spectral sequence features after Transformer encoding to obtain a global context representation, while also obtaining the attention weights corresponding to each band.

3. The hyperspectral remote sensing image prediction method based on a partitioned attention network according to claim 1, characterized in that, Step 8 specifically refers to: A CNN-Transformer encoder hybrid architecture is established. First, the features of the soil sample data that have undergone secondary preprocessing are downsampled using CNN, and then the features are input into the Transformer encoder. The SpecPAT-Net model is built based on a CNN-Transformer encoder hybrid architecture and bound to band values. This provides the SpecPAT-Net model with additional interval identity information for the interval to which each band belongs, enabling the model to distinguish band information from different sources. Unique location identification information is generated for each band using sine and cosine functions. The sine function is used when the dimension index is even, and the cosine function is used when the dimension index is odd. The expression is: ; ; in, This indicates the location and identity information of the specific spectral wavelength corresponding to an even-numbered dimension index. This indicates the location and identity information of the specific spectral wavelength corresponding to an odd-numbered dimension index. This represents the position index of the band, corresponding to the wavelength of the spectrum; i represents the current dimension index, with a value range of 0. , It is the dimension of the location encoding.

Citation Information

Patent Citations

  • Soil organic matter content estimation method and device, electronic equipment and storage medium

    CN116310881A

  • Multi-source remote sensing image classification method based on key band retrieval attention mechanism

    CN120198818A