Mechanical fault diagnosis method based on KNN weighted directed graph graph attention neural network
By using a graph attention neural network based on a weighted directed graph (KNN) to process bearing vibration signals, the problem of insufficient feature information and correlation capture in existing technologies is solved, and higher fault detection accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202311737903.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-15
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-12-15
AI Technical Summary
Existing technologies struggle to capture sufficient feature information and correlations between time-series data segments in bearing vibration signals, resulting in insufficient accuracy and reliability of fault detection results.
Fault diagnosis is performed using a graph attention neural network (GAT) based on a weighted directed graph of KNN. The bearing vibration signal is processed by constructing a weighted directed graph and a graph attention network (GATconv layer, TopKPooling layer, global average pooling layer and fully connected neural network) to capture the dependencies between nodes and edges.
It improves the accuracy and reliability of fault detection, can more accurately capture the correlation between data, and enhances feature extraction capabilities.
Smart Images

Figure CN117786519B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of fault diagnosis, and particularly relates to a mechanical fault diagnosis method based on a KNN weighted directed graph and a graph attention neural network. BACKGROUND
[0002] Traditional machine learning models, such as multilayer perceptron and support vector machine, usually focus on signal features in time domain, frequency domain and time-frequency domain, and these models are only suitable for scenarios with small sample data and simple patterns. In recent years, deep learning models represented by convolutional neural network, autoencoder and generative adversarial network have been widely applied in the field of fault diagnosis, and feature extraction still focuses on data values, lacking exploration of hidden relationships and structures in data. These traditional neural networks can usually only process Euclidean data such as images, speech and text. As for bearing vibration signals and other time series data images used in fault detection, the data nodes converted therefrom can generally only update the node state independently, so the existing technology is difficult to capture sufficient information in terms of both the relevance between different time series data segments and feature information. SUMMARY
[0003] The application aims to provide a mechanical fault diagnosis method based on a KNN weighted directed graph and a graph attention neural network, so as to solve the problem that the existing technology is difficult to capture sufficient feature information in time series features and the relevance between time series data segments, resulting in that only data values can be focused on when processing bearing vibration signals, and thus the accuracy and reliability of detection results are insufficient.
[0004] The mechanical fault diagnosis method based on the KNN weighted directed graph and the graph attention neural network comprises the following steps.
[0005] Step 1: collecting time series data of bearing vibration to form a data set, and then constructing a KNN-based weighted directed graph, the method for constructing the weighted directed graph comprising data segmentation, random grouping, establishment of a weighted directed graph and FFT transformation.
[0006] Step 2: inputting the weighted directed graph into a trained network model structure for fault detection, the network model structure of the method belonging to a graph attention network GAT, comprising two GATconv layers, two TopKPooling layers, two global average pooling layers and a fully connected neural network.
[0007] Preferably, the step 1 comprises the following steps.
[0008] S1.1, data segmentation: dividing each time series data in the data set into N nodes with a length of L, and the feature sequence of each node is the corresponding time series data with a length of L.
[0009] S1.2, random grouping: the N nodes are randomly shuffled and divided into several integral groups according to m nodes per group.
[0010] S1.3, establishing a weighted directed graph based on KNN: using KNN algorithm to calculate the K nearest nodes of each node for each divided group of data.
[0011] S1.4, FFT transformation: performing FFT transformation on the time series data corresponding to each node with a length of L to obtain the corresponding spectral features.
[0012] Preferably, in step S1.3, after dividing the m nodes into a group, the corresponding KNN parameter K is set to determine the K nearest nodes corresponding to each node, and each node has an edge pointing to the nearest node. The weight calculation formula of each edge is:
[0013]
[0014] where d i represents the distance from the current node to the i-th node in the K nearest nodes, and w i represents the weight of the corresponding edge. Since there are multiple groups of data, the resulting weighted directed graph is a graph consisting of several groups.
[0015] Preferably, in step 2, the graph data of the weighted directed graph is input and processed through the GATconv layer, and then the TopKPooling layer is used to downsample the nodes to obtain the processed new graph data. The new graph data is processed in two different ways. One is to sequentially process the new graph data through the GATconv layer, the TopKPooling layer, and then the global average pooling to obtain the result Figure One ; and the other is to directly perform global average pooling on the new graph data to obtain the result Figure Two ; the results Figure One and the results Figure Two are added to construct a new feature map, and the new feature map is a group of feature maps corresponding to the input weighted directed graph. Finally, the feature maps in the new feature map are added and flattened, and a fully connected neural network is used for classification to output the fault label.
[0016] Preferably, in the network model structure of step 2, the GATconv layer adopts the GAT mechanism, that is, a self-attention mechanism is introduced into the GCN. When updating the feature vector of a node, the GATconv layer first calculates the attention coefficients of all neighbors, then multiplies the attention coefficients by the features of the corresponding neighbors, and then sums them to obtain the updated node features.
[0017] Preferably, when the GATconv layer updates the feature vector of a node, the specific calculation process is as follows: the input of the GATconv layer is a set of node features The output is The attention coefficient between nodes is calculated as follows:
[0018]
[0019] Wherein, a ij represents the attention coefficient between i node and j node; W is a trainable weight parameter, which represents applying a shared linear transformation parameterized by a weight matrix to each node; represents the weight vector related to the attention mechanism , and the transpose of is a trainable weight parameter; represents the splicing of the features of i node and j node after weight conversion, represents the splicing of the features of i node and k node after weight conversion; m i represents the set of nodes connected to i node, and LeakyRelU() represents processing through the activation function LeakyRelU.
[0020] Preferably, for the output h' aggregated at the end, the element is calculated as follows:
[0021]
[0022] Wherein, σ represents the activation function Sigmoid, a ij represents the attention coefficient between i node and j node; W is a trainable weight parameter, which represents applying a shared linear transformation parameterized by a weight matrix to each node, represents the jth element in the input h of the GATconv layer.
[0023] The present application has the following advantages: the present application adopts a graph neural network, which is a deep learning technology for processing graph data, and can process non-Euclidean data by capturing the dependency between nodes and edges. The present application also introduces an attention mechanism on the basis of the graph neural network, that is, uses a graph attention network (GAT) to process input data, so that the present application can fully consider the relationship between data and can more accurately capture the relevance between data when processing graph structure data. The present application applies the graph attention network to bearing fault diagnosis, compared with the traditional deep neural network, this structure can more accurately capture the relevance of data inside, can capture more information, greatly improve the accuracy and reliability of the detection result.
[0024] Meanwhile, in the GAT provided by the application, the state update of each node considers the state of the neighbor nodes, the GAT calculates the attention weight between a node and its neighbor nodes, and then updates the state of the node according to the weight, so that more information can be captured. Compared with other methods, the graph structure established by the method contains the direction information and weight information of the state transition between nodes, and contains more features. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 The figure is a flowchart of step 1 in the KNN weighted directed graph-based graph attention neural network mechanical fault diagnosis method of the application.
[0026] Figure 2 The figure is a flowchart of step 2 in the application.
[0027] Figure 3 The figure is a schematic diagram of the principle of calculating the updated node features in the application.
[0028] Figure 4 The figure is a comparison chart of detection accuracy rates obtained by verifying the detection effect of the application. DETAILED DESCRIPTION
[0029] The specific embodiments of the application will be further described in detail below with reference to the drawings, and by describing the embodiments, to help the skilled in the art to have a more complete, accurate and in-depth understanding of the inventive concept and technical solutions of the application.
[0030] As shown in Figures 1-3 The application provides a KNN weighted directed graph-based graph attention neural network mechanical fault diagnosis method, which comprises the following steps.
[0031] Step 1: collecting time series data of bearing vibration to form a data set, and then constructing a KNN-based weighted directed graph, the method for constructing the weighted directed graph comprising data segmentation, random grouping, establishing a weighted directed graph and FFT transformation.
[0032] The step specifically comprises the following sub-steps.
[0033] S1.1, data segmentation: segmenting each time series data in the data set into N nodes with a length of L, and the feature sequence of each node is the corresponding time series data with a length of L.
[0034] S1.2, random grouping: randomly shuffling the N nodes, and dividing them into several integral groups according to m nodes per group.
[0035] S1.3, establishing a weighted directed graph based on KNN: using KNN algorithm to calculate the nearest K nodes of each node in each divided group.
[0036] For example, 5 nodes are divided into a group, that is, m = 5; then set the KNN parameter, for example, K = 3, which means that the nearest 3 nodes of the 1st node are 2, 3 and 5, then the 1st node has edges pointing to the 2nd, 3rd and 5th nodes, and the weight calculation formula of each edge is:
[0037]
[0038] where d i represents the distance from the current node to the i-th node in the nearest K nodes, and w i represents the weight of the corresponding edge. Since the data has multiple groups, the resulting weighted directed graph is a graph consisting of several groups.
[0039] S1.4, FFT transformation: the time series data corresponding to each node with a length of L is subjected to FFT transformation (i.e. Fourier transformation) to obtain the corresponding spectral features.
[0040] Step 2: input the weighted directed graph into the trained network model structure for fault detection. The network model structure of this method belongs to the graph attention network GAT, which includes two GATconv layers, two TopKPooling layers, two global average pooling layers and one fully connected neural network.
[0041] The time series data of bearing vibration is converted into a weighted directed graph based on KNN in the previous step, and in the model structure constructed in this step, the model structure belongs to the graph attention network GAT, the graph data of the weighted directed graph is input, processed through the GATconv layer, and then down-sampled through the TopKPooling layer to obtain the processed new graph data, which is processed in two different ways, one is to sequentially process the new graph data through the GATconv layer, TopKPooling layer, and then through the global average pooling to obtain the result Figure One ; and the other is to directly perform global average pooling on the new graph data to obtain the result Figure Two . The results Figure One and the results Figure Two are added through eigenvalues to construct a new feature map, which is a graph group of a feature map corresponding to the input weighted directed graph, and finally the feature maps in the new feature map are added and flattened, classified through the fully connected neural network, and the fault label is output.
[0042] The GATconv layer adopts a GAT mechanism, that is, a self-attention mechanism is introduced in the GCN to enhance the feature extraction capability. When updating the feature vector of a node, the GATconv layer first calculates the attention coefficient of all neighbors, then multiplies the attention coefficient by the feature of the corresponding neighbor, and then sums to obtain the updated node feature. The specific calculation process is as follows: the input of the GATconv layer is a set of node features The output is The attention coefficient between nodes is calculated as follows:
[0043]
[0044] Where a ij represents the attention coefficient between the i node and the j node; W is a trainable weight parameter, which represents applying a shared linear transformation parameterized by a weight matrix to each node; represents the weight vector related to the attention mechanism is a trainable weight parameter; represents the concatenation of the features of the i node and the j node after weight conversion, represents the concatenation of the features of the i node and the k node after weight conversion; m i represents the set of nodes connected to the i node, and LeakyRelU() represents processing through the activation function LeakyRelU.
[0045] For the finally aggregated output h', the element is calculated as follows:
[0046]
[0047] σ represents the activation function Sigmoid, a ij represents the attention coefficient between the i node and the j node, W is a trainable weight parameter, which represents applying a shared linear transformation parameterized by a weight matrix to each node, represents the jth element in the input h of the GATconv layer.
[0048] To verify the detection effect of the method, the following experiments are performed. An experimental device including a driving motor, a gear box, a brake, a water pump and a plurality of rotating shafts is set up on the experimental platform, and an acceleration sensor is deployed at the bearing of the rotating shaft. There are six acceleration sensors in total, which are used to collect vibration data. The experimental data includes 12 groups of data of the above-mentioned 6 measuring points, which are marked with 12 labels 0-11 in turn, wherein the data of labels 0-5 are fault data of the 6 measuring points, and the data of labels 6-11 are normal data of the 6 measuring points. For each group of data, 80% is used for training and 20% is used for testing.
[0049] The model provided by the present application and other models for comparison are trained by using training samples, and the models for comparison include a one-dimensional convolutional neural network (1D-CNN), a two-dimensional convolutional neural network (2D-CNN), a convolutional neural network based on continuous wavelet transform (CWT-CNN), a convolutional neural network and long short-term memory network model (CNN-LSTM), a convolutional neural network based on Fourier transform (FTT-CNN), and a long short-term memory network (LSTM). After training, test samples are input into different models to obtain detection results, and the accuracy is calculated and compared. As shown in Table 1, it can be seen that the present method has obvious improvement in accuracy compared with the prior art. Figure 4
[0050] The present application has been described above in conjunction with the drawings, and it is obvious that the specific implementation of the present application is not limited by the above method, and various non-essential improvements or direct application of the inventive concept and technical solution of the present application to other occasions without improvement are within the protection scope of the present application.
Claims
1. A method for mechanical fault diagnosis based on a KNN weighted directed graph graph attention neural network, characterized in that: Comprising the following steps: Step 1: collect time series data of bearing vibration to form a data set, and then construct a weighted directed graph based on KNN, the method for constructing the weighted directed graph comprising data segmentation, random grouping, FFT transformation and KNN-based weighted directed graph construction; Step 2: input the weighted directed graph into the trained network model structure for fault detection, the network model structure of the method belonging to a graph attention network (GAT) comprising two GATconv layers, two TopKPooling layers, two global average pooling layers and a fully connected neural network; The step 1 comprises the following steps: S1.1, data segmentation: segment each time series data in the data set into N nodes with a length of L, and the feature sequence of each node is the corresponding time series data with a length of L; S1.2, random grouping: randomly shuffle the N nodes and divide them into several integral groups according to m nodes per group; S1.3, FFT transformation: perform FFT transformation on the time series data with a length of L corresponding to each node to obtain the corresponding frequency spectrum features; S1.4, KNN-based weighted directed graph construction: use KNN algorithm to calculate the K nearest nodes of each node for each group of data; In the step 2, the graph data of the weighted directed graph is input, processed by the GATconv layer, and then down-sampled by the TopKPooling layer to obtain the processed new graph data, which is processed in two different ways, one is to sequentially process the new graph data by the GATconv layer, the TopKPooling layer, and then by the global average pooling to obtain a result graph one, and the other is to directly perform global average pooling on the new graph data to obtain a result graph two; the result graph one and the result graph two are added by the characteristic value to construct a new feature graph, the new feature graph is a graph group of one feature graph corresponding to the input weighted directed graph, finally the new feature graph is added and flattened, and classified by the fully connected neural network to output the fault label.
2. The KNN-based weighted directed graph-based graph attention neural network mechanical fault diagnosis method according to claim 1, characterized in that: In the step S1.4, after dividing the m nodes into a group, the corresponding KNN parameter K is set to determine the K nearest nodes corresponding to each node, so that each node has an edge pointing to the nearest node, and the weight calculation formula of each edge is: , wherein, d i denotes the distance from the current node to the i-th node in the K nearest nodes, and w i denotes the weight of the corresponding edge; since the data has multiple groups, the resulting weighted directed graph is a graph consisting of several groups.
3. The KNN-based weighted directed graph-based graph attention neural network mechanical fault diagnosis method according to claim 2, characterized in that: In the network model structure of the step 2, the GATconv layer adopts the GAT mechanism, that is, the self-attention mechanism is introduced into the GCN, when updating the feature vector of the node, the GATconv layer first calculates the attention coefficient of all neighbors, then multiplies the attention coefficient with the corresponding neighbor feature, and then sums to obtain the updated node feature.
4. The KNN-based weighted directed graph-based graph attention neural network mechanical fault diagnosis method according to claim 3, characterized in that: When the GATconv layer updates the feature vector of a node, the specific calculation process is as follows: the input of the GATconv layer is a set of node features , and the output is , and the attention coefficient between nodes is calculated as follows: wherein, a ij denotes the attention coefficient between i-th node and j-th node; W are trainable weight parameters, denoting applying a shared linear transformation parameterized by weight matrix to each node; denotes the weight vector related to the attention mechanism is the transpose of, are trainable weight parameters; denotes the concatenation of the features of i-th node and j-th node after weight transformation, denotes the concatenation of the features of i-th node and k-th node after weight transformation; m i denotes the set of nodes connected to i-th node, LeakyRelU denotes the processing by activation function LeakyRelU .
5. The KNN weighted directed graph-based graph attention neural network mechanical fault diagnosis method according to claim 4, characterized in that: For the last aggregated output The elements therein Is calculated as follows: wherein, σ denotes the activation function Sigmoid, a ij denotes the attention coefficient between i and j nodes, W are trainable weight parameters, denoting the application of a shared linear transformation parameterized by weight matrices to each node, denotes the jth element in the input h of the GATconv layer.
Citation Information
Patent Citations
Rolling bearing fault diagnosis method based on WOA-VMD and GAT
CN116662848A
Gearbox fault diagnosis method based on semi-supervised dynamic graph attention
CN116894215A