A graph anomaly detection method and system based on vehicle model data flow graph

Through the combination of the Sentence-Bert model and graph neural network, the problem of low abnormal detection efficiency of vehicle data flow graph is solved, efficient abnormal node detection and risk assessment are achieved, and the abnormal detection effect of vehicle data flow graph is improved.

CN118520406BActive Publication Date: 2024-11-08AUTOMOTIVE DATA OF CHINA (TIANJIN) CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410981349.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-08
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The prior art relies on manual features and domain knowledge in the abnormal detection of vehicle model data flow diagrams, which is time-consuming and inefficient, making it difficult to effectively process large-scale high-dimensional graph data.

Method used

The Sentence-Bert model is used for data preprocessing, the vehicle model data flow diagram is converted into text diagrams, and node-level unsupervised anomaly detection is performed through the graph neural network, and the graph autoencoder is used to reconstruct errors as outliers to improve detection efficiency.

Benefits of technology

It realizes efficient detection of abnormal nodes in vehicle model data flow chart, improves the efficiency of risk assessment and abnormal node positioning, enhances the model's adaptability to different data sets, and achieves excellent abnormal detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520406B_ABST
    Figure CN118520406B_ABST
Patent Text Reader

Abstract

The present invention discloses a graph anomaly detection method and system based on a vehicle model data flow graph, and relates to the field of computer data processing. The present invention performs data preprocessing operations on the vehicle model data flow graph, converts the vehicle model data flow graph into a graph format of a text graph, and generates a text graph of the entire vehicle system; obtains the vector representation of the text on each node according to a preset model, and converts the text graph into a static vector attribute graph; performs node-level unsupervised anomaly detection on the static attribute graph to obtain an inspection result. The top TOP K nodes are selected from high to low as abnormal nodes to perform risk assessment and inspection on them, thereby improving the efficiency of risk assessment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer data processing, and in particular relates to a graph anomaly detection method and system based on a vehicle model data flow graph. Background Art

[0002] With the advent of the Internet era and the era of big data, the scale and complexity of data have shown an unprecedented growth trend. As a powerful data carrier, graphs have been used by many industries to represent complex structured data and have been widely used in many fields. At the same time, the automotive industry continues to innovate and develop, using advanced information and communication technologies to combine automobiles with the Internet, artificial intelligence and other technologies to achieve intelligent interconnection and data exchange between vehicles, between vehicles and infrastructure, and between vehicles and users. Intelligent networked vehicles have become one of the important trends in the development of traditional vehicles towards intelligence and automation. In the information security technology of intelligent networked vehicles, the vehicle data flow graph is a very important data.

[0003] Vehicle data flow diagrams are mainly used in risk assessment of intelligent connected vehicles. By drawing data flow diagrams of various asset data in the vehicle system, data flow analysis can be performed on risk failures and possible causes based on the attribute information and topological structure of the data flow diagram, which can more accurately diagnose the risks of automotive electronic control systems and improve the efficiency of risk diagnosis. Therefore, anomaly detection of vehicle data flow diagrams has become an important task in automotive risk assessment.

[0004] The main body of the vehicle model data flow diagram is the data flow diagram (DFD), which is a typical static attributed graph. One of its characteristics is that the nodes and edges of the graph carry certain information, which is called attributes. The second characteristic is that the structural connection relationship between the nodes and edges in the graph and the attributes on them will not change due to changes in time, so the graph is called static. Early work on graph anomaly detection relied heavily on domain knowledge and statistical methods, in which the features for detecting anomalies were mostly handcrafted. This handcrafted detection task is labor-intensive and naturally very time-consuming. In addition, real-world graphs usually contain a large number of attribute-labeled nodes and edges, so they are large-scale and high-dimensional. In order to overcome the limitations of early work, deep learning methods have received considerable attention in recent years when detecting anomalies from graphs. Deep learning has a nonlinear multi-layer structure that can examine large-scale high-dimensional data and extract features from the data, thereby achieving satisfactory performance without the burden of manual features.

[0005] Recently, it has been found that the message passing mechanism in graph representation has a highly expressive ability, and Graph Neural Network (GNN) has been used to detect anomalies from graphs. Even for graph anomalies with highly complex structures or attributes, it is relatively simple to use GNN to learn and extract anomalies from them, because GNN itself is used to process graph data with attributes. The most advanced graph anomaly detection method combines GNN with existing deep learning methods, where GNN is used to capture the structural features of the graph, and deep learning methods are used to capture other types of information, such as text, time, etc. This technology uses the latest deep learning method to mine the possible abnormal nodes in the vehicle data flow graph, which is essentially a static attribute graph. It can achieve good detection results in node-level graph anomaly detection and is suitable for risk assessment of automotive data flows. Summary of the invention

