Cross-domain hyperspectral anomaly detection method and system based on causal perception

By constructing a causal-aware cross-domain hyperspectral anomaly detection method, a causal model and a relation-aware capsule network are built to learn causal consistency features. This solves the problem of insufficient generalization ability of existing methods in cross-scene detection and achieves efficient and stable anomaly detection.

CN120953803APending Publication Date: 2025-11-14XINJIANG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511057131.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing hyperspectral anomaly detection methods lack generalization ability across scenes, sensors, or complex backgrounds. They rely on specific background modeling, ignore the stable structural cooperative relationship between the anomalous target and the background, and lack a unified characterization mechanism and interpretable modeling paradigm, resulting in a decline in detection performance.

Method used

A cross-domain hyperspectral anomaly detection method based on causal perception is adopted. By constructing a causal model, cooperative relationship features are obtained. The cooperative-conflict relationship capture module, relationship-aware capsule network and representation consistency constraint module are used to learn causal consistency features. A loss function is designed for training and optimization.

Benefits of technology

It achieves more robust and efficient anomaly detection capabilities in multiple different scenarios, improves detection accuracy and stability, reduces false positives and false negatives, and has cross-domain transferability and interpretability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953803A_ABST
    Figure CN120953803A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-domain hyperspectral anomaly detection method and system based on causal perception, and relates to the technical field of remote sensing image processing and computer vision. The method comprises the following steps: constructing a hyperspectral anomaly detection causal model; a nested window structure is adopted in the collaboration-conflict relation capturing module, and a pixel relation is calculated through a Hadamard product and used for extracting collaboration relation characteristics among pixels; the relation sensing capsule network learns causal consistency of collaborative relation characteristics by combining a self-attention mechanism on the basis of a capsule network; mapping the learned cooperative relationship features into causal variables, and ensuring that the causal variables maintain causal invariance under intervention by representing consistency constraints; and designing a loss function, and performing hyperspectral image anomaly detection through the trained and optimized hyperspectral anomaly detection causal model. According to the method, a causal modeling norm and a structural consistency learning mechanism are introduced, and more robust and efficient anomaly detection capability is realized in a plurality of different scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of remote sensing image processing and computer vision technology, and particularly relates to a cross-domain hyperspectral anomaly detection method and system based on causal perception. Background Technology

[0002] With the development of hyperspectral imaging technology, hyperspectral images (HSIs) have been widely used in remote sensing monitoring, agricultural management, and urban change detection. Hyperspectral anomaly detection (HAD), as a key technology that can identify anomalous regions in images without prior target information, has significant application value. However, due to the characteristics of hyperspectral images, such as high dimensionality, sparseness, high redundancy, and complex backgrounds, anomaly detection still faces significant challenges, especially in cross-scene, cross-sensor, or open-set environments. Existing methods often suffer from poor generalization ability, overfitting, and decreased detection accuracy.

[0003] Existing hyperspectral anomaly detection methods mainly include statistical modeling-based methods and deep learning-based methods. Statistical modeling methods, such as the Reed-Xiaoli (RX) algorithm, assume that the background follows a multivariate Gaussian distribution and measure the degree of anomaly using Mahalanobis distance. However, their performance degrades significantly when the background modeling accuracy is insufficient or the spectral fluctuations are large. In recent years, deep learning methods have gradually become mainstream. For example, HADGAN uses generative adversarial networks to model high-dimensional backgrounds, BASGAN improves detection sensitivity through spectral sharpening, and GT-HAD introduces a gated Transformer to model spatial-spectral similarity and uses content matching mechanisms to improve the model's expressive power. Although these methods perform well in specific scenarios, they generally rely on scene-specific training, meaning the model needs to be trained and optimized on specific images or datasets. Their generalization ability is limited, and once transferred to different scenarios, the detection performance drops significantly.

[0004] To address these issues, some scholars have attempted to introduce techniques such as transfer learning, adversarial training, and attention mechanisms to enhance cross-domain adaptability. However, a unified theoretical framework or semantic interpretation mechanism is still lacking to guide models in learning feature representations that are both transferable and interpretable. In particular, current methods often focus on enhancing background modeling capabilities, neglecting the causal mechanisms of the inherent collaborative relationship between abnormal targets and the background. This limits the model's understanding of the nature of anomalies and its ability to generalize detection capabilities.

[0005] Therefore, while current deep learning-based hyperspectral anomaly detection methods achieve good performance in specific scenarios, they suffer from weak generalization ability, reliance on specific background modeling, and difficulty in transfer across different scenarios. These limitations make them unsuitable for the complex and ever-changing remote sensing scenarios in real-world applications. There is an urgent need for a new hyperspectral anomaly detection paradigm with clear theoretical support, stable feature representations, and cross-scenario transfer capabilities to achieve more robust and efficient generalized detection performance. To address this technical bottleneck, this invention proposes a cross-domain hyperspectral anomaly detection method based on causal perception. It introduces a causal modeling paradigm, mines stable collaborative relationship features between pixels, and improves the model's generalization ability to detect anomalies in different scenarios through the learning of causal variables, thereby significantly improving the robustness and accuracy of detection. Summary of the Invention

[0006] The purpose of this invention is to provide a cross-domain hyperspectral anomaly detection method and system based on causal perception, in order to solve the problem that existing hyperspectral anomaly detection technologies mentioned in the background art have insufficient generalization ability when facing cross-scene, cross-sensor, or complex background conditions; in addition, existing methods generally rely on modeling background features, ignoring the stable structural cooperative relationship between the anomaly target and the background, resulting in insufficient ability to model the essence of the anomaly; at the same time, the lack of a unified representation mechanism and interpretable modeling paradigm makes it difficult for existing models to maintain stable and robust performance in multi-source remote sensing data.

[0007] To achieve the above objectives, the present invention employs the following technical solution:

[0008] In its first aspect, this invention proposes a method for detecting cross-domain hyperspectral anomalies based on causal perception, comprising the following steps:

[0009] S1. Construct a causal model for hyperspectral anomaly detection, implicitly learn causal variables by acquiring collaborative relationship features, and achieve anomaly detection by learning representation consistency;

[0010] S2. Construct a collaborative-conflict relationship capture module, which adopts a nested window structure, calculates pixel relationships through the Hadamard product, and generates a feature representation with a unified dimension; the collaborative-conflict relationship capture module is used to extract collaborative relationship features between pixels;

[0011] A relation-aware capsule network is constructed, and a self-attention mechanism is combined on the basis of the capsule network to learn the causal consistency of collaborative relation features;

[0012] A representation consistency constraint module is constructed to map the learned collaborative relationship features to causal variables, and through representation consistency constraints, the causal variables are ensured to maintain causal invariance under intervention.

[0013] S3. Design a loss function, train and optimize the causal model for hyperspectral anomaly detection, and use the optimized causal model for hyperspectral anomaly detection to detect anomalies in hyperspectral images.

[0014] Preferably, the extraction of collaborative relationship features between pixels is specifically as follows:

[0015] For each target pixel, construct a matrix of size w. in ×w in inner window W in and a size of w out ×w out exterior window W out The Hadamard product is used to obtain the cooperative and conflict relationships between local pixels.

[0016]

[0017] Where, x h Center pixel For the surrounding neighboring pixels, ||·||2 represents the l2 norm;

[0018] WideResNet is used to extract relational features; for each spectral pixel, spectral information is extracted along the spectral dimension to obtain feature descriptors.

[0019] F h =WideResNet(R f h )

[0020] F i =WideResNet(R f i ), i = 1…N d

[0021] Among them, F h F represents the feature that indicates the relationship between the center pixel and itself. i Represents the center pixel x of the nested window h With surrounding neighboring pixels Relationship characteristics, d f N represents the dimension of the feature, cc is the number of channels after convolution; d It is the number of pixels between the inner and outer windows.

[0022] for The relational features V after NetVLAD pooling layer i for:

[0023]

[0024] in, n c The number centered, a j (f i ) is f i With center c i Relationship;

[0025] Using a binary predictor to analyze relation features V i Classify the data and predict the probability that target pixels and background pixels have a cooperative relationship, thus obtaining the cooperative relationship feature V. FR .

[0026] Preferably, the relationship-aware capsule network includes a capsule-front self-attention layer, an encoder, and a decoder; specifically as follows:

[0027] The relation-aware capsule network adds a capsule-pre-self-attention layer before the encoder; the capsule-pre-self-attention layer enhances the model's global perception capability through a self-attention mechanism.

[0028] The encoder includes a primary capsule layer and a routing capsule layer. The primary capsule layer performs preliminary encoding on the input relational features and converts them into vector form. The routing capsule layer extracts high-level features from the primary capsule layer and instantiates them through a dynamic routing mechanism.

[0029] After the encoder, the features are reconstructed by a fully connected decoder.

[0030] Furthermore, the relationship-aware capsule network is specifically as follows:

[0031] The collaborative relationship feature V FR The input is fed into the capsule pre-attention layer, which has three feature extractors V. K (x), V V (x) and V Q (x), V K (x i ) and V V (x j ) Receive input feature maps from the i-th and j-th positions respectively;

