Training method and device of fault diagnosis model based on small samples

By building inter-class discriminant loss function and in-class aggregation loss function, and optimizing the meta-learning model, the problem of poor fault diagnosis effect of small and medium-sized samples in the existing technology is solved, and higher fault diagnosis accuracy and robustness are achieved.

CN117763436BActive Publication Date: 2024-12-03CHINA UNIV OF PETROLEUM (BEIJING)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311519406.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2024-12-03
Estimated Expiration
2043-11-14

AI Technical Summary

Technical Problem

The existing fault diagnosis method based on small samples is difficult to learn strong discriminant characteristics in the face of scarce data and noise, resulting in poor diagnostic results and unable to meet the actual application needs.

Method used

Construct inter-class discriminant loss function and in-class aggregation loss function, and optimize the meta-learning model by optimizing the loss function to ensure that the difference between the inter-class distance and the in-class distance is greater than the preset boundary value, and improve the discriminant and reliable model Great.

Benefits of technology

The fault diagnosis model's ability to distinguish different fault categories is improved, the resistance to noise is enhanced, and the accuracy of fault diagnosis is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117763436B_ABST
    Figure CN117763436B_ABST
Patent Text Reader

Abstract

The present application discloses a training method and device for a fault diagnosis model based on a small sample. The training method for a fault diagnosis model based on a small sample includes: constructing a data set according to an acquired fault data sample, wherein the fault data sample includes fault data and a fault category corresponding to the fault data; constructing an inter-class discrimination loss function that ensures that the difference between the inter-class distance and the intra-class distance is greater than a preset boundary value; constructing an intra-class aggregation loss function that calculates the average distance in the feature space between any fault data sample and the category center of the fault category corresponding to the fault data sample; constructing an optimization loss function according to the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories; and according to the data set, using the optimization loss function to perform gradient descent optimization on the meta-learning model to obtain a fault diagnosis model based on a small sample. Thus, the accuracy of fault diagnosis is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of fault diagnosis, and in particular to a training method and device for a fault diagnosis model based on a small sample. Background Art

[0002] With the continuous progress and development of modern science and technology, industrial production processes and equipment are becoming increasingly advanced and complex, and various abnormalities and failures are inevitable. If an abnormal situation occurs in a certain link of the production process and is not discovered in time and effective measures are not taken, it may lead to serious production accidents, equipment damage and other major economic losses, and even casualties.

[0003] With the advancement of sensor technology and the accumulation of industrial big data, among the many data-driven fault detection and diagnosis data-driven methods, deep learning-based methods are based on machine learning theory and have accumulated fruitful results in the field of fault diagnosis, but there is still a large gap from practical application. The main reason is that deep learning usually relies on a premise that enough data samples can be obtained in advance. However, in practical applications, the industrial data fault samples that can be obtained are very scarce. In this case, deep learning cannot achieve the expected diagnostic effect. The existing meta-learning-based fault diagnosis method is more suitable for small sample data sets, but it is difficult to learn strong discriminative features. When the fault data is easily affected by environmental disturbances and there is noisy data, the performance of fault diagnosis is very poor and it is difficult to meet the needs of practical applications.

[0004] It can be seen that the existing fault diagnosis based on small samples has the technical problem of poor diagnostic effect. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a training method and device for a fault diagnosis model based on a small sample, so as to solve the technical problem that the fault diagnosis based on a small sample in the prior art has poor diagnostic effect.

[0006] In order to achieve the above-mentioned object, the first aspect of the present application provides a training method for a fault diagnosis model based on a small sample, comprising:

[0007] Building a data set according to the acquired fault data samples, wherein the fault data samples include fault data and fault categories corresponding to the fault data;

[0008] Construct an inter-class discrimination loss function that ensures that the difference between the inter-class distance and the intra-class distance is greater than the preset boundary value, where the inter-class distance represents the distance between the class centers of the fault classes corresponding to any two fault data samples in the feature space, and the intra-class distance represents the distance between the class centers of the fault classes corresponding to any one fault data sample and the fault data sample in the feature space;

[0009] Construct an intra-class aggregation loss function that calculates the average distance between any fault data sample and the category center of the fault category corresponding to the fault data sample in the feature space;

[0010] Construct an optimized loss function based on the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories;

[0011] According to the data set, the meta-learning model is optimized by gradient descent using the optimized loss function to obtain a fault diagnosis model based on small samples.

[0012] In the embodiment of the present application, an optimization loss function is constructed based on the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories, including:

[0013] According to the preset parameter λ, the optimization loss function is constructed by the following formula:

[0014]

[0015] In the formula, represents the inter-class discrimination loss function for all fault categories, represents the intra-class aggregation loss function for all fault categories, Represents the optimization loss function, and λ represents the preset parameter.

[0016] In the embodiment of the present application, according to the data set, the meta-learning model is optimized by gradient descent using the optimized loss function to obtain a fault diagnosis model based on a small sample, including:

[0017] Divide the dataset into training set and test set;

[0018] Divide the training set and test set into multiple tasks respectively;

[0019] The fault data of all fault categories of the training set are divided into a first support set and a first query set, and the multiple categories of the test set are divided into a second support set and a second query set;

[0020] According to the first support set, the first query set and the second support set, the meta-learning model is optimized by gradient descent using the optimized loss function to obtain a fault diagnosis model based on small samples.

[0021] In the embodiment of the present application, according to the first support set, the first query set and the second support set, the meta-learning model is gradient-optimized by using the optimization loss function to obtain a fault diagnosis model based on a small sample, including:

[0022] According to the first support set and the first query set, the optimization loss function of each task is calculated, and the meta-learning model is optimized by gradient descent using the optimization loss function to obtain an initial fault diagnosis model based on a small sample;

[0023] The category center of the fault category corresponding to the samples belonging to the second support set is calculated according to the second support set, and the fault diagnosis model based on small samples is constructed according to the initial fault diagnosis model based on small samples and the category center of the fault category corresponding to the samples belonging to the second support set.

[0024] In the embodiment of the present application, the fault diagnosis model based on a small sample is:

[0025]

[0026] In the formula, represents the initial small sample based fault diagnosis model, x q Indicates the fault sample to be diagnosed, c m represents the category center of the fault category corresponding to the m-th sample in the test set, that is, the category center of the fault category corresponding to the sample belonging to the second support set, Express request With c m The distance Express request The parameters to obtain the minimum value, Represents x q The corresponding fault category.

[0027] A second aspect of the present application provides a fault diagnosis method, comprising:

[0028] Obtain samples of faults to be diagnosed;

[0029] The fault sample to be diagnosed is input into a small sample-based fault diagnosis model to obtain a corresponding fault category, wherein the small sample-based fault diagnosis model is obtained by the training method of the small sample-based fault diagnosis model according to any one of the first aspects.

[0030] The third aspect of the present application provides a training device for a fault diagnosis model based on a small sample, comprising:

[0031] a memory configured to store instructions; and

[0032] A processor is configured to call instructions from a memory and implement the training method of a small sample-based fault diagnosis model according to any one of the first aspects when executing the instructions.

[0033] A fourth aspect of the present application provides a fault diagnosis device, comprising:

[0034] a memory configured to store instructions; and

[0035] The processor is configured to call instructions from a memory and implement the fault diagnosis method according to the second aspect when executing the instructions.

[0036] A fifth aspect of the present application provides an electronic device, including:

[0037] A training device for a fault diagnosis model based on a small sample according to the third aspect; or

[0038] A fault diagnosis device according to the fourth aspect.

[0039] The sixth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the training method for a fault diagnosis model based on a small sample according to any one of the first aspects, or the fault diagnosis method according to the second aspect.

[0040] Through the above technical scheme, an inter-class discrimination loss function is constructed to ensure that the difference between the inter-class distance and the intra-class distance is greater than a preset boundary value, and an intra-class aggregation loss function is constructed to calculate the average distance in the feature space from any one of the fault data samples to the category center of the fault category corresponding to the fault data sample. The model is optimized using the inter-class discrimination loss function and the intra-class aggregation function, so that the obtained fault diagnosis model based on small samples can better distinguish different fault categories, is more robust, and is not easily affected by noise, thereby improving the accuracy of fault diagnosis.

[0041] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0043] Figure 1 A schematic diagram of a process flow of a method for training a fault diagnosis model based on a small sample according to an embodiment of the present application is shown;

[0044] Figure 2 A schematic diagram of a process flow of a fault diagnosis method according to an embodiment of the present application is shown;

[0045] Figure 3 A schematic diagram of the structure of a training device for a fault diagnosis model based on a small sample according to an embodiment of the present application is shown;

