Time sequence anomaly detection method based on attention calibration enhancement

By constructing a time-series anomaly detection model based on attention calibration enhancement, and utilizing a dual-branch self-attention encoder and an unsupervised contrastive learning loss function, the model solves the detection challenges of scarce anomaly samples and complex data in existing technologies, achieving more efficient anomaly identification and early warning effects.

CN120995254APending Publication Date: 2025-11-21CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510934574.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing time series anomaly detection methods struggle to accurately identify outliers when faced with sparse outlier samples and complex, variable data, and unsupervised learning methods are ineffective, resulting in limited detection performance.

Method used

A time-series anomaly detection model based on attention calibration enhancement is adopted. The model constructs intra-block and inter-block attention views through a dual-branch self-attention encoder. Combined with the attention calibration enhancement module and the unsupervised contrastive learning loss function, the model's ability to identify the consistency of normal points and the differences of anomalies is improved.

Benefits of technology

It significantly improves the model's performance on multiple evaluation metrics, enabling early detection of equipment failures, identification of fraudulent activities, and monitoring of environmental anomalies, and has broad adaptability and deployment value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120995254A_ABST
    Figure CN120995254A_ABST
Patent Text Reader

Abstract

The invention relates to a time sequence anomaly detection method based on attention calibration enhancement, and the method comprises the following steps: (1) carrying out the data preprocessing of a multivariate time sequence; (2) carrying out channel independent blocking on the multivariate time sequence; (3) constructing a double-branch self-attention encoder, an attention calibration enhancement module and a contrast learning loss function; (4) performing an experiment by adopting a Mars science laboratory data set and soil humidity active and passive data, and training a model; and step (5), evaluating the model based on three evaluation indexes including the accuracy rate, the recall rate and the F1 score. According to the scheme, the two attention matrixes are adjusted through weighted deviation, the difference of normal points is reduced, meanwhile, the difference of abnormal points is further amplified, the abnormal points are better recognized, and the accuracy of time sequence anomaly detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to time series anomaly detection networks, and in particular to a time series anomaly detection method based on attention calibration enhancement. Background Technology

[0002] Time series anomaly detection technology has broad practical application prospects in fields such as industrial equipment operation status monitoring, financial transaction fraud detection, complex system fault diagnosis, and intelligent traffic management. With the development of the Internet of Things (IoT) and sensing technologies, various systems continuously generate large-scale, multi-dimensional time series data during operation. Timely detection of potential anomaly patterns helps improve system stability and security, preventing significant losses. For example, in wind farm operation, accurately identifying abnormal fluctuations in wind turbine sensor data can effectively avoid critical equipment failures; in financial systems, timely detection of abnormal changes in transaction behavior helps prevent fraud and ensure fund security. Therefore, building efficient and robust anomaly detection models for complex and variable time series data has become a research focus in the field of intelligent monitoring.

[0003] However, time series anomaly detection still faces multiple challenges. First, anomalous samples themselves are uncertain and diverse, making it difficult to clearly define the criteria for "anomaly." Second, anomalous events are relatively rare in reality, resulting in a severe shortage of labeled data, which limits the practicality of supervised learning and semi-supervised methods. Third, time series generally exhibit characteristics such as time dependence, inter-dimensional correlation, and non-stationarity, which require detection models to consider both the dynamic changes in time structure and overall distribution. To alleviate the problem of insufficient labels, unsupervised reconstruction methods, which have emerged in recent years, identify anomalous points by learning the reconstruction ability of normal samples, showing good application potential. However, in real-world environments, anomalous points often coexist with normal points within the same time window, making it difficult for models to accurately learn pure normal behavior patterns, severely impacting detection performance. Therefore, how to design an unsupervised time series anomaly detection method with strong generalization ability and adaptability to complex distribution changes is currently a research hotspot and key technical challenge in this field. Summary of the Invention

[0004] Purpose of the invention: The purpose of this invention is to provide a time series anomaly detection method based on attention calibration enhancement, thereby improving the accuracy of time series anomaly detection.