[0032] The capsule-pre-attention layer employs convolutional and non-local operations. The non-local operations are as follows:

[0033] η ij (x)=V K (x i ) T V V (x j )

[0034] Among them, V K (x)=Wk x i V V (x)=W v x j , and It is the learned weight matrix;

[0035] For η ij Calculate the softmax to obtain the attention map ψ ij Attention map ψ is obtained through matrix multiplication. ij With V Q (x i Multiplying these together yields the final self-attention map. The self-attention mechanism of matrix multiplication is used to apply this to all derived V. Q (x i The features are weighted and summed, and the final output y of the capsule pre-attention layer is... i as follows:

[0036]

[0037] y i =υι i +x i

[0038] Where υ is initially 0 and is automatically adjusted during training to balance local information and global dependencies;

[0039] The final output y of the capsule pre-attention layer i It is passed to the primary capsule layer; let u j Let u be the output vector of capsule j, and then compressed using a nonlinear compression function. j Normalization is performed:

[0040]

[0041] Among them, M ij It is the weight matrix connecting the capsule layers, o ij It is the coupling coefficient between capsule i and capsule j located in the upper layer. The coupling coefficient is determined through an iterative dynamic routing process:

[0042]

[0043] Among them, s ij This represents the logarithm of the prior probability that the i-th capsule should be coupled to the j-th capsule;

[0044] The decoder is implemented through a fully connected layer to obtain reconstructed features.

[0045] Preferably, the consistency constraint is specifically defined as follows:

[0046] Mapping the characteristics of synergistic relationships to a set of potential causal variables:

[0047]

[0048] The correlation matrix of collaborative relationship features is calculated to capture the dependencies between features, ensuring that the learned causal variables satisfy the consistency condition; specifically:

[0049]

[0050] in, and Let i and j represent the i-th and j-th columns of R, respectively.

[0051] Preferably, the loss function includes a focus loss function L. b Reconstruction loss function L re and structural consistency loss function L r ;

[0052] L = L b +L re +L r

[0053] Focus loss function L b This is used to alleviate the imbalance between the prediction data of the binary predictors in the collaborative-conflict relationship capture module;

[0054] Reconstruction loss function L re , used to calculate the reconstruction loss of the decoder in the relation-aware capsule network;

[0055] Structural consistency loss function L r , is used to indicate the stability of causal variables in the consistency constraint module.

[0056] Furthermore, the loss function is as follows:

[0057] Focus loss function L b Specifically:

[0058] L b =-λ(1-p i ) γ log(p i )

[0059] Where λ and γ are coefficients set empirically, p i This indicates the probability that the target pixel and the background pixel have a cooperative relationship;

[0060] Reconstruction loss function L re Specifically:

[0061]

[0062] Among them, V FR This represents the collaborative relationship features of the input to the relationship-aware capsule network. Represents reconstructed features;

[0063] Structural consistency loss function L r Specifically:

[0064]

[0065] Where C(i,j) represents the correlation matrix of the dependency relationship between collaborative relationship features.

[0066] Preferably, step S3 is as follows:

[0067] The hyperspectral anomaly detection causal model calculates an anomaly score based on the deviation between the measured and learned causal consistency, and then performs anomaly detection on the target pixel based on the anomaly score.

[0068]

[0069] Where s represents the anomaly score.

[0070] In a second aspect, this invention proposes a cross-domain hyperspectral anomaly detection system based on causal perception, employing a causal model framework for hyperspectral anomaly detection, including:

[0071] The collaborative-conflict relationship capture module includes a nested window structure for extracting collaborative relationship features between pixels;

[0072] A relation-aware capsule network, comprising a capsule-fronted self-attention layer, an encoder, and a decoder, is used to learn the causal consistency of collaborative relation features.

[0073] The representation consistency constraint module uses representation consistency constraints to ensure that causal variables maintain causal invariance under intervention.

[0074] Compared with the prior art, the beneficial effects of the present invention are:

[0075] (1) By introducing a causal modeling paradigm and a structural consistency learning mechanism, this invention effectively overcomes the technical bottlenecks of strong scene dependence, unstable features and lack of interpretability in the existing technology, and achieves more robust and efficient anomaly detection capabilities in multiple different scenarios.

[0076] (2) To address the problem that existing methods heavily rely on scene-specific background modeling, resulting in poor generalization ability, this invention introduces a causal consistency learning framework. It extracts potential causal variables Z based on a causal graph model and utilizes a relation-aware network to model the collaborative relationships between pixels, thereby achieving the learning of stable mechanisms for abnormal behavior. This approach differs from traditional techniques that enhance background features through reconstruction errors, spectral difference measures, or attention mechanisms, and fundamentally learns causal representations that can be transferred across domains.

[0077] (3) To improve the robustness of the model to non-causal perturbations (such as background changes, illumination perturbations, etc.), this invention designs a structural consistency constraint mechanism. This mechanism constrains the causal variables learned by the model under different conditions to maintain structural stability by inputting data pairs before and after the perturbation, thereby achieving consistency in feature representation. This representation consistency constraint constitutes a key means to combat the influence of different scene conditions, significantly reducing the false detection and false negative problems common in existing technologies. Attached Figure Description

[0078] Figure 1 This is a flowchart of the cross-domain hyperspectral anomaly detection method based on causal perception in this invention;

[0079] Figure 2 This is a structural block diagram of the relation-aware capsule network in this invention;

[0080] Figure 3 This image shows the detection results of the causal perception-based cross-domain hyperspectral anomaly detection method in this invention on a hyperspectral image dataset. Detailed Implementation

[0081] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0082] Example 1:

[0083] The technical solution of the cross-domain hyperspectral anomaly detection method based on causal perception mainly consists of three parts: causal model construction, causal consistency learning of relation representation, training loss, and anomaly detection.

[0084] Part 1: Causal Model Construction for Hyperspectral Anomaly Detection.

[0085] Deep learning excels at discovering complex relationships between large datasets, but it has limitations in explaining the underlying causal relationships behind these connections. Causal relationships possess logical reasoning and stability, making the combination of deep learning with interpretable causal relationships an emerging research direction. Analyzing the visual components of different target categories from the perspective of causal learning helps models identify key attributes, thereby achieving accurate recognition.

[0086] In hyperspectral image processing tasks, a uniform network structure struggles to handle the spectral differences between scenes due to the potential for various types of ground features in different scenes. Despite significant differences in spectral features across images, the fundamental assumption remains that anomalous targets in anomaly detection tasks typically exhibit clear differences from their neighboring ground features. Compared to changes in image scene content, the relationship between target pixels and neighboring pixels within a nested window is cross-domain shared, primarily falling into two categories: cooperative and conflicting relationships. When surrounding pixels belong to the same category as the central pixel, they exhibit a cooperative relationship; when they belong to different categories, they exhibit a conflicting relationship. Based on this, these two relationships do not change with variations in the HSI scene, thus enabling cross-domain anomaly detection by learning the relationship features between pixels. Inspired by causal representation learning, this paper hypothesizes the existence of a causal variable that can fully describe a universal pattern of cooperative relationships, under which conflicting relationships exhibit significant variations. Therefore, this invention designs a causal model for hyperspectral anomaly detection, implicitly learning unobservable causal variables using existing cooperative relationship features, and achieving anomaly detection through learning representation consistency.

[0087] Based on the common cause principle in causal representation learning, if two random variables X and Y are statistically correlated... There must exist a third variable Z that affects both variables and explains their dependency, thus achieving independence (X⊥Y∣Z) under condition Z.

[0088] In hyperspectral anomaly detection tasks, the correlation between cooperative relationships X and background Y can be explained by a latent causal variable Z. Although the causal variable Z cannot be directly observed, it has a causal influence on the learning of cooperative relationships and background in hyperspectral images. This invention implicitly learns a set of intrinsically consistent causal factors {z1, z2, ... z} through a directed acyclic graph. n} can effectively characterize different types of collaborative relationships.