[0046] Figure 4 A schematic diagram of the structure of a fault diagnosis device according to an embodiment of the present application is shown schematically. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0048] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0049] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0050] Figure 1 The flowchart of a method for training a fault diagnosis model based on a small sample according to an embodiment of the present application is schematically shown. Figure 1 As shown, an embodiment of the present application provides a training method for a fault diagnosis model based on a small sample, and the method may include the following steps.

[0051] Step 110: construct a data set according to the acquired fault data samples, wherein the fault data samples include fault data and fault categories corresponding to the fault data.

[0052] It should be noted that the model provided in this application is a fault diagnosis model based on a small sample, so the number of fault data samples should be a small sample. The existing machine learning model for fault diagnosis requires a large number of samples as training data. In practical applications, there may be a situation where there are many data categories but the number of each type of data samples is very small. In this case, the machine learning model often fails to meet the accuracy requirements of fault diagnosis in practical applications. Therefore, the embodiment of the present application adopts a meta-learning method to construct a fault diagnosis model based on a small sample, which can use a small amount of data of these known categories to learn an initial model, so that the model can also have a better diagnostic effect when the training data is less. The data size of the small sample is also different according to different task types and data complexity, and the embodiment of the present application does not limit this.

[0053] Meta-learning methods are also called "learning to learn" methods. Their goal is to obtain an initial model that can quickly adapt to new tasks from a small amount of experience. Meta-learning methods often use the "N-way K-shot" learning task, which divides the data set into multiple tasks, and then divides each task into multiple support sets (Support Set) and query sets (Query Set). First, learn on the samples of one task, and then learn other tasks in turn. "N-way" means that the number of categories in each task is N, and "K-shot" means that the number of samples in the support set in each category is K. The support set and query set are unique concepts in meta-learning. The support set is the data sample used to train the model, and the query set is the data sample used to test and optimize the model. The model uses a small number of K samples in the support set of each category, first learns on the support set, and then predicts and optimizes the model performance on the query set, thereby obtaining an initial model that can have a good learning effect even in a small sample data set.

[0054] Specifically, the fault data sample includes fault data and a fault category corresponding to the fault data, wherein the fault data is a feature of the fault data sample, and the fault category corresponding to the fault data is a label of the fault data sample.

[0055] It is understandable that fault data samples can be obtained from various data sources, such as equipment logs, fault reports, etc., and fault data samples can come from different fields and equipment, such as industrial equipment failures, transportation failures, computer hardware failures, software application failures, power system failures, etc. The embodiments of the present application are not limited to this.

[0056] Step 120: construct an inter-class discrimination loss function that ensures that the difference between the inter-class distance and the intra-class distance is greater than a preset boundary value, wherein the inter-class distance represents the distance between the category centers of the fault categories corresponding to any two fault data samples in the feature space, and the intra-class distance represents the distance between any one fault data sample and the category center of the fault category corresponding to the fault data sample in the feature space.

[0057] It should be noted that the small sample-based fault diagnosis model provided in the embodiment of the present application adopts a meta-learning method, while the existing meta-learning methods usually directly use cross entropy loss or mean square error loss to optimize the model, and do not explicitly quantify the degree of inter-class differences. In the optimization process, there is a lack of effective use of feature intra-class similarity and inter-class differences, and it is difficult to learn strong discriminative features. Therefore, when the fault data is susceptible to environmental disturbances or there may be noisy data, the performance of fault diagnosis using meta-learning will be very poor. Therefore, the embodiment of the present application provides two loss functions to optimize the model, wherein the purpose of the inter-class discriminant loss function is to make the features of samples of the same category closer (that is, the intra-class distance is as small as possible), and the features of samples of different categories are far away from each other (that is, the inter-class distance is as large as possible). In order to achieve this purpose, the inter-class discriminant loss function is constructed by ensuring that the difference between the inter-class distance and the intra-class distance is greater than the preset boundary value.

[0058] For many data, a single sample is easily affected by noise. Compared with the existing triple loss that directly uses a single sample to calculate the category center, the inter-class discrimination loss function provided in the embodiment of the present application uses the mean of multiple samples to calculate the category center, which is more representative. In addition, the triple loss uses a single data point as an "anchor point", sample points of the same type as "positive examples", and the nearest heterogeneous sample points as "negative examples". By making the distance from the anchor point to the negative example greater than the distance to the positive example by a larger margin, better discrimination is achieved. Therefore, the minimum value of the distance between the category centers of the fault categories corresponding to any two fault data samples in the feature space is used, rather than the distance between any sample and the nearest heterogeneous sample center as the representation of the inter-class distance, which will enable the model to better distinguish different fault categories, and be more robust and less susceptible to noise.