[0005] Technical Solution: This invention presents an attention-calibrated enhanced time series anomaly detection method. The innovation lies in proposing an attention-calibrated enhanced time series anomaly detection model. To achieve a robust and universal model, the original multivariate time series is first divided into channel-independent blocks. Then, a dual-branch encoder is used to model stable correlation patterns of normal points under different views. To enable the model to more effectively identify anomalies and further improve prediction accuracy, this invention introduces intra-block and inter-block self-attention mechanisms into the dual-branch encoder, calculating intra-block and inter-block dependencies respectively, thereby constructing two different attention views. To better capture the consistency relationship of normal points in the time series under the two attention views, this invention proposes an attention calibration enhancement module. This module takes the two attention views as input and adjusts the two attention matrices through weighted bias, reducing the differences between normal points while further amplifying the differences between anomalies to better identify them.

[0006] This invention includes the following steps:

[0007] (1) Perform data preprocessing on the multivariate time series; perform linear interpolation on the missing values ​​in the original multivariate time series to avoid the missing values ​​from seriously affecting the performance of the model of this invention, and perform data standardization on the time series;

[0008] (2) Obtain the preprocessed standardized multivariate time series data from step (1); perform channel-independent segmentation on the multivariate time series data S with dimensions B×T×C (B represents batch size, T represents sequence length, and C represents number of channels) to obtain the segmented sequence. (N represents the number of blocks, and P represents the length of each block), which facilitates subsequent input to the dual-branch self-attention encoder for attention matrix calculation, and constructs different attention views for the time series for unsupervised contrastive learning training;

[0009] (3) Obtain the multivariate time series after block division in step (2), construct a dual-branch self-attention encoder and attention calibration enhancement module to process it, and design an unsupervised contrastive learning loss function as the optimization objective of the model of this invention;

[0010] (3.1) Construct a dual-branch self-attention encoder; use a multi-head self-attention mechanism to calculate the attention matrix, mainly involving the dot product operation of query (Q) and key (K). In order to fully capture the dependencies of different dimensions and improve the expressive power of the model, a multi-head calculation mechanism is used, and its mathematical expression is shown in formulas (1)-(3):

[0011]

[0012] A = Concat(A1, A2, ..., AM (3) Among them, Let d represent the linear transformation matrix, M represent the feature dimension, and Q represent the number of attention heads. k and K k Let A and B represent the query and key of the k-th attention head, respectively, and let A represent the softmax activation function. k Let A represent the calculated k-th attention matrix, where A is the sum of all attention matrices A1-A2. M The images are spliced ​​together. To construct different views for training unsupervised contrastive learning, intra-block and inter-block self-attention mechanisms are used to calculate intra-block dependencies and inter-block dependencies, respectively. However, before calculating the attention, feature embedding is required on the segmented time series, and its mathematical expression is shown in formula (4):

[0013]

[0014] Among them, Conv 1D This represents a one-dimensional convolution operation, where PE represents positional encoding, and X represents... intra and X inter Let X represent the intra-block feature representation and the inter-block feature representation, respectively. Then, let X = X in formula (1). intra and X = X inter Two different attention views A of the time series are obtained by using formulas (1)-(3). intra and A inter To ensure the comparability of the outputs of the two branches, it is necessary to ensure that the dimensions of the two attention views are consistent. Therefore, an upsampling operation is further performed on both.

[0015] (3.2) Construct an attention calibration enhancement module; use difference operation on the two upsampled attention views to obtain attention difference maps in two directions, and then use two-dimensional convolution and sigmoid activation function to calculate calibration weights to reduce the difference between the two views at normal points. The mathematical expressions are shown in formulas (5)-(6):

[0016]

[0017] Among them, Conv 2D This represents a two-dimensional convolution operation, sigmoid represents the sigmoid activation function, and ⊙ represents the Hadamard product of matrices. and This shows two attention views after calibration and enhancement;

[0018] (3.3) Design an unsupervised contrastive learning loss function; Considering the scarcity of labeled data, the supervised learning paradigm is difficult to apply. This invention designs an unsupervised contrastive learning loss function for the training of the entire model. By comparing and reducing the degree of difference between two views, the model learns a consistent representation of normal points. Its mathematical expression is shown in formulas (7)-(9):

[0019]

[0020] L = L inter -L intra (9)

[0021] Where KL represents the KL divergence, and sg represents the gradient cutoff operation. and Each by A intra and A inter After flattening, L represents the optimization objective of the model during training;

[0022] (4) Construct a time series anomaly detection model based on attention calibration enhancement, and train the model of the present invention using time series; In the present invention, we use the Mars Science Laboratory dataset and the active and passive soil moisture dataset for experiments. The model is built on the PyTorch framework and trained on an NVIDIA RTX A6000 GPU equipped with an Intel i5 processor and Ubuntu system; The Adam optimizer is used for gradient updates during the training process, with a learning rate of 0.0001, and the unsupervised contrastive learning loss in formula (9) is used as the loss function;

[0023] (5) The model performance is evaluated based on three evaluation metrics: precision, recall, and F1 score. The mathematical expressions are shown in formulas (10)-(12):

[0024]

[0025] In this context, PR, RC, and F1 represent precision, recall, and F1 score, respectively, while TP, FP, and FN represent true positives, false positives, and false negatives, respectively.

[0026] A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the attention calibration-enhanced time-series anomaly detection method described above.

[0027] An electronic device includes: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the attention calibration-enhanced time-series anomaly detection method.

[0028] Compared to existing technologies, the advantages of this invention are as follows: The model of this application shows significant improvements across multiple evaluation metrics. Since neural networks are highly sensitive to data distribution, the original multivariate time series data is first standardized using one-dimensional linear interpolation and Z-score normalization. Secondly, the preprocessed multivariate time series is divided into channels independently to facilitate subsequent input to a dual-branch self-attention encoder for attention matrix calculation. The dual-branch self-attention encoder, composed of multi-head self-attention, establishes intra-block and inter-block attention views for unsupervised training. The attention calibration enhancement module can perform distribution calibration and enhancement on two different attention views obtained from the dual-branch self-attention encoder, improving the similarity of normal points under different views while expanding the distribution differences of outliers. The unsupervised contrastive learning loss function is designed to train the model of this invention without using labels. Performance evaluation using PR, RC, and F1 metrics reveals that the attention calibration enhancement-based time series anomaly detection method of this patent significantly outperforms existing algorithms. In practical applications, the method of this application demonstrates significant effectiveness in several typical scenarios. For example, in industrial equipment condition monitoring, it can detect minute vibration anomalies in the operation of equipment such as motors and pumps in advance, enabling fault warnings several hours ahead; in financial trading systems, it can effectively identify high-frequency abnormal trading behavior within a short period, reducing the risk of fraud; in smart city environmental monitoring, it can detect sudden air quality anomalies or traffic flow changes, assisting relevant departments in timely responses. The method in this application not only outperforms existing technologies in theoretical performance but also has broad adaptability and deployment value in practical scenarios. Attached Figure Description

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

[0030] Figure 2 This is a schematic diagram of the framework of a time series anomaly detection model based on attention calibration enhancement;

[0031] Figure 3 This is a schematic diagram of a dual-branch self-attention encoder.

[0032] Figure 4 A schematic diagram of the attention calibration enhancement module;

[0033] Figure 5 This is a schematic diagram of the unsupervised contrastive learning loss function used to train the entire model. Detailed Implementation

[0034] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0035] Example: Figure 2As shown, an attention-calibrated enhancement-based time series anomaly detection method is proposed. Its innovations mainly consist of three parts: First, a dual-branch self-attention encoder is used to model the time series, employing intra-block and inter-block self-attention to calculate dependencies within the time series. Second, an attention calibration enhancement module is introduced, adjusting the attention matrices of the two views through weighted bias to reduce the differences between normal points while amplifying the differences between anomalies. Third, a novel unsupervised contrastive learning loss function is proposed. The two enhanced attention views obtained from the attention calibration enhancement module are used as input, and the differences between the two views are calculated using dimension flattening and KL divergence. The entire model is trained by reducing the degree of difference between the two views during training to effectively detect anomalies in the time series.

[0036] like Figure 1 As shown, the present invention includes the following steps:

[0037] Step (1): Perform data preprocessing on the multivariate time series; perform linear interpolation on the missing values ​​in the original multivariate time series to avoid the missing values ​​from seriously affecting the performance of the model of this invention, and perform data standardization on the time series;

[0038] Step (1.1): First, a one-dimensional linear interpolation algorithm is used for each channel of the multivariate time series to fill in the missing values. The mathematical expression is shown in formula (1):

[0039]

[0040] Among them, S i (t) represents the value of the i-th channel of the multivariate time series S at time t, which is based on the existing data S. i (t k ) and S i (t k+1 Perform interpolation calculations;

[0041] Step (1.2): Use the Z-score standardization method to convert the multivariate time series data into a standard normal distribution (mean 0, standard deviation 1), as shown in formula (2):

[0042]

[0043] Where S represents the raw values ​​of the multivariate time series, and μ and σ represent the mean and standard deviation of the time series. norm This represents a multivariate time series after Z-score standardization;

[0044] Step (2): Obtain the preprocessed standardized multivariate time series data S from step (1) (here, for convenience, S represents the multivariate time series processed by steps (1.1) and (1.2)); perform channel-independent segmentation on the multivariate time series data S with dimensions B×T×C (B represents batch size, T represents sequence length, and C represents number of channels) to obtain the segmented sequence. (N represents the number of blocks, P represents the length of each block, T = N × P), which facilitates subsequent input to the dual-branch self-attention encoder for attention matrix calculation, and constructs different attention views for the time series for unsupervised contrastive learning training;

[0045] Step (2.1): The feature dimensions of the multivariate time series S are rearranged, and block operations and dimension reshaping operations are performed on each channel. The mathematical expression is shown in formula (3):

[0046]

[0047] Here, Permute represents the order reordering operation, used to swap the order of dimensions T and C; Div represents the block operation on dimension T; and Reshape represents the dimension reshaping operation, used to reshape dimensions B and C into (B×C) dimensions. This represents the multivariate time series after partitioning;

[0048] Step (3): Obtain the multivariate time series after segmentation in step (2). A dual-branch self-attention encoder and an attention calibration enhancement module are constructed to process it, and an unsupervised contrastive learning loss function is designed as the optimization objective of the model of this invention;

[0049] Step (3.1): Construct a two-branch self-attention encoder; as follows Figure 3 As shown, the encoder consists of multi-head self-attention blocks with shared parameters. The attention matrix is ​​calculated using a multi-head self-attention mechanism, primarily involving the dot product operation of the query (Q) and key (K). To fully capture dependencies across different dimensions and improve the model's expressive power, a multi-head computation mechanism is used, whose mathematical expressions are shown in formulas (4)-(6):

[0050]

[0051] A = Concat(A1, A2, ..., A M (6) Among them, Let d represent the linear transformation matrix, M represent the feature dimension, and Q represent the number of attention heads. k and K kLet A and B represent the query and key of the k-th attention head, respectively, and let A represent the softmax activation function. k This represents the calculated k-th attention matrix, with dimensions (B×C)×l×l (l=N or P), where A is the sum of all attention matrices A1-A. M The concatenation yields a dimension of (B×C)×M×l×l. To construct different views for unsupervised contrastive learning training, intra-block and inter-block self-attention mechanisms are used to calculate intra-block and inter-block dependencies, respectively. However, before calculating attention, feature embedding is required on the segmented time series, and its mathematical expression is shown in formula (7):

[0052]

[0053] Among them, Conv 1D This represents a one-dimensional convolution operation, where PE represents positional encoding, and X represents... intra and X inter Let X represent the intra-block feature representation and the inter-block feature representation, respectively. Then, let X = X in formula (4). intra and X = X inter Two different attention views of the time series are obtained by using formulas (4)-(6). and To make the outputs of the two branches comparable, it is necessary to ensure that the dimensions of the two attention views are consistent. Therefore, a copy-based upsampling operation is further performed to unify the latter two dimensions to the length T, that is, the dimensions are (B×c)×M×T×T.

[0054] Step (3.2) Construct the attention calibration enhancement module; such as Figure 4 As shown, for the two attention views A after upsampling inter and A inter Using bidirectional difference operations, attention difference maps A in two directions are obtained. inter -A intra and A intra -A inter Then, calibration weights are calculated using two-dimensional convolution and the Sigmoid activation function to reduce the differences between the two views at normal points. The mathematical expressions are shown in formulas (8)-(9):

[0055]

[0056] Among them, Conv 2D This represents a two-dimensional convolution operation, sigmoid represents the sigmoid activation function, and ⊙ represents the Hadamard product of matrices. and This represents two attention views after calibration and enhancement. The motivation is that the attention distribution of normal points in a multivariate time series should be similar in both views, while the differences in outliers will be further amplified.

[0057] Step (3.3) Design an unsupervised contrastive learning loss function; considering the scarcity and high cost of labeled data in the real world, the supervised learning paradigm using labels is difficult to apply. Therefore, this invention designs an unsupervised contrastive learning loss function for training the entire model, such as... Figure 5 As shown, the model learns a consistent representation of normal points by comparing and reducing the degree of difference between the two views. This is because learning a consistent representation of outliers from different perspectives is very difficult, but relatively easy for normal points. Its mathematical expression is shown in formulas (10)-(12):

[0058]

[0059] L = L inter -L intra (12)

[0060] Where KL represents the KL divergence, and sg represents the gradient cutoff operation, used to prevent model collapse. and Each by A intra and A inter After flattening and calculating the mean value of the multivariate model, the dimension is B×(M×T×T), where L represents the optimization objective of the model during training.

[0061] Step (4): Construct a time series anomaly detection model based on attention calibration enhancement, and train the model of the present invention using time series data; In the present invention, we use the Mars Science Laboratory dataset and the active and passive soil moisture dataset for experiments. The model is built on the PyTorch framework and trained on an NVIDIA RTX A6000 GPU equipped with an Intel i5 processor and an Ubuntu system; The training process uses the Adam optimizer for gradient updates, with a learning rate of 0.0001, and the unsupervised contrastive learning loss in formula (12) is used as the loss function;

[0062] Step (5): The model performance is evaluated based on three evaluation metrics: precision, recall, and F1 score. The mathematical expressions are shown in formulas (13)-(15):

[0063]

[0064]

[0065] In this context, PR, RC, and F1 represent precision, recall, and F1 score, respectively; TP, FP, and FN represent true positives, false positives, and false negatives, respectively. PR calculates the proportion of samples predicted as outliers by the model that are actually outliers. RC calculates the proportion of samples correctly identified as outliers by the model. F1 represents the harmonic mean of precision and recall.

[0066] It should be noted that the above embodiments are not intended to limit the scope of protection of the present invention. Equivalent transformations or substitutions made based on the above technical solutions all fall within the scope of protection of the claims of the present invention.

Claims

1. A time-series anomaly detection method based on attention calibration enhancement, characterized in that, The method includes the following steps: Step (1): Preprocessing the multivariate time series data; Step (2): Divide the multivariate time series into independent channels; Step (3): Construct a dual-branch self-attention encoder, an attention calibration enhancement module, and a contrastive learning loss function; Step (4): Experiments were conducted using the Mars Science Laboratory dataset and active and passive soil moisture data to train the model; Step (5): Evaluate the model based on three evaluation metrics: accuracy, recall, and F1 score.

2. The time series anomaly detection method based on attention calibration enhancement according to claim 1, characterized in that, Step (1): Perform data preprocessing on the multivariate time series; perform linear interpolation on the missing values ​​in the original multivariate time series to avoid the missing values ​​from seriously affecting the performance of the model of this invention, and perform data standardization on the time series; Step (1.1): First, use a one-dimensional linear interpolation algorithm on each channel of the multivariate time series to fill in the missing values. Its mathematical expression is shown in formula (1): Among them, S i (t) represents the value of the i-th channel of the multivariate time series S at time t, which is based on the adjacent time t. k and t k+1 The existing data S i (t k ) and S i (t k+1 Perform interpolation calculations; Step (1.2): Use the Z-score standardization method to convert the multivariate time series data into a standard normal distribution (mean 0, standard deviation 1), as shown in formula (2): Where S represents the raw values ​​of the multivariate time series, and μ and σ represent the mean and standard deviation of the time series. norm This represents a multivariate time series after Z-score standardization.

3. The time series anomaly detection method based on attention calibration enhancement according to claim 2, characterized in that, Step (2): Divide the multivariate time series into independent channels, as follows: Obtain the preprocessed standardized multivariate time series data S from step (1); perform channel-independent segmentation on the multivariate time series data S with dimensions B×T×C, where B represents the batch size, T represents the sequence length, and C represents the number of channels, to obtain the segmented sequence. N represents the number of blocks, P represents the length of each block, and T = N × P, which facilitates subsequent input to the dual-branch self-attention encoder for attention matrix calculation, and constructs different attention views for the time series for unsupervised contrastive learning training. Step (2.1): The feature dimensions of the multivariate time series S are rearranged, and block operations and dimension reshaping operations are performed on each channel. The mathematical expression is shown in formula (3): Here, Permute represents the order reordering operation, used to swap the order of dimensions T and C; Div represents the block operation on dimension T; and Reshape represents the dimension reshaping operation, used to reshape dimensions B and C into (B×C) dimensions. This represents a multivariate time series after being segmented.

4. The time series anomaly detection method based on attention calibration enhancement according to claim 3, characterized in that, Step (3): Construct a dual-branch self-attention encoder, an attention calibration enhancement module, and a contrastive learning loss function; details are as follows: Obtain the multivariate time series after block division in step (2) A dual-branch self-attention encoder and an attention calibration enhancement module are constructed to process it, and an unsupervised contrastive learning loss function is designed as the optimization objective of the model of this invention; Step (3.1): Construct a dual-branch self-attention encoder; this encoder consists of multi-head self-attention blocks with shared parameters. The attention matrix is ​​calculated using a multi-head self-attention mechanism, which mainly involves the dot product operation of query (Q) and key (K). In order to fully capture the dependencies of different dimensions and improve the expressive power of the model, a multi-head calculation mechanism is used, and its mathematical expression is shown in formulas (4)-(6): A=Concat(A1,A2,...,A M ) (6) in, Let d represent the linear transformation matrix, M represent the feature dimension, and Q represent the number of attention heads. k and K k Let A and B represent the query and key of the k-th attention head, respectively, and let A represent the softmax activation function. k This represents the calculated k-th attention matrix, with dimensions (B×C)×l×l (l=N or P), where A is the sum of all attention matrices A1-A. M The concatenation results in a dimension of (B×C)×M×l×l. To construct different views for unsupervised contrastive learning training, intra-block and inter-block self-attention mechanisms are used to calculate intra-block dependencies and inter-block dependencies, respectively. However, before calculating attention, feature embedding is required on the segmented time series, and its mathematical expression is shown in formula (7): Among them, Conv 1D This represents a one-dimensional convolution operation, where PE represents positional encoding, and X represents... intra and X inter Let X represent the intra-block feature representation and inter-block feature representation respectively. Then, let X = X in formula (4). intra and X = X inter Two different attention views of the time series are obtained by using formulas (4)-(6). and To make the outputs of the two branches comparable, it is necessary to ensure that the dimensions of the two attention views are consistent. Therefore, a copy-based upsampling operation is further performed to unify the latter two dimensions to the length T, that is, the dimensions are (B×C)×M×T×T. Step (3.2) Construct the attention calibration enhancement module; perform the above sampling on the two attention views A. intra and A inter Using bidirectional difference operations, attention difference maps A in two directions are obtained. inter -A intra and A intra -A inter Then, calibration weights are calculated using two-dimensional convolution and the Sigmoid activation function to reduce the differences between the two views at normal points. The mathematical expressions are shown in formulas (8)-(9): Among them, Conv 2D This represents a two-dimensional convolution operation, sigmoid represents the sigmoid activation function, and ⊙ represents the Hadamard product of matrices. and This shows two attention views after calibration and enhancement; Step (3.3) Design the unsupervised contrastive learning loss function; the mathematical expression is shown in formulas (10)-(12): L=L inter -L intra (12) Where KL represents the KL divergence, and sg represents the gradient cutoff operation, used to prevent model collapse. and Each by A intra and A inter After flattening and calculating the mean value of the multivariate model, the dimension is B×(M×T×T), where L represents the optimization objective of the model during training.

5. The time series anomaly detection method based on attention calibration enhancement according to claim 4, characterized in that, Step (4): Experiments were conducted using the Mars Science Laboratory dataset and active and passive soil moisture data to train the model, as detailed below. The Mars Science Lab dataset and the active and passive soil moisture dataset were used for the experiment. The model was built on the PyTorch framework and trained on an NVIDIA RTX A6000 GPU equipped with an Intel i5 processor and Ubuntu system. The Adam optimizer was used for gradient updates during the training process, with a learning rate of 0.0001. Formula (12) unsupervised contrastive learning loss was used as the loss function.

6. The time series anomaly detection method based on attention calibration enhancement according to claim 5, characterized in that, Step (5): The model performance is evaluated based on three evaluation metrics: precision, recall, and F1 score. The mathematical expressions are shown in formulas (13)-(15): Where PR, RC, and F1 represent precision, recall, and F1 score, respectively; TP, FP, and FN represent true positives, false positives, and false negatives, respectively. PR calculates the proportion of true outliers among all samples predicted as outliers by the model; RC calculates the proportion of true outliers correctly identified by the model among all samples that are actually outliers; and F1 represents the harmonic mean of precision and recall.

7. A computer-readable storage medium storing computer instructions thereon, characterized in that: When executed by a processor, the computer instructions implement the steps of the attention calibration-enhanced time series anomaly detection method as described in any one of claims 1-6.

8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the attention calibration-enhanced time-series anomaly detection method as described in any one of claims 1 to 6.