[0006] In order to detect graph anomalies on vehicle data flow graphs, this method performs data preprocessing on vehicle data flow graphs, integrates scattered data flow graphs, and transfers the information carried on edge data flows to nodes, converting them into node features to obtain text graphs; a node-level unsupervised graph anomaly detection model is performed on the text graph. The model first encodes the text on the node into a corresponding text vector through a semantically enhanced pre-trained language model, and then reconstructs the converted static attribute graph in the subsequent graph autoencoder, using the reconstruction error as the outlier value to select the corresponding abnormal nodes from high to low. This can not only ensure that the risk anomalies in the graph are found as much as possible, but also save the time of searching for abnormal nodes one by one in the global scope, improving the efficiency of risk assessment and the efficiency of abnormal node location.

[0007] The technical solution adopted by the present invention to solve the above technical problems is:

[0008] A graph anomaly detection method based on a vehicle model data flow graph comprises the following steps: S1, performing data preprocessing operations on the vehicle model data flow graph, converting the vehicle model data flow graph into a graph format of a text graph, and generating a text graph of a whole vehicle system; the text graph comprises structural information and text attribute information; the text attribute information comprises node labels, descriptions, and keywords;

[0009] The pre-processing comprises:

[0010] S11, merging all local subgraphs according to the names of the nodes to achieve subgraph aggregation;

[0011] S12, transferring the text carried on the edge of the graph to N nodes connected to the merging center node; the merging center node is a node with the same name in the local subgraph;

[0012] S2. Obtain the vector representation of the text on each node according to the preset model, and convert the text graph into a static vector attribute graph;

[0013] The preset model is the Sentence-Bert model, which is used as the encoder of the node text. When using Sentence-Bert for the encoding stage, the formula is as follows:

[0014] ;

[0015] Sentence is a sentence as input, Embedding is the encoding vector representing the sentence, Bert means encoding each token in the sentence, and pooling means pooling, which aggregates the information represented by all tokens to form a vector representing the semantics of the entire sentence.

[0016] Among them, there are three ways to fine-tune the Sentence-Bert model: the first two methods use the Siamese network architecture, and the latter uses the triplet network architecture. The essence of these two architectures is that multiple inputs share a set of models and their parameters, and they are updated simultaneously during the final gradient back propagation;

[0017] Fine-tuning the Sentence-Bert model includes:

[0018]

[0019]

[0020]

[0021] ;

[0022] Where W is the learnable parameter of the linear transformation layer, o is the actual classification label, is the predicted classification label. For the trained model, only the BERT layer and pooling layer of the model are used as text encoders to extract the semantic representation vector of the text.

[0023] After inputting sentence pairs A and B into the pre-trained language model BERT, the semantic vectors u and v of A and B are obtained according to a certain pooling strategy, and the absolute values ​​of u, v, and uv are concatenated to obtain the final vector, which is then input into the Softmax layer to classify the relationship between the sentence pairs, and finally the cross entropy loss of the classification prediction is optimized;

[0024] Furthermore, fine-tuning the Sentence-Bert model also includes:

[0025]

[0026]

[0027] ;

[0028] The cosine similarity calculation model is:

[0029]

[0030] The semantic vectors u and v of sentence A and sentence B are obtained by the same encoding method as the above-mentioned fine-tuning method. That is, after inputting sentence pairs A and B into the pre-trained language model BERT, the semantic vectors u and v of A and B are obtained according to a certain pooling strategy, and the absolute values ​​of u, v, and uv are vectorized to obtain the final vector. The loss function is the mean square error loss of the cosine similarity of the semantic vectors of the two sentences.

[0031] Furthermore, fine-tuning the Sentence-Bert model also includes:

[0032]

[0033]

[0034]

[0035] ;

[0036] in In order to control the hyperparameters of the similarity difference between sentences A, B and A, C, given a baseline sentence A, find a sentence B with a similar meaning and a sentence C with an opposite meaning. The corresponding semantic vectors u, v, w are obtained by encoding with BERT and pooling layers, and the loss function is minimized to make sentences A and B as close as possible and A and C as far away as possible.

[0037] The Sentence-Bert model improves its ability to understand sentence semantic information by mixed training of these three fine-tuning tasks, so that the final text encoding vector is consistent with the text semantics.

[0038] S3. Perform node-level unsupervised anomaly detection on static attribute graphs, including:

[0039] S31 integrates graph structure information into node text representation through graph neural network.

[0040] S32 reconstructs the attribute matrix and adjacency matrix of the static attribute graph through the obtained node embedding, and uses the reconstruction error of the attribute matrix and the adjacency matrix as the loss to train the graph autoencoder;

[0041] In S32, after the graph with semantic vectors of nodes is input into the model, the adjacency matrix A and attribute matrix X of the graph are extracted at the encoder layer, and the structural information is also encoded into the node representation vector after passing through several GCN layers. The formula of the GCN layer is given by:

[0042]

[0043] ;

[0044] Where H is the attribute matrix on a hidden layer, W is the trainable weight matrix, and l represents the number of layers of the current GCN. is a unit matrix. After the node embedding vector is obtained through the GCN layer, the attribute matrix X and the adjacency matrix A are restored by a layer of GCN and a sigmoid function to obtain the reconstructed attribute matrix and adjacency matrix, and the reconstruction loss is calculated. Finally, the gradient is updated by backpropagation to minimize the loss continuously and the outliers of the nodes are sorted by using the final loss of each node as the outlier score, and the top n nodes are taken as outliers.

[0045] Among them, the sigmoid function is as follows:

[0046] ;

[0047] The penalty coefficient introduced, the loss function after the modification, and the node outlier value are shown in the following formula:

[0048]

[0049]

[0050] ;

[0051] and represents the penalty coefficient for the reconstruction loss of non-zero elements, where and All are greater than 1; and and represent A and The row vector corresponding to the i-th node in , and represents X and The row vector corresponding to the i-th node in , and in the two formulas are used to measure the importance attached to structural loss and property loss.

[0052] After modifying the anomaly detection model, you only need to input the static vector attribute graph to get the anomaly scores of all nodes in the graph, and select the top K nodes from high to low as abnormal nodes for risk assessment and inspection. This can ensure that the risk anomalies in the graph are found as much as possible and save time in searching for abnormal nodes one by one in the global scope, thereby improving the efficiency of risk assessment.

[0053] The beneficial effects of the present invention are as follows:

[0054] 1) The present invention integrates the localized subgraphs and transfers the data flow information on the edges to the nodes, which can greatly expand the text features on the nodes and explain what kind of information the component node has the ability to process from a global perspective. The abstraction and representation of the node characteristics in a global sense also enables the automotive component to be well expressed by the text on the node. This good expression ability can continue to play a role in subsequent graph anomaly detection and improve the final effect of graph anomaly detection.

[0055] 2) In the anomaly detection of text graphs, an innovative approach is proposed to enhance the anomaly detection effect by improving text representation. Different from the traditional method of using only shallow semantic language models to roughly encode text, this invention uses Sentence-Bert to perform fine-grained modeling of semantics and uses three different tasks to fine-tune the pre-trained model Bert to enhance its semantic representation ability. As the node text representation ability is improved, the anomaly detection ability will also be enhanced, thereby improving the effect of the final model.

[0056] 3) In the anomaly detection module, the loss function of the DOMINANT model is modified by adding a penalty for non-zero elements in the reconstruction loss, so that the modified model can be fine-tuned to adapt to data sets with different characteristics, improving the adaptability of the model to different data sets, so that the processed vehicle data flow graph can be well modeled and anomalies can be detected. Finally, Sentence-Bert is combined with the modified DOMINANT into a new text graph anomaly detection model, which is compared with some traditional mainstream models on the vehicle data flow graph dataset, and the best anomaly detection effect is achieved, which also proves the effectiveness of the present invention.

[0057] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above description and other purposes, features and advantages of the present invention more obvious and easy to understand, the preferred embodiments are specifically cited and described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0059] Figure 1 It is the model framework flow chart of the present invention;

[0060] Figure 2 The processing flow of the data preprocessing module of the present invention;

[0061] Figure 3 The Siamese network architecture of the node characterization module of the present invention;

[0062] Figure 4 A triplet network architecture of the node representation module of the present invention;

[0063] Figure 5 The graph autoencoder architecture of the anomaly detection module of the present invention;

[0064] Figure 6 Classification of graph anomalies for the field of graph anomaly detection;

[0065] Figure 7 The detection effect of the present invention on different types of anomalies during the testing phase;

[0066] Figure 8 It is a part of the original Json file that stores the vehicle model data flow graph;

[0067] Fig. 9 This is a data flow diagram of a certain car model after the original Json file is opened under OWASP-Threat-Dragon. DETAILED DESCRIPTION

[0068] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0069] In the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be connected, detachably connected, or integrated; it can be mechanically connected or electrically connected; it can be directly connected or indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0070] Example 1

[0071] A graph anomaly detection method based on a vehicle model data flow graph comprises the following steps:

[0072] S1. Perform data preprocessing on the vehicle data flow graph, convert the vehicle data flow graph into a text graph format, and generate a text graph of the entire vehicle system; the text graph includes structure information and text attribute information; the text attribute information includes node labels, descriptions, and keywords;

[0073] The pre-processing comprises:

[0074] S11, merging all local subgraphs according to the names of the nodes to achieve subgraph aggregation;

[0075] S12: transferring the text carried on the edge of the graph to N nodes connected to the merging center node; the merging center node is a node with the same name in the local subgraph;

[0076] Optionally, S101, before merging, it is necessary to filter out the identifiers of the defined nodes and edges according to the template to ensure that each node in the subgraph has a unique identifier, so that different nodes can be distinguished during merging.

[0077] S102, perform node mapping: create a mapping table to map node identifiers in all subgraphs to nodes in the merged graph.

[0078] S103, merging nodes: according to the mapping table, adding nodes in all subgraphs to the merged graph. If two subgraphs have the same nodes, it is necessary to decide whether to merge these nodes or keep them as independent nodes according to a preset algorithm.

[0079] S104, merging edges: transferring the text carried on the edges in the graph to N nodes connected to the merging center node; the merging center node is a node with the same name in the local subgraph;

[0080] The node reservation preset method includes:

[0081] Create a mapping system that maps node identifiers in all subgraphs to a unified node identifier. This mapping system can be a dictionary or a hash table, where the key is the original node identifier and the value is the unified node identifier. Use a set to store all node identifiers that have appeared. The characteristic of a set is that it does not allow duplicate elements, which can be used to quickly check whether a node already exists.

[0082] The uniqueness of the merge center identifier is ensured by comparing the hash value of the current identifier with the value in the hash table.

[0083] Further, a category dimension is added to the identifier. When comparing, the dimension information is compared first, and then the hash value is compared.

[0084] S2. Obtain the vector representation of the text on each node according to the preset model, and convert the text graph into a static vector attribute graph;

[0085] The preset model is the Sentence-Bert model, which is used as the encoder of the node text. When using Sentence-Bert for the encoding stage, the formula is as follows:

[0086] ;

[0087] Sentence is a sentence as input, Embedding is the encoding vector representing the sentence, Bert means encoding each token in the sentence, and pooling means pooling, which aggregates the information represented by all tokens to form a vector representing the semantics of the entire sentence.

[0088] Among them, fine-tuning the Sentence-Bert model includes:

[0089]

[0090]

[0091]

[0092] ;

[0093] Where W is the learnable parameter of the linear transformation layer, o is the actual classification label, is the predicted classification label. For the trained model, only the BERT layer and pooling layer of the model are used as text encoders to extract the semantic representation vector of the text.

[0094] After inputting sentence pairs A and B into the pre-trained language model BERT, the semantic vectors u and v of A and B are obtained according to a certain pooling strategy, and the absolute values ​​of u, v, and uv are concatenated to obtain the final vector, which is then input into the Softmax layer to classify the relationship between the sentence pairs, and finally the cross entropy loss of the classification prediction is optimized;

[0095] Furthermore, fine-tuning the Sentence-Bert model also includes:

[0096]

[0097]

[0098] ;

[0099] The cosine similarity calculation model is:

[0100] ;

[0101] The semantic vectors u and v of sentence A and sentence B are obtained by the same encoding method as the above-mentioned fine-tuning method. That is, after inputting sentence pairs A and B into the pre-trained language model BERT, the semantic vectors u and v of A and B are obtained according to a certain pooling strategy, and the absolute values ​​of u, v, and uv are vectorized to obtain the final vector. The loss function is the mean square error loss of the cosine similarity of the semantic vectors of the two sentences.

[0102] Furthermore, fine-tuning the Sentence-Bert model also includes:

[0103]

[0104]

[0105]

[0106] ;

[0107] in In order to control the hyperparameters of the similarity difference between sentences A, B and A, C, given a baseline sentence A, find a sentence B with a similar meaning and a sentence C with an opposite meaning. The corresponding semantic vectors u, v, w are obtained by encoding with BERT and pooling layers, and the loss function is minimized to make sentences A and B as close as possible and A and C as far away as possible.

[0108] The Sentence-Bert model improves its ability to understand sentence semantic information by mixed training of these three fine-tuning tasks, so that the final text encoding vector is consistent with the text semantics.

[0109] S3. Perform node-level unsupervised anomaly detection on static attribute graphs, including:

[0110] S31 integrates graph structure information into node text representation through graph neural network.

[0111] S32 reconstructs the attribute matrix and adjacency matrix of the static attribute graph through the obtained node embedding, and uses the reconstruction error of the attribute matrix and the adjacency matrix as the loss to train the graph autoencoder;

[0112] In S32, after the graph with semantic vectors of nodes is input into the model, the adjacency matrix A and attribute matrix X of the graph are extracted at the encoder layer, and the structural information is also encoded into the node representation vector after passing through several GCN layers. The formula of the GCN layer is given by:

[0113]

[0114] ;

