Train fault identification method and system
Through the improved supervision and comparison learning network, the data set samples are sampled, which solves the problem of low accuracy in the identification of occasional faults in the prior art, and efficient identification and timely alarm of train faults are achieved, and safety is improved.
Patent Information
- Application Number
- CN202411500834.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-14
AI Technical Summary
The existing train fault identification methods account for a small proportion of occasional faults in the data set, resulting in the training of the neural network model having low accuracy in identifying the occasional faults of the train, and the accidental faults cannot be detected in time, causing safety hazards.
Using an improved supervised comparison learning network, the data set samples are sampled through a priori and posterior probability distributions to ensure that the sampling probability of large and small data set samples converges to 1/K, K is the number of labels, and balances the data. Imbalance problem.
It improves the recognition efficiency of long-tail data, reduces the negative impact of sample imbalance on the recognition situation, enhances the accuracy of occasional fault identification, improves the stability and accuracy of fault identification, and shortens the time for fault detection.
Smart Images

Figure CN119445221A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an image recognition method and system. Background Art
[0002] During the running of the train, some occasional faults with extremely low frequency but serious consequences may occur, such as the breaking of bolts at the axle box tie rod seat, which will cause great safety hazards. In order to ensure the smooth and safe operation of the train, it is necessary to discover such occasional faults in time and stop the train as soon as possible.
[0003] In the existing train fault identification method using neural network models, since multiple train faults need to be identified, the above-mentioned occasional faults with extremely low frequency account for a small proportion in the data set, and many other more frequent faults account for a large proportion in the data set, and the fault distribution has a certain long-tail characteristic. In the training process of the neural network model, there will be an imbalance in the training samples, which will make the trained neural network model have low accuracy in identifying occasional train faults, and fail to detect occasional faults in time, thus causing safety hazards. Summary of the invention
[0004] The purpose of the present invention is to overcome the problem in the existing train fault identification method that, due to the small proportion of sporadic faults in the data set, the trained neural network model has low accuracy in identifying sporadic train faults and cannot detect sporadic faults in time, and a train fault identification method and system are provided.
[0005] The present invention provides a train fault identification method, the steps of which are as follows:
[0006] Step 1: Collect images of the faulty parts of the train to be identified;
[0007] Step 2: Input the fault location image into the train fault recognition model;
[0008] The train fault identification model includes an improved supervised contrastive learning network;
[0009] During the training of the train fault identification model, when the improved supervised contrastive learning network samples the data set samples, the sampling probability of the large number of data set samples and the sampling probability of the small number of data set samples converge to 1 / K; K is the number of labels;
[0010] The labels of the samples in the large dataset are the same, the labels of the samples in the small dataset are the same, and the labels of the samples in the large dataset are different from the labels of the samples in the small dataset;
[0011] Step 3: If there is a fault in the fault location image, the train fault identification model will alarm.
[0012] Furthermore, the train fault identification model training process is as follows:
[0013] Step 21: Input the data set samples into the train fault identification model;
[0014] The data set samples include train non-fault images, train common fault images and train occasional fault images; and the proportion of train occasional fault images in the data set samples is smaller than the proportion of train non-fault images and / or train common fault images in the data set samples;
[0015] Step 22: Conduct the first round of training on the train fault identification model;
[0016] Among them, the supervised contrastive learning network samples the data set samples according to the prior probability;
[0017] The prior probability follows the following prior probability distribution:
[0018]
[0019] Among them, y i is the label corresponding to an anchor image selected by the train image feature extraction network; p(y i ) is the cumulative sampling probability of the data set samples corresponding to each label when the sampling probability of each data set sample as an anchor image follows a uniform distribution; tanh is the hyperbolic tangent function; λ∈(0,1) and φ∈(0,1) are both adjustable parameters; I is the set of all labels; y j Any of all tags;
[0020] Step 23: Perform the Sth round of training on the train fault identification model; the initial value of S is 2, and S is greater than or equal to 2;
[0021] Among them, the supervised contrastive learning network samples the data set based on the posterior probability train;
[0022] The posterior probability follows the posterior probability distribution:
[0023]
[0024]
[0025] Among them, z i and z a These are the normalized features obtained by extracting features from the dataset samples and calculating them through the supervised contrastive learning network in the S-1 round of training:
[0026]
[0027]
[0028] F is the feature extractor in the supervised contrastive learning network; x i An anchor image selected for the supervised contrastive learning network; x a is the rest of the instances with the same label as the anchor image; P(i) is the set of all positive samples; B is any batch of image sample-label pairs; ψ is the posterior probability influence rate adjustment parameter
[0029] Step 24: determine whether the train fault identification model meets the training completion condition, and if so, complete the training of the train fault identification model;
[0030] Otherwise, set S+1 and return to execute steps 2 and 3.
[0031] Furthermore, step 22 and step 23 further include:
[0032] If there are labels that have not been sampled, a random sampling is performed on the dataset samples corresponding to the labels.
[0033] Further, the supervised contrast loss SCL of the improved supervised contrast learning network includes:
[0034]
[0035] in, τ is the temperature parameter; P(i) is the set of all positive samples, |P(i)| represents its cardinality; x p is a positive sample, and p is the ordinal number of the positive sample.
[0036] Furthermore, the supervised contrast loss SCL of the improved supervised contrast learning network also includes:
[0037]
[0038] The present invention also provides a train fault identification system, comprising:
[0039] An image acquisition module, used to acquire images of the faulty parts of the train to be identified;
[0040] A fault identification module, used for inputting the fault location image into the train fault identification model;
[0041] The train fault identification model includes an improved supervised contrastive learning network;
[0042] During the training of the train fault identification model, when the improved supervised contrastive learning network samples the data set samples, the sampling probability of the large number of data set samples and the sampling probability of the small number of data set samples converge to 1 / K; K is the number of labels;
[0043] The labels of the samples in the large dataset are the same, the labels of the samples in the small dataset are the same, and the labels of the samples in the large dataset are different from the labels of the samples in the small dataset;
[0044] And used to alarm when a fault exists in the image of the fault part.
[0045] Furthermore, it also includes:
[0046] A train fault identification model training module, used to input data set samples into the train fault identification model;
[0047] The data set samples include train non-fault images, train common fault images and train occasional fault images; and the proportion of train occasional fault images in the data set samples is smaller than the proportion of train non-fault images and / or train common fault images in the data set samples;
[0048] and, used for the first round of training of the train fault identification model;
[0049] Among them, the supervised contrastive learning network samples the data set samples according to the prior probability;
[0050] The prior probability follows the following prior probability distribution:
[0051]
[0052] Among them, y i is the label corresponding to an anchor image selected by the train image feature extraction network; p(y i ) is the cumulative sampling probability of the data set samples corresponding to each label when the sampling probability of each data set sample as an anchor image follows a uniform distribution; tanh is the hyperbolic tangent function; λ∈(0,1) and φ∈(0,1) are both adjustable parameters; I is the set of all labels; y j Any of all tags;
[0053] and, used for performing the Sth round of training on the train fault identification model; the initial value of S is 2, and S is greater than or equal to 2;
[0054] Among them, the supervised contrastive learning network samples the data set based on the posterior probability train;
[0055] The posterior probability follows the posterior probability distribution:
[0056]
[0057]
[0058] Among them, z i and z aThese are the normalized features obtained by extracting features from the dataset samples and calculating them through the supervised contrastive learning network in the S-1 round of training:
[0059]
[0060]
[0061] F is the feature extractor in the supervised contrastive learning network; x i An anchor image selected for the supervised contrastive learning network; x a is the rest of the instances with the same label as the anchor image; P(i) is the set of all positive samples; B is any batch of image sample-label pairs; ψ is the posterior probability influence rate adjustment parameter
[0062] and, used to determine whether the train fault identification model meets the training completion condition, and if so, complete the training of the train fault identification model;
[0063] Otherwise, let S+1 and continue to train the train fault recognition model for the Sth round.
[0064] Furthermore, the train fault identification model training module is also used to:
[0065] When there are labels that have not been sampled, a random sampling is performed on the data set samples corresponding to the labels.
[0066] Further, the supervised contrast loss SCL of the improved supervised contrast learning network includes:
[0067]
[0068] in, τ is the temperature parameter; P(i) is the set of all positive samples, |P(i)| represents its cardinality; x p is a positive sample, and p is the ordinal number of the positive sample.
[0069] Furthermore, the supervised contrast loss SCL of the improved supervised contrast learning network also includes:
[0070]
[0071] The beneficial effects of the present invention are:
[0072] The train fault identification method and system of the present invention use an improved supervised comparative learning method to improve the recognition efficiency of long-tail data, reduce the negative impact of sample imbalance on the recognition situation, and enhance the accuracy of occasional fault identification. It improves the stability and accuracy of fault identification and effectively shortens the time of fault detection. It can quickly and accurately detect occasional faults, thereby reducing or even eliminating safety hazards. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 The present invention is a flow chart of a train fault identification model training process in the train fault identification method of the present invention. DETAILED DESCRIPTION
[0074] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0075] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0076] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention. Specific implementation method 1
[0078] The train fault identification method of this embodiment has the following steps:
[0079] Step 1: Collect images of the faulty parts of the train to be identified;
[0080] Step 2: Input the fault location image into the train fault recognition model;
[0081] The train fault identification model includes an improved supervised contrastive learning network;
[0082] During the training of the train fault identification model, when the improved supervised contrastive learning network samples the data set samples, the sampling probability of the large number of data set samples and the sampling probability of the small number of data set samples converge to 1 / K; K is the number of labels;
[0083] The labels of the samples in the large dataset are the same, the labels of the samples in the small dataset are the same, and the labels of the samples in the large dataset are different from the labels of the samples in the small dataset;
[0084] Step 3: If there is a fault in the fault location image, the train fault identification model will alarm. Specific implementation method 2
[0086] This implementation is a further explanation of the first implementation. In this implementation, the train fault identification model training process is as follows:
[0087] Step 21: Input the data set samples into the train fault identification model;
[0088] The data set samples include train non-fault images, train common fault images and train occasional fault images; and the proportion of train occasional fault images in the data set samples is smaller than the proportion of train non-fault images and / or train common fault images in the data set samples;
[0089] Step 22: Conduct the first round of training on the train fault identification model;
[0090] Among them, the supervised contrastive learning network samples the data set samples according to the prior probability;
[0091] The prior probability follows the following prior probability distribution:
[0092]
[0093] Among them, y i is the label corresponding to an anchor image selected by the train image feature extraction network; p(y i ) is the cumulative sampling probability of the data set samples corresponding to each label when the sampling probability of each data set sample as an anchor image follows a uniform distribution; tanh is the hyperbolic tangent function; λ∈(0,1) and φ∈(0,1) are both adjustable parameters; I is the set of all labels; y j Any of all tags;
[0094] Step 23: Perform the Sth round of training on the train fault identification model; the initial value of S is 2, and S is greater than or equal to 2;
[0095] Among them, the supervised contrastive learning network samples the data set based on the posterior probability train;
[0096] The posterior probability follows the posterior probability distribution:
[0097]
[0098]
[0099] Among them, z i and z a These are the normalized features obtained by extracting features from the dataset samples and calculating them through the supervised contrastive learning network in the S-1 round of training:
[0100]
[0101]
[0102] F is the feature extractor in the supervised contrastive learning network; x iis an anchor image selected by the supervised contrastive learning network; x is the remaining instances with the same label as the anchor image; P(i) is the set of all positive samples; B is any batch of image sample-label pairs; ψ is the posterior probability influence rate adjustment parameter
[0103] Step 24: determine whether the train fault identification model meets the training completion condition, and if so, complete the training of the train fault identification model;
[0104] Otherwise, set S+1 and return to execute steps 2 and 3.
[0105] The other technical solutions of this embodiment are exactly the same as those of the first embodiment. Specific implementation method three
[0107] This embodiment is a further description of the second embodiment. In this embodiment, step 22 and step 23 further include:
[0108] If there are labels that have not been sampled, a random sampling is performed on the dataset samples corresponding to the labels.
[0109] The other technical solutions of this embodiment are exactly the same as those of the second embodiment. Specific implementation method four
[0111] This embodiment is a further explanation of the second or third embodiment. In this embodiment, improving the supervised contrast loss SCL of the supervised contrast learning network includes:
[0112]
[0113] in, τ is the temperature parameter; P(i) is the set of all positive samples, |P(i)| represents its cardinality; x p is a positive sample, and p is the ordinal number of the positive sample.
[0114] The other technical solutions of this embodiment are exactly the same as those of the second or third embodiment. Specific implementation method five
[0116] This embodiment is a further explanation of the second or third embodiment. In this embodiment, the improved supervised contrast loss SCL of the supervised contrast learning network further includes:
[0117]
[0118] The other technical solutions of this embodiment are exactly the same as those of the second or third embodiment. Specific implementation method 6
[0120] The train fault identification system of this embodiment includes:
[0121] An image acquisition module, used to acquire images of the faulty parts of the train to be identified;
[0122] A fault identification module, used for inputting the fault location image into the train fault identification model;
[0123] The train fault identification model includes an improved supervised contrastive learning network;
[0124] During the training of the train fault identification model, when the improved supervised contrastive learning network samples the data set samples, the sampling probability of the large number of data set samples and the sampling probability of the small number of data set samples converge to 1 / K; K is the number of labels;
[0125] The labels of the samples in the large dataset are the same, the labels of the samples in the small dataset are the same, and the labels of the samples in the large dataset are different from the labels of the samples in the small dataset;
[0126] And used to alarm when a fault exists in the image of the fault part. Specific implementation method seven
[0128] This embodiment is a further description of the sixth embodiment. In this embodiment, the following is also included:
[0129] A train fault identification model training module, used to input data set samples into the train fault identification model;
[0130] The data set samples include train non-fault images, train common fault images and train occasional fault images; and the proportion of train occasional fault images in the data set samples is smaller than the proportion of train non-fault images and / or train common fault images in the data set samples;
[0131] and, used for the first round of training of the train fault identification model;
[0132] Among them, the supervised contrastive learning network samples the data set samples according to the prior probability;
[0133] The prior probability follows the following prior probability distribution:
[0134]
[0135] Among them, y i is the label corresponding to an anchor image selected by the train image feature extraction network; p(y i ) is the cumulative sampling probability of the data set samples corresponding to each label when the sampling probability of each data set sample as an anchor image follows a uniform distribution; tanh is the hyperbolic tangent function; λ∈(0,1) and φ∈(0,1) are both adjustable parameters; I is the set of all labels; y is any label among all labels;
[0136] and, used for performing the Sth round of training on the train fault identification model; the initial value of S is 2, and S is greater than or equal to 2;
[0137] Among them, the supervised contrastive learning network samples the data set based on the posterior probability train;
[0138] The posterior probability follows the posterior probability distribution:
[0139]
[0140]
[0141] Among them, z i and z a These are the normalized features obtained by extracting features from the dataset samples and calculating them through the supervised contrastive learning network in the S-1 round of training:
[0142]
[0143]
[0144] F is the feature extractor in the supervised contrastive learning network; x i An anchor image selected for the supervised contrastive learning network; x a is the rest of the instances with the same label as the anchor image; P(i) is the set of all positive samples; B is any batch of image sample-label pairs; ψ is the posterior probability influence rate adjustment parameter
[0145] and, used to determine whether the train fault identification model meets the training completion condition, and if so, complete the training of the train fault identification model;
[0146] Otherwise, let S+1 and continue to train the train fault recognition model for the Sth round.
[0147] The other technical solutions of this embodiment are exactly the same as those of embodiment 6. Specific implementation method eight
[0149] This implementation mode is a further explanation of the seventh implementation mode. In this implementation mode, the train fault identification model training module is also used for:
[0150] When there are labels that have not been sampled, a random sampling is performed on the data set samples corresponding to the labels.
[0151] The other technical solutions of this embodiment are exactly the same as those of embodiment seven. Specific implementation method nine
[0153] This embodiment is a further explanation of the seventh or eighth embodiment. In this embodiment, the improved supervised contrast loss SCL of the supervised contrast learning network includes:
[0154]
[0155] in, τ is the temperature parameter; P(i) is the set of all positive samples, |P(i)| represents its cardinality; x p is a positive sample, and p is the ordinal number of the positive sample.
[0156] The other technical solutions of this embodiment are exactly the same as those of embodiment seven or eight. Specific implementation method ten
[0158] This embodiment is a further explanation of the seventh or eighth embodiment. In this embodiment, the improved supervised contrast loss SCL of the supervised contrast learning network further includes:
[0159]
[0160] The other technical solutions of this embodiment are exactly the same as those of embodiment seven or eight. Specific embodiments
[0162] The train fault identification method of the present invention is specifically described as follows:
[0163] 1. Collect images
[0164] Build high-speed imaging equipment to obtain high-definition linear array grayscale images of various parts of the train, and stitch them into a complete picture of the side and bottom of the train. Collect images in different time periods and different environments, expand the sample, and ensure that there are various natural interferences in the data sample, such as light, rain, mud stains, etc., to enhance the robustness of the algorithm and ensure that the algorithm can be applied to different working conditions of the train.
[0165] 2. Target capture
[0166] Since the axle box tie rod seat bolt targets to be detected are only distributed in a specific area and their positions on the vehicle body are basically fixed, the starting and ending positions are determined based on prior knowledge such as the wheelbase information, and the target area is intercepted based on the starting and ending positions to obtain the target image, thereby reducing the size of the image to be identified, increasing the relative proportion of the target in the identified image, reducing interference, facilitating model training, and improving the recognition rate.
[0167] 3. Identification of broken bolts on the axle box tie rod seat
[0168] When identifying train faults, since the frequency of faults such as the broken axle box tie rod seat bolts, which have serious consequences and require the train to be stopped, is extremely low, and there are often many other more frequent faults in the data set, some faults including the broken axle box tie rod seat bolts account for a small proportion in the data set, and have a certain long-tail characteristic in the fault distribution. The large number of data set samples, i.e., data with the same label and a large proportion in the data set, and the small data set samples and data with a unified label and a small proportion in the data set, are almost all distributed in the long tail part of the data set.
[0169] Therefore, this fault characteristic places requirements on the detection network: for a large number of data sets containing a limited number of samples in a minority class, the detection network needs to be able to effectively deal with this data imbalance problem and avoid differential recognition of the minority class. Therefore, it is necessary to design data sampling and the network to balance the data distribution of long-tail data as much as possible.
[0170] Supervised contrastive learning shows great potential in alleviating data imbalance because it can learn the features of each category separately and calculate the loss. However, the performance of supervised contrastive learning is subject to an inherent challenge: it requires a large enough batch of training data to build contrasts covering all categories, but this requirement is difficult to meet in the context of extremely unbalanced data. In order to solve the above problem, improvements are made in its data sampling.
[0171] To this end, the present invention performs weight allocation based on posterior sampling estimation for different label categories in the data set. First, a set of prior distributions is assigned to the labels, and then as sampling proceeds, the posterior distribution of the probability of occurrence of different labels is continuously estimated, and the sampling ratio of the support category is adjusted in real time to ensure that data of different labels are sampled evenly, so as to achieve a better recognition effect for the axle box tie rod seat bolt break fault, which has a very small effective proportion in the data set.
[0172] Among them, supervised contrastive learning (SCL) is an extension of the unsupervised contrastive learning method. Supervised contrastive learning aims to learn a feature extractor F that can distinguish between features with the same label y i =y j Positive sample pairs (xi,xj) and with different labels y i ≠y j Negative sample pairs (x i ,x j ).
[0173] The specific steps are:
[0174] (1) Assume that a small batch contains N images, which are sub-images of specific parts of the train obtained by the target capture in step 2, including images with and without faults captured in the axle box tie rod seat bolt area, and also images of other areas of the train that need to be trained together. The proportion of images with broken axle box tie rod seat bolts is very small, and the same type of fault has different fault forms, and the component features as the fault background are also different. Each sub-image is randomly enhanced twice (cropping, flipping, etc.), and two new images are obtained for each image, and a total of 2N new images are obtained as subsequent network input for training.
[0175] (2) After the backbone network is used for calculation, 2N images will generate 2N image features. Regularization is performed on each enhanced image feature to transform it into a unit vector. In this way, each image feature falls on a hypersphere with a radius of 1. The features obtained are {j1,z2,…,z i ,…,z j ,…,z 2N}.
[0176] (3) For any anchor image i (i.e. a randomly selected image): First, among the remaining images, there is an image j such that images i and j are different images obtained by random enhancement from the same source image, or images i and j are from the same label (e.g. both indicate a certain fault, or both indicate the normal condition of a certain part, etc.). In order for the network to learn similar features for different enhancement results of the same image and images with the same label, when extracting features, it is necessary to make the features of images i and j as close as possible (i.e. the inner product of their feature vectors approaches 1). In addition to the above-mentioned images i and j, for the remaining images, such as image k, if it comes from different source images or different categories than image i, the learning goal of the network should be to make their features far away from each other (i.e. the inner product of their feature vectors approaches -1).
[0177] Specifically, given any batch of sample-label pairs and a temperature parameter τ, defining two SCL losses as:
[0178]
[0179] Where j is the ordinal number of a selected anchor image, A(i) is the ordinal number of batch B\{(x i ,y i)}, that is, the i-th anchor image is excluded, and a represents one of the indexes. P(i) is the set of all positive samples (that is, the set of all samples with the same label as the i-th anchor image), |P(i)| represents its cardinality (the number of samples in the positive sample set), and z represents the normalized feature of x extracted by F:
[0180]
[0181] For a set of well-classified images for train data, the distribution should be that the same categories are concentrated together, and the features of different categories are scattered on the high-dimensional sphere. It can be observed that at this time, the label category with less data volume (such as fault label 2) has a lower probability of occurrence, so the probability of inconsistency with other direction categories is lower than that of the category with high data volume. Therefore, for types far away from large-scale data, their sampling probability should be increased. For the original supervised contrastive learning algorithm, it samples each picture in the sampling as an anchor sample, so it can be considered that the sampling probability of each picture used as an anchor picture in the current batch follows a uniform distribution:
[0182]
[0183] Among them, y i is the corresponding label of anchor image i, N B is the total number of samples in the selected batch.
[0184] For the complete data set, the cumulative sampling probability corresponding to each label data is:
[0185]
[0186] Among them, M(y i ) represents the number of samples of label yi in the complete data set, I is the set of all labels, N is the total number of samples, p(y i ) is the label y i The sampling probability of It is the sum of the sampling probabilities of all labels, and its value is 1.
[0187] However, for long-tail data, the number of samples with different labels varies greatly, and we hope to reduce the training tendency caused by the difference in the number of samples. An extreme consideration is to distribute the samples evenly, but this method is obviously not in line with the actual situation. Therefore, the present invention proposes a probability distribution based on the basic form of information entropy and with some changes. Specifically, p(y i ) is corrected to:
[0188]
[0189] Where K is the number of labels, λ∈(0,1) and φ∈(0,1) are adjustable parameters. The following conclusions can be drawn:
[0190] For label y i , when p(y i )≤1 / K, then q(y i )≥p(y i ), on the contrary, when p(y i )≥1 / K, then q(y i )≤p(y i ), if and only if p(y i )=1 / K, the above two inequalities can be equal.
[0191] because:
[0192]
[0193] Let r(y i )=(p(y i )-1 / K), let r(y i )≥0, due to the boundedness of the tanh function (that is, the graph of the hyperbolic tangent function is sandwiched between the horizontal lines y=1 and y=-1, and when the absolute value of x in the tanh function is large, the graph of the hyperbolic tangent function is close to the straight line y=1 in the first quadrant and close to the straight line y=-1 in the third quadrant) at this time:
[0194]
[0195] Therefore, it can be proved that when r(y i )=p(y i )-1 / K≥0, that is, p(y i )≥1 / K, q(y i )≤p(y i ), which means that if a label has a large distribution and exceeds the mean of all labels in the data set, then the sampling probability of this label after correction will be lower than before correction. Similarly, if a label accounts for a small proportion, the sampling probability after correction will increase, ensuring the improvement of the uniformity of sampling of large and small samples and avoiding large deviations.
[0196] For any satisfaction For the discrete probability distribution p(yi), for any given ε, there exists a pair of appropriate adjustable parameters λ and φ so that for the modified sampling probability q(y i ),have:
[0197]
[0198] The proof is as follows:
[0199]
[0200] It can be seen that for any given ε, by adjusting the adjustable parameters λ, φ, let λφ <∈ / (K+1), we can make That is, the value can be very small, and it can be considered Approximately 1.
[0201] Therefore, it can be considered that the corrected result is close to a probability distribution with a cumulative sum of 1 and the correction can scale the probability away from 1 / K to 1 / K, ensuring that the minimum probability is That is, no matter what the proportion of labels in the data set is, after correction, the sampling probabilities of large and small samples tend to converge to 1 / K. The corrected sampling probabilities of large samples and long-tail data are close to a mean, ensuring the balance of sampling.
[0202] In summary, the corrected probability can balance the imbalance between a large number of labels and a very small number of labels, and ultimately make the sampling probability of labels with a small number of samples and a large number of samples closer to a uniform distribution, which can achieve a better sampling effect.
[0203] Therefore, the overall sampling probability obeys the following prior distribution:
[0204]
[0205] At the same time, for samples that deviate less from the overall samples, the probability of less sample distribution is greater. Therefore, it is necessary to correct the sampling probability based on the posterior relative distance after each learning process. The corrected probability distribution is:
[0206]
[0207] Among them, p c (y i ) represents the posterior pseudo probability based on the cosine distance correction, which is defined as:
[0208]
[0209] Among them, ψ is an adjustable parameter used to balance the influence rate of the posterior probability. ψ is a positive real number, and its value range is not limited. When the parameter is positive infinity, because it is in the denominator, it will cause the corrected probability of each item to be equal. At this time, the corrected probability has nothing to do with the sample, which will make the probability more uniformly distributed. When the parameter is close to 0, the function depends greatly on the distribution of the sample, such as the distance and number between the sampled sample and other samples. Therefore, when the value is small, the posterior pseudo-probability is more affected by the sample, and the optimization effect is more obvious. The reference value of ψ can be given as 0.1 with reference to the temperature coefficient τ.
[0210] At the same time, since purely random sampling will lead to unstable training, each set of data in the small batch must be sampled at least once each time to ensure complete coverage of the entire data set. Therefore, the final sampling process is:
[0211] Step 1: First, sample according to the prior probability given in Formula 11 and perform a complete training on the dataset.
[0212] Step 2: Starting from the second training cycle, calculate the posterior sampling probability according to formula 12, and perform sampling based on the sampling probability.
[0213] Step 3: For each small batch, if a certain label appears in the small batch but is not sampled, the data corresponding to the label is randomly sampled.
[0214] Continue steps 2 and 3 until training is complete.
[0215] Fault alarm
[0216] Analyze the detection results to determine whether there is a fault. If so, an alarm is required. Based on the detection results of the previous network model, according to the scale parameters and the start and end coordinates of the image capture, restore the position of the fault on the vehicle and report the fault alarm coordinates.
[0217] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the features of the various dependent claims and herein may be combined in a manner different from that described in the original claims. It should also be understood that the features described in conjunction with the individual embodiments may be used in other embodiments.
Claims
1. A train fault identification method, characterized in that: Here are the steps: Step 1: Collect images of the faulty parts of the train to be identified; Step 2: inputting the fault location image into a train fault recognition model; The train fault identification model includes an improved supervised contrastive learning network; During the training of the train fault identification model, when the improved supervised contrastive learning network samples the data set samples, the sampling probabilities of the large number of data set samples and the small number of data set samples converge to 1 / K; K is the number of labels; Step 3: If there is a fault in the fault location image, the train fault identification model will alarm.
2. The train fault identification method according to claim 1, characterized in that: The training process of the train fault identification model is as follows: Step 21: Input the data set samples into the train fault identification model; The data set samples include train non-fault images, train common fault images and train occasional fault images; and the proportion of train occasional fault images in the data set is smaller than the proportion of train non-fault images and / or train common fault images in the data set; Step 22: Conduct the first round of training on the train fault identification model; Among them, the improved supervised contrastive learning network samples the data set samples according to the prior probability; The prior probability obeys the following prior probability distribution: Among them, y i The label corresponding to an anchor image selected to improve the supervised contrastive learning network; p(y i ) is the cumulative sampling probability of the data set samples corresponding to each label when the sampling probability of each data set sample as an anchor image follows a uniform distribution; tanh is the hyperbolic tangent function; λ∈(0,1) and φ∈(0,1) are both adjustable parameters; I is the set of all labels; y j Any of all tags; Step 23: Perform the Sth round of training on the train fault identification model; the initial value of S is 2, and S is greater than or equal to 2; Among them, the improved supervised contrastive learning network samples the data set samples based on the posterior probability train; The posterior probability follows the posterior probability distribution: Among them, z i and z a These are the normalized features obtained by extracting and calculating features of the dataset samples through the improved supervised contrastive learning network in the S-1 round of training: F is the feature extractor in the improved supervised contrastive learning network; x i An anchor image selected to improve the supervised contrastive learning network; x a is the rest of the instances with the same label as the anchor image; P(i) is the set of all positive samples; B is any batch of image sample-label pairs; ψ is the posterior probability influence rate adjustment parameter Step 24: determine whether the train fault identification model meets the training completion condition, and if so, complete the training of the train fault identification model; Otherwise, set S+1 and return to execute steps 2 and 3.
3. The train fault identification method according to claim 2, characterized in that: Step 22 and step 23 also include: If there are labels that have not been sampled, a random sampling is performed on the data set samples corresponding to the labels.
4. The train fault identification method according to claim 2 or 3, characterized in that: Improved supervised contrast loss SCL of supervised contrast learning network includes: in, τ is the temperature parameter; P(i) is the set of all positive samples, |P(i)| represents its cardinality; x p is a positive sample, and p is the ordinal number of the positive sample.
5. The train fault identification method according to claim 2 or 3, characterized in that: Improved supervised contrast loss SCL of supervised contrast learning network also includes:
6. Train fault identification system, characterized in that: include: An image acquisition module, used to acquire images of the faulty parts of the train to be identified; A fault identification module, used for inputting the fault location image into a train fault identification model; The train fault identification model includes an improved supervised contrastive learning network; During the training of the train fault identification model, when the improved supervised contrastive learning network samples the data set samples, the sampling probabilities of the large number of data set samples and the small number of data set samples converge to 1 / K; K is the number of labels; And used to alarm when a fault exists in the image of the fault part.
7. The train fault identification system according to claim 6, characterized in that: Also includes: A train fault identification model training module, used to input data set samples into the train fault identification model; The data set samples include train non-fault images, train common fault images and train occasional fault images; and the proportion of train occasional fault images in the data set samples is smaller than the proportion of train non-fault images and / or train common fault images in the data set samples; and, used for the first round of training of the train fault identification model; Among them, the improved supervised contrastive learning network samples the data set samples according to the prior probability; The prior probability obeys the following prior probability distribution: Among them, y i is the label corresponding to an anchor image selected by the train image feature extraction network; p(y i ) is the cumulative sampling probability of the data set samples corresponding to each label when the sampling probability of each data set sample as an anchor image follows a uniform distribution; tanh is the hyperbolic tangent function; λ∈(0,1) and φ∈(0,1) are both adjustable parameters; I is the set of all labels; y j Any of all tags; and, used for performing the Sth round of training on the train fault identification model; the initial value of S is 2, and S is greater than or equal to 2; Among them, the improved supervised contrastive learning network samples the data set samples based on the posterior probability train; The posterior probability follows the posterior probability distribution: Among them, z i and z a These are the normalized features obtained by extracting and calculating features of the dataset samples through the improved supervised contrastive learning network in the S-1 round of training: F is the feature extractor in the improved supervised contrastive learning network; x i An anchor image selected to improve the supervised contrastive learning network; x a is the rest of the instances with the same label as the anchor image; P(i) is the set of all positive samples; B is any batch of image sample-label pairs; ψ is the posterior probability influence rate adjustment parameter and, used to determine whether the train fault identification model meets the training completion condition, and if so, complete the training of the train fault identification model; Otherwise, let S+1 and continue to train the train fault recognition model for the Sth round.
8. The train fault identification system according to claim 7, characterized in that: The train fault identification model training module is also used for: When there are labels that have not been sampled, random sampling is performed on the data set samples corresponding to the labels.
9. The train fault identification system according to claim 7 or 8, characterized in that: Improved supervised contrast loss SCL of supervised contrast learning network includes: in, τ is the temperature parameter; P(i) is the set of all positive samples, |P(i)| represents its cardinality; x p is a positive sample, and p is the ordinal number of the positive sample.
10. The train fault identification system according to claim 9, characterized in that: Improved supervised contrast loss SCL of supervised contrast learning network also includes: