Small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning

By using WGAN-GP-C and metric learning methods in mechanical pump fault diagnosis, the problem of scarce mechanical pump fault data is solved, and high-accurate fault diagnosis is achieved, and the performance and adaptability of the model are improved.

CN114037001BActive Publication Date: 2025-04-29CHINESE PEOPLES LIBERATION ARMY UNIT 92578
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111183493.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-11
Publication Date
2025-04-29
Estimated Expiration
2041-10-11

AI Technical Summary

Technical Problem

The data on mechanical pump failures are scarce, making it difficult for the existing technology to effectively diagnose small samples, resulting in low diagnostic accuracy, missed false alarms and other problems.

Method used

The mechanical pump small sample fault diagnosis method based on WGAN-GP-C and metric learning is adopted to achieve accurate diagnosis of mechanical pump faults through data preprocessing, data enhancement, and model optimization.

Benefits of technology

In the context of small samples, the accuracy of fault diagnosis is improved, the occurrence of false positives and missed reports is reduced, and the performance and adaptability of the model is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114037001B_ABST
    Figure CN114037001B_ABST
Patent Text Reader

Abstract

The present invention discloses a small sample fault diagnosis method for mechanical pumps based on WGAN‑GP‑C and metric learning. The method is designed based on one-dimensional convolution and time series data, and consists of four parts: data preprocessing, data enhancement, metric learning, and model optimization. Among them, data preprocessing realizes data adaptive denoising and standardization; in the data enhancement part, WGAN‑GP‑C is obtained by modifying the network and structure based on WGAN‑GP to expand data by category, thereby strengthening the edge boundary information of the data; the metric network combines the residual idea and the spatial adaptive structure to realize feature mapping, and then combines the KNN algorithm to realize state classification; in the model optimization part, the present invention uses the weight quantization idea to optimize the network, uses Ball‑tree to realize KNN and deletes the training data according to important factors, thereby improving the algorithm performance as a whole. The present invention has good performance in the case of scarce data, high practical value, and can provide ideas for relevant staff who repair mechanical pumps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a mechanical pump fault diagnosis method, and in particular to a mechanical pump small sample fault diagnosis method based on WGAN-GP-C and metric learning. Background Art

[0002] With the development of science and technology, the structure of ship equipment is becoming more and more complex, the functions are becoming more and more perfect, the degree of automation is becoming higher and higher, and the complexity of mechanical equipment is also increasing exponentially. Therefore, when a component of a mechanical equipment fails, it may cause the entire system to fail. This failure may not only cause serious economic losses, but also cause casualties. Therefore, it is urgent to develop and improve intelligent diagnosis technology that can effectively diagnose mechanical equipment failures.

[0003] Intelligent diagnosis technology combines fault diagnosis technology with network transmission technology. By using computer software, the diagnosis process is made intelligent, which not only lowers the threshold of fault diagnosis and facilitates use, but also improves the reliability of diagnosis results. It has gradually received more and more attention and has become a hot spot in current research and application.

[0004] With the emergence of detection technologies such as fuzzy set theory, expert systems, neural networks, and wavelet analysis, intelligent fault diagnosis technology has developed into a comprehensive technology with multidisciplinary coupling. Understanding and rationally adopting these technologies will exponentially improve the efficiency of ship equipment and meet the full life, full system, and full cost management of ship equipment, which is of great significance for ensuring the reliability and safety of ship systems.

[0005] Nowadays, intelligent fault diagnosis systems for mechanical pumps generally use data-driven models. Most of these models use machine learning algorithms such as gradient boosting trees, support vector machines, and logistic regression to input the extracted fault features into the algorithm model and adjust the model parameters. After multiple iterative training, the diagnostic model is obtained.

[0006] In recent years, the development of deep learning and neural networks has introduced new ideas for fault diagnosis. They have strong expressive power, overcome the shortcomings of traditional machine learning algorithms, and have the potential to identify minor faults. Their application in fault diagnosis has received widespread attention from scholars in the industry. These diagnostic models usually have good results in specific scenarios, but the establishment of most models requires a lot of data. The scale of data has a huge impact on some of the models, especially based on deep learning and neural networks and model structures. The impact of the amount of data is particularly obvious. However, in reality, the fault data of mechanical equipment such as mechanical pumps is very scarce and may be partially missing, which makes it difficult to support the effective training of a set of ordinary algorithms. The small sample data increases the difficulty of data analysis, making it difficult for the algorithm to obtain ideal results, so that fault diagnosis faces problems such as low accuracy, missed reports and false alarms.

[0007] The design of mechanical fault diagnosis algorithms for small sample backgrounds is a hot research topic today. Many strategies have emerged in recent years, but most of them still have problems such as single adaptation scenarios and defects in algorithm performance, which is why continued research is meaningful. Summary of the invention

[0008] In order to solve the shortcomings of the prior art, the purpose of the present invention is to provide a small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning. In the context of small samples with scarce fault data of ship mechanical pumps, a small sample fault diagnosis algorithm based on WGAN-GP-C and metric learning is designed based on one-dimensional convolution and time series data, and the fault data of typical mechanical pumps are used to verify and implement the algorithm.

[0009] To achieve the purpose of the present invention, the technical solution adopted by the present invention is:

[0010] A small sample fault diagnosis method for a mechanical pump based on WGAN-GP-C and metric learning, the method comprising the steps of:

[0011] (1) Read time series data and perform data preprocessing;

[0012] (2) Construct the WGAN-GP-C model and perform data augmentation based on the WGAN-GP-C model;

[0013] (3) Construct a fault diagnosis model based on metric learning and KNN classification algorithm;

[0014] (4) Optimize the model;

[0015] (5) Use the optimized model to perform fault diagnosis on the preprocessed and data-enhanced data.

[0016] Furthermore, the step (1) specifically includes:

[0017] (1.1) Read the time series data and cut it according to the set length, and filter it using the normalized least mean square adaptive filter NLMS;

