A flight data anomaly detection method and device based on contrastive learning
Through a comparison learning-based method, using graph attention network and dual-view comparison strategy, combined with the gated loop unit, the problem of global context information and variable dependency recognition in flight data is solved, and the robustness and accuracy of anomaly detection are improved.
Patent Information
- Application Number
- CN202410513278.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-04-26
AI Technical Summary
Existing flight data anomaly detection methods are difficult to effectively capture the strong dependence between global context information and variables in flight data, and the ability to identify outliers in extremely long time series is limited, especially when the type and number of exceptions are unknown. Next, traditional methods often ignore the exception points that account for a small proportion in the data.
Using a contrast learning-based approach, the dependence and temporal correlation between variables are captured through two parallel graph attention networks, random noise is introduced for data augmentation, and the local invariance of potential variables is extracted using a two-view comparison strategy, combining the gate The control loop unit reconstructs the output for abnormal detection.
Capturing invariant information and fine-grained representations in multivariable time series is realized, which improves the robustness and accuracy of anomaly detection, and can effectively identify dynamic changes in flight data and interdependence between parameters.
Smart Images

Figure CN118332468B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of anomaly detection, and in particular to a flight data anomaly detection method and device based on contrastive learning. Background Art
[0002] Flight safety is a core concern of the civil aviation industry. According to Boeing's statistics on commercial aircraft accidents from 2013 to 2022, a total of 300 flight accidents occurred from 2013 to 2022, of which 26 were fatal. Fatal incidents include controlled flight into terrain, loss of control in the air, runway overrun / runoff and hard landing, which are related to the pilot's driving operation and other uncontrollable factors such as weather, and these factors are directly reflected in the flight parameters. In 2006, the Civil Aviation Administration of China issued the "Large Aircraft Public Air Transport Carrier Operation Qualification Certification Rules" (CCAR-121-R4), which stipulates that all operating aircraft must be equipped with a Quick Access Recorder (QAR). The Quick Access Recorder is used to collect flight data of the aircraft in daily operations, including aircraft position, speed, altitude, attitude, engine parameters and many other parameter information.
[0003] In-depth analysis and detection of QAR data is crucial in flight safety management, which not only helps to analyze the causes of accidents, but also prevents possible flight risks in the future. Real-time monitoring and analysis of QAR data can effectively identify potential risks such as technical failures, operational errors or adverse weather conditions, so that appropriate measures can be taken in time to prevent accidents. This analysis plays an important role in optimizing flight operation procedures, improving the quality of pilot training, and ensuring the safety and efficiency of flight operations.
[0004] With the continuous development of technology, it has become a reality to use advanced data analysis methods to deeply analyze and detect flight data anomalies. Flight data has the characteristics of ultra-long and high-dimensional variables, and traditional statistical learning distribution models often cannot fully describe its characteristics. In addition, existing machine learning-based methods and deep learning-based methods are difficult to capture global context information in extremely long time series, which in turn affects the actual effectiveness of the model. At the same time, these methods often ignore the strong dependencies between flight variables. At the same time, in anomaly detection, the type and number of anomalies are usually unknown, and normal points and anomalies may coexist in the same instance. Existing fully supervised and semi-supervised methods are difficult to capture anomalies and intervals in the data where the anomaly ratio is small. These methods often only focus on the learning of normal categories and cannot identify completely new anomalies. Summary of the invention
[0005] The present application aims to solve one of the technical problems in the related art at least to some extent.
[0006] To this end, the first objective of the present application is to propose a flight data anomaly detection method based on contrastive learning.
[0007] The second objective of the present application is to propose a flight data anomaly detection device based on contrastive learning.
[0008] To achieve the above-mentioned purpose, the first embodiment of the present application proposes a flight data anomaly detection method based on contrastive learning, comprising:
[0009] Two parallel graph attention networks are used to capture the inter-variable dependencies and intra-variable temporal correlations of flight data respectively.
[0010] Mapping the embedded representations of the time correlation and the variable dependency to a low-dimensional space, introducing random noise to perform data enhancement on the mapped data, and obtaining an enhanced embedding window and a non-enhanced embedding window;
[0011] A dual-view comparison strategy is used to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window, and the data representation of multivariate time series is learned from the perspective of local comparison.
[0012] An input is reconstructed using the enhanced embedding window and the non-enhanced embedding window, a reconstructed output is obtained according to a decoder based on a gated recurrent unit, and anomaly detection is performed using the reconstructed output.
[0013] Optionally, the two parallel graph attention networks are a variable-oriented graph attention network and a time-oriented graph attention network, and the method further includes:
[0014] In the variable-oriented graph attention network, each unique variable is conceptualized as an independent node, and the edges between nodes represent the dynamic interactions and dependencies between variables. i Represents a unique variable, the attention coefficient α ij Represents each edge, quantizing the variable node v i For variable node v j The degree of influence exerted, for each variable node v j , by weighted summing the variable influences of its neighboring nodes, an updated output h is obtained j , the expression is:
[0015]
[0016]
[0017]
[0018] in, represents the cascade operation between two nodes, w is a learnable weight parameter, LeakyReLU() is a nonlinear activation function, e ij Represents node v j For node v i The correlation coefficient of node v i The number of neighbors of
[0019] In the variable-oriented graph attention network, each specific timestamp point is conceptualized as an independent node, and the edges between nodes represent the temporal relationship between different timestamps. Corresponding to a unique timestamp point, it contains the state of all variables at that specific moment. Each edge α ij Quantified the time node v i For time node v j The degree of influence, for each time node v j , by weighted summing the influence information of its adjacent time nodes, an updated node output h is obtained j .
[0020] Optionally, the method of using two parallel graph attention networks to respectively capture variable dependencies between flight data variables and temporal correlation within variables includes:
[0021] Let VariableGat() represent the variable-oriented graph attention network, TimeGat() represent the time-oriented graph attention network, and the embedding of the time correlation and the variable dependency is expressed as:
[0022]
[0023]
[0024]
[0025] in, Indicates input, and They represent the embedding of the variable-oriented graph attention network and the time-oriented graph attention network in the i-th window respectively, concat(*) represents the concatenation operation, represents the embedding of the overall output, N fea Indicates the number of embedded variables.
[0026] Optionally, embed the whole output Add Gaussian noise N(0,σ1) to generate a non-enhanced embedding window Based on the temporal convolutional network-based autoencoder architecture, Gaussian noise N(0,σ2) is added to the intermediate embedding to obtain an enhanced embedding window in Represents the number of enhancement windows, expressed as:
[0027]
[0028]
[0029]
[0030]
[0031] in, represents the i-th embedding window after being processed by the correlation extraction module, Represents the decoder output obtained without adding random noise, the symbols N(0,σ1) and N(0,σ2) represent Gaussian noise with mean 0 and variance σ1 and σ2 respectively, Enc() represents an autoencoder based on a temporal convolutional network, Dec() represents a decoder based on a temporal convolutional network, the temporal convolutional network includes multiple one-dimensional convolutional layers, each of which contains dilated causal convolution, pooling operation, weight normalization, ReLU activation function and regularization technology to prevent overfitting, the loss function of the autoencoder based on the temporal convolutional network is:
[0032]
[0033] in, represents the temporal convolutional network based autoencoder loss.
[0034] Optionally, the dual-view comparison strategy is used to extract local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window, and the data representation of the multivariate time series is learned from the perspective of local comparison, including:
[0035] Constructing positive and negative sample pairs inside and between the non-enhanced embedding window and the enhanced embedding window respectively;
[0036] Comparing the positive and negative sample pairs of the non-enhanced embedding window and the enhanced embedding window, the ability of the model to distinguish subtle differences between the positive and negative sample pairs is enhanced.
[0037] Optionally, constructing positive and negative sample pairs inside and between the non-enhanced embedding window and the enhanced embedding window, respectively, comprises:
[0038] In the non-enhanced embedding window, let the i-th element be expressed as Its adjacent elements in the non-enhanced embedding window and the corresponding i-th element in the enhanced embedding window are marked as positive sample pairs. The distance between the current element i and its adjacent element k is |ki|=1, and its non-adjacent elements in the non-enhanced embedding window and the elements in the enhanced embedding window except the i-th element are marked as negative sample pairs.
[0039] In the enhanced embedding window, let the i-th element be represented as Its adjacent elements in the enhanced embedding window and the corresponding i-th element in the non-enhanced embedding window are marked as positive sample pairs. Its non-adjacent elements in the enhanced embedding window and the elements in the non-enhanced embedding window except the i-th element are marked as negative sample pairs
[0040] Optionally, comparing the positive and negative sample pairs within the non-enhanced embedding window and the enhanced embedding window to enhance the model's ability to distinguish subtle differences between the positive and negative sample pairs includes:
[0041] The similarity between positive sample elements is maximized in the non-enhanced embedding window and the enhanced embedding window, and the similarity between negative sample elements is minimized. The contrast loss function is expressed as:
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050] Among them, N w and They represent the number of non-enhanced embedding windows and enhanced embedding windows respectively. F(x,y) is used to calculate the similarity between two element values. τ is a temperature coefficient used to adjust the similarity distribution. is the contrast loss;
[0051] Wherein, in the non-enhanced embedding window, Indicates similarity calculation among adjacent elements. represents the calculation of non-adjacent elements, Indicates that similarity calculation is performed between the i-th element in the non-enhanced embedding window and the i-th element in the enhanced embedding window, excluding the i-th element;
[0052] Wherein, in the enhanced embedding window, Indicates similarity calculation among adjacent elements. represents the calculation of non-adjacent elements, It indicates that similarity calculation is performed between the i-th element in the enhanced embedding window and the i-th element in the non-enhanced embedding window, and the i-th element is not included.
[0053] Optionally, reconstructing the input using the enhanced embedding window and the non-enhanced embedding window, and obtaining the reconstructed output according to a decoder based on a gated cycle unit, includes:
[0054] set up and denote the i-th element in the non-enhanced embedding window and the enhanced embedding window respectively, and the expression of the reconstructed output is:
[0055]
[0056]
[0057] Among them, concat(*) represents the concatenation operation. Represents the concatenated elements. Represented as reconstructed data, Linear() represents a linear transformation operation, and GRU() represents a decoding and reconstruction operation of a gated recurrent unit GRU;
[0058] The basic operating principle of the gated recurrent unit is to update the gate z (t) and reset gate r (t) Control the hidden state ht-1, the expression is:
[0059] z (t) =σ(W (z) χ t +U (z) h t-1 +b (z) )
[0060] r (t) =σ(W (r) χ t +U (r) h t-1 +b (r) )
[0061]
[0062]
[0063] Among them, χt represents The tth element of (*) and U (*) is the weight of GRU, b (*) is the bias value, σ(*) is the activation function;
[0064] The reconstruction loss of the gated recurrent unit is:
[0065]
[0066] in, represents the reconstruction loss;
[0067] The overall loss function is expressed as the encoder loss Contrastive loss and reconstruction loss The goal of contrastive learning is to minimize the overall loss function and obtain the reconstructed output, where the overall loss function is expressed as:
[0068]
[0069] in, Indicates overall loss.
[0070] Optionally, performing anomaly detection using the reconstructed output includes:
[0071] An anomaly score is calculated for each variable based on the reconstructed output, and the sum of the anomaly scores of all variables is taken as the final anomaly score, which is expressed as:
[0072]
[0073] Among them, S t represents the final anomaly score, is the reconstructed data;
[0074] A learnable parameter θ is used as the anomaly threshold. If the final anomaly score S t If the abnormal threshold θ is exceeded, it is identified as abnormal at timestamp t, otherwise it is considered normal. The expression is:
[0075]
[0076] Among them, y t Indicates the anomaly detection result.
[0077] To achieve the above-mentioned purpose, the second embodiment of the present application proposes a flight data anomaly detection device based on contrastive learning, comprising:
[0078] A correlation extraction module is used to capture the inter-variable dependencies and the intra-variable temporal correlations of flight data using two parallel graph attention networks;
[0079] A data enhancement module, used to map the embedded representation of the time correlation and the variable dependency to a low-dimensional space, introduce random noise to perform data enhancement on the mapped data, and obtain an enhanced embedding window and a non-enhanced embedding window;
[0080] The dual-view comparison module is used to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window using a dual-view comparison strategy, and learn the data representation of multivariate time series from a local comparison perspective;
[0081] A reconstruction module is used to reconstruct an input using the enhanced embedding window and the non-enhanced embedding window, obtain a reconstructed output according to a decoder based on a gated recurrent unit, and perform anomaly detection using the reconstructed output.
[0082] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0083] Two parallel graph attention networks are used to capture the temporal correlation within each variable and the dependencies between different variables respectively, to learn local embedding representations rich in internal correlation and dependency, so as to minimize information loss; the embedding is mapped to a low-dimensional space through an autoencoder architecture based on a temporal convolutional network, and random noise is added to enhance it, showing a wider range of data features in the original space; the local invariance of the dual-view latent variables of the data is captured through an improved dual-view comparison method, which can learn the data representation of multivariate time series from a local comparison perspective; the input is reconstructed using two embedding views through a decoder based on a gated recurrent unit, and the resulting reconstruction error is used to achieve anomaly detection, which can capture invariant information and fine-grained representation from the dynamically changing flight parameter time series, thereby improving the robustness of anomaly detection.
[0084] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0086] Figure 1 is a text flow chart of a flight data anomaly detection method based on contrastive learning according to an embodiment of the present application;
[0087] Figure 2is an image flow chart of a flight data anomaly detection method based on contrastive learning according to an embodiment of the present application;
[0088] FIG3( a) is a schematic diagram of a variable-oriented graph attention network according to an embodiment of the present application;
[0089] FIG3( b) is a schematic diagram of a time-oriented graph attention network according to an embodiment of the present application;
[0090] Figure 4 is a schematic diagram of the architecture of a temporal convolutional network according to an embodiment of the present application;
[0091] FIG5( a ) is a schematic diagram showing the effect of window size on the performance of the method of the present application according to an embodiment of the present application;
[0092] FIG5( b ) is a schematic diagram showing the effect of window interval on the performance of the method of the present application according to an embodiment of the present application;
[0093] FIG5( c ) is a schematic diagram showing the effect of the convolution kernel size on the performance of the method of the present application according to an embodiment of the present application;
[0094] FIG5( d ) is a schematic diagram showing the effect of the number of auto-encoder layers on the performance of the method of the present application according to an embodiment of the present application;
[0095] FIG5( e ) is a schematic diagram showing the effect of the number of decoder layers on the performance of the method of the present application according to an embodiment of the present application;
[0096] Figure 6 is a schematic diagram of changes in various variables in a case of abnormal landing according to an embodiment of the present application;
[0097] FIG7(a), FIG7(b), FIG7(c), FIG7(d), FIG7(e), and FIG7(f) are schematic diagrams showing changes in indicated airspeed, nose landing gear status, pitch angle, pitch angle control instruction, roll angle, and roll angle control instruction in a case of a heavy landing according to an embodiment of the present application;
[0098] Figure 8 It is a block diagram of a flight data anomaly detection device based on contrastive learning according to an embodiment of the present application. DETAILED DESCRIPTION
[0099] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0100] Although existing studies have proposed many new methods for flight safety analysis and anomaly detection on flight data, these studies still have the following three limitations when applied to QAR data:
[0101] (1) Scarce anomalies: In the field of flight data anomaly detection and analysis, the number of data samples marked as anomalies is often limited. This phenomenon causes the performance of traditional classification network architectures to significantly degrade when dealing with unbalanced data sets, making it a great challenge to train an effective supervised learning model. Due to the lack of sufficient anomaly labeled samples, the model may be more inclined to learn the features of the majority categories and ignore the features of the minority categories. This situation may cause the training results to be over-fitted to normal data, thereby ignoring the true abnormal patterns.
[0102] (2) Insufficient feature extraction capabilities: Some methods attempt to use statistical-based detection methods, which usually require a certain amount of prior experience. However, due to the different sampling frequencies of QAR record parameters, their data distribution often cannot be described by traditional distribution models. At the same time, most machine learning-based methods tend to select parameter values at specific time points or fixed sampling frequencies as features. Similarly, deep learning-based methods have difficulty covering global context information when encountering ultra-long time series data, and rough preprocessing methods may lead to a large amount of information loss, seriously affecting model accuracy.
[0103] (3) Lack of consideration of parameter interdependence: QAR data is highly specialized, and there are significant correlations between different flight parameters. For example, when the aircraft suddenly encounters a tailwind (reflected by the WIN_ALG parameter), the pilot may need to adjust the control (reflected by the PITCH_CMD parameter), which in turn affects the pitch angle of the aircraft (reflected by the PITCH parameter). This dynamic and interdependent relationship is at the core of QAR data analysis, but existing research has largely ignored the importance of these relationships. Most existing flight data analysis methods tend to consider individual parameters in isolation without deeply exploring the intrinsic connections between these parameters. This approach ignores the impact that interactions between flight parameters may have on flight safety, thereby limiting the effectiveness of anomaly detection models.
[0104] A flight data anomaly detection method and device based on contrastive learning according to an embodiment of the present application will be described below with reference to the accompanying drawings.
[0105] Figure 1 and Figure 2 They are respectively a text flow chart and an image flow chart of a flight data anomaly detection method based on contrastive learning according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0106] In step 101, two parallel graph attention networks are used to capture the variable dependencies between flight data variables and the temporal correlation within variables respectively.
[0107] In one embodiment of the present application, a graph attention network GAT is used to extract temporal correlation and variable dependency. Compared with traditional neural networks, GAT considers the different effects of different adjacent nodes on graph structured data when processing input, so that the association relationship in the graph can be captured more accurately. On this basis, the present application proposes two types of graph attention mechanisms: variable-oriented GAT and time-oriented GAT, which are used to extract variable dependencies between different variables and temporal correlation within variables, respectively.
[0108] Specifically, in the variable-oriented graph attention network, each unique variable is conceptualized as an independent node, and the edges between nodes represent the dynamic interactions and dependencies between variables. In this way, the entire multivariate time series is viewed as a graph, as shown in Figure 3(a). In this graph, each node v i Represents a unique variable, the attention coefficient α ij Represents each edge, thereby quantizing the variable node v i For variable node v j The degree of influence exerted. For each variable node v j , by weighted summing the variable influences of its neighboring nodes, an updated output h is obtained j , which includes the fusion of neighborhood information. The specific details are expressed as follows:
[0109]
[0110]
[0111]
[0112] in, represents the cascade operation between two nodes, w is a learnable weight parameter, LeakyReLU() is a nonlinear activation function, e ij Represents node v j For node v i The correlation coefficient of node v i The number of neighbors.
[0113] In the variable-oriented graph attention network, each specific timestamp point is conceptualized as an independent node, and the edges between nodes represent the temporal relationship between different timestamps. In this way, the sequential data points in the sliding window are effectively transformed into a structured graph, as shown in Figure 3(b). In this graph, each node Corresponding to a unique timestamp point, it contains the state of all variables at that specific moment. Each edge α ij Quantified the time node v i For time node v j The degree of influence, for each time node v j , by weighted summing the influence information of its adjacent time nodes, an updated node output h is obtained j .
[0114] In one embodiment of the present application, the process of using two parallel graph attention networks to capture variable dependencies between flight data variables and temporal correlations within variables respectively specifically includes:
[0115] Let VariableGat() represent the variable-oriented graph attention network and TimeGat() represent the time-oriented graph attention network, then the embedding of time correlation and variable dependency is expressed as:
[0116]
[0117]
[0118]
[0119] in, Indicates input, and They represent the embedding of the variable-oriented graph attention network and the time-oriented graph attention network in the i-th window respectively, concat(*) represents the concatenation operation, represents the embedding of the overall output, N fea Indicates the number of embedded variables.
[0120] It should be noted that the number of embedded variables N after the splicing operation fea will be three times the initial number of variables.
[0121] Step 102, mapping the embedded representation of time correlation and variable dependency to a low-dimensional space, introducing random noise to perform data enhancement on the mapped data, and obtaining an enhanced embedding window and a non-enhanced embedding window.
[0122] The purpose of this step is to map the embedded representation of temporal correlation and variable dependency into a low-dimensional space and introduce random noise for data augmentation. When modeling multivariate time series, it is crucial to understand the intricate interactions between time-varying variables and to accurately capture the interdependencies and dynamic changes of these variables.
[0123] Existing data augmentation methods do not fully utilize the inherent characteristics of time series data. To address the above problems, this application proposes an autoencoder architecture based on a temporal convolutional network (TCN). TCN focuses on modeling data dynamics and capturing subtle changes and trends using its one-dimensional convolutional layers, which helps generate synthetic data that closely resembles the actual data distribution. Based on performing basic transformations on the encoded input rather than directly applying it to the original input, this approach will generate more reasonable synthetic data.
[0124] Specifically, first embed the overall output Add Gaussian noise N(0,σ1) to generate a non-enhanced embedding window Secondly, based on the temporal convolutional network-based autoencoder architecture, Gaussian noise N(0,σ2) is added to the intermediate embedding to obtain an enhanced embedding window in Represents the number of enhancement windows, and its expression is:
[0125]
[0126]
[0127]
[0128]
[0129] in, represents the i-th embedding window after being processed by the correlation extraction module, Represents the decoder output obtained without adding random noise. The symbols N(0,σ1) and N(0,σ2) represent Gaussian noise with mean 0 and variance σ1 and σ2 respectively. Enc() represents an autoencoder based on a temporal convolutional network, and Dec() represents a decoder based on a temporal convolutional network.
[0130] It should be noted that if Figure 4 As shown in the figure, the temporal convolutional network layer includes multiple one-dimensional convolutional layers, each of which contains dilated causal convolution, pooling operation Chomping, weight normalization, ReLU activation function and Dropout, a regularization technique to prevent overfitting.
[0131] Specifically, dilated causal convolution is used to obtain an exponentially growing receptive field, thereby retaining a wide range of valid historical information. Chomping aims to ensure that the dimensions of the data after convolution are aligned with the dimensions of the input data. Weight normalization (WN) is a method of normalizing neuron weights in neural network optimization to speed up the convergence process in deep learning training. The operating logic expression of the temporal convolutional network layer is:
[0132]
[0133]
[0134]
[0135] in, represents the initial input, and represents the intermediate output, Represents the final output, Conv() represents the separable convolution operation, WN() represents weight normalization, Chomp() represents the pooling operation, ReLU() represents the ReLU activation function, and Dropout() represents regularization.
[0136] Then, the loss function of the temporal convolutional network based autoencoder can be expressed as:
[0137]
[0138] in, represents the temporal convolutional network based autoencoder loss.
[0139] Step 103, using a dual-view comparison strategy to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window, and learning the data representation of the multivariate time series from a local comparison perspective.
[0140] In the embodiment of the present application, after the above steps, two different views will be observed: a non-enhanced embedded window and enhanced embed windows In order to effectively learn fine-grained representations within these windows, this application improves the dual-view comparison method, which constructs positive and negative sample pairs within non-enhanced windows and enhanced windows.
[0141] In one embodiment of the present application, in the non-enhanced embedding window, let the i-th element be represented as Its adjacent elements in the non-enhanced embedding window and the corresponding i-th element in the enhanced embedding window are marked as positive sample pairs The distance between the current element i and its adjacent element k is |ki|=1, and its non-adjacent elements in the non-enhanced embedding window and the elements except the i-th element in the enhanced embedding window are marked as negative sample pairs.
[0142] In another embodiment of the present application, within the enhanced embedding window, let the i-th element be represented as Its adjacent elements in the enhanced embedding window and the corresponding i-th element in the non-enhanced embedding window are marked as positive sample pairs. Its non-adjacent elements in the enhanced embedding window and the elements except the i-th element in the non-enhanced embedding window are marked as negative sample pairs
[0143] It should be noted that after constructing the positive and negative sample pairs in the non-enhanced embedding window and the enhanced embedding window, a special training strategy needs to be formulated to enhance the model's ability to distinguish subtle differences between positive and negative sample pairs by comparing the positive and negative sample pairs in the non-enhanced embedding window and the enhanced embedding window, so that the model can more effectively learn and identify normal and abnormal points and intervals.
[0144] As a possible implementation method, the core goal of the training strategy is to maximize the similarity between positive sample elements in the non-enhanced embedding window and the enhanced embedding window, and minimize the similarity between negative sample elements. Therefore, the contrast loss function is expressed as:
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153] Among them, N w and denote the number of non-enhanced embedding windows and enhanced embedding windows, respectively, and they are equal, only different in the equation. F(x,y) is used to calculate the similarity between two element values, and τ is a temperature coefficient used to adjust the similarity distribution. is the comparison loss.
[0154] Among them, in the non-enhanced embedded window, Indicates similarity calculation among adjacent elements. represents the calculation of non-adjacent elements, Indicates that similarity calculation is performed between the i-th element in the non-enhanced embedding window and the enhanced embedding window, excluding the i-th element;
[0155] Among them, in the enhanced embed window, Indicates similarity calculation among adjacent elements. represents the calculation of non-adjacent elements, Indicates that similarity is calculated between the i-th element in the enhanced embedding window and the non-enhanced embedding window, but does not include the i-th element.
[0156] Step 104: reconstruct the input using the enhanced embedding window and the non-enhanced embedding window, obtain the reconstructed output according to the decoder based on the gated recurrent unit, and perform anomaly detection using the reconstructed output.
[0157] In the embodiment of the present application, the reconstructed output is obtained by reconstructing the embedding, and a gated recurrent unit (GRU) is selected for decoding and reconstructing the intermediate hidden embedding because it has a lower risk of overfitting and has comparable performance compared to LSTM.
[0158] In one embodiment of the present application, and denote the i-th element in the non-enhanced embedding window and the enhanced embedding window respectively, and the expression of the reconstructed output is:
[0159]
[0160]
[0161] Among them, concat(*) represents the concatenation operation. Represents the concatenated elements. It is represented as reconstructed data, Linear() represents a linear transformation operation, and GRU() represents a decoding and reconstruction operation of a gated recurrent unit GRU.
[0162] And the basic operating principle of the gated recurrent unit is to update the gate z (t) and reset gate r (t) Control the hidden state ht-1, the specific expression is:
[0163] z (t) =σ(W (z) χ t +U (z) h t-1 +b (z) )
[0164] r (t) =σ(W (r) χ t +U (r) h t-1 +b (r) )
[0165]
[0166]
[0167] Among them, χt represents The tth element of (*) and U (*) is the weight of GRU, b (*) is the bias value, σ(*) is the activation function;
[0168] Then, the reconstruction loss of the gated recurrent unit can be expressed as:
[0169]
[0170] in, represents the reconstruction loss;
[0171] Finally, the overall loss function is expressed as the encoder loss Contrastive loss and reconstruction loss The goal of contrastive learning is to minimize the overall loss function and obtain the reconstructed output, where the overall loss function is expressed as:
[0172]
[0173] in, Indicates overall loss.
[0174] It should be noted that due to the significant correlation between normal data points, the present application expects that the distance between abnormal data points and normal data points will be significantly greater than the distance between normal points. In the present application, the anomaly score is determined by calculating the reconstruction error. This error quantitatively reflects the degree to which a data point or interval deviates from its typical pattern and is an important criterion for anomaly identification.
[0175] Specifically, this application calculates an anomaly score for each variable and takes the sum of all variables as the final anomaly score. Therefore, The final anomaly score of is defined as:
[0176]
[0177] Among them, S t represents the final anomaly score, is the reconstructed data.
[0178] Then, in one embodiment of the present application, a learnable parameter θ is used as the anomaly threshold. If the final anomaly score S t If the abnormal threshold θ is exceeded, it is identified as abnormal at timestamp t, otherwise it is considered normal. The expression is:
[0179]
[0180] Among them, y t Indicates the anomaly detection result.
[0181] In a possible embodiment, a threshold that maximizes the model F1 score is selected as the abnormality threshold.
[0182] To illustrate the beneficial effects of the present application in detail, in some embodiments, the present application evaluates the CLAD model on two real-world datasets, including the QAR dataset and the MSL dataset. The CLAD model is constructed according to a flight data anomaly detection method based on contrastive learning proposed in the present application.
[0183] Among them, the QAR dataset consists of 44,808 flight samples of an Airbus A321 aircraft of a Chinese airline. Each flight sample records multiple variables throughout the flight phase from takeoff to landing. Based on professional knowledge, this application only focuses on 31 interrelated variables, including radio altitude, airspeed, pitch, roll, etc. Table 1 summarizes the physical meaning of these variables and the corresponding sampling frequencies. The data of these variables are collected at different sampling rates, ranging from 1 to 8 Hz (where 1 Hz means one observation per second). The time series length of each flight sample is 100.
[0184] Table 1 Detailed description of some QAR parameters
[0185]
[0186] The MSL (Mars Science Laboratory) dataset is a collection curated by NASA. The dataset contains 27 independent entities, each monitored by 55 metrics. The length of the time series for each entity varies from about 2000 to 6000. It is widely used in anomaly detection research, providing a mixture of normal operation data and anomalies reflecting the rover's various conditions and activities on Mars.
[0187] In addition, in these embodiments of the present application, according to expert advice, the present application focuses on the landing stage of each flight, extracting data from 90 seconds before landing to 10 seconds after landing. The data set is divided into a training set, a validation set, and a test set in a ratio of 6:1:3, wherein neither the training set nor the validation set contains any abnormal samples. Using expert experience, the present application coordinates data with different frequency characteristics to a standard frequency of 1Hz to ensure the scientific consistency of the entire data set. In addition, the model parameter settings are consistent on the QAR data set and the MSL data set. The deviations of Gaussian noise σ1 and σ2 and the temperature coefficient τ are set to 0.5, 0.5, and 0.25, respectively. The dimension of the sliding window is configured to 15, and the stride interval is set to 1. The autoencoder in the data enhancement module consists of three layers of TCN. The kernel size of these layers is 7, and the expansion factor used is d={1,2,4}. The dimension of the hidden layer is set to 87, and the GRU of the reconstruction module has 1 layer. For model training, the present application uses the Adam optimizer to train a network with a batch size of 128. A learning rate decay strategy was adopted, with an initial learning rate of 1e-3 and halved every 10 epochs. The training was conducted for a total of 80 epochs. In addition, all experiments were implemented in PyTorch with four NVIDIA GeForce RTX 3090 24GB GPUs.
[0188] In order to evaluate the effectiveness of the model proposed in this application, in one embodiment of this application, this application selects 12 comparison methods from the perspectives of machine learning, unsupervised learning methods and self-supervised learning methods, among which the machine learning methods include LOF and IForest, the unsupervised learning methods include DAGMM, LSTM, MAD-GAN, OmniAnomaly, THOC, MTAD-GAT, GDN, CAE-M and AnomalyTransformer, and the self-supervised learning method is DCdetector. This application uses three indicators, precision, recall and F1 score, as evaluation criteria.
[0189] According to the results in Table 2, it can be seen that the model proposed in this application is always better than the current optimal model in terms of F1 score. In terms of the two key indicators of precision and recall, it also achieved similar or even better results than the optimal model. At the same time, the experimental results show that most of the proposed deep learning-based methods are better than the existing machine learning-based methods, which shows that deep learning-based models are more effective in capturing variables that are conducive to anomaly detection. It is worth noting that both DCdetector and the model proposed in this application use contrastive learning methods, and their performance exceeds that of existing unsupervised methods, which shows that contrastive learning is good at detecting anomalies in data. Although the THOC model shows a higher recall rate than the model proposed in this application on the QAR dataset, its precision and F1 score are extremely low.
[0190] Table 2 Comparative experimental results
[0191]
[0192] In order to explore the relative contributions of the four processes in the CLAD framework, in another embodiment of the present application, the present application conducted an ablation experiment, and the results are shown in Table 3. Specifically, CLAD CE- After removing the correlation extraction process, the performance has partially degraded. This phenomenon is due to the incomplete consideration of time correlation and variable dependency, which limits the ability to extract information and thus reduces the efficiency of detecting anomalies. DA- Replacing the proposed autoencoder architecture with a traditional time-frequency domain augmentation method shows a significant drop in performance, highlighting the inadequacy of traditional methods in complex, multivariate, and non-periodic data environments. In contrast, the autoencoder framework designed for abstract and subtle variable detection can adeptly capture the inherent representations of such complex data. DC- The dual-view comparison process was removed to evaluate its effectiveness. This method directly reconstructs window samples within the embedding environment generated by the data augmentation module, which does not successfully capture the subtle differences between different views in the embedding, nor does it fully identify anomalies in the data, which significantly reduces the overall efficiency of the module. CLAD DF- and CLAD DL- Replacing the GRU with a fully connected network and LSTM as the main body of the decoder, respectively, highlights the GRU’s superior ability to capture the long-term dependencies necessary for processing sequential data, as well as to avoid the vanishing gradient problem that is common in traditional neural networks through its gating mechanism.
[0193] Table 3 Ablation studies
[0194]
[0195] Finally, in order to study the impact of hyperparameters on CLAD performance, in one embodiment of the present application, Figure 5(a)-Figure 5(e)As shown in Figure 5(a), the effect of different sliding window sizes on the experimental results is shown. The model maintains good performance over a wide range of window sizes (from 15 to 90). The stride interval of the sliding window affects the construction of positive and negative sample pairs. The results in Figure 5(b) show that when the interval is set to 1, the model achieves the best performance. Figure 5(c) reveals the important role of the TCN convolution kernel size in the TCN-based autoencoder framework. Setting the TCN convolution kernel size to 7 can achieve the most effective performance. At the same time, Figure 5(d) analyzes the effect of the number of layers in the TCN-based autoencoder on the model effect. The study found that the model performance is best when it is a three-layer structure. Figure 5(e) illustrates the effect of changing the number of GRU layers used for reconstruction on the experimental performance, indicating that a single-layer reconstruction GRU can reach the peak of model performance.
[0196] In order to understand the effectiveness of the model proposed in this application more specifically, this application performed visual analysis on the MSL dataset and the QAR dataset (including point anomalies and interval anomalies). The results show that the CLAD model can accurately identify data anomalies in the MSL dataset and the QAR dataset. These visual examples clearly demonstrate the effectiveness of CLAD in anomaly detection.
[0197] In addition, this application uses an example as a case study. Figure 6 This figure describes a detected abnormal landing case and records various variables related to the pilot's operation and flight status, such as pitch (PITCH, PITCH_CMD), roll (ROLL, ROLL_CMD), etc. Figure 7(a)-Figure 7(f) The visualizations show subtle changes in the values of each variable and their deviations from the collective norm. These visualizations show that an abnormally high indicated airspeed (IAS) during the landing phase triggered an anomaly. This required the pilot to spend extra time reducing the airspeed, resulting in unstable control inputs (PITCH_CMD, ROLL_CMD) that deviated from the normal operating mode. As a result, the aircraft's nose landing gear (LDGNOS) touched the ground later than planned, and the pitch and roll angles suddenly changed excessively. Ultimately, this caused the vertical rate at touchdown (VRTG) to exceed the typical value, which is likely to lead to a hard landing. The CLAD model is able to detect anomalies in each flight variable during the landing phase. In fact, this example is indeed a hard landing event, which also verifies the effectiveness of the model.
[0198] In order to implement the above embodiment, Figure 8 As shown, the present application also proposes a flight data anomaly detection device 10 based on contrastive learning, comprising:
[0199] A correlation extraction module 100, for capturing variable dependencies between flight data variables and temporal correlation within variables using two parallel graph attention networks;
[0200] A data enhancement module 200 is used to map the embedded representation of time correlation and variable dependency to a low-dimensional space, introduce random noise to perform data enhancement on the mapped data, and obtain an enhanced embedding window and a non-enhanced embedding window;
[0201] A dual-view comparison module 300 is used to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window using a dual-view comparison strategy, and learn the data representation of multivariate time series from a local comparison perspective;
[0202] The reconstruction module 400 is used to reconstruct the input using the enhanced embedding window and the non-enhanced embedding window, obtain the reconstructed output according to the decoder based on the gated recurrent unit, and perform anomaly detection using the reconstructed output.
[0203] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0204] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution of this application can be achieved, and this document is not limited here.
[0205] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A flight data anomaly detection method based on contrastive learning, characterized in that: include: Two parallel graph attention networks are used to capture the inter-variable dependencies and intra-variable temporal correlations of flight data respectively. Mapping the embedded representations of the time correlation and the variable dependency to a low-dimensional space, introducing random noise to perform data enhancement on the mapped data, and obtaining an enhanced embedding window and a non-enhanced embedding window; A dual-view comparison strategy is used to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window, and the data representation of multivariate time series is learned from a local comparison perspective. reconstructing an input using the enhanced embedding window and the non-enhanced embedding window, obtaining a reconstructed output according to a decoder based on a gated recurrent unit, and performing anomaly detection using the reconstructed output; The two parallel graph attention networks are a variable-oriented graph attention network and a time-oriented graph attention network, and the method further includes: In the variable-oriented graph attention network, each unique variable is conceptualized as an independent node, and the edges between nodes represent the dynamic interactions and dependencies between variables. Represents a unique variable, the attention coefficient Represents each edge, quantizing the variable node For variable nodes The degree of influence exerted, for each variable node , by weighted summing the variable influences of its neighboring nodes, an updated output is obtained , the expression is: in, Represents a cascade operation between two nodes. is a learnable weight parameter, is a nonlinear activation function, Representation Node For Node The correlation coefficient of Representation Node The number of neighbors of is the activation function; In the time-oriented graph attention network, each specific timestamp point is conceptualized as an independent node, and the edges between nodes represent the temporal relationship between different timestamps. Corresponds to a unique timestamp point, including the state of all variables at that timestamp point. Each edge Quantified time nodes For time nodes The degree of influence, for each time node , by weighted summing the influence information of its adjacent time nodes, an updated node output is obtained ; The two parallel graph attention networks are used to capture the variable dependencies between flight data variables and the temporal correlation within variables, respectively, including: set up represents a variable-oriented graph attention network, Representing a time-oriented graph attention network, the embedding of the temporal correlation and the variable dependency is expressed as: in, Indicates input, and Respectively represent The embedding of variable-oriented graph attention network and time-oriented graph attention network in the window, Represents a splicing operation, represents the embedding of the overall output, represents the number of embedded variables; The step of mapping the embedded representation of the time correlation and the variable dependency to a low-dimensional space, introducing random noise to perform data enhancement on the mapped data, and obtaining an enhanced embedding window and a non-enhanced embedding window includes: Embed the whole original output Add Gaussian noise , generates a non-enhanced embedded window , based on the temporal convolutional network-based autoencoder architecture, adding Gaussian noise to the intermediate embedding , get the enhanced embed window ,in Represents the number of enhancement windows, expressed as: in, Represents the first An embedded window, represents the decoder output obtained without adding random noise, symbol and indicates that the mean is 0 and the variance is and Gaussian noise, represents an autoencoder based on a temporal convolutional network, represents a decoder based on a temporal convolutional network, wherein the temporal convolutional network includes multiple one-dimensional convolutional layers, each of which includes an expanded causal convolution, a pooling operation, a weight normalization, a ReLU activation function, and a regularization technique to prevent overfitting. The loss function of the automatic encoder based on the temporal convolutional network is: in, represents the autoencoder loss based on the temporal convolutional network; The dual-view comparison strategy is used to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window, and learn the data representation of multivariate time series from a local comparison perspective, including: Constructing positive and negative sample pairs inside and between the non-enhanced embedding window and the enhanced embedding window respectively; Comparing the positive and negative sample pairs within the non-enhanced embedding window and the enhanced embedding window, enhancing the model's ability to distinguish subtle differences between the positive and negative sample pairs; The constructing positive and negative sample pairs inside and between the non-enhanced embedding window and the enhanced embedding window respectively comprises: In the non-enhanced embedding window, set The elements are represented as , its adjacent element in the non-enhanced embedding window and the corresponding first element in the enhanced embedding window elements are marked as positive pairs , and the current element Its adjacent elements The distance between , which is the non-adjacent element in the non-enhanced embedding window and the non-adjacent element in the enhanced embedding window except the first Elements other than the given elements are marked as negative sample pairs. ; In the enhanced embedding window, set The elements are represented as , its adjacent element in the enhanced embedding window and the corresponding first element in the non-enhanced embedding window elements are marked as positive pairs , which is in the non-adjacent elements of the enhanced embedding window and the non-enhanced embedding window except the first Elements other than the given elements are marked as negative sample pairs. ; The comparing the positive and negative sample pairs within the non-enhanced embedding window and the enhanced embedding window to enhance the model's ability to distinguish subtle differences between the positive and negative sample pairs includes: The similarity between positive sample elements is maximized in the non-enhanced embedding window and the enhanced embedding window, and the similarity between negative sample elements is minimized. The contrast loss function is expressed as: in, and denote the number of non-enhanced embedding windows and enhanced embedding windows respectively, Used to calculate the similarity between two element values. is a temperature coefficient used to adjust the similarity distribution, is the contrast loss; Wherein, in the non-enhanced embedding window, Indicates that similarity is calculated among adjacent elements. represents the calculation of non-adjacent elements, Indicates the first The similarity is calculated between elements, excluding the elements; Wherein, in the enhanced embedding window, Indicates that similarity is calculated among adjacent elements. represents the calculation of non-adjacent elements, Indicates the first The similarity is calculated between elements, excluding the elements; The step of reconstructing the input using the enhanced embedding window and the non-enhanced embedding window and obtaining the reconstructed output according to a decoder based on a gated cycle unit includes: set up and Respectively represent the first elements, the expression of the reconstructed output is: in, Represents a splicing operation, Represents the concatenated elements. is represented as the reconstructed data, represents a linear transformation operation, Represents the decoding and reconstruction operation of the gated recurrent unit GRU; The basic operating principle of the gated recurrent unit is to update the gate and reset gate Controlling hidden states , the expression is: in, express No. elements, and is the weight of GRU, is the bias value, is the activation function; The reconstruction loss of the gated recurrent unit is: in, represents the reconstruction loss; The overall loss function is expressed as the encoder loss , contrast loss and reconstruction loss The goal of contrastive learning is to minimize the overall loss function and obtain the reconstructed output, where the overall loss function is expressed as: in, Indicates overall loss; The using the reconstructed output to perform anomaly detection includes: An anomaly score is calculated for each variable based on the reconstructed output, and the sum of the anomaly scores of all variables is taken as the final anomaly score, which is expressed as: in, represents the final anomaly score, is the reconstructed data; Using a learnable parameter As the anomaly threshold, if the final anomaly score Exceeding the abnormal threshold , then at the timestamp is identified as abnormal, otherwise it is considered normal. The expression is: in, Indicates the anomaly detection result.
2. A flight data anomaly detection device based on contrastive learning, used to implement the flight data anomaly detection method based on contrastive learning as claimed in claim 1, characterized in that: The flight data anomaly detection device based on contrastive learning comprises: A correlation extraction module is used to capture the inter-variable dependencies and the intra-variable temporal correlations of flight data using two parallel graph attention networks; A data enhancement module, used to map the embedded representation of the time correlation and the variable dependency to a low-dimensional space, introduce random noise to perform data enhancement on the mapped data, and obtain an enhanced embedding window and a non-enhanced embedding window; The dual-view comparison module is used to extract the local invariance of latent variables in the enhanced embedding window and the non-enhanced embedding window using a dual-view comparison strategy, and learn the data representation of multivariate time series from a local comparison perspective; A reconstruction module is used to reconstruct an input using the enhanced embedding window and the non-enhanced embedding window, obtain a reconstructed output according to a decoder based on a gated recurrent unit, and perform anomaly detection using the reconstructed output.