[0059] Step 130: construct an intra-class aggregation loss function that calculates the average distance between any fault data sample and the class center of the fault class corresponding to the fault data sample in the feature space.

[0060] It is understandable that the inter-class discrimination loss function constrains the difference between the inter-class distance and the intra-class distance, that is, it only considers the relative relationship, but lacks constraints on the absolute distance within the class, that is, it does not consider the absolute relationship. In order to encourage the clustering effect of similar samples, the center loss function can be used to calculate the absolute distance between classes. However, the existing center loss function only uses small batches of data to recalculate the category center under ordinary training methods. During training, the specific category data of each batch will be calculated and updated. The batches processed by meta-learning are tasks rather than specific category data. Therefore, the center loss function is not applicable to this situation.

[0061] In order to better measure the absolute distance between classes in meta-learning, the embodiment of the present application constructs an intra-class aggregation loss function that calculates the average distance between any fault data sample and the category center of the fault category corresponding to the fault data sample in the feature space. The intra-class aggregation loss function calculates and updates the specific category data in each task during the training process of meta-learning, which can more accurately measure the absolute distance between classes in meta-learning, thereby enhancing the discriminability of the model.

[0062] Step 140: construct an optimized loss function based on the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories.

[0063] In the embodiment of the present application, step 140 includes:

[0064] Step 141: According to the preset parameter λ, an optimization loss function is constructed by the following formula:

[0065]

[0066] In the formula, represents the inter-class discrimination loss function for all fault categories, represents the intra-class aggregation loss function for all fault categories, Represents the optimization loss function, and λ represents the preset parameter.

[0067] It can be understood that λ represents a preset parameter, which determines the relative importance of the inter-class discriminant loss function and the intra-class aggregation loss function in the optimization loss function, so that both loss functions can receive sufficient attention during the optimization process. When the calculated value of the inter-class discriminant loss function and the calculated value of the intra-class aggregation loss function are not at the same scale, if the two are directly summed to construct the optimization loss function, the scale of one of the losses will be too large, so that the loss will dominate the final optimization loss function during the optimization process, making the influence of the other loss too small and unable to be fully optimized. Therefore, the preset parameter λ can be adjusted according to the calculated value of the intra-class aggregation loss function, and the calculated value of the inter-class discriminant loss function and the calculated value of the intra-class aggregation loss function are adjusted to the same scale, so that the optimization loss function can reflect the combined influence of the inter-class discriminant loss function and the intra-class aggregation loss function at a suitable scale, thereby improving the optimization effect of the optimization loss function on the model.

[0068] It should be noted that the preset parameter λ can be adjusted dynamically in real time. According to the continuous calculation and update of the calculated value of the intra-class aggregation loss function, the preset parameter λ will also be continuously adjusted to ensure that the calculated value of the inter-class discrimination loss function and the calculated value of the intra-class aggregation loss function are always kept at the same scale during the optimization process of the model, ensuring the balance between the inter-class discrimination loss function and the intra-class aggregation loss function.

[0069] Step 150: According to the data set, the meta-learning model is optimized by gradient descent using the optimized loss function to obtain a fault diagnosis model based on a small sample.

[0070] It should be noted that the small sample-based fault diagnosis model provided in the embodiment of the present application is obtained by training through metric-based meta-learning, and metric-based meta-learning does not directly optimize the model using labels, but defines the distance or similarity metric between instances, and optimizes the model through this metric to make similar instances closer. Therefore, in the embodiment of the present application, the above-mentioned optimized loss function that measures the instance distance is used to perform gradient descent optimization on the model, which can meet the learning requirements of metric-based meta-learning.

[0071] In metric-based meta-learning, the meta-learning model can be understood as a feature space, i.e., a feature mapping module, the main idea of ​​which is to map the input features into a high-dimensional space, and then predict the category based on the distance or similarity of the features in this space. In the embodiment of the present application, the meta-learning model can be a fully connected neural network, a residual network, etc., which is not limited in the embodiment of the present application.

[0072] Specifically, according to the acquired data set, the meta-learning model is optimized by gradient descent using the optimized loss function, the gradient of the optimized loss function relative to the meta-learning model parameters is calculated, and the parameters of the meta-learning model are updated, where the update direction is the direction of gradient descent, and the parameters are updated in the parameter space along the direction where the loss function decreases fastest, so as to minimize the optimized loss function and obtain a fault diagnosis model based on small samples.