[0115] Where H is the attribute matrix on a hidden layer, W is the trainable weight matrix, and l represents the number of layers of the current GCN. is a unit matrix. After the node embedding vector is obtained through the GCN layer, the attribute matrix X and the adjacency matrix A are restored by a layer of GCN and a sigmoid function to obtain the reconstructed attribute matrix and adjacency matrix, and the reconstruction loss is calculated. Finally, the gradient is updated by backpropagation to minimize the loss continuously and the outliers of the nodes are sorted by using the final loss of each node as the outlier score, and the top n nodes are taken as outliers.

[0116] Among them, the sigmoid function is as follows:

[0117] ;

[0118] The penalty coefficient introduced, the loss function after the modification, and the node outlier value are shown in the following formula:

[0119]

[0120]

[0121] ;

[0122] and represents the penalty coefficient for the reconstruction loss of non-zero elements, where and All are greater than 1; and and represent A and The row vector corresponding to the i-th node in , and represents X and The row vector corresponding to the i-th node in , and in the two formulas are used to measure the importance attached to structural loss and property loss.

[0123] Example 2

[0124] like Figure 1 As shown, the graph anomaly detection system based on the vehicle model data flow graph of the present invention includes

[0125] The data preprocessing module is used to obtain a complete global system text diagram from scattered localized vehicle model data diagrams. The example results and process are as follows: Figure 2 As shown, it is beneficial to the subsequent node characterization task and anomaly detection task;

[0126] The node representation module is used to convert all the text information on the node into relevant vectors through the powerful semantic understanding ability of the fine-tuned pre-trained language model. The more similar the vectors with similar text semantics are, the greater the cosine similarity is. The fine-tuning method that combines the Siamese network architecture and the triplet network architecture is used. The specific fine-tuning process is as follows: Figure 3 and Figure 4 As shown;

[0127] Anomaly detection module, used to detect abnormal nodes that may exist in the static vector graph (its example and process are as follows Figure 5 As shown in Figure 2), the reconstruction error obtained by the graph autoencoding is finally used as the outlier value, and the top K nodes are selected from high to low as outlier nodes for detection;

[0128] The above three modules are superimposed on each other to form the anomaly detection process, and the specific steps are as follows:

[0129] S1. Merge the scattered and localized vehicle model data flow graphs, and transfer the data flow signals (such as switch signals, etc.) carried on the edges to the vehicle components, interfaces, and data, so that the entire graph is converted into a static text graph;

[0130] The step S1 specifically includes the following steps:

[0131] S11. In the example of the invention application, the original data is a piece of scattered localized vehicle data flow diagram, and its specific information is contained and covered by a Json file with a specific format. The specific format of the Json file is shown in Figure 8 , open the file under OWASP-Threat-Dragon to see the specific vehicle model data flow diagram (see Fig. 9 ). Therefore, the present invention will traverse all vehicle model data flow Json files, put all automobile components, interfaces, and data names into a set, such as {GW, BCM, TSG, ..., EPS}, and extract the data signal flow relationship between all automobile components, interfaces, and data, such as [{source: BCM, target: GW, text: 1. KL15}, ..., {source: EPS, target: GW, text: 1. Power assist status signal}];

[0132] S12. According to the name set {GW, BCM, TSG,…, EPS} of all automobile components, interfaces, and data and the data signal flow relationship, a dictionary is established to transfer the data signal flow text originally carried on the edge to the automobile components, interfaces, and data uniquely identified by the name. At this time, the text features of all automobile components, interfaces, and data can be expanded by traversing the data signal flow relationship. For example, [{source:BCM,target:GW,text:1.KL15},…,{source:EPS,target:GW,text:1.Power Assist Status Signal}] will expand the text features of automobile components, interfaces, and data into {BCM:[“1.KL15”,…], EPS:[“1.Power Assist Status Signal”,…], GW:[“1.KL15”,“1.Power Assist Status Signal”,…], …}. Such text features represent the ability of the automobile components, interfaces, and data to process the types of information.

[0133] S2. Input the text features of automotive components, interfaces, and data into the Sentence-Bert model and convert them into vector features;

[0134] The step S2 specifically includes the following steps:

[0135] S21. First, merge the feature parts in the text feature dictionary of automobile components, interfaces, and data from the original list containing strings to a long string, thus creating a key-value pair dictionary with the key being the automobile component, interface, and data name and the value being the text string {BCM: , EPS: , GW: ,…};

[0136] S22. Then input these text features into the Sentence-Bert model that has been pre-trained with rich corpus, where the parameters of Bert are fixed and pre-trained. The pooling strategy adopts the average value method. For each word Bert, a corresponding vector will be generated. Finally, the representation vector of the entire text is replaced by the average value of all word vectors, and finally a 768-dimensional vector (Embedding) corresponding to the number of text strings is generated. Then all the text strings in the new dictionary are converted into vectors, and {BCM: , EPS: , GW: ,…};

[0137] S23. Then, combined with the data signal flow relationship between automobile components, interfaces, and data, these data can be converted into corresponding static vector attribute graphs and stored in the graph format data of torch_geometric.data. They can be stored locally as vehicle_data.pt files, which is beneficial for subsequent anomaly detection.

[0138] S3. Read the local vehicle_data.pt file and directly input it into the modified DOMINANT model for anomaly detection;

[0139] The step S3 specifically includes the following steps:

[0140] Finally, see the anomaly detection section Figure 5 , input the read vehicle_data.pt file into the modified DOMINANT model, and obtain the reconstruction errors of various automobile components, interfaces, and data through the graph autoencoder. They are sorted from high to low according to the size of the reconstruction error. Finally, a vector with a length of the set {GW, BCM, TSG...EPS} is returned. If there is an abnormality, the value at the corresponding position is 1, otherwise it is 0. Next, you only need to check these abnormal automobile components, interfaces, and data. There is no need to check all automobile components, interfaces, and data one by one, which saves a lot of time and labor costs. This can not only ensure that the risk anomalies in the graph are found as much as possible, but also save the time of searching for anomalies one by one in the global range, thereby improving the efficiency of risk assessment.

[0141] In order to verify the effectiveness of the present invention, that is, whether it can effectively detect abnormal nodes in the vehicle model data flow diagram, it is necessary to evaluate the node representation module and the abnormality detection module of the present invention. The evaluation is divided into two parts: one is to evaluate the node representation module; the other is to evaluate the abnormality detection module. Therefore, the present invention will set up multiple comparative experiments to verify its effectiveness and advancement.

[0142] Before evaluating the present invention, we first need to briefly introduce the classification of graph anomalies and the evaluation indicators of graph anomaly detection. In node-level graph anomaly detection, according to some common characteristics of anomalies, they can be roughly divided into two categories. The first type of anomaly is attribute anomaly (Contextual Anomaly), which refers to nodes with attribute characteristics that are very different from normal nodes. The second type of anomaly is structural anomaly (Structural Anomaly), which refers to nodes with connection patterns that are very different from normal nodes. The specific situations of attribute anomaly and structural anomaly can be seen in Figure 6 In the selection of evaluation indicators, the AUC (Area Under the ROC Curve) score is an important indicator for measuring the performance of anomaly detection models. The ROC (Receiver Operating Characteristic) curve is a tool for evaluating the performance of binary classifiers. The horizontal axis represents the false positive rate (0 Positive Rate) and the vertical axis represents the true positive rate (1 Positive Rate). The calculation formulas for the two are given by the following formula:

[0143]

[0144] ;

[0145] The AUC score is the area under the ROC curve, which is used to measure the classification performance of the model under different thresholds. In anomaly detection tasks, normal samples are usually regarded as "negative classes" and abnormal samples are regarded as "positive classes". Therefore, the ROC curve describes the ability of the model to identify abnormal samples under different thresholds. The higher the AUC score, the better the performance of the model in identifying abnormal samples, achieving a higher true positive rate while maintaining a lower false positive rate. Because the AUC score has such an excellent comprehensive property for judging the anomaly detection effect, the AUC score is generally selected as an evaluation indicator in graph anomaly detection tasks.

[0146] In order to prove the effectiveness of the model framework adopted by the present invention, the present invention compares the model framework with some traditional graph anomaly detection paradigms. In the node representation module, the processing of text on the text graph in the field of graph anomaly detection is usually to encode the text with a shallow semantic model (such as Bag of words, Skip-Gram, GloVe, etc.). Therefore, in the node representation module of the evaluation phase, in addition to using Sentence-Bert as an encoder, the Word2Vec model will be selected as a comparison, and in the anomaly detection module, some graph autoencoders that have been proven to have good effects in recent years will also be added as comparison objects. In order to avoid the unfair deviation of randomness from the results, the average AUC score obtained after 100 evaluation experiments was taken as an indicator for judging the quality of the model in the test phase. The specific results are shown in Table 1 below, where DOMINANT* represents the graph autoencoder anomaly detection model used by the present invention.

[0147] Table 1 AUC scores (%) under different model architectures

[0148] Skip-Gram Sentence-Bert GCNAE 67.11 69.99 DOMINANT 72.09 79.77 AnomalyDAE 72.26 74.51 GAAN 52.36 54.00 ComGA 72.21 79.96 DOMINANT* 73.37 81.00

[0149] It can be seen that the model framework of the present invention has obtained the highest AUC score, and compared with the text representation under the shallow semantic model Skip-Gram, the AUC scores obtained by the text representation under Sentence-Bert are generally higher, which fully demonstrates the significant impact of the improvement of text representation on the improvement of anomaly detection, and also illustrates the superiority of the node representation module of the present invention. By comparing DOMINANT and DOMINANT* at the same time, it can be seen that the improvement of the loss function also has a certain impact on the improvement of AUC. This also shows that the adaptability of the anomaly detection module of the present invention can bring a certain improvement in the anomaly detection effect for data sets with different characteristics.

[0150] While conducting comparative experiments on the model framework, the attribute anomalies and structural anomalies on the vehicle data flow graph are also evaluated separately during the evaluation phase to test the perception ability of the present invention on attribute anomalies and structural anomalies. By conducting comparative experiments on the vehicle data flow graph by considering only attribute anomalies and only structural anomalies, the specific ROC curve is as follows: Figure 7 It can be seen that when considering structural anomalies alone, the detection AUC score of the present invention for structural anomalies reaches 0.81, and when considering attribute anomalies alone, the detection AUC score for attribute anomalies also reaches 0.81, which fully demonstrates that the present invention has a relatively strong perception of both structural anomalies and attribute anomalies, and can better detect structural anomalies and attribute anomalies.

[0151] The beneficial effects of the present invention are as follows:

[0152] 1) The present invention integrates the localized subgraphs and transfers the data flow information on the edges to the nodes, which can greatly expand the text features on the nodes and explain what kind of information the component node has the ability to process from a global perspective. The abstraction and representation of the node characteristics in a global sense also enables the automotive component to be well expressed by the text on the node. This good expression ability can continue to play a role in subsequent graph anomaly detection and improve the final effect of graph anomaly detection.

[0153] 2) In the anomaly detection of text graphs, an innovative approach is proposed to enhance the anomaly detection effect by improving text representation. Different from the traditional method of using only shallow semantic language models to roughly encode text, this invention uses Sentence-Bert to perform fine-grained modeling of semantics and uses three different tasks to fine-tune the pre-trained model Bert to enhance its semantic representation ability. As the node text representation ability is improved, the anomaly detection ability will also be enhanced, thereby improving the effect of the final model.

[0154] 3) In the anomaly detection module, the loss function of the DOMINANT model is modified by adding a penalty for non-zero elements in the reconstruction loss, so that the modified model can be fine-tuned to adapt to data sets with different characteristics, improving the adaptability of the model to different data sets, so that the processed vehicle data flow graph can be well modeled and anomalies can be detected. Finally, Sentence-Bert is combined with the modified DOMINANT into a new text graph anomaly detection model, which is compared with some traditional mainstream models on the vehicle data flow graph dataset, and the best anomaly detection effect is achieved, which also proves the effectiveness of the present invention.

[0155] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A graph anomaly detection method based on vehicle model data flow graph, characterized in that: The method comprises the following steps: S1. Perform data preprocessing on the vehicle data flow graph, convert the vehicle data flow graph into a text graph format, and generate a text graph of the entire vehicle system; the text graph includes structure information and text attribute information; the text attribute information includes node labels, descriptions, and keywords; The pre-processing comprises: S11, merging all local subgraphs according to the names of the nodes to achieve subgraph aggregation; S12, transferring the text carried on the edge of the graph to N nodes connected to the merging center node; the merging center node is a node with the same name in the local subgraph; S2. Obtain the vector representation of the text on each node according to the preset model, and convert the text graph into a static vector attribute graph; S3. Perform node-level unsupervised anomaly detection on the static attribute graph to obtain inspection results.

2. The graph anomaly detection method based on vehicle model data flow graph according to claim 1 is characterized in that: The preset model is the Sentence-Bert model, which is used as the encoder of the node text.

3. The graph anomaly detection method based on vehicle model data flow graph according to claim 2 is characterized in that: When the fine-tuned Sentence-Bert model is in the encoding phase, the formula is as follows: Embedding=pooling(Bert(Sentence)) Sentence is a sentence taken as input, Embedding is the encoding vector representing the sentence, Bert means encoding each token in the sentence, and pooling means pooling, which aggregates the information represented by all tokens to form a vector representing the semantics of the entire sentence.

4. The graph anomaly detection method based on vehicle model data flow graph according to claim 3 is characterized in that: Fine-tune the Sentence-Bert model during training, including: After inputting sentence pairs A and B into the pre-trained language model BERT, the semantic vectors u and v of A and B are obtained according to a certain pooling strategy, and the absolute values ​​of u, v, and uv are concatenated to obtain the final vector, which is then input into the Softmax layer to classify the relationship between the sentence pairs, and finally optimize the cross entropy loss of classification prediction; fine-tuning is as follows: u=pooling(Bert(SentenceA)); v=pooling(Bert(SentenceB)); Where W is the learnable parameter of the linear transformation layer, o is the actual classification label, is the predicted classification label; for the trained model, only the BERT layer and pooling layer of the model are taken as the text encoder to extract the semantic representation vector of the text.

5. The graph anomaly detection method based on vehicle model data flow graph according to claim 4 is characterized in that: Fine-tuning the Sentence-Bert model includes: After inputting sentence pairs A and B into the pre-trained language model BERT, the semantic vectors u and v of A and B are obtained according to a certain pooling strategy, and the absolute values ​​of u, v, and uv are concatenated to obtain the final vector. The loss function is the mean square error loss of the cosine similarity of the semantic vectors of the two sentences. The fine-tuning is as follows: u=pooling(Bert(SentenceA)); v=pooling(Bert(SentenceB)); loss = MSE(cos(u,v)); The cosine similarity calculation model is: similarity=cos(Embedding_A,Embedding_B).

6. The graph anomaly detection method based on vehicle model data flow graph according to claim 5 is characterized in that: Fine-tuning the Sentence-Bert model includes: Given a benchmark sentence A, find a sentence B with a similar meaning and a sentence C with an opposite meaning. Similarly, the corresponding semantic vectors u, v, and w are obtained by encoding with BERT and the pooling layer, and the loss function is minimized to make sentences A and B as close as possible and A and C as far apart as possible. The fine-tuning is as follows: u=pooling(Bert(SentenceA)); v=pooling(Bert(SentenceB)); w=pooling(Bert(SentenceC)); loss=max(||uv||-||uw||+∈,0); Where ∈ is a hyperparameter that controls the difference in similarity between sentences A, B and sentences A, C.

7. The graph anomaly detection method based on vehicle model data flow graph according to claim 1 is characterized in that: Perform node-level unsupervised anomaly detection on static property graphs, including: S31. Integrate graph structure information into node text representation through graph neural network. S32. Reconstruct the attribute matrix and adjacency matrix of the static attribute graph through the obtained node embedding, and use the reconstruction error of the attribute matrix and the adjacency matrix as the loss to train the graph autoencoder.

8. The graph anomaly detection method based on vehicle model data flow graph according to claim 7 is characterized in that: In S32, it includes: S321, after the graph with semantic vectors of nodes is input into the model, the adjacency matrix A and attribute matrix X of the graph are extracted at the encoder layer, and after passing through several GCN layers, the structural information is also encoded into the node representation vector. The formula of the GCN layer is given by: Where H is the attribute matrix on a hidden layer, W is the trainable weight matrix, l represents the number of layers of the current GCN, and I is an identity matrix; S322, after the node embedding vector is obtained through the GCN layer, the attribute matrix X and the adjacency matrix A are restored by a layer of GCN and a sigmoid function to obtain the reconstructed attribute matrix and adjacency matrix, and the reconstruction loss is calculated. S323, back propagate and update the gradient to continuously minimize the loss and use the final node loss as the abnormal score to sort the abnormal values ​​of the nodes, and take the top n as abnormal nodes. Among them, the sigmoid function is as follows: The penalty coefficient introduced, the loss function after modification and optimization, and the node outlier value are shown in the following formula: θ and represents the penalty coefficient for the reconstruction loss of non-zero elements, where θ and are all greater than 1; a i and and represent A and The row vector corresponding to the i-th node in i and represents X and The row vector corresponding to the i-th node in , and α in both formulas is used to weigh the weights of structural loss and attribute loss.

9. A graph anomaly detection system based on vehicle model data flow graph, characterized in that: The system includes the following steps: A data preprocessing module is used to perform data preprocessing operations on the vehicle model data flow graph, convert the vehicle model data flow graph into a text graph format, and generate a text graph of the entire vehicle system; the text graph includes structure information and text attribute information; the text attribute information includes node labels, descriptions, and keywords; Wherein, the preprocessing includes: Merge all local subgraphs according to the names of the nodes to achieve subgraph aggregation; transfer the text carried on the edges of the graph to N nodes connected to the merging center node; the merging center node is the node with the same name in the local subgraph; A node representation module is used to obtain the vector representation of the text on each node according to a preset model, and convert the text graph into a static vector attribute graph; The anomaly detection module is used to perform node-level unsupervised anomaly detection on the static attribute graph to obtain inspection results.

Citation Information

Patent Citations

  • Methods and systems for monitoring a vehicle for faults

    CN103472814A

  • Processing a data flow graph of a hybrid flow

    CN105683940A

  • Message compression in scalable messaging system

    CN109417503A

  • Address information feature extraction method based on deep neural network model

    CN110377686A

  • Generation method and device for node representation in heterogeneous graph and electronic equipment

    CN111144577A