[0018] (1.2) Use median filtering to remove outliers;

[0019] (1.3) The mean and variance of each dimension of the statistical data are normalized using the Z-score method. Further, the NLMS filtering algorithm is as follows:

[0020] y(k)=w T (k)x(k)

[0021] e(k)=d(k)-y(k)

[0022]

[0023] Where x(k) is the input signal, y(k) is the output signal, d(k) is the reference signal, w(k) is the filter coefficient, α is the adjustment factor to prevent the denominator from being zero, and |x(k)| 2 is the square of the Euclidean norm of x(k), is the step size parameter.

[0024] Furthermore, the step (2) specifically includes:

[0025] (2.1) The WGAN-GP-C model is constructed based on the WGAN-GP and residual structure. When the generator inputs random noise, a label is added for category guidance. The discriminator outputs the data to identify the category to which it belongs, thus generating data by category.

[0026] (2.2) Train the WGAN-GP-C model, feed the generated samples and real samples into the discriminator together, first train the data distribution to make the generated samples closer to the real samples, and then train the classification while improving the distribution;

[0027] (2.3) When generating samples using the trained WGAN-GP-C, filter the generated sample data;

[0028] (2.4) The quality of the generated sample data is evaluated using the maximum mean difference (MMD) and the model is adjusted accordingly.

[0029] Furthermore, the loss function of the generator G, the loss function of the discriminator D, and the loss function of the data category are as follows:

[0030]

[0031]

[0032]

[0033] in, represents the mathematical expectation of f(x) for x under distribution P, x r is a real sample, x f is the generated sample, P r represents the real data distribution, P f represents the generated data distribution, and Respectively represent x r and x f Category, express The data distribution, Indicates that in the distribution P r and distribution P f The data points on the line of express data distribution, L2 represents the L2 regularization penalty, λ1, λ2, λ3, λ4, and λ5 are hyperparameters that control different parts of the loss function, n represents the number of samples, i.e., the dimension of y, i 、class i Represents the network output and true category of the i-th sample.

[0034] Furthermore, the data screening step includes: passing the generated samples through the discriminator to perform category judgment, retaining the generated samples whose input labels are the same as the discriminator output categories; for each retained sample, choosing whether to retain the sample with a certain probability a, and this probability a is taken as the accuracy a of the discriminator on the real data test set.

[0035] Furthermore, the step (3) specifically includes:

[0036] (3.1) Construct a metric network model, including a convolutional neural network Vector-CNN and a spatial adaptive structure. The sample data is converted into a vector through the convolutional neural network. The spatial position matrix is ​​constructed in the spatial adaptive structure. Then, different weights are assigned to the spatial positions according to the vector features to realize spatial metric mapping.

[0037] (3.2) Construct a triplet dataset and use the Adam optimizer to train the metric network model;

[0038] (3.3) Build a classification algorithm model, use the KNN algorithm to find the optimal k value and the corresponding accuracy, and test the trained metric network model.

[0039] Furthermore, the spatial adaptive structure loss function is as follows:

[0040] l triplet (x a,x p ,x n )=max{0,d(E a ,E p )-d(E a ,E n )+μ

[0041] loss = l triplet (x a ,x p ,x n )+λl E

[0042] Among them, d(E a ,E p ) means E a and E p Euclidean distance, μ is a hyperparameter, and λ is a hyperparameter that controls the degree of penalty; x a Represents anchor, x p and x n Represent positive samples and negative samples respectively, E a 、E p and E n Represents the output of the metric network mapping of the three; l E Indicates L2 regularization processing.

[0043] Furthermore, the step (4) specifically includes:

[0044] (4.1) Quantize the metric network; specifically, quantize the convolutional neural network Vector-CNN and fuse the adjacent modules of the network; specifically, use symmetric quantization for the convolution weight, do not quantize the bias, and use asymmetric quantization for the activation layer;

[0045] (4.2) Use the ball-tree structure to accelerate the KNN algorithm;

[0046] (4.3) Screen the training set data, propose the important factors IF of the training set data, and sort all samples from small to large according to the important factors; and remove some samples with smaller IF while ensuring the accuracy of the algorithm.

[0047] Furthermore, the important factors of a sample are defined as the sum of the reciprocal squares of its Euclidean distances with samples of the same type, plus the sum of the squares of its Euclidean distances with samples of different types after resizing. Considering the differences in the size distribution of important factors of samples of different types, operations are performed separately according to data categories when sorting and implementing data deletion.

[0048]

[0049]

[0050]

[0051] Among them, x in Represents the nth sample of the i-th class of training samples, N i represents the number of samples of the i-th category, C represents the number of sample categories, d(x in ,x im ) represents x in and x im The Euclidean distance of Representing a collection The maximum value of Representing a collection The minimum value of and The collections are and collection Delete the set of larger and smaller values ​​in a certain proportion. mean() represents the average value of all values ​​in the set, and inf represents the minimum value that prevents the denominator from being zero.

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

[0053] (1) The present invention adopts the NLMS+median filtering scheme for rare fault data to obtain better filtering performance under a smaller time disadvantage; the filtering is combined with data standardization to form the data preprocessing part, which has a significant effect on improving the model performance;

[0054] (2) Data enhancement is the first step to address the current situation of small samples. WGAN-GP-C is modified based on WGAN-GP to generate data by category. It is combined with parameter adjustment and effective data screening strategies to achieve data enhancement and strengthen data edge information.

[0055] (3) In the model optimization part, quantization processing was performed on Vector-CNN to reduce the model size by about 4 times while ensuring the operation speed and classification performance; the conventional implementation of KNN was replaced with Ball-tree, which effectively improved the search speed; the definition of important factors was proposed, and the important factors based on the properties of the training set were used as reference to remove data in the implementation, which further optimized the ball-tree construction time and search time;

[0056] (4) This method has a good fault identification accuracy rate in complex scenarios such as high noise interference and insufficient sample quantity. It is scientific and reasonable, has strong adaptability, and high practical value. It can provide a reference for relevant personnel in mechanical pump research and development, large-scale machinery operation and maintenance, and research. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 The overall block diagram of the small sample fault diagnosis method for mechanical pumps based on WGAN-GP and metric learning;

[0058] Figure 2 Design diagram for WGAN-GP-C network;

[0059] Figure 3 Design diagram for metric-net structure;

[0060] Figure 4 Schematic diagram of KNN classifier;

[0061] Figure 5 Schematic diagram of the changes in the relevant losses during WGAN-GP-C model training; a is the generator loss, and b is the discriminator loss;

[0062] Figure 6 Schematic diagram of the loss change during metric-net training; a is the loss change, b is l E change;

[0063] Figure 7 This is a two-dimensional visualization diagram of the vector library after quantization;

[0064] Figure 8 Schematic diagram of the change in accuracy during data screening; a is the change in optimal accuracy, b is the change in search time, c is the change in time for establishing the tree structure, and d is the change in accuracy. DETAILED DESCRIPTION

[0065] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of this application.

[0066] like Figure 1 As shown, the small sample fault diagnosis method of mechanical pump based on WGAN-GP-C and metric learning described in the present invention consists of four parts: data preprocessing, data enhancement based on WGAN-GP-C, classification algorithm based on metric learning and KNN, and model optimization, which can realize accurate diagnosis of mechanical pump faults with small sample background.

[0067] The small sample fault diagnosis method of mechanical pump based on WGAN-GP-C and metric learning described in the present invention has the following specific steps:

[0068] (1) Data preprocessing design;

[0069] The original data were read and cut into 2015 lengths, and the data were filtered using a normalized least mean square adaptive filter (NLMS) with a filter order of 16 and a step factor of 0.05, and outliers were removed using a median filter with a kernel of 5. The mean and variance of each dimension of the data were calculated, and the Z-score method was used for data standardization.

[0070] (2) Data augmentation design based on WGAN-GP-C;

[0071] The WGAN-GP-C model was designed based on the WGAN-GP and residual structure ideas. Category guidance information was added when the generator input random noise, and the discriminator output introduced the part that discriminated the data category. In the WGAN-GP-C training, the first 50,000 epochs only trained the data distribution, and then trained the data distribution and data classification at the same time to generate data by category. The quality of data generation was evaluated using the Maximum Mean Discrepancy (MMD) and the network was adjusted accordingly. The data enhancement process followed the data screening strategy.

[0072] (3) Classification algorithm design based on metric learning and KNN;

[0073] Build a metric network model based on the residual idea and propose a spatial adaptive structure, so that the sample can find a more suitable spatial position according to its own properties when performing spatial mapping. The output dimension of the data mapping is 32. Construct a triplet data set. Use a learning rate of lr = 5×10 -5 The Adam optimizer is used to train the network model. When building the classification algorithm model, the KNN algorithm is used to traverse the parameter k in the range of [1,100], and then the performance of the KNN algorithm is tested on the test set to find the optimal k value and the corresponding accuracy.

[0074] (4) Build the model and optimize it;

[0075] Quantize the metric network. Use symmetric quantization for the convolution weight, no quantization for the bias, and asymmetric quantization for the activation layer. Implement 32-bit to 8-bit operations. Use a tree structure to implement KNN. Compare the search time of linear scan, Kd-tree, and Ball-tree, and choose Ball-tree to implement the KNN algorithm. Screen the training set data, propose the concept of important factors (IF) of training data, sort all samples from small to large according to the important factors, and remove some samples with smaller IFs while ensuring the accuracy of the algorithm, so as to achieve data screening, optimize the speed of Ball-tree construction, and improve the search speed.

[0076] (5) Build and optimize the model to perform fault diagnosis on the preprocessed data.

[0077] In the step (1),

[0078] (1.1) NLMS in data preprocessing is improved from the least mean square adaptive filter (LMS). It has been widely used in signal processing, channel equalization and other fields. It obtains the optimal solution based on stochastic gradient descent. The algorithm operation process includes filter output calculation (Formula 1), error signal calculation (Formula 2), and weight coefficient update (Formula 3).

[0079] y(k)=w T (k)x(k) (1)

[0080] e(k)=d(k)-y(k) (2)

[0081] w(k+1)=w(k)+μe(k)x(k) (3)

[0082] Among them, x(k) is the input signal, y(k) is the output signal, d(k) is the reference signal (x(k) will be used as the reference in actual use), w(k) is the coefficient of the adaptive filter, and μ is the step size parameter.

[0083] When the signal is unstable or complex, LMS often has problems of unstable convergence or even difficulty in convergence due to the fixed convergence step size. The Normalized Least Mean Square (NLMS) adaptive filter uses the input signal to normalize the fixed step size parameter, thereby continuously changing the step size parameter. Therefore, the NLMS algorithm has higher adaptability and convergence stability than LMS.

[0084] When NLMS is operating, its filter coefficients are updated as shown in Formula 4.

[0085]

[0086] where α is a scaling factor to prevent the denominator from being zero, |x(k)| 2 is the square of the Euclidean norm of x(k), is the step size parameter.

[0087] (1.2) Median filtering replaces the value of a point in a digital sequence with the median of all points in a neighborhood of that point, thereby eliminating isolated noise points and effectively suppressing outliers.

[0088] (1.3) Data standardization is to ensure that the network treats all dimensions of the data equally so as to achieve a good convergence effect. The present invention uses the Z-score standardization method, which is calculated as follows.

[0089]

[0090] Among them, x ik is the parameter of the i-th row and k-th column of the data set, std k is the mean and standard deviation of the parameters in the kth column.

[0091] In the step (2),

[0092] (2.1) Data enhancement based on WGAN-GP-C is the first step of the present invention for mechanical pump fault diagnosis. WGAN-GP-C is obtained by modifying the structure of WGAN-GP to realize data generation by category.

[0093] The Wasserstein Generative Adversarial Networks (WGAN) solves the problem of the difficulty in training the native Generative Adversarial Network (GAN), but the gradient clipping (weight clipping) of WGAN still easily leads to gradient vanishing or gradient explosion. To solve this problem, the training technique of gradient penalty was introduced into WGAN, namely WGAN-GP.

[0094] like Figure 2 As shown, an important premise of data generation in the present invention is to generate data according to data categories. Therefore, category guidance information needs to be added when designing the network structure based on WGAN-GP, which is called WGAN-GP-C (WGAN-GP with category).

[0095] The present invention is designed to add labels to the random noise data input by the generator for category guidance, wherein the labels are represented by trainable word embeddings of the same latitude as the random noise, and the generated samples are sent to the discriminator together with the real samples, and the discriminator outputs the Wasserstein distance (EM distance, Earth Mover's Distance, EMD) between the generated samples and the real samples and the category to which the samples belong. When constructing the generator and discriminator of WGAN-GP-C, the residual idea is used for design based on 1DCNN. It is worth noting that in the construction of the discriminator, when the residual structure is used, Batch Normalization is not added. According to the structural design of the present invention, the loss function of the generator G(x) can be obtained as shown in Formula 6, and the loss function of the discriminator D(x) can be obtained as shown in Formula 7. Among them, the cross entropy function is used to calculate the loss of the data category, as shown in Formula 8.

[0096]

[0097]

[0098]

[0099] in, represents the mathematical expectation of f(x) for x under distribution P, x r is a real sample, x f is the generated sample, P r represents the real data distribution, P f represents the generated data distribution, and Respectively represent x r and x f Category, express The data distribution, Indicates that in the distribution P r and distribution P f The data points on the line of express data distribution, L2 represents the L2 regularization penalty, λ1, λ2, λ3, λ4, and λ5 are hyperparameters that control different parts of the loss function, n represents the number of samples, i.e., the dimension of y, i 、class i Represents the network output and true category of the i-th sample.

[0100] The training method of WGAN-GP-C is to better meet the needs of generating data by category in the present invention. First, the data distribution is trained to make the generated data close to the real data, and then the classification is trained while improving the distribution to find the boundary information of the generated data. That is, the parameters of formulas 6 and 7 are set. In the first 50,000 epochs, λ2=10, λ1=λ3=λ4=λ5=0 are set, and data training is imported. In the training after 50,000 epochs, λ1=1, λ2=10, λ3=0, λ4=10, and λ5=0.004 are set, and training continues.

[0101] When using the trained WGAN-GP-C to generate samples, the design is to screen the generated sample data. In this process, the present invention believes that the discriminator has better performance, so the data screening process is associated with the discriminator. The steps of data screening are: (1) The generated samples are judged by the discriminator, and the generated samples with the same input label and discriminator output category are retained. (2) For each sample retained in (1), choose whether to retain the sample with a certain probability a. This probability a is the accuracy a of the discriminator on the real data test set.

[0102] (2.2) The quality of the generated samples is evaluated using the MMD (Maximum Mean Discrepancy, MMD) method. MMD measures the distance between the distribution of the training data set and the generated data set in Hilbert space. The smaller the value, the closer the distribution of the two sets of data is.

[0103] In the step (3),

[0104] (3.1) The metric network model designed based on metric learning and KNN classification algorithm is the second step of the present invention for the small sample problem of mechanical pumps. Metric learning is a spatial mapping method that can learn a more discriminative feature space (embedding space). Its effect is more effective than feature extraction and is significant in small sample problems.

[0105] like Figure 3As shown, the network model design based on metric learning of the present invention is designed based on 1DCNN and residual structure, and with reference to Similarity Condition Embedding Network, a spatial adaptive structure is proposed, so that the sample automatically selects a more appropriate spatial position according to its own data properties when performing spatial mapping. It is named metric-net. Metric-net is mainly composed of a convolutional neural network named Vector-CNN and a spatial adaptive structure. Vector-CNN is implemented based on 1DCNN, and uses multiple residual structures and pooling structures to achieve better convergence effect. One-dimensional data will obtain a vector, namely Vector, after passing through this part.

[0106] In the spatial adaptive structure, Vector is used for processing. The network will use a learnable matrix mask in this part, which contains n arrays with the same dimensions as Vector, namely M1, M2, ..., Mn. Its function is to automatically learn n spatial positions that can effectively represent the characteristics of the mechanical pump vibration data; in addition, Vector will pass through a small network and output n data, namely W1, W2, ..., Wn, which aims to assign different weights to the above n spatial positions according to the vector characteristics so as to reasonably reorganize them to achieve better spatial metric mapping.

[0107] In the calculation of the spatial adaptive structure, Mi (i = 1, 2, ..., n) is normalized with the L2 norm and then Hadamard product is performed with Vector to realize the mapping of samples to different spatial positions, and then multiplied with Wi (i = 1, 2, ..., n), and the obtained n vectors are accumulated by dimension to obtain the final Embedding, which can be regarded as a self-attention mechanism. Metric-net uses a learnable mask and does not seek the sparsity of the mask during implementation, thereby realizing adaptive search of spatial positions.

[0108] (3.2) In order to train the metric network, the present invention defines a triple {x a ,x p ,x n}, where x a Represents anchor, x p and x n Represent positive samples and negative samples respectively, E a 、E p and E n represents the output of the three-dimensional metric network mapping, and the final triplet loss can be expressed as formula 9. The present invention performs L2 regularization on the final Embedding, i.e. E , then the loss function of the network is shown in Formula 10.

[0109] l triplet (x a ,x p ,x n )=max{0,d(E a ,E p )-d(E a ,E n )+μ} (9)

[0110] loss = l triplet (x a ,x p ,x n )+λl E (10)

[0111] Among them, d(E a ,E p ) means E a and E p The Euclidean distance of , μ is a hyperparameter. λ is a hyperparameter that controls the degree of penalty.

[0112] When constructing the triplet dataset, we followed the principle of combining two sets of data of the same category with nine sets of data of different categories. In order to achieve good convergence of the network, a smaller learning rate was used during training. The Adma optimizer was used for learning, and the learning rate was lr = 5 × 10 -5 , the batch size is set to 512. Set the parameters of Equation 9 and Equation 10, where μ = 0.6 and λ = 5e-3.

[0113] (3.3) For the data to be diagnosed, it can be pre-processed and mapped into a vector using the network, and then searched in the surrounding space to judge the data based on the category of the surrounding vectors.

[0114] like Figure 4 As shown, the present invention adopts the KNN algorithm to perform neighbor search, traverses the parameter k in the range of [1,100], and then tests the performance of the KNN algorithm on the test set to find the optimal k value and the corresponding accuracy.

[0115] In the step (4),

[0116] (4.1) The main purpose of model optimization is to reduce the model memory usage and improve the operation speed while ensuring performance. Quantization is an important way for the present invention to process the metric network. When the metric network is quantized, the 32-bit operation is converted to an 8-bit operation, thereby reducing the volume and improving the operation speed, but it will also bring certain errors. The present invention adopts a solution that combines module fusion with static quantization (Post Training Static Quantization). For the trained network model, after specifying the quantization position, the parameters of the convolutional layer, bn layer (Batch Normalization) and activation layer in the model are fused, the quantization method is determined, reasoning is performed on the training set, and channel-by-channel observation is performed to obtain reasonable quantization parameters.

[0117] (4.2) The tree structure is used to implement KNN in order to improve the search speed of KNN. The linear scanning method of the KNN algorithm has a slow operation speed. In order to improve the real-time performance of the algorithm, the present invention uses a tree structure to accelerate the operation. The more commonly used one is Kd-tree, which can save a lot of online search time, but it uses hyper-rectangles to divide data, and the search speed is not good when the data dimension is high. To improve this situation, Ball-tree came into being. It divides data on a series of nested hyper-spheres, and judges based on the sum of the two sides and the size of the third side during the search, thereby improving the operation efficiency.

[0118] (4.3) The purpose of training set data screening is to further improve the search speed of Ball-tree and reduce the time and memory usage of Ball-tree. Although the tree structure has a high search efficiency, its tree building process is complex and time-consuming. Therefore, if the training data can be reduced without affecting the performance, the tree building efficiency and search efficiency can also be further improved. The present invention uses a weighted voting method in the KNN algorithm to obtain the final category result. The training samples that can effectively achieve classification should be close to the same category and far from different categories, so as to have better distinguishability.

[0119] Therefore, the important factor (IF) of a sample is defined as the sum of the reciprocal of the square of its Euclidean distance with samples of the same type, plus the sum of the square of its Euclidean distance with samples of different types after adjustment. The size adjustment refers to the mean of the square of the two Euclidean distances mentioned above, as shown in Formula 11. Considering the differences in the size distribution of important factors of samples of different categories, operations are performed separately according to data categories when sorting and implementing data reduction.

[0120]

[0121]

[0122]

[0123] Among them, x in Represents the nth sample of the i-th class of training samples, N i represents the number of samples of the i-th category, C represents the number of sample categories, d(x in ,x im ) represents x in and x im The Euclidean distance of Representing a collection The maximum value of Representing a collection The minimum value of and The collections are and collection Delete the set of larger and smaller values ​​in a certain proportion. mean() represents the average value of all values ​​in the set, and inf represents the minimum value that prevents the denominator from being zero.

[0124] The present invention conducts multiple experimental comparisons on different parameter settings of the algorithm design to achieve better parameter selection and further expand the practicality and universality of the overall algorithm.

[0125] The small sample fault diagnosis method of mechanical pump based on WGAN-GP-C and metric learning described in the present invention has the following specific steps:

[0126] S1, data preprocessing design;

[0127] The original data were read and cut into 2015 lengths, and the data were filtered using a normalized least mean square adaptive filter (NLMS) with a filter order of 16 and a step factor of 0.05, and outliers were removed using a median filter with a kernel of 5. The mean and variance of each dimension of the data were calculated, and the Z-score method was used for data standardization.

[0128] The present invention uses vibration sensors to be placed on the mechanical pump test bench, and the time series data is converted and transmitted to the PC software, and some data is extracted for algorithm verification. It includes 10 types of data, type 0 is normal, and types 1 to 9 are faults. After processing, there are 150 data of each type, 90 of which are used for model establishment and 60 for testing. The experimental computer is configured with an 8-core CPU (i7-6700), 8GB RAM, and a GTX 1080 graphics card. It should be noted that the calculation of the model running time in the present invention is all performed on the CPU.

[0129] The parameters and experimental settings of this step are as follows: (1) Count the data volume of all categories of samples and unify the format. (2) Set the number of NLMS sampling points to 215, the filter order to 16, and the step factor to The adjustment factor α = 0.0001, all data were processed using NLMS. (3) The kernel of the median filter was set to 5, and the sample data were processed. (4) The data were normalized using the Z-score, and the mean and standard deviation of the data set were recorded.

[0130] A complex signal dn=0.6sin(5x)+0.3cos(10x)+0.1sin(20x) is used to add Gaussian noise with a mean of 0 and a standard deviation of 0.3 to form a mixed signal. The mixed signal is processed using LMS, NLMS, and a combination of NLMS and median filtering. The root mean square error (RMSE) and operation time are used to evaluate the processing effect. The performance comparison of different filtering methods is shown in Table 1.

[0131] Table 1

[0132]

[0133] In order to demonstrate the impact of filtering schemes and data standardization on model performance, a BP neural network (Back Propagation Neuron Network) with four hidden layers and 1000, 500, 100, and 50 hidden neurons was trained for 1500 epochs using four types of data: unprocessed, only data standardized, only filtered, and both filtered and data standardized. The accuracy of the test set is shown in Table 2.

[0134] Table 2

[0135]

[0136] It can be seen from Table 2 that, under the data background of the mechanical pump group, the filtering scheme designed by the present invention combined with the data preprocessing method of data standardization has a significant effect on improving the data expression ability, which is conducive to model establishment.

[0137] S2, data augmentation design based on WGAN-GP-C;

[0138] The WGAN-GP-C model was designed based on the WGAN-GP and residual structure ideas. Category guidance information was added when the generator input random noise, and the discriminator output introduced the part that discriminated the data category. In the WGAN-GP-C training, the first 50,000 epochs only trained the data distribution, and then trained the data distribution and data classification at the same time to generate data by category. The quality of data generation was evaluated using the Maximum Mean Discrepancy (MMD) and the network was adjusted accordingly. The data enhancement process followed the data screening strategy.

[0139] The experimental steps are as follows: (1) Process the samples to make them more suitable for network training. (2) Set the dimension of random noise to 128, use the adam optimizer for learning, and set the initial learning rate to lr = 1×10 -4 , and reduce the learning rate by 10 times at 100,000 and 150,000 epochs, set the generator to be updated every 6 steps, and set the batch size to 128. (3) Set the parameters of equations 6 and 7. In the first 50,000 epochs, set λ2=10, λ1=λ3=λ4=λ5=0, and import data for training. (4) In the training after 50,000 epochs, set λ1=1, λ2=10, λ3=0, λ4=10, λ5=0.004, and continue training. (5) Select a model with good performance based on the EM distance, use MMD to evaluate the data and adjust the parameters appropriately, and screen the generated data to obtain an enhanced data set.

[0140] like Figure 5 As shown, for the parameter settings of λ3 and λ4 in Formula 7, the present invention conducts experiments comparing two groups of different settings. At the same time, to prove the effect of WGAN-GP-C, Auxiliary Classifier GAN (ACGAN) is used for comparative experiments. For the generated samples, in order to demonstrate the effect of the data screening scheme, two processing methods without data screening (no filter) and data screening (filter) are used to generate two groups of data, and the final generated samples are evaluated by MMD. The data evaluation results under different models and different data processing methods are shown in Table 3. The quality of the generated data of WGAN-GP-C is much higher than that of ACGAN, and the parameter setting method of the present invention enables the model to have better performance. At the same time, the data screening scheme can achieve further improvement in data quality.

[0141] Table 3

[0142]

[0143] Experiments show that the classification accuracy of the discriminator in the test set is 83.33%. The present invention performs data enhancement based on the model. To test the effect of data enhancement, a BP Neuron Network with 4 hidden layers and 1000, 500, 100, and 50 hidden neurons is trained with data sets with different enhancement multiples to test its accuracy on the test set. When the data enhancement multiple is 1, the accuracy of the BP neural network improves the fastest. Therefore, in consideration of not introducing too many data characteristics that do not belong to the real data itself, the present invention selects a data enhancement multiple of 1, thereby generating an enhanced data set for subsequent algorithm design.

[0144] S3, classification algorithm design based on metric learning and KNN;

[0145] Build a metric network model based on the residual idea and propose a spatial adaptive structure, so that the sample can find a more suitable spatial position according to its own properties when performing spatial mapping. The output dimension of the data mapping is 32. Construct a triplet data set. Use a learning rate of lr = 5×10 -5 The Adam optimizer is used to train the network model. When building the classification algorithm model, the KNN algorithm is used to traverse the parameter k in the range of [1,100], and then the performance of the KNN algorithm is tested on the test set to find the optimal k value and the corresponding accuracy.

[0146] The specific experimental steps are as follows: (1) Use the training set to construct a triplet format dataset to facilitate metric-net training. (2) Use the adma optimizer for learning with a learning rate of lr = 5×10 -5 , the batch size is set to 512. (3) Set the parameters of Equation 10 and Equation 11, where μ = 0.6 and λ = 5e-3. (4) Use the trained network to convert the data set into a vector library, and use the KNN algorithm to traverse the parameter k in the range of [1,100] to find the optimal k value and the corresponding accuracy. (5) Use the method (4) to test multiple models obtained by training, so as to select a better metric network model.

[0147] like Figure 6As shown, in order to achieve a better model design, the present invention conducted comparative experiments on different parameter settings. Among them, the comparison of 0.2, 0.6, and 1 was set for formula 10, and verified on the original data set and the enhanced data set. The data dimensions of the Embedding output by the model were set to 16 and 32, respectively, and verified on the original data set. The spatial adaptive structure introduces a structure with less computational complexity to the algorithm model. To verify its effect, the above-mentioned metric learning-based experiments were verified on metric-net and Vector-CNN without spatial adaptive structure, respectively. The accuracy results are shown in Table 4 (1)-(14). In order to prove that metric learning is more suitable for small sample backgrounds, the present invention changes Vector-CNN into a classification network, and uses multi-classification cross entropy to train on the original data set enhanced data set. The results are shown in Table 4 (15) and (16).

[0148] Table 4

[0149]

[0150] From (1), (3), (8) and (10) in Table 4, it can be seen that in the data set of the present invention, setting the data dimension of the Embedding output by the model to 32 can enable the model to achieve better performance. From a theoretical analysis, when the output dimension is 32, more data information can be retained, the data is more expressive, and it is more conducive to classification tasks.

[0151] From the accuracy under different parameter settings of μ, it can be seen that under the same conditions, setting μ = 0.6 has a better effect. At this time, the degree to which different categories of data are pulled apart is greater than that of μ = 0.2, making the data boundary more obvious and more suitable for the complex task of mechanical equipment fault diagnosis. At the same time, compared with μ = 1, the network needs to separate different types of data to a smaller extent, which is easier to achieve in training. Although the model accuracy in both (13) and (14) is 99.33%, from a comprehensive perspective of the training situation and the final model selection, in the case of (13), the model performance is more stable and superior. Therefore, the present invention finally selects μ = 0.6.

[0152] From the comparison of (1)-(7) and (8)-(14) in Table 4, it can be seen that under the idea of ​​metric learning, combined with the spatial adaptive structure, the data can find a more suitable spatial position according to its own performance, thereby improving the performance of the algorithm. At the same time, in order to exclude the possibility that the spatial adaptive result is a high performance in exchange for a large amount of calculation and a large space occupancy, Vector-CNN and the spatial adaptive structure are compared in terms of model size, calculation amount (floating point operations per second, FLOPs) and CPU time consumption. The results are shown in Table 5. As can be seen from the table, the model size ratio of Vector-CNN and the spatial adaptive structure is 75:1, the MFLOPs ratio is 6663:1, and the operation time ratio is 3:1. In the context of the present invention, the spatial adaptive structure can achieve a large performance improvement at a relatively low cost, which proves the rationality of the design.

[0153] From the comparison between (1)-(14) and (15) and (16) in Table 4, it can be seen that the scheme design based on metric learning is more suitable for mechanical pump fault diagnosis with a small sample background, thus proving the rationality and effectiveness of the scheme design.

[0154] From the comparison of the performance of the model on the original data set and the enhanced data set, it can be seen that data enhancement improves the model effect from 98.16% in (10) of Table 4 to 99.33%, which proves that the data enhancement scheme has a significant performance improvement effect. It also proves that the two-step solution designed by the present invention for the small sample problem, namely, data enhancement based on WGAN-GP-C and classification algorithm design based on metric learning and KNN, can show better performance in the face of small sample fault diagnosis tasks of mechanical pumps. The model comparison between Vector-CNN and spatial adaptive structure is shown in Table 5.

[0155] Table 5

[0156]

[0157] S4, model optimization;

[0158] Quantize the metric network. Use symmetric quantization for the convolution weight, no quantization for the bias, and asymmetric quantization for the activation layer. Implement 32-bit to 8-bit operations. Use a tree structure to implement KNN. Compare the search time of linear scan, Kd-tree, and Ball-tree, and choose Ball-tree to implement the KNN algorithm. Screen the training set data, propose the concept of important factors (IF) of training data, sort all samples from small to large according to the important factors, and remove some samples with smaller IFs while ensuring the accuracy of the algorithm, so as to achieve data screening, optimize the speed of Ball-tree construction, and improve the search speed.

[0159] The model optimization part is divided into 3 steps, each step is as follows:

[0160] Quantify metric-net: (1) Analyze network characteristics. The CPU time consumption of Vector-CNN and spatial adaptive structure is about 3:1, the model size is about 75:1, and the computing amount (floating point operations per second, FLOPs) is about 6663:1, so the quantization of the present invention is performed on the Vector-CNN part. (2) Some adjacent modules of the network are merged. (3) Symmetric quantization is used for convolution weights, bias is not quantized, and asymmetric quantization is used for activation layers. (4) Insert the model of the observation tensor into the network, and send the training set to the network operation for calibration. (5) Quantize the network model and test the performance of the new model in combination with the KNN algorithm. Figure 7 shown.

[0161] Steps to speed up KNN operation using tree structure: (1) Use Kd-tree and Ball-tree to replace linear scanning algorithm. (2) Compare the search time of linear scanning, Kd-tree and Ball-tree. (3) Analyze the tree building time of Kd-tree and Ball-tree. Figure 8 shown.

[0162] Filter the data in the vector library according to important factors: (1) Determine the set and collection The ratio of removing larger and smaller values ​​is 0.15, resulting in the set and Calculate the important factor (IF) for each sample in the vector library and sort them by category from small to large. (2) Take the ratio of data to be removed between [0, 0.99] and traverse it at intervals of 0.01. (3) Remove data from each category of data in proportion, test the algorithm accuracy, search time, and tree building time, and choose a larger ratio of data to be removed while ensuring accuracy.

[0163] According to the above content, the Vector-CNN of metric-net is quantified, and the model optimization effect is measured by calculating the model size, calculation amount (MFLOPs), operation time and final model classification accuracy. For comparison, the present invention uses group convolution and depthwise separable convolution to process Vector-CNN. The results are shown in Table 6, where GC represents group convolution, DPC represents depthwise separable convolution, and the model size, MFLOPs and time in the table are all for Vector-CNN.

[0164] Table 6

[0165]

[0166] Quantization is more advantageous for grouped convolution and depthwise separable convolution in reducing the model size, and has less impact on the model accuracy. Lightweight network structures such as grouped convolution and depthwise separable convolution are not well supported on the CPU, so their operation time increases instead. Quantization effectively reduces the model size, and the operation time remains basically unchanged.

[0167] The present invention uses the above steps to establish a classification model, and compares the operation time and accuracy of other commonly used algorithms on the preprocessed data set. The algorithms involved in the comparison include Naive Bayes classifiers, decision tree, support vector machine, Ball-tree, 3-layer BP neural network (hidden neurons are 1000, 500, 100, 50 respectively), classification implemented by Vector-CNN, etc. The classifier performance comparison table is shown in Table 7.

[0168] Table 7

[0169]

[0170] From the comparison results in Table 7, it can be seen that the mechanical pump failure data used in the present invention has a relatively obvious small sample characteristic, and although the training of the scheme designed by the present invention for its small sample characteristics is relatively complex, its accuracy has obvious advantages over ordinary classification models, and the calculation speed after model optimization is also considerable, and the overall performance is good.

[0171] In order to better verify the effect of the method of the present invention under different training data amounts, the sample data amount of each category in the training set is set to 10, 20, 30 and 60 respectively, the model performance is tested, and compared with the classification achieved by SVM and Vector-CNN with better performance in Table 7. The accuracy results are shown in Table 8.

[0172] Table 8

[0173]

[0174] It can be seen that the algorithm proposed for the small sample background of mechanical pumps has good performance on the data set of the present invention, and has a higher accuracy than the ordinary method under different training data amounts, which proves the effectiveness of the scheme.

[0175] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.

Claims

1. A small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning, characterized in that: The method comprises the steps of: (1) Read time series data and perform data preprocessing; (2) Construct the WGAN-GP-C model and perform data augmentation based on the WGAN-GP-C model; Specifically include: (2.1) The WGAN-GP-C model is constructed based on the WGAN-GP and residual structure. When the generator inputs random noise, a label is added for category guidance. The discriminator outputs the data to identify the category to which it belongs, thus generating data by category. (2.2) Train the WGAN-GP-C model, feed the generated samples and real samples into the discriminator together, first train the data distribution to make the generated samples closer to the real samples, and then train the classification while improving the distribution; (2.3) When generating samples using the trained WGAN-GP-C, filter the generated sample data; (2.4) The quality of the generated sample data is evaluated using the maximum mean difference (MMD) and the model is adjusted accordingly; (3) Construct a fault diagnosis model based on metric learning and KNN classification algorithm; Specifically include: (3.1) Construct a metric network model, including a convolutional neural network Vector-CNN and a spatial adaptive structure. The sample data is converted into a vector through the convolutional neural network. The spatial position matrix is ​​constructed in the spatial adaptive structure. Then, different weights are assigned to the spatial positions according to the vector features to realize spatial metric mapping. (3.2) Construct a triplet dataset and use the Adam optimizer to train the metric network model; (3.3) Build a classification algorithm model, use the KNN algorithm to find the optimal k value and the corresponding accuracy, and test the trained metric network model; (4) Optimize the fault diagnosis model; (5) Use the optimized fault diagnosis model to perform fault diagnosis on the preprocessed and data enhanced data.

2. The small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning according to claim 1 is characterized in that: The step (1) specifically comprises: (1.1) Read the time series data and cut it according to the set length, and filter it using the normalized least mean square adaptive filter NLMS; (1.2) Use median filtering to remove outliers; (1.3) The mean and variance of each dimension of the statistical data are processed by Z-score method for data standardization.

3. The small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning according to claim 2 is characterized in that: The NLMS filtering algorithm is as follows: y(k)=w T (k)x(k) e(k)=d(k)-y(k) Where x(k) is the input signal, y(k) is the output signal, d(k) is the reference signal, w(k) is the filter coefficient, α is the adjustment factor to prevent the denominator from being zero, and |x(k)| 2 is the square of the Euclidean norm of x(k), is the step size parameter.

4. The small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning according to claim 1 is characterized in that: The loss function of the generator G, the loss function of the discriminator D, and the loss function of the data category are as follows: in, represents the mathematical expectation of f(x) for x under distribution P, x r is a real sample, x f is the generated sample, P r represents the real data distribution, P f represents the generated data distribution, and Respectively represent x r and x f Category, express The data distribution, Indicates that in the distribution P r and distribution P f The data points on the line of express data distribution, L2 represents the L2 regularization penalty, λ1, λ2, λ3, λ4, and λ5 are hyperparameters that control different parts of the loss function, n represents the number of samples, i.e., the dimension of y, i 、class i Represents the network output and true category of the i-th sample.

5. The small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning according to claim 1 is characterized in that: The data screening step includes: passing the generated samples through the discriminator to judge the category, retaining the generated samples whose input labels are the same as the discriminator output category; for each retained sample, choosing whether to retain the sample with a certain probability a, and this probability a is taken as the accuracy a of the discriminator on the real data test set.

6. The method for small sample fault diagnosis of mechanical pumps based on WGAN-GP-C and metric learning according to claim 1, characterized in that: The spatial adaptive structure loss function is as follows: l triplet (x) a ,x p ,x n )=max{0,d(E a ,E p )-d(E a ,E n )+μ} loss=l triplet (x a ,x p ,x n )+λl E Among them, d(E a ,E p ) means E a and E p Euclidean distance, μ is a hyperparameter, and λ is a hyperparameter that controls the degree of penalty; x a Represents anchor, x p and x n Represent positive samples and negative samples respectively, E a 、E p and E n Represents the output of the metric network mapping of the three; l E Indicates L2 regularization processing.

7. The small sample fault diagnosis method for mechanical pumps based on WGAN-GP-C and metric learning according to claim 1 is characterized in that: The step (4) specifically comprises: (4.1) Quantize the metric network; specifically, quantize the convolutional neural network Vector-CNN and fuse the adjacent modules of the network; specifically, use symmetric quantization for the convolution weight, do not quantize the bias, and use asymmetric quantization for the activation layer; (4.2) Use the ball-tree structure to accelerate the KNN algorithm; (4.3) Screen the training set data, propose the important factors IF of the training set data, and sort all samples from small to large according to the important factors; and remove some samples with smaller IF while ensuring the accuracy of the algorithm.

8. The method for small sample fault diagnosis of mechanical pumps based on WGAN-GP-C and metric learning according to claim 7, characterized in that: The important factors of a sample are defined as the sum of the reciprocal squares of its Euclidean distances from samples of the same type, plus the sum of the squares of its Euclidean distances from samples of different types after resizing. Considering the differences in the size distribution of important factors of samples of different types, operations are performed separately according to data categories when sorting and implementing data deletion. Among them, x in Represents the nth sample of the i-th class of training samples, N i represents the number of samples of the i-th category, C represents the number of sample categories, d(x in ,x im ) represents x in and x im The Euclidean distance of Representing a collection The maximum value of Representing a collection The minimum value of and The collections are and collection Delete the set of larger and smaller values ​​in a certain proportion. mean() represents the average value of all values ​​in the set, and inf represents the minimum value that prevents the denominator from being zero.

Citation Information

Patent Citations

  • Fault diagnosis method based on metric learning and time sequence during industrial process

    CN105116872A

  • Intelligent fault diagnosis method based on deep adversarial domain self-adaption

    CN111898634A