[0073] By optimizing the loss function and performing gradient descent optimization on the meta-learning model, the predicted value of the model in each task can be made closer and closer to the true value, and finally a fault diagnosis model based on small samples that meets the needs of actual applications is obtained, thereby improving the accuracy of fault diagnosis.

[0074] In the embodiment of the present application, step 150 includes:

[0075] Step 151, dividing the data set into a training set and a test set;

[0076] Step 152, dividing the training set and the test set into multiple tasks respectively;

[0077] Step 153, dividing the fault data of all fault categories of the training set into a first support set and a first query set, and dividing the multiple categories of the test set into a second support set and a second query set;

[0078] Step 154 ​​: According to the first support set, the first query set, and the second support set, the meta-learning model is optimized by gradient descent using an optimized loss function to obtain a fault diagnosis model based on a small sample.

[0079] Specifically, the data set is divided into a training set and a test set. In the embodiment of the present application, a division ratio of 4:1 is selected, that is, 80% of the data categories are randomly selected as training sets, and 20% of the data categories are selected as test sets, wherein the categories of the training set and the test set are not repeated; and the training set and the test set are randomly divided into multiple tasks, and each category of data is divided into a first support set and a first query set according to the category of the samples in each task of the training set, and a "3-way 5-shot" learning task is adopted, wherein "3-way5-shot" means that each task contains 3 categories of data, 5 samples in each category of data are the first support set, and the remaining samples in this category of data are the first query set. The test set is divided in the same way, and the test set is divided into multiple tasks, each task contains 3 categories of data, 5 samples in each category of data are the second support set, and the remaining samples in this category of data are the second query set.

[0080] By dividing the training set and the test set and ensuring that the sample categories of the training set and the test set are not repeated, the model can have a good diagnostic effect on unprecedented fault categories; and adopting the "3-way 5-shot" learning task and dividing each task into a support set and a query set, the model is allowed to learn based on small sample data of each task and each category, so that the model can have a good learning effect even under a small sample data set.

[0081] In the embodiment of the present application, step 154 ​​includes:

[0082] According to the first support set and the first query set, the optimization loss function of each task is calculated, and the meta-learning model is optimized by gradient descent using the optimization loss function to obtain an initial fault diagnosis model based on a small sample;

[0083] The category center of the fault category corresponding to the samples belonging to the second support set is calculated according to the second support set, and the fault diagnosis model based on small samples is constructed according to the initial fault diagnosis model based on small samples and the category center of the fault category corresponding to the samples belonging to the second support set.

[0084] It should be noted that both the training set and the test set in this application will participate in the training of the model. By optimizing the preset meta-learning model through the first support set and the first query set in the training set, an initial fault diagnosis model based on a small sample can be obtained. However, this model cannot be directly applied. It is also necessary to use the second support set in the test set to calculate the category center of the fault category corresponding to the samples belonging to the second support set. Only according to the initial fault diagnosis model based on a small sample and the category center of the fault category corresponding to the samples belonging to the second support set can a fault diagnosis model based on a small sample that meets engineering needs and can be actually applied be obtained.

[0085] Specifically, the first support set in each task is used to calculate the inter-class distance, that is, the distance between the class centers of the fault classes corresponding to any two fault data samples in the feature space, and then the first support set and the first query set are used to calculate the intra-class distance, that is, the distance between the class centers of the fault classes corresponding to any fault data sample in the first query set and the fault data sample in the feature space. By ensuring that the inter-class distance is greater than the preset boundary value of the intra-class distance, the inter-class discrimination is improved, which can be expressed by the following formula:

[0086]

[0087] In the formula, f Φ represents the feature space, i.e., the meta-learning model, x j represents the jth sample in the first query set, c n Represents x j The category center of the fault category corresponding to the n-th category sample, d(fΦ (x p ), c n ) means to find f Φ (x j ) and c n The distance between them, α represents the preset boundary, c a With c b represents the category center of the ath class and the bth class corresponding to any two samples, d(c a , c b ) means to find c a With c b The distance between It means to find d(c a , c b ) is the minimum value of .

[0088] where c n 、c a With c b They are all calculated based on the first support set using the following formula, taking n as an example:

[0089]

[0090] In the formula, x i represents the i-th sample in the first support set, f Φ represents the meta-learning model, S n represents the first support set in the nth class sample, |S n | represents the number of samples in the first support set of the nth class sample, N represents the total number of fault categories in the training set, Indicates that S n According to each x i The calculated f Φ (x i ) to sum, c n Represents x i The category center of the fault category corresponding to the n-th category sample.

