Bearing fault detection method based on convolution multi-head self-attention mechanism
Technical Field
The invention relates to the field of equipment health management, in particular to a bearing fault diagnosis method.
Background
The bearing is used as the core of the rotating mechanical component and is concerned with the normal operation of the whole mechanical equipment. During the operation of the equipment, the stator, the rotor and other parts of the bearing are easily damaged due to overload, friction, corrosion, gluing and the like. These failures can cause the entire mechanical equipment to fail, affect the performance of the production equipment, and can cause personnel injury. In order to maintain high performance of the machine while avoiding casualties and economic losses due to bearing failure, the best solution is to perform fault detection and health monitoring of the bearings.
With the rapid development of sensor technology, computer technology and information processing technology, the device health management method based on data driving and deep learning is becoming a new research hotspot and development trend. The method comprehensively utilizes sensor data and a machine learning theory, learns the failure characteristics of the machine by establishing deep learning model training data, can effectively solve the problem that diagnosis experts are rare relative to mechanical equipment, and can effectively monitor massive data and quickly predict the occurrence of accidents. The bearing fault can be effectively detected by utilizing the deep learning model.
The patent publication of invention with application number 201910728620.X discloses a rolling bearing obstacle diagnosis based on a self-attention neural network, which learns a vibration signal through a self-attention mechanism; the method attempts to learn bearing fault signatures using a single self-attentive approach, failing to learn rich bearing fault signatures. Meanwhile, a self-attention mechanism is directly used, and local characteristics of the bearing cannot be effectively learned. The method provided by the invention effectively solves the problems, and simultaneously uses the position encoder to provide position information when the multi-head self-attention module learns the bearing characteristics, thereby effectively solving the position information problem in the global characteristic learning.
Disclosure of Invention
Objects of the invention
The invention aims to provide a bearing fault detection method based on convolution multi-head attention. The bearing fault detection method is high in bearing fault detection precision and suitable for practical engineering projects.
(II) technical scheme
The technical scheme of the invention is that a bearing fault detection method based on convolution multi-head attention comprises the following steps: the method comprises the following steps of collecting vibration signals of a fault bearing, preprocessing the vibration signals to generate a bearing fault data set, constructing a convolution multi-head self-attention mechanism network, and further training to obtain a bearing fault detection result.
The method comprises the steps of collecting fault signals of the bearing, collecting different types of fault bearing vibration signal parameter information through a sensor, and recording a bearing fault label.
The bearing signal preprocessing operation is to carry out standard normalization processing on the bearing signal and then cut the bearing signal in equal length, wherein the standard normalization function is as follows:
where x represents the sample signal, μ represents the sample signal mean, and σ represents the sample signal standard deviation.
And generating a bearing fault data set, carrying out equal-quantity random selection on different types of fault bearing signals, and randomly dividing the fault bearing signals into a training set, a verification set and a test set according to the ratio of 7:2: 1.
Constructing a convolution multi-head self-attention mechanism network, wherein the structure sequentially comprises the following steps: convolutional layer → position encoder → multi-headed self-attention module → global averaging pooling layer → fully-connected layer output layer. The convolution layer is a one-dimensional convolution neural network, the number of convolution kernels is set to be 32, the size of the convolution kernels is set to be 8 multiplied by 8, and the step length is set to be 8; the position encoder uses positional encoding:
PE is a two-dimensional matrix, sin variables are added at even positions, cos variables are added at odd positions, the whole PE matrix is filled, the initial characteristics of the bearing signals are extracted by using a convolutional neural network, position coding is completed, and when multi-head self-attention is used, the characteristic position coding is facilitated to learn associated characteristics.
The multi-head self-attention mechanism allows the model to jointly pay attention to information from different representation subspaces at different positions, and the self-attention mechanism is independently used, so that abundant characteristic information cannot be obtained, and the bearing characteristic learning process comprises the following steps:
wherein a is a bearing feature matrix, WqA weight matrix consisting of query vectors q (query), WkA weight matrix consisting of key vectors k (key), WvA weight matrix consisting of a vector of values v (value); using scaled dot productsAs an attention mechanism:
dkis the square root of the key vector dimension, in the self-attention mechanism the output of self-attention is a weighted sum of value vectors v, the weight assigned to each value vector is calculated by the degree of correlation of the query vector q and the current key vector k, the multi-headed self-attention mechanism:
wherein Wi Q,Wi K,Wi VAnd WoAre learnable parameters.
The global average pooling layer can reduce the network parameter quantity and prevent the overfitting phenomenon.
The number of neurons in the fully connected layer equals the total number of bearing fault classes.
Training a convolution multi-head self-attention mechanism network: inputting the bearing training set and the verification set into a convolution multi-head self-attention machine network, setting a learning rate learning _ rate of the network to be 0.0055 by using a cross entropy loss function, training the network by using a gradient descent method, and updating the weight values and the learning rates of the training set and the verification set until the network loss function is converged to obtain the trained convolution multi-head self-attention machine network; classifying fault bearing signals: and inputting the bearing test set into the trained convolution multi-head self-attention mechanism network to obtain a bearing fault detection result, and calculating the precision of the convolution multi-head self-attention mechanism network model for bearing fault detection by comparing the bearing fault detection result with a correct label.
The invention realizes the intelligent detection of automatic extraction of various fault characteristics of the bearing. The invention identifies the accurate identification of various fault characteristics of the bearing.
(III) advantageous effects
The technical scheme of the invention has the following beneficial technical effects: the method is used for identifying vibration signals of various fault bearings, the experimental result is shown in FIG. 4, the identification result reaches 98.8%, and the result proves that the bearing fault detection method based on the convolution multi-head self-attention mechanism is effective.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a graph of loss function during training according to an embodiment of the present invention;
FIG. 3 is a graph of an accuracy function during training according to an embodiment of the present invention;
FIG. 4 is a recognition result confusion diagram according to an embodiment of the present invention;
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings in conjunction with the following detailed description. It should be understood that the description is intended to be exemplary only, and is not intended to limit the scope of the present invention. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present invention.
Embodiment 1 of the present invention, a bearing fault detection method based on convolution multi-head attention, which is shown in fig. 1, is performed according to the following steps:
the method comprises the steps of collecting fault signals of the bearing, collecting 10 different types of fault bearing vibration signal parameter information through a sensor, and recording a bearing fault label.
The bearing signal preprocessing operation is to carry out standard normalization processing on the bearing signal, then cut the bearing signal according to 2048 sampling points in equal length, and the standard normalization function is as follows:
where x represents the sample signal, μ represents the sample signal mean, and σ represents the sample signal standard deviation.
And (3) generating a bearing fault data set, randomly selecting 1000 parts of 10 different types of fault bearing signals, and randomly dividing the signals into a training set, a verification set and a test set according to the ratio of 7:2: 1.
Constructing a convolution multi-head self-attention mechanism network, wherein the structure sequentially comprises the following steps: convolutional layer → position encoder → multi-headed self-attention module → global averaging pooling layer → fully-connected layer output layer. The convolution layer is a one-dimensional convolution neural network, the number of convolution kernels is set to be 32, the size of the convolution kernels is set to be 8 multiplied by 8, and the step length is set to be 8; the position encoder uses positional encoding:
PE is a two-dimensional matrix, sin variables are added at even positions, cos variables are added at odd positions, the whole PE matrix is filled, the initial characteristics of the bearing signals are extracted by using a convolutional neural network, position coding is completed, and when multi-head self-attention is used, the characteristic position coding is facilitated to learn associated characteristics.
The multi-head self-attention mechanism allows the model to jointly pay attention to information from different representation subspaces at different positions, and the self-attention mechanism is independently used, so that abundant characteristic information cannot be obtained, and the bearing characteristic learning process comprises the following steps:
wherein a is a bearing feature matrix, WqA weight matrix consisting of query vectors q (query), WkA weight matrix consisting of key vectors k (key), WvA weight matrix consisting of a vector of values v (value); using the scaled dot product as the attention mechanism:
dkis the square root of the key vector dimension, and in the self-attention mechanism the output from attention is a weighted sum of value vectors v, assigned to each value vectorThe weight of the key vector k is calculated through the correlation degree of the query vector q and the current key vector k, and the multi-head self-attention mechanism is as follows:
wherein Wi Q,Wi K,Wi VAnd WoAre learnable parameters.
The global average pooling layer can reduce the network parameter quantity and prevent the overfitting phenomenon.
The full-connection layer outputs different types of faults respectively in a model training stage, the number of the neurons in the full-connection layer is equal to the number of the bearing fault types, namely the number of the neurons is set to be 10.
Training a convolution multi-head self-attention mechanism network: inputting the bearing training set and the verification set into a convolution multi-head self-attention mechanism network, setting a learning rate learning _ rate of the network to be 0.0055 by using a cross entropy loss function, training the network by using a gradient descent method, and updating the weight values and the learning rates of the training set and the verification set until the network loss function is converged to obtain the trained convolution multi-head self-attention mechanism network. The loss functions of the training set and the validation set during the training process are shown in fig. 2. The accuracy of the training set and the validation set during the training process is shown in fig. 3. Inputting the bearing test set into the trained convolution multi-head self-attention mechanism network to obtain a bearing fault detection result, comparing the bearing fault detection result with a correct label, calculating the bearing fault detection accuracy of the convolution multi-head self-attention mechanism network model, wherein the bearing fault detection accuracy reaches 98.8%, and the identification result confusion graph is shown in fig. 4.
Those skilled in the art will appreciate that the invention may be practiced without these specific details.