Zero sample fault diagnosis method, system and equipment based on multi-class comparative learning
By adopting multi-class comparison learning methods in industrial zero-sample fault diagnosis, the pre-trained language model and multi-scale feature fusion model are optimized, and the problem that class-attribute matrix quality affects diagnostic performance in the existing technology is solved, and more accurate unknown fault category recognition is achieved.
Patent Information
- Application Number
- CN202411576971.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, in industrial zero-sample fault diagnosis, the embedded method based on the class-attribute matrix, the diagnostic performance depends on the quality of the class-attribute matrix, but the existing construction methods fail to fully evaluate the importance of attributes, resulting in limited model performance.
Using a method based on multi-class comparison learning, we use the method to obtain the fault description text, extract the fault prototype vector features and multi-scale fusion fault features, perform multi-class comparison learning, optimize the pre-trained language model and multi-scale feature fusion model, improve the feature similarity under the same fault category, and reduce the feature similarity under different categories.
Improve the accuracy of identification of unknown fault categories, and optimize model parameters, enhance the high-quality representation of fault prototypes, and improve the performance of zero-sample fault diagnosis.
Smart Images

Figure CN119513694A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of fault diagnosis, and in particular relates to a zero-sample fault diagnosis method, system and equipment based on multi-class contrast learning. Background Art
[0002] Zero-shot fault diagnosis is a special fault diagnosis task whose main goal is to be able to identify faults without target fault samples for training. Zero-shot learning is a learning strategy that allows the model to reason without samples of a specific class. The model relies on shared features or attributes for fault identification. By understanding and mapping the attributes of the fault, the model is able to identify unseen fault classes. In complex manufacturing systems and equipment, zero-shot fault diagnosis can help monitor and diagnose unseen faults in real time.
[0003] In the related art, in actual industrial scenarios, there are significant differences in the distribution of known category faults and unknown category faults, which leads to insufficient generalization ability of the diagnostic model trained only with known category faults when identifying unknown category faults. In the field of industrial zero-sample fault diagnosis research, fault description based on process mechanism and domain expert knowledge serves as a common knowledge bridge connecting known category faults and unknown category faults, among which class-attribute matrix is one of the most commonly used auxiliary knowledge expression forms.
[0004] Regarding the above-mentioned related technologies, the diagnostic performance of the embedded method based on attribute transfer and class-attribute matrix depends largely on the quality of the class-attribute matrix. The current way of constructing the class-attribute matrix fails to fully evaluate the importance of attributes, which directly affects the performance of the zero-sample fault diagnosis model. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a zero-sample fault diagnosis method, system and device based on multi-class contrastive learning, which can accurately identify the fault category of unknown category.
[0006] A zero-sample fault diagnosis method based on multi-class contrastive learning, comprising:
[0007] Get the fault description text;
[0008] A pre-trained language model is used to extract fault prototype vector features of different fault categories from the fault description text to form a fault prototype vector tuple;
[0009] The original fault samples of known fault categories are subjected to dual-channel attention feature fusion through a multi-scale feature fusion model to obtain multi-scale fusion fault features of several different fault categories, forming a multi-scale fusion fault feature tuple;
[0010] The fault prototype vector tuple and the multi-scale fusion fault feature tuple are subjected to multi-class comparative learning, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category is improved by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories is reduced, so as to obtain an optimized pre-trained language model and an optimized multi-scale feature fusion model;
[0011] Input the fault description texts of all unknown fault categories into the optimized pre-trained language model to obtain the fault prototype tuples of the unknown category;
[0012] Input the fault sample to be diagnosed into the optimized multi-scale feature fusion model to obtain the multi-scale fusion fault feature of the fault sample to be diagnosed;
[0013] The multi-scale fusion fault features of the fault sample to be diagnosed are compared with the fault prototype tuple of the unknown category for similarity, and the fault category corresponding to the fault prototype of the unknown category with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed is selected as the diagnosis result.
[0014] Optionally, the original fault samples of known fault categories are subjected to dual-channel attention feature fusion through a multi-scale feature fusion model to obtain multi-scale fusion fault features of several different fault categories, and the multi-scale fusion fault feature tuples include:
[0015] Inputting the original fault samples of the known fault category into two parallel convolution layers with different convolution kernel sizes to obtain a first local fault feature and a second local fault feature;
[0016] Adding the first local feature and the second local feature element by element to obtain a multi-scale addition feature;
[0017] The multi-scale addition features are placed in the activation layer and the maximum pooling layer to obtain multi-scale fault features;
[0018] The multi-scale fault features are subjected to dual-channel attention feature fusion to obtain multi-scale fused fault features of several different fault categories, forming a multi-scale fused fault feature tuple.
[0019] Optionally, the multi-scale fault features are subjected to dual-channel attention feature fusion to obtain multi-scale fusion fault features of several different fault categories, and the multi-scale fusion fault feature tuple comprises:
[0020] Performing a channel attention operation on the multi-scale fault features to obtain a channel attention enhanced feature;
[0021] Performing a spatial attention operation on the channel attention enhancement feature to obtain a spatial attention enhancement feature;
[0022] After the spatial attention enhanced features are passed through a flattening layer and a fully connected layer, multi-scale fused fault features of several different fault categories are obtained to form a multi-scale fused fault feature tuple.
[0023] Optionally, the fault prototype vector tuple and the multi-scale fusion fault feature tuple are subjected to multi-class comparative learning, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category is improved by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories is reduced, so as to obtain the optimized pre-trained language model and the optimized multi-scale feature fusion model, including:
[0024] Perform multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature to obtain the similarity between the multi-scale fusion fault feature and the fault prototype vector tuple;
[0025] Get the preset loss function;
[0026] According to the loss function, the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model are changed through the back propagation algorithm, the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category is improved, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories is reduced, so as to obtain the optimized pre-trained language model and the optimized multi-scale feature fusion model.
[0027] Optionally, comparing the multi-scale fusion fault features of the fault sample to be diagnosed with the fault prototype tuple of the unknown category for similarity, and selecting the fault category corresponding to the fault prototype of the unknown category having the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed as the diagnosis result includes:
[0028] Get the preset text for unknown categories;
[0029] According to the preset text, the fault category of each fault prototype in the fault prototype tuple of the unknown category is obtained;
[0030] The similarity between the multi-scale fusion fault feature of the fault sample to be diagnosed and each fault prototype of the unknown category in the fault prototype tuple of the unknown category is calculated, and the fault category corresponding to the fault prototype with the highest similarity to the multi-scale fusion fault feature of the fault sample to be diagnosed is selected as the diagnosis result.
[0031] Optional, including:
[0032] The loss function is:
[0033]
[0034] Among them, τ represents the temperature factor hyperparameter, f i and p i They are respectively represented as the fault characteristics and fault prototype of known category i, S(f i ,p j )=p j T f i , N is the number of fault categories, F is the fault prototype vector tuple, P is the multi-scale fusion fault feature tuple, and exp is the exponent.
[0035] A fault diagnosis system based on multi-class contrastive learning, comprising:
[0036] A first acquisition module is used to acquire a fault description text;
[0037] An extraction module, used for extracting fault prototype vector features of different fault categories from the fault description text by using a pre-trained language model to form a fault prototype vector tuple;
[0038] The fusion module is used to perform dual-channel attention feature fusion on the original fault samples of known fault categories through a multi-scale feature fusion model to obtain fused fault features of several different fault categories to form a multi-scale fused fault feature tuple;
[0039] A training module, used for performing multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature tuple, improving the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category and reducing the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, so as to obtain an optimized pre-trained language model and an optimized multi-scale feature fusion model;
[0040] The second acquisition module is used to input the fault description texts of all unknown fault categories into the optimized pre-trained language model to obtain the fault prototype tuples of the unknown category;
[0041] The third acquisition module is used to input the fault sample to be diagnosed into the optimized multi-scale feature fusion model to obtain the multi-scale fusion fault feature of the fault sample to be diagnosed;
[0042] The identification module is used to compare the multi-scale fusion fault features of the fault sample to be diagnosed with the fault prototype tuple of the unknown category for similarity, and select the fault category corresponding to the fault prototype with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed as the diagnosis result.
[0043] Optionally, the fusion module includes:
[0044] A convolution unit, used for inputting the original fault samples of the known fault category into two parallel convolution layers with different convolution kernel sizes to obtain a first local fault feature and a second local fault feature;
[0045] an adding unit, configured to add the first local feature and the second local feature element by element to obtain a multi-scale added feature;
[0046] An enhancement unit, used for obtaining a multi-scale fault feature by placing the multi-scale addition feature into an activation layer and a maximum pooling layer;
[0047] The fusion unit is used to perform dual-channel attention feature fusion on the multi-scale fault features to obtain fused fault features of several different fault categories to form a multi-scale fused fault feature tuple.
[0048] A terminal device comprises a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor loads and executes the computer program, a zero-sample fault diagnosis method based on multi-class contrast learning is adopted.
[0049] A computer-readable storage medium stores a computer program. When the computer program is loaded and executed by a processor, a zero-sample fault diagnosis method based on multi-class contrastive learning is adopted.
[0050] The beneficial effects of the present invention are:
[0051] The fault description text is input into the pre-trained language model to obtain the fault prototype vector feature, the original fault sample is input into the multi-scale feature fusion model to obtain the multi-scale fusion fault feature, the pre-trained language model and the multi-scale feature fusion model are trained so that the multi-scale fusion fault feature and the fault prototype vector feature have high similarity under the same fault category, and the multi-scale fusion fault feature and the fault prototype vector feature have low similarity under different categories. The fault prototype tuple of unknown category and the multi-scale fusion fault feature of the fault sample to be diagnosed are obtained by using the trained optimized pre-trained language model and the optimized multi-scale feature fusion model, the similarity of the fault prototype tuple of unknown category and the multi-scale fusion fault feature of the fault sample to be diagnosed is calculated, and the fault category corresponding to the fault prototype with the highest similarity to the multi-scale fusion fault feature of the fault sample to be diagnosed is selected as the diagnosis result. Compared with the class matrix, the fault description text is directly processed through the pre-trained language model, and the fault category knowledge learned from the fault description text of the known fault category is transferred to the unknown category, so that the prototype representation vector of the high-quality unknown fault category can be extracted, and the accuracy of the classification of the unknown fault category can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A flowchart of a zero-sample fault diagnosis method based on multi-class contrast learning of the present invention;
[0053] Figure 2 Schematic diagram of the training and testing process of multi-class contrastive learning of the present invention;
[0054] Figure 3 This is a schematic diagram of experimental results of a zero-sample fault diagnosis method based on multi-class contrastive learning in the present invention. DETAILED DESCRIPTION
[0055] A zero-shot fault diagnosis method based on multi-class contrastive learning, such as Figure 1 As shown, including:
[0056] S1. Get the fault description text.
[0057] Specifically, the fault description text is a text including the fault location and fault category of a known fault.
[0058] The failure in this application refers to failures in the industrial field, including but not limited to functional failure of some components and abnormal parameters, such as feed temperature failure, discharge temperature failure and cooling temperature failure in a certain industrial production process.
[0059] S2. Use the pre-trained language model to extract fault prototype vector features of different fault categories from the fault description text to form a fault prototype vector tuple.
[0060] Specifically, the pre-trained language model in this embodiment uses the BERT model to extract the fault prototype vector features of different fault categories from the fault description text to form a fault prototype vector tuple. The fault prototype vector tuple is represented by P = {p1, p2, ..., p N} means, where p n ∈R m×1 It is represented as the prototype semantic vector of known category n. There are N known categories of faults in total. R is the real set, and m*1 is a one-dimensional vector of m dimensions.
[0061] S3. The original fault samples of known fault categories are passed through a multi-scale feature fusion model and dual-channel attention feature fusion to obtain multi-scale fusion fault features of several different fault categories to form a multi-scale fusion fault feature tuple.
[0062] Specifically, the original fault samples in this embodiment use the TEP dataset, which is a public simulation dataset. The multi-scale feature fusion model in this embodiment is named MsFFM. n Input into the multi-scale feature fusion model to obtain its high-quality multi-scale fusion fault features, f n ∈R 1×m .
[0063] S4. Perform multi-category comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature tuple. By changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category is improved, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories is reduced, so as to obtain the optimized pre-trained language model and the optimized multi-scale feature fusion model.
[0064] Specifically, the training process is as follows: Figure 2 As shown in the figure, the purpose of multi-class contrastive learning is to make the similarity score of the fault prototype vector features and the multi-scale fusion fault features belonging to the same fault category in the multi-scale fusion feature tuple and the fault prototype vector tuple as high as possible, and the similarity score of the fault prototype vector features and the multi-scale fusion fault features belonging to different fault categories as low as possible. Specifically, the model parameters of the multi-scale feature fusion model and the model parameters of the pre-trained language model are changed through the back propagation of the loss function during the training process.
[0065] S5. Input the fault description texts of all unknown fault categories into the optimized pre-trained language model to obtain the fault prototype tuples of the unknown category.
[0066] Specifically, in the field of industrial zero-sample fault diagnosis research, fault description based on process mechanism and domain expert knowledge serves as a common knowledge bridge connecting known category faults and unknown category faults.
[0067] At this point, the pre-trained language model has been optimized, and the fault description text of the unknown category fault is the new unknown category that has appeared, the fault category that does not exist in the existing data, and the fault description text of the unknown category fault can be given by domain experts.
[0068] The fault description text of unknown category is provided by experts, and one text represents one fault category.
[0069] S6. Input the fault sample to be diagnosed into the optimized multi-scale feature fusion model to obtain the multi-scale fusion fault feature of the fault sample to be diagnosed.
[0070] Specifically, the fault sample to be diagnosed is TEP test data.
[0071] The purpose of obtaining the optimized multi-scale feature fusion model and the optimized pre-trained language model is to enable the two models to learn the ability of feature extraction so that the extracted features have high similarity if they are of the same fault category, and low similarity if they are of different fault categories.
[0072] S7. Compare the similarity between the multi-scale fusion fault features of the fault sample to be diagnosed and the fault prototype tuple of the unknown category, and select the fault prototype with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed as the diagnosis result.
[0073] Specifically, after the multi-scale feature fusion model and the pre-trained language model are trained, the multi-scale fusion fault features of the fault sample to be diagnosed obtained by optimizing the multi-scale feature fusion model and the fault prototype tuples of the unknown category obtained by optimizing the pre-trained language model are compared one by one for similarity, and the fault prototype of the unknown category with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed is selected, and then the fault category to which the fault prototype of the unknown category belongs is used as the fault category of the multi-scale fusion fault features of the fault sample to be diagnosed as the diagnosis result.
[0074] In one implementation of this embodiment, step S3 is to pass the original fault samples of known fault categories through the multi-scale feature fusion model and perform dual-channel attention feature fusion to obtain multi-scale fusion fault features of several different fault categories, and the multi-scale fusion fault feature tuples include:
[0075] S21. Inputting the original fault samples of known fault categories into two parallel convolution layers with different convolution kernel sizes to obtain a first local fault feature and a second local fault feature.
[0076] Specifically, the original fault sample x of known category n is n Input to two parallel convolution layers with different convolution kernel sizes to extract multiple local fault features, g k1×1 (x n ) is the first local fault characteristic and g k2×1 (x n ) is the second local fault characteristic.
[0077] S22: Add the first local feature and the second local feature element by element to obtain a multi-scale added feature.
[0078] S23, placing the multi-scale addition features into an activation layer and a maximum pooling layer to obtain a multi-scale fault feature.
[0079] Specifically, the first local feature and the second local feature are added element by element and then put into the activation layer and the maximum pooling layer to be expressed as:
[0080] f mc =MaxPool(σ(g k1×1 (x n )+g k2×1 (x n )))
[0081] Among them, f mc is a multi-scale fault feature, MaxPool represents the maximum pooling operation, x n represents the original input sample, g k1 ×1 represents a one-dimensional convolution operation with a convolution kernel size of k1×1, g k2×1 represents a one-dimensional convolution operation with a convolution kernel size of k2×1, and σ represents the Sigmoid activation function.
[0082] S24, performing dual-channel attention feature fusion on the multi-scale fault features to obtain multi-scale fused fault features of several different fault categories to form a multi-scale fused fault feature tuple.
[0083] Specifically, the dual-channel attention feature fusion includes channel attention fusion operation and spatial attention fusion operation.
[0084] It is worth noting that the present invention first adds the multi-scale fault features element by element and then puts them into the activation layer and the pooling layer, rather than first putting the multi-scale fault features into the activation layer and then adding them element by element. This approach can better integrate the multi-scale fault features and avoid the loss of some detailed information of the fault samples during the calculation process.
[0085] In one implementation of this embodiment, step S24 is to perform dual-channel attention feature fusion on the multi-scale fault features to obtain fused fault features of several different fault categories, and the multi-scale fused fault feature tuple comprises:
[0086] S31. Perform channel attention operation on the multi-scale fault features to obtain channel attention enhanced features.
[0087] Specifically, the channel attention operation dynamically adjusts the importance weights of each channel to enhance the network's attention to important features and suppress irrelevant features. It is specifically expressed as:
[0088] M c (f mc )=σ(MLP(AP(f mc ))+MLP(MP(f mc )))
[0089]
[0090] Among them, f cam Channel attention enhancement features, σ represents the Sigmoid activation function, represents element-by-element multiplication operation, MLP represents multi-layer perceptron, AP represents global average pooling operation along the channel dimension, MP represents global maximum pooling operation along the channel dimension, M c (f mc ) is the feature after global averaging and maximum pooling.
[0091] S32. Perform spatial attention operation on the channel attention enhancement feature to obtain the spatial attention enhancement feature.
[0092] Specifically, the spatial attention operation focuses on different areas of the input feature map. By dynamically adjusting the importance of each spatial position, the model can focus more on the key areas, thereby improving performance. Specifically:
[0093] M s (f cam )=σ(g 7×1 ([AP(f cam ); MP(f cam )]))
[0094]
[0095] Among them, [AP(f); MP(f)] means concatenating the global average pooling and maximum pooling results along the channel dimension, g 7×1 To use a one-dimensional convolution operation g 7×1 , M c represents the channel attention module, Ms Represents the spatial attention module.
[0096] S33. After the spatial attention enhanced features are passed through the flattening layer and the fully connected layer, multi-scale fused fault features of several different fault categories are obtained to form a multi-scale fused fault feature tuple.
[0097] In one implementation of this embodiment, step S4 is to perform multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature tuple, and improve the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, and reduce the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories, so as to obtain the optimized pre-trained language model and the optimized multi-scale feature fusion model, including:
[0098] S41. Perform multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature to obtain the similarity between the multi-scale fusion fault feature and the fault prototype vector tuple.
[0099] S42. Obtain a preset loss function.
[0100] Specifically, the loss function is:
[0101] Among them, τ represents the temperature factor hyperparameter, f i and p i They are respectively represented as the fault characteristics and fault prototype of known category i, S(f i ,p j )=p j T f i , N is the number of fault categories, F is the fault prototype vector tuple, P is the multi-scale fault feature tuple, exp is the exponent, and T is the transposed matrix.
[0102] During the training process, the loss function is minimized to make the similarity between the multi-scale fault features and the fault prototype vector features under the same fault category as high as possible.
[0103] S43. According to the loss function, the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model are changed through the back propagation algorithm to improve the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category, and reduce the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories, so as to obtain the optimized pre-trained language model and the optimized multi-scale feature fusion model.
[0104] In one implementation of this embodiment, step S7, that is, calculating the similarity between the multi-scale fusion fault feature of the fault sample to be diagnosed and each unknown category fault prototype in the fault prototype tuple of the unknown category, and selecting the fault category corresponding to the fault prototype having the highest similarity with the multi-scale fusion fault feature of the fault sample to be diagnosed as the diagnosis result, includes:
[0105] S51. Obtain preset text of unknown category.
[0106] Specifically, the preset texts of the unknown categories can be provided by experts in this field, and each text represents a fault category.
[0107] S52. Obtaining, according to the preset text, a preset fault category of each fault prototype in the fault prototype tuple of unknown category.
[0108] S53, calculating the similarity between the multi-scale fusion fault feature of the fault sample to be diagnosed and each unknown category fault prototype in the unknown category fault prototype tuple, and selecting the preset fault category of the unknown category fault prototype with the highest similarity as the fault category of the multi-scale fusion fault feature of the fault sample to be diagnosed.
[0109] Specifically, through the learning of multi-scale fusion fault feature tuples and fault prototype tuples of known categories, we have learned how to classify fault prototype vector features and multi-scale fusion fault features under the same fault category. Then, the fault prototypes of unknown categories and the multi-scale fusion fault features of the fault samples to be diagnosed are classified into which category of unknown category fault prototypes according to the learned classification ability. That is, the multi-scale fusion fault features of the fault samples to be diagnosed and the fault prototype tuples of unknown categories are calculated for similarity, and the fault prototype of unknown category with the highest similarity to the multi-scale fusion fault features of the fault samples to be diagnosed is found. Then, according to the expert's classification of the fault prototype of the unknown category, it is used as the fault category of the multi-scale fusion fault features of the fault samples to be diagnosed, and the fault category is used as the diagnosis result.
[0110] Input the description text of all unknown faults into BERT to obtain the unknown fault prototype tuple U = {u1,u2,…,u M}, where u m ∈R m×1 It is represented as the prototype semantic vector of the unknown category m, and there are M unknown category faults in total.
[0111] Then take an original fault sample x of an unknown category u Input into the trained optimized multi-scale feature fusion model to obtain the fault feature f u ∈R 1×m .
[0112] Finally, the fault sample x u Fault characteristics of u Compare the similarity with the unknown category fault prototype tuple U S = {S (f u ,u1),S(f u ,u2),…,S(f u ,u M )}, where S() is represented as the similarity score function, namely the cosine similarity function, and the unknown category fault argmax(S) with the highest score is taken as the final diagnosis result.
[0113] The multi-scale feature fusion model for the TEP dataset is shown in Table 1. In this embodiment, the Adam optimizer is used to train the model, with 100 training rounds, 64 training batches, a learning rate of 0.001, and a loss function L McCL The temperature factor τ in is set to 0.1. Specifications of experimental equipment: The computer system is window10, the processor is AMD Ryzen 76800H@3.20GHz, and the programming tools are python 3.8.16 and pytorch 2.0.0. Table 2 describes the detailed settings of the four sets of zero-shot fault diagnosis tasks in the TEP data.
[0114] Table 1
[0115]
[0116]
[0117] Table 2
[0118]
[0119] Experimental results: The present invention has conducted sufficient experiments in four groups of zero-sample fault diagnosis tasks in TEP. The experimental results are as follows: Figure 3 As shown, the accuracy of group A is 93.4%, the accuracy of group B is 81.3%, the accuracy of group C is 65.0% and the accuracy of group D is 81.1%. In this application, accuracy, precision, recall rate and F1 score are used as evaluation indicators.
[0120] A fault diagnosis system based on multi-class contrastive learning, comprising:
[0121] A first acquisition module is used to acquire a fault description text;
[0122] An extraction module is used to extract fault prototype vector features of different fault categories from the fault description text using a pre-trained language model to form a fault prototype vector tuple;
[0123] The fusion module is used to perform dual-channel attention feature fusion on the original fault samples of known fault categories through a multi-scale feature fusion model to obtain fused fault features of several different fault categories to form a multi-scale fused fault feature tuple;
[0124] A training module is used to perform multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature tuple, and improve the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, and reduce the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories, so as to obtain an optimized pre-trained language model and an optimized multi-scale feature fusion model;
[0125] The second acquisition module is used to input the fault description texts of all unknown fault categories into the optimized pre-trained language model to obtain the fault prototype tuples of the unknown category;
[0126] The third acquisition module is used to input the fault sample to be diagnosed into the optimized multi-scale feature fusion model to obtain the multi-scale fusion fault feature of the fault sample to be diagnosed;
[0127] The identification module is used to compare the similarity between the multi-scale fusion fault features of the fault sample to be diagnosed and the fault prototype tuple of the unknown category, and select the fault category corresponding to the fault prototype with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed as the diagnosis result.
[0128] The fusion module includes:
[0129] A convolution unit, used for inputting the original fault samples of known fault categories into two parallel convolution layers with different convolution kernel sizes to obtain a first local fault feature and a second local fault feature;
[0130] An adding unit, used for adding the first local feature and the second local feature element by element to obtain a multi-scale added feature;
[0131] The enhancement unit is used to obtain multi-scale fault features by putting the multi-scale addition features into the activation layer and the maximum pooling layer;
[0132] The fusion unit is used to perform dual-channel attention feature fusion on the multi-scale fault features to obtain fused fault features of several different fault categories to form a multi-scale fused fault feature tuple.
[0133] An embodiment of the present application also discloses a terminal device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor loads and executes the computer program, a zero-sample fault diagnosis method based on multi-class comparative learning is adopted.
[0134] The terminal device may be a computer device such as a desktop computer, a laptop computer or a cloud server, and the terminal device includes but is not limited to a processor and a memory. For example, the terminal device may also include input and output devices, a network access device and a bus.
[0135] Among them, the processor can adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be adopted. The general-purpose processor can adopt a microprocessor or any conventional processor, etc., and this application does not impose any restrictions on this.
[0136] Among them, the memory can be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device, or it can be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (SMC), a secure digital card (SD) or a flash memory card (FC) equipped on the terminal device, etc., and the memory can also be a combination of an internal storage unit and an external storage device of the terminal device. The memory is used to store computer programs and other programs and data required by the terminal device. The memory can also be used to temporarily store data that has been output or is to be output, and this application does not impose any restrictions on this.
[0137] Among them, through this terminal device, a zero-sample fault diagnosis method based on multi-class contrast learning in the above embodiment is stored in the memory of the terminal device, and is loaded and executed on the processor of the terminal device for easy use.
[0138] An embodiment of the present application further discloses a computer-readable storage medium, and the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, a zero-sample fault diagnosis method based on multi-class comparative learning in the above embodiment is adopted.
[0139] Among them, the computer program can be stored in a computer-readable medium, the computer program includes computer program code, the computer program code can be in the form of source code, object code, executable file or certain middleware, etc. The computer-readable medium includes any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer-readable medium includes but is not limited to the above-mentioned components.
[0140] Among them, through this computer-readable storage medium, a zero-sample fault diagnosis method based on multi-class comparative learning in the above embodiment is stored in a computer-readable storage medium, and is loaded and executed on a processor to facilitate the storage and application of the above method.
[0141] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of protection of the present application is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0142] One or more embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the present application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application should be included in the protection scope of the present application.
Claims
1. A zero-sample fault diagnosis method based on multi-class contrastive learning, characterized in that: include: Get the fault description text; A pre-trained language model is used to extract fault prototype vector features of different fault categories from the fault description text to form a fault prototype vector tuple; The original fault samples of known fault categories are subjected to dual-channel attention feature fusion through a multi-scale feature fusion model to obtain multi-scale fusion fault features of several different fault categories, forming a multi-scale fusion fault feature tuple; The fault prototype vector tuple and the multi-scale fusion fault feature tuple are subjected to multi-class comparative learning, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category is improved by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories is reduced, so as to obtain an optimized pre-trained language model and an optimized multi-scale feature fusion model; Input the fault description texts of all unknown fault categories into the optimized pre-trained language model to obtain the fault prototype tuples of the unknown category; Input the fault sample to be diagnosed into the optimized multi-scale feature fusion model to obtain the multi-scale fusion fault feature of the fault sample to be diagnosed; The multi-scale fusion fault features of the fault sample to be diagnosed are compared with the fault prototype tuple of the unknown category for similarity, and the fault category corresponding to the fault prototype of the unknown category with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed is selected as the diagnosis result.
2. The zero-sample fault diagnosis method based on multi-class contrastive learning as claimed in claim 1, characterized in that: The original fault samples of known fault categories are subjected to dual-channel attention feature fusion through a multi-scale feature fusion model. The multi-scale fusion fault features of several different fault categories are obtained, and the multi-scale fusion fault feature tuples include: Inputting the original fault samples of the known fault category into two parallel convolution layers with different convolution kernel sizes to obtain a first local fault feature and a second local fault feature; Adding the first local feature and the second local feature element by element to obtain a multi-scale addition feature; The multi-scale addition features are placed in the activation layer and the maximum pooling layer to obtain multi-scale fault features; The multi-scale fault features are subjected to dual-channel attention feature fusion to obtain multi-scale fused fault features of several different fault categories, forming a multi-scale fused fault feature tuple.
3. The zero-sample fault diagnosis method based on multi-class contrastive learning as claimed in claim 2, characterized in that: The multi-scale fault features are subjected to dual-channel attention feature fusion, The multi-scale fusion fault features of several different fault categories are obtained, and the multi-scale fusion fault feature tuples include: Performing a channel attention operation on the multi-scale fault features to obtain a channel attention enhanced feature; Performing a spatial attention operation on the channel attention enhancement feature to obtain a spatial attention enhancement feature; After the spatial attention enhanced features are passed through a flattening layer and a fully connected layer, multi-scale fused fault features of several different fault categories are obtained to form a multi-scale fused fault feature tuple.
4. The zero-sample fault diagnosis method based on multi-class contrastive learning as claimed in claim 1, characterized in that: The method of performing multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature tuple, improving the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category and reducing the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, and obtaining the optimized pre-trained language model and the optimized multi-scale feature fusion model includes: Perform multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature to obtain the similarity between the multi-scale fusion fault feature and the fault prototype vector tuple; Get the preset loss function; According to the loss function, the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model are changed through the back propagation algorithm, the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category is improved, and the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories is reduced, so as to obtain the optimized pre-trained language model and the optimized multi-scale feature fusion model.
5. The zero-sample fault diagnosis method based on multi-class contrastive learning as claimed in claim 1, characterized in that: The comparing the similarity between the multi-scale fusion fault feature of the fault sample to be diagnosed and the fault prototype tuple of the unknown category, and selecting the fault category corresponding to the fault prototype of the unknown category having the highest similarity with the multi-scale fusion fault feature of the fault sample to be diagnosed as the diagnosis result includes: Get the preset text for unknown categories; According to the preset text, the fault category of each fault prototype in the fault prototype tuple of the unknown category is obtained; The similarity between the multi-scale fusion fault feature of the fault sample to be diagnosed and each fault prototype of the unknown category in the fault prototype tuple of the unknown category is calculated, and the fault category corresponding to the fault prototype with the highest similarity to the multi-scale fusion fault feature of the fault sample to be diagnosed is selected as the diagnosis result.
6. The zero-sample fault diagnosis method based on multi-class contrastive learning as claimed in claim 4, characterized in that it comprises: The loss function is: Among them, τ represents the temperature factor hyperparameter, f i and p i They are respectively represented as the fault characteristics and fault prototype of known category i, S(f i ,p j )=p j T f i , N is the number of fault categories, F is the fault prototype vector tuple, P is the multi-scale fusion fault feature tuple, and exp is the exponent.
7. A fault diagnosis system based on multi-class contrastive learning, characterized in that: include: A first acquisition module is used to acquire a fault description text; An extraction module, used for extracting fault prototype vector features of different fault categories from the fault description text by using a pre-trained language model to form a fault prototype vector tuple; The fusion module is used to perform dual-channel attention feature fusion on the original fault samples of known fault categories through a multi-scale feature fusion model to obtain fused fault features of several different fault categories to form a multi-scale fused fault feature tuple; A training module, used for performing multi-class comparative learning on the fault prototype vector tuple and the multi-scale fusion fault feature tuple, improving the similarity between the multi-scale fusion fault features and the fault prototype vector features under the same fault category and reducing the similarity between the multi-scale fusion fault features and the fault prototype vector features under different categories by changing the model parameters of the pre-trained language model and the model parameters of the multi-scale feature fusion model, so as to obtain an optimized pre-trained language model and an optimized multi-scale feature fusion model; The second acquisition module is used to input the fault description texts of all unknown fault categories into the optimized pre-trained language model to obtain the fault prototype tuples of the unknown category; The third acquisition module is used to input the fault sample to be diagnosed into the optimized multi-scale feature fusion model to obtain the multi-scale fusion fault feature of the fault sample to be diagnosed; The identification module is used to compare the multi-scale fusion fault features of the fault sample to be diagnosed with the fault prototype tuple of the unknown category for similarity, and select the fault category corresponding to the fault prototype with the highest similarity to the multi-scale fusion fault features of the fault sample to be diagnosed as the diagnosis result.
8. The fault diagnosis system based on multi-class contrastive learning as claimed in claim 7, characterized in that: The fusion module includes: A convolution unit, used for inputting the original fault samples of the known fault category into two parallel convolution layers with different convolution kernel sizes to obtain a first local fault feature and a second local fault feature; an adding unit, configured to add the first local feature and the second local feature element by element to obtain a multi-scale added feature; An enhancement unit, used for obtaining a multi-scale fault feature by placing the multi-scale addition feature into an activation layer and a maximum pooling layer; The fusion unit is used to perform dual-channel attention feature fusion on the multi-scale fault features to obtain fused fault features of several different fault categories to form a multi-scale fused fault feature tuple.
9. A terminal device, comprising a memory and a processor, characterized in that: The memory stores a computer program that can be run on the processor, and when the processor loads and executes the computer program, the method according to any one of claims 1 to 7 is adopted.
10. A computer-readable storage medium having a computer program stored therein, characterized in that: When the computer program is loaded and executed by a processor, the method according to any one of claims 1 to 7 is adopted.