[0091] It should be noted that since the first support set and the first query set are divided for the same type of samples, x j The category center of the fault category corresponding to the n-th category sample is x i The category center of the fault category corresponding to the n-th category sample has the same meaning.

[0092] Based on the above formula, the inter-class discrimination loss function of the n-th class sample of each task in the training set can be expressed by the following formula:

[0093]

[0094] In the formula, represents the inter-class discrimination loss function of the n-th class sample of each task in the training set, Q n represents the first query set in the nth class of samples, x j represents the jth sample in the first query set, d(f Φ (x j ), c n ) means to find f Φ (x j ) and c n The distance between Indicates that Q n According to each x j The calculated d(f Φ (x j ), c n ) to sum, express A value greater than 0 in .

[0095] The inter-class discriminant loss function of each class in each task of the training set is summed to obtain the inter-class discriminant loss function of each task in the training set, which is expressed by the following formula:

[0096]

[0097] In the formula, Represents the inter-class discriminative loss function for all fault classes in the training set for each task.

[0098] The intra-class clustering loss function is calculated using the first support set and the first query set. Specifically, the average distance between the class centers of the fault classes corresponding to the j-th sample and the j-th sample in the first query set in the feature space is calculated, which can be expressed by the following formula:

[0099]

[0100] In the formula, |Q n | represents the number of samples in the first query set in the nth class of samples, represents the intra-class aggregation loss function for the n-th class samples of each task in the training set.

[0101] The intra-class aggregation loss function of each class in each task of the training set is summed to obtain the intra-class aggregation loss function of each task in the training set, which is expressed by the following formula:

[0102]

[0103] In the formula, Represents the intra-class aggregate loss function for all fault classes in the training set for each task.

[0104] According to the preset parameter λ, the optimization loss function of each task in the training set is constructed by the following formula:

[0105]

[0106] In the formula, represents the inter-class discrimination loss function for all fault categories of each task in the training set, represents the intra-class aggregate loss function for all fault categories for each task in the training set, represents the optimization loss function for each task in the training set, and λ represents the preset parameter.

[0107] Each task in the training set is traversed in turn, the optimized loss function of each task in the training set is calculated, and the meta-learning model is optimized by gradient descent using the optimized loss function to obtain the initial fault diagnosis model based on small samples.

[0108] By using the optimized loss function to perform gradient descent optimization on the meta-learning model, the initial small-sample-based fault diagnosis model is obtained, which can enable the model to have good learning performance even under small sample data sets, and is conducive to the subsequent construction of a small-sample-based fault diagnosis model that meets production needs.

[0109] In the embodiment of the present application, the fault diagnosis model based on a small sample is:

[0110]

[0111] In the formula, represents the initial small sample based fault diagnosis model, x q Indicates the fault sample to be diagnosed, c m represents the category center of the fault category corresponding to the m-th sample in the test set, that is, the category center of the fault category corresponding to the sample belonging to the second support set, Express request With c m The distance Express request The parameters to obtain the minimum value, Represents x q The corresponding fault category.

[0112] It should be noted that since the second support set and the second query set are divided for samples of the same type, the category center of the fault category corresponding to the mth sample in the test set has the same meaning as the category center of the fault category corresponding to the sample belonging to the second support set or the second query set.

[0113] Specifically, the fault sample x to be diagnosed q Input into the initial small sample based fault diagnosis model obtained in the above embodiment, and obtain And calculate the category center of the fault category corresponding to the mth sample in the training set, and get cm. The parameter when the minimum value is obtained is x q The corresponding fault category.

[0114] In order to test the effect of the small sample-based fault diagnosis model obtained in the embodiment of the present application, the fault data in the second query set can be input into the small sample-based fault diagnosis model to obtain the predicted fault category, and an evaluation index is selected to evaluate the prediction effect of the small sample-based fault diagnosis model on the second query set according to the predicted fault category and the actual fault category in the second query set, so as to objectively evaluate the diagnostic effect of the model on fault diagnosis. It should be noted that there are many evaluation indicators, such as accuracy, confusion matrix, etc., which are not limited in the embodiment of the present application.