[0089] Specifically, the non-causal variable U only affects the cooperative relationship X, such as environmental factors. Variables P and P′ represent jointly independent disturbance noise, f cr (·), h cr (·) and g cr (·) represents an unknown structure function with a causal mechanism.

[0090]

[0091] This invention provides the aforementioned theoretical basis from a modeling perspective, defining the generation method of cooperative relationships and their potential causal invariance. Subsequently, a cooperative-conflict relationship capture module, a relationship-aware capsule network, and a representation consistency constraint module are designed, based on explicit feature relationships learned from the model, to approximate this causal mechanism in practice.

[0092] Part Two: Learning Causal Consistency in Relational Representations.

[0093] 1) Collaboration-Conflict Relationship Capture Module.

[0094] In cross-domain hyperspectral anomaly detection tasks, it is assumed that there are certain cooperative or conflicting relationships between the target pixel and its surrounding background pixels. To effectively extract these relationship features, a cooperative-conflict relationship capture module is designed. To capture these complex inter-pixel relationships, a nested window structure is constructed, pixel relationships are calculated through Hadamard product, and a feature representation with a unified dimension is generated.

[0095] Specifically, in HSI, for each target pixel, a matrix of size w is constructed. in ×w in inner window W in and a size of w out ×w out exterior window W out And by using their Hadamard product, the cooperative and conflict relationships between local pixels are obtained, such as... Figure 1 The upper part is shown. Specifically, it is shown in Equation 2:

[0096]

[0097] Where, x h Center pixel For the surrounding neighboring pixels, ||·||2 represents the l2 norm.

[0098] Then, WideResNet is used to extract relational features. For each spectral pixel, a one-dimensional convolution with a kernel size of 1×9 is applied along the spectral dimension to extract spectral information, thereby obtaining feature descriptors.

[0099]

[0100] Among them, F h F represents the feature that indicates the relationship between the center pixel and itself. i Indicates the center x of the nested window h With surrounding neighboring pixels Relationship characteristics, df The dimension of the feature is represented by cc, where cc is the number of channels after convolution, and N is the number of channels. d It is the number of pixels between the inner and outer windows.

[0101] for The relationship features after the NetVLAD pooling layer are:

[0102]

[0103] in, n c The number centered, a j (f i ) is f i With center c i The relationship.

[0104]

[0105] Using a binary classifier to classify the input relation features, the relation prediction can be expressed as:

[0106] p i =h(V i (6)

[0107] Where, p i h(·) represents the probability that the target pixel and the background pixel are in a cooperative relationship, and h(·) is the mapping function of the binary classifier.

[0108] To alleviate the severe imbalance between data, focus loss L is introduced. b To optimize the model.

[0109] L b =-λ(1-p i ) γ log(p i (7)

[0110] In the experiment, λ and γ were empirically set to 0.9 and 2, respectively.

[0111] 2) Relationship-aware capsule network.

[0112] To better learn the causal consistency of collaborative relationships, a relation-aware capsule network is proposed, which inputs the collaborative relationship features obtained from the collaborative-conflict relationship capture module into the relation-aware capsule network.

[0113] First proposed by Sabour et al., capsule networks use vector representations instead of the scalar representations found in traditional neural networks, enriching feature representation capabilities. This design allows capsule networks to better capture changes in feature patterns when dealing with complex scenarios, offering greater robustness and expressive power compared to CNNs.

[0114] Compared to traditional capsule networks, relation-aware capsule networks add a pre-capsule self-attention layer before the encoder and decoder. This pre-capsule self-attention layer enhances the model's global perception capability through a self-attention mechanism. The encoder consists of a primary capsule layer and a routing capsule layer. The primary capsule layer initially encodes the input relation features and transforms them into vector form. Then, the routing capsule layer extracts and instantiates high-level features from the primary capsule layer through a dynamic routing mechanism. The routing capsule layer can dynamically adjust the output of lower-level capsules by learning the correlations between high-level features, enabling the network to more accurately capture collaborative relation features. After the encoder, the network reconstructs the features through a fully connected decoder. The decoder not only supervises the network to learn more accurate feature representations but also improves the interpretability of the output. By reconstructing the input relation features, the decoder enhances the capsule network's understanding of relation features, thereby further improving the overall performance of the model.

[0115] Specifically, the collaborative relationship features V obtained from the collaborative-conflict relationship capture module FR The input is fed into the pre-capsule self-attention layer. Where V... K (x), V V (x) and V Q (x) represents three feature extractors. V Q The number of channels of (x) is the same as that of the input, V K (x) and V V (x) is the location information module used to calculate attention. V K (x i ) and V V (x j The input feature maps from positions i and j are received respectively. Based on salient features, relevant activations are passed only through the primary capsule layer, such as... Figure 1 lower half and Figure 2 As shown.

[0116] Within the attention module, two-dimensional 1×1 convolutions and nonlocal operations are employed. This helps the network model relationships between spatially distant regions and maintains a balance between efficiency and long-range dependencies by providing weighted features at all locations. The definition of the nonlocal operation is shown in Equation 8:

[0117] η ij (x)=V K (xi ) T V V (x j (8)

[0118] Among them, V K (x)=W k x i V V (x)=W v x j , and It is the learned weight matrix.

[0119] Then for η ij Calculate softmax to obtain the output attention map ψ ij :

[0120]

[0121] To obtain the final self-attention map It will serve as the input to the primary capsule layer, and the attention map ψ will be processed through matrix multiplication. ij With V Q (x i Multiplication:

[0122]

[0123] Among them, V Q (x i ) = W q x i W q It is a weight matrix learned through training. Through matrix multiplication, a self-attention mechanism applies this weight matrix to all derived V values. Q (x i The features are weighted and summed, and features with less influence are filtered out. Therefore, the final output of the self-attention layer is shown in Equation 11:

[0124] y i =υι i +x i (11)

[0125] Here, υ is initially set to 0. The model can first explore local spatial information, and then analyze more complex data through a self-attention mechanism during automatic refinement. During training, υ is automatically adjusted, gradually learning how to balance local information and global dependencies.

[0126] The final output y of the capsule pre-attention layer i It is passed to the primary capsule layer. Let u jLet u be the output vector of capsule j. The length of the vector represents the probability that the feature represented by the vector is perceived by the higher-level network, and should be between 0 and 1. To correctly represent the features, u is compressed using a non-linear compression function. j Normalization is performed.

[0127]

[0128] Among them, M ij It is the weight matrix connecting the capsule layers, o ij These are the coupling coefficients between capsule i and capsule j located in the upper layer, which are determined through an iterative dynamic routing process.

[0129]

[0130] Among them, s ij Let represent the logarithm of the prior probability that the i-th capsule should be coupled to the j-th capsule.

[0131] The decoder is mainly implemented using fully connected layers, and the specific calculation method is as follows:

[0132]

[0133] Where Reshape(·) represents the reshaping operation, This indicates that the data has been reconstructed.

[0134] In this process, the reconstruction loss is L re As shown in Equation 15:

[0135]

[0136] 3) Represents consistency constraints.

[0137] Because causal variables possess inherent consistency, they can effectively capture common characteristics among similar events. This means that causal variables are not only applicable to specific scenarios but can also be generalized to different instances of the same type of event. Therefore, by introducing representation consistency constraints, the representation of synergistic relationship features can be mapped to a set of latent causal variables, thereby enhancing the model's generalization ability.

[0138]

[0139] Specifically, the learned collaborative relationship features are first mapped to causal representations, and then, through representation consistency constraints, these causal variables are ensured to maintain causal invariance under intervention. To achieve this goal, the model captures the dependencies between features by calculating the correlation matrix of collaborative relationship features, thereby ensuring that the learned causal variables satisfy the consistency condition.

[0140]

[0141] in, and Let i and j represent the i-th and j-th columns of R, respectively.

[0142] By optimizing the correlation matrix, the model can ensure that the consistent causal variables learned under normal circumstances remain stable, while conflicting relationships will disrupt this consistency, thereby helping the model to identify anomalies.

[0143]

[0144] Part 3: Training Loss and Anomaly Detection.

[0145] During training, the overall optimization process of the model can be divided into three key parts. First, to alleviate the problem of severe data imbalance, a focus loss function is introduced in the co-operation-conflict relationship capture module to effectively optimize model performance. Second, for each training sample, the model reconstructs the data using a relationship-aware capsule network and optimizes it using a reconstruction loss function to ensure a high degree of consistency between the reconstruction result and the original sample. Finally, in the representation consistency constraint module, the optimization of the loss function ensures that the causal variables learned by the model remain stable and consistent. The overall loss function comprehensively considers the losses of these three parts, thereby achieving a comprehensive optimization of model performance.

[0146] L = L b + L re + L r (19)

[0147] During the model inference and prediction phase, anomaly scores are calculated by measuring the deviation between the measured and learned causal consistency.

[0148]

[0149] Where s represents the anomaly score.

[0150] Experimental verification:

[0151] The ABU dataset is a commonly used dataset in the field of hyperspectral imaging, containing hyperspectral images of different scenes such as airports, beaches, and cities. The model in this invention and the representative model BockNet were tested on datasets such as abu-airport, abu-beach, and abu-urban. AUC was used as the evaluation metric to calculate the detection score, and the detection results are shown in Table 1.

[0152] Table 1. Comparison and evaluation results of the model in this invention with BockNet.

[0153]

[0154] Table 1 shows that the present invention was compared with the representative method BockNet in three typical scenarios (Airport, Beach, and Urban). The present invention achieved superior performance on all subsets, demonstrating good stability and generalization ability. In the Airport scenario, the present method outperformed BockNet on all four subsets, with the average score improving from 0.9488 to 0.9670. In the Beach scenario, both methods performed well, but the present method still maintained its lead on each subset, with an average score of 0.9954, a significant improvement over BockNet's 0.9839. In the most challenging Urban scenario, the present method achieved significant improvements in most subsets, especially on Urban-5, where the score improved from 0.8893 to 0.9827, and the overall average score improved from 0.9641 to 0.9921. Overall, the proposed method achieves an average performance of 0.9854 across all scenarios, nearly 2 percentage points higher than BockNet's 0.9655, fully validating the robustness and accuracy of the proposed method in complex contexts. This invention offers significant advantages, primarily in its strong cross-scenario generalization ability, high stability of detection results, and causal interpretability of the model representation.

[0155] from Figure 3 It can be seen that, Figure 3 (a) Figure 3 (b) Figure 3 (c) These are the detection results of the present invention on the abu-airport, abu-beach, and abu-urban datasets, respectively. The model in the present invention can adapt to different scenarios and the detection results are stable.

[0156] The key point of this invention lies in proposing a causal consistency modeling paradigm to improve the cross-scene generalization ability of hyperspectral anomaly detection. Its core includes two technical steps: (1) constructing a causal modeling structure graph to analyze the stable cooperative relationship between anomalous pixels and the background; and (2) extracting causal feature representations that are insensitive to domain changes through a representation consistency learning mechanism to enhance the model's ability to model the essence of anomalies. The above method, by designing a relationship-aware module with causal reasoning capabilities and a consistency comparison loss function, achieves a more robust and universal recognition of anomalous pixels.

[0157] This invention does not rely on traditional detection models based on pixel or background spectral statistical features. Instead, it introduces causal variables as key mediating variables in hyperspectral data to model the cooperative or conflicting relationship between anomalies and the background. Existing methods often enhance background representation capabilities through reconstruction errors or spatial attention mechanisms, but they do not explicitly model the causal drivers of anomalous behavior. Therefore, when background distribution or environmental conditions change, the model's detection performance fluctuates significantly. In contrast, this invention models and learns the "cooperative relationship" through a causal consistency framework, maintaining relatively stable anomaly recognition capabilities across multiple different scenarios.

[0158] Furthermore, the "relationship-aware capsule network" in this invention enables dynamic aggregation and decoupling of anomalous features. Combined with the "structural consistency loss function" constraining the training process, it effectively avoids the model from overfitting to specific background features. Compared to existing technologies, this invention not only has advantages in detection accuracy, but more importantly, it provides a unified and interpretable cross-domain anomaly modeling method with stronger robustness and practical application value.

[0159] The above description is only for the purpose of helping to understand the method and core essence of the present invention, but the scope of protection of the present invention is not limited thereto. For those skilled in the art, any equivalent substitutions or modifications made to the technical solution and inventive concept disclosed in the present invention within the scope of the technology disclosed in the present invention should be covered within the scope of protection of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A cross-domain hyperspectral anomaly detection method based on causal perception, characterized in that, Includes the following steps: S1. Construct a causal model for hyperspectral anomaly detection, implicitly learn causal variables by acquiring collaborative relationship features, and achieve anomaly detection by learning representation consistency; S2. Construct a collaborative-conflict relationship capture module, which adopts a nested window structure, calculates pixel relationships through the Hadamard product, and generates a feature representation with a unified dimension; the collaborative-conflict relationship capture module is used to extract collaborative relationship features between pixels; A relation-aware capsule network is constructed, and a self-attention mechanism is combined on the basis of the capsule network to learn the causal consistency of collaborative relation features; A representation consistency constraint module is constructed to map the learned collaborative relationship features to causal variables, and through representation consistency constraints, the causal variables are ensured to maintain causal invariance under intervention. S3. Design a loss function, train and optimize the causal model for hyperspectral anomaly detection, and use the optimized causal model for hyperspectral anomaly detection to detect anomalies in hyperspectral images.

2. The cross-domain hyperspectral anomaly detection method based on causal perception according to claim 1, characterized in that, The extraction of collaborative relationship features between pixels is specifically as follows: For each target pixel, construct a matrix of size w. in ×w in inner window W in and a size of w out ×w out exterior window W out The Hadamard product is used to obtain the cooperative and conflict relationships between local pixels. Where, x h Center pixel For the surrounding neighboring pixels, ||·||2 represents the l2 norm; WideResNet is used to extract relational features; for each spectral pixel, spectral information is extracted along the spectral dimension to obtain feature descriptors. F h =WideResNet(R f h ) F i =WideResNet(R f i ),i=1…N d Among them, F h F represents the feature that indicates the relationship between the center pixel and itself. i Represents the center pixel x of the nested window h With surrounding neighboring pixels Relationship characteristics, d f N represents the dimension of the feature, cc is the number of channels after convolution; d It is the number of pixels between the inner and outer windows. for The relational features V after NetVLAD pooling layer i for: in, n c The number centered, a j (f i ) is f i With center c i Relationship; Using a binary predictor to analyze relation features V i Classify the data and predict the probability that target pixels and background pixels have a cooperative relationship, thus obtaining the cooperative relationship feature V. FR .

3. The cross-domain hyperspectral anomaly detection method based on causal perception according to claim 2, characterized in that, The relation-aware capsule network includes a capsule-front self-attention layer, an encoder, and a decoder; specifically as follows: The relation-aware capsule network adds a capsule-pre-self-attention layer before the encoder; the capsule-pre-self-attention layer enhances the model's global perception capability through a self-attention mechanism. The encoder includes a primary capsule layer and a routing capsule layer. The primary capsule layer performs preliminary encoding on the input relational features and converts them into vector form. The routing capsule layer extracts high-level features from the primary capsule layer and instantiates them through a dynamic routing mechanism. After the encoder, the features are reconstructed by a fully connected decoder.

4. The cross-domain hyperspectral anomaly detection method based on causal perception according to claim 3, characterized in that, The relationship-aware capsule network is as follows: The collaborative relationship feature V FR The input is fed into the capsule pre-attention layer, which has three feature extractors V. K (x), V V (x) and V Q (x), V K (x i ) and V V (x j ) Receive input feature maps from the i-th and j-th positions respectively; The capsule-pre-attention layer employs convolutional and non-local operations. The non-local operations are as follows: η ij (x)=V K (x i ) T V V (x j ) For η ij Calculate the softmax to obtain the attention map ψ ij Attention map ψ is obtained through matrix multiplication. ij With V Q (x i Multiplying these together yields the final self-attention map. The self-attention mechanism of matrix multiplication is used to apply this to all derived V. Q (x i The features are weighted and summed to obtain the final output y of the capsule pre-attention layer. i ; The final output y of the capsule pre-attention layer i It is passed to the primary capsule layer; let u j Let u be the output vector of capsule j, and then compressed using a nonlinear compression function. j Normalization is performed; the coupling coefficients in the nonlinear compression function are determined through an iterative dynamic routing process; The decoder is implemented through a fully connected layer to obtain reconstructed features.

5. The cross-domain hyperspectral anomaly detection method based on causal perception according to claim 4, characterized in that, The consistency constraint is specifically defined as follows: Mapping the characteristics of synergistic relationships to a set of potential causal variables: The correlation matrix of collaborative relationship features is calculated to capture the dependencies between features, ensuring that the learned causal variables satisfy the consistency condition; specifically: in, and Let i and j represent the i-th and j-th columns of R, respectively.

6. The method for cross-domain hyperspectral anomaly detection based on causal perception according to any one of claims 1-5, characterized in that, The loss function includes the focus loss function L. b Reconstruction loss function L re and structural consistency loss function L r ; L=L b +L re +L r Focus loss function L b This is used to alleviate the imbalance between the prediction data of the binary predictors in the collaborative-conflict relationship capture module; Reconstruction loss function L re , used to calculate the reconstruction loss of the decoder in the relation-aware capsule network; Structural consistency loss function L r , is used to indicate the stability of causal variables in the consistency constraint module.

7. The cross-domain hyperspectral anomaly detection method based on causal perception according to claim 6, characterized in that, The loss function is as follows: Focus loss function L b Specifically: L b =-λ(1-p i ) γ log(p i ) Where λ and γ are coefficients set empirically, p i This indicates the probability that the target pixel and the background pixel have a cooperative relationship; Reconstruction loss function L re Specifically: Among them, V FR This represents the collaborative relationship features of the input to the relationship-aware capsule network. Represents reconstructed features; Structural consistency loss function L r Specifically: Where C(i,j) represents the correlation matrix of the dependency relationship between collaborative relationship features.

8. The cross-domain hyperspectral anomaly detection method based on causal perception according to claim 7, characterized in that, S3 is specifically as follows: The hyperspectral anomaly detection causal model calculates anomaly scores based on the deviation between measured and learned causal consistency. Where s represents the anomaly score, and anomaly detection of target pixels is performed based on the anomaly score.

9. A cross-domain hyperspectral anomaly detection system based on causal perception applied to the method of claim 8, characterized in that, A causal model framework for hyperspectral anomaly detection is adopted, including: The collaborative-conflict relationship capture module includes a nested window structure for extracting collaborative relationship features between pixels; A relation-aware capsule network, comprising a capsule-fronted self-attention layer, an encoder, and a decoder, is used to learn the causal consistency of collaborative relation features. The representation consistency constraint module uses representation consistency constraints to ensure that causal variables maintain causal invariance under intervention.