[0115] The small sample-based fault diagnosis model provided in the embodiment of the present application constructs an inter-class discrimination loss function that ensures that the difference between the inter-class distance and the intra-class distance is greater than a preset boundary value, and an intra-class aggregation loss function that calculates the average distance in the feature space from any one of the fault data samples to the category center of the fault category corresponding to the fault data sample, and optimizes the model using the inter-class discrimination loss function and the intra-class aggregation function, so that the obtained small sample-based fault diagnosis model has better distinction between different fault categories, is more robust, and is not easily affected by noise, thereby improving the accuracy of fault diagnosis.

[0116] Figure 2 The flowchart of a fault diagnosis method according to an embodiment of the present application is schematically shown. Figure 2 As shown, an embodiment of the present application provides a fault diagnosis method, which may include the following steps.

[0117] Step 210: Obtain a fault sample to be diagnosed;

[0118] Step 220: input the fault sample to be diagnosed into a small sample-based fault diagnosis model to obtain a corresponding fault category, wherein the small sample-based fault diagnosis model is obtained by a training method for a small sample-based fault diagnosis model according to any one of the first aspects.

[0119] It can be understood that the fault samples to be diagnosed can be obtained from data sources such as equipment logs and fault reports. By inputting the fault samples to be diagnosed that need to be diagnosed into the small sample-based fault diagnosis model provided in the above embodiment, the fault category corresponding to the fault samples to be diagnosed can be obtained.

[0120] The screw detection method provided in the embodiment of the present application obtains fault samples to be diagnosed that need to be diagnosed, and inputs the fault samples to be diagnosed into the small sample-based fault diagnosis model provided in the above embodiment, thereby obtaining a fault category with higher accuracy.

[0121] Figure 3 The structure diagram of a training device for a fault diagnosis model based on a small sample according to an embodiment of the present application is schematically shown. Figure 3 As shown, an embodiment of the present application provides a training device for a fault diagnosis model based on a small sample, the device comprising:

[0122] Memory 310, configured to store instructions; and

[0123] The processor 320 is configured to call instructions from the memory 310 and implement the training method of the fault diagnosis model based on small samples according to any one of the first aspects when executing the instructions.

[0124] Specifically, in the embodiment of the present application, the processor 320 may be configured to:

[0125] Building a data set according to the acquired fault data samples, wherein the fault data samples include fault data and fault categories corresponding to the fault data;

[0126] Construct an inter-class discrimination loss function that ensures that the difference between the inter-class distance and the intra-class distance is greater than the preset boundary value, where the inter-class distance represents the distance between the class centers of the fault classes corresponding to any two fault data samples in the feature space, and the intra-class distance represents the distance between the class centers of the fault classes corresponding to any one fault data sample and the fault data sample in the feature space;

[0127] Construct an intra-class aggregation loss function that calculates the average distance between any fault data sample and the category center of the fault category corresponding to the fault data sample in the feature space;

[0128] Construct an optimized loss function based on the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories;

[0129] According to the data set, the meta-learning model is optimized by gradient descent using the optimized loss function to obtain a fault diagnosis model based on small samples.

[0130] It can be understood that the training device for the fault diagnosis model based on small samples provided in the embodiment of the present application can implement the various processes of the training method for the fault diagnosis model based on small samples in the above-mentioned embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0131] Figure 4The structure diagram of a fault diagnosis device according to an embodiment of the present application is schematically shown. Figure 4 As shown, an embodiment of the present application provides a fault diagnosis device, the device comprising:

[0132] Memory 410, configured to store instructions; and

[0133] The processor 420 is configured to call instructions from the memory 410 and implement the fault diagnosis method according to the second aspect when executing the instructions.

[0134] Specifically, in the embodiment of the present application, the processor 420 may be configured to:

[0135] Obtain samples of faults to be diagnosed;

[0136] The fault sample to be diagnosed is input into a small sample-based fault diagnosis model to obtain a corresponding fault category, wherein the small sample-based fault diagnosis model is obtained by the training method of the small sample-based fault diagnosis model according to any one of the first aspects.

[0137] It can be understood that the fault diagnosis device provided in the embodiment of the present application can implement each process based on the fault diagnosis method in the above embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0138] The present application also provides an electronic device, which may include:

[0139] A training device for a fault diagnosis model based on a small sample according to the third aspect; or

[0140] A fault diagnosis device according to the fourth aspect.

[0141] It can be understood that the electronic device provided in the embodiment of the present application includes a training device for the fault diagnosis model based on small samples according to the third aspect, or a fault diagnosis device according to the fourth aspect, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0142] An embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the training method of a fault diagnosis model based on a small sample according to any one of the first aspects, or the fault diagnosis method according to the second aspect, and can achieve the same technical effect. To avoid repetition, they are not repeated here.

[0143] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0144] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0145] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0146] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0148] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0149] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0150] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0151] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A training method for a fault diagnosis model based on a small sample, characterized in that: include: Constructing a data set according to the acquired fault data samples, wherein the fault data samples include fault data and a fault category corresponding to the fault data; Constructing an inter-class discrimination loss function that ensures that the difference between the inter-class distance and the intra-class distance is greater than a preset boundary value, wherein the inter-class distance represents the distance between the class centers of the fault classes corresponding to any two of the fault data samples in the feature space, and the intra-class distance represents the distance between any one of the fault data samples and the class center of the fault class corresponding to the fault data sample in the feature space; Constructing an intra-class aggregation loss function that calculates the average distance between any one of the fault data samples and the class center of the fault class corresponding to the fault data sample in the feature space; Constructing an optimization loss function according to the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories; According to the data set, performing gradient descent optimization on the meta-learning model using the optimization loss function to obtain the small sample-based fault diagnosis model; The step of performing gradient descent optimization on the meta-learning model using the optimization loss function according to the data set to obtain the fault diagnosis model based on a small sample includes: Dividing the data set into a training set and a test set; Divide the training set and the test set into multiple tasks respectively; Dividing the fault data of all the fault categories of the training set into a first support set and a first query set, respectively, and dividing the multiple categories of the test set into a second support set and a second query set; According to the first support set, the first query set and the second support set, the meta-learning model is optimized by gradient descent using the optimization loss function to obtain the small sample-based fault diagnosis model; The step of performing gradient descent optimization on the meta-learning model using the optimization loss function according to the first support set, the first query set, and the second support set to obtain the small sample-based fault diagnosis model includes: According to the first support set and the first query set, the optimization loss function of each of the tasks is calculated, and the meta-learning model is optimized by gradient descent using the optimization loss function to obtain an initial small sample-based fault diagnosis model; Calculating the category center of the fault category corresponding to the samples belonging to the second support set according to the second support set, and constructing the small sample-based fault diagnosis model according to the initial small sample-based fault diagnosis model and the category center of the fault category corresponding to the samples belonging to the second support set; The fault diagnosis model based on small samples is: In the formula, represents the initial small sample based fault diagnosis model, x q represents the sample of the fault to be diagnosed, c m represents the category center of the fault category corresponding to the m-th sample in the test set, that is, the category center of the fault category corresponding to the sample belonging to the second support set, Express request With c m The distance Express request The parameters to obtain the minimum value, Represents x q The corresponding fault category.

2. The training method of the fault diagnosis model based on small samples according to claim 1 is characterized in that: The optimizing loss function is constructed based on the inter-class discrimination loss function and the intra-class aggregation loss function of all fault categories, including: According to the preset parameter λ, the optimization loss function is constructed by the following formula: In the formula, represents the inter-class discrimination loss function for all fault categories, represents the intra-class aggregation loss function for all fault categories, represents the optimization loss function, and λ represents the preset parameter.

3. A fault diagnosis method, characterized in that: include: Obtain samples of faults to be diagnosed; The fault sample to be diagnosed is input into the small sample-based fault diagnosis model to obtain a corresponding fault category, wherein the small sample-based fault diagnosis model is obtained by the training method of the small sample-based fault diagnosis model according to any one of claims 1 to 2.

4. A training device for a fault diagnosis model based on a small sample, characterized in that: include: a memory configured to store instructions; as well as A processor is configured to call the instructions from the memory and implement the training method of the small sample-based fault diagnosis model according to any one of claims 1 to 2 when executing the instructions.

5. A fault diagnosis device, characterized in that: include: a memory configured to store instructions; as well as A processor is configured to call the instructions from the memory and implement the fault diagnosis method according to claim 3 when executing the instructions.

6. An electronic device, characterized in that: include: The training device for the fault diagnosis model based on small samples according to claim 4; or The fault diagnosis device according to claim 5.

7. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions for causing a machine to execute the training method for a fault diagnosis model based on a small sample according to any one of claims 1 to 2, or the fault diagnosis method according to claim 3.

Citation Information

Patent Citations

  • Circuit breaker fault diagnosis method and system based on convolutional prototype network

    CN115905972A

  • Equipment fault diagnosis method based on semi-supervised small sample

    CN116451150A