A Pattern Recognition Method Based on a Dual Contrast Architecture

By employing a dual-contrast architecture and label diffusion method, this approach addresses the shortcomings of existing unsupervised feature extraction and applicability to one-dimensional data, achieving high pattern recognition accuracy and rapid model convergence.

CN116304603BActive Publication Date: 2025-11-14CHINA RAILWAY ENGINEERING EQUIPMENT GROUP CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310346327.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2025-11-14
Estimated Expiration
2043-04-03

AI Technical Summary

Technical Problem

Existing semi-supervised classification methods based on contrastive learning suffer from insufficient supervised training at low labeling rates, and data augmentation methods are not suitable for one-dimensional data, resulting in insufficient unsupervised feature extraction capabilities and low pattern recognition accuracy.

Method used

A dual-contrast architecture is adopted, which performs two comparisons through three encoders and performs time-frequency transformations under different parameters to obtain high-quality data augmentation samples. The label diffusion method is used to improve the labeling rate, and supervised training is performed on the encoder and linear classifier.

Benefits of technology

It improves the ability to extract sample features, reduces the need for labeled data, improves the accuracy of pattern recognition, and accelerates the model convergence speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116304603B_ABST
    Figure CN116304603B_ABST
Patent Text Reader

Abstract

This invention proposes a pattern recognition method based on a dual-contrast architecture to address the problem of low accuracy in existing pattern recognition methods under extremely low label rates. The steps are as follows: Data preprocessing: enhancing one-dimensional vibration signals into two-dimensional time-frequency signals with different parameters; Dual-contrast architecture construction: constructing a dual-contrast architecture using three parallel encoders; Negative example set initialization: filling the negative example set by encoding random samples using the encoders; Dual-contrast architecture training: training the dual-contrast architecture using unlabeled data; Label diffusion: labeling some unlabeled data using labeled data; Pattern recognition model training: training the model using the labeled dataset after label diffusion; Pattern recognition: performing pattern recognition on the input data using the trained pattern recognition model. This invention has the following advantages: strong data feature extraction capability; small required labeled data; fast model convergence speed; and high pattern recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of computer pattern recognition, and more particularly to a pattern recognition method based on a dual-contrast architecture. Background Technology

[0002] Pattern recognition is a fundamental aspect of human intelligence, and people frequently engage in pattern recognition in daily life. With the advent of computers in the 1940s and the rise of artificial intelligence in the 1950s, people hoped to use computers to replace or extend some of human mental labor. Pattern recognition rapidly developed into a new discipline in the early 1960s. Pattern recognition refers to the process of processing and analyzing various forms of information (numerical, textual, and logical relationships) representing things or phenomena to describe, identify, classify, and interpret them. It is an important component of information science and artificial intelligence. Specifically, pattern recognition uses computers to analyze data, find patterns hidden within the data, and classify the remaining data based on these patterns. Pattern recognition can be used in text and speech recognition, remote sensing, fault diagnosis, machine vision, and medicine, among other fields.

[0003] Pattern recognition, also known as pattern classification, is categorized into supervised, unsupervised, and semi-supervised classification based on whether data category labels are known in advance. Generally, supervised classification relies on a large amount of labeled data. However, in practical engineering, manually labeling large amounts of data is time-consuming and costly, and labeling depends on the experience and knowledge of experts in the relevant domain. Therefore, labeled data is scarce in engineering projects. Unsupervised classification does not require data labels; it simply uses the features inherent in the data itself to group together samples with high similarity and separate samples with significant differences. Semi-supervised classification utilizes both unlabeled and labeled data to train the model, thus fully leveraging the corrective effect of limited sample labels on pattern recognition results, and is gaining increasing attention in pattern recognition.

[0004] Contrastive learning provides a new paradigm for semi-supervised classification. First, an encoder is trained using unlabeled data to extract feature representations. Then, the encoder is connected to a linear classifier, which is trained using labeled data to achieve semi-supervised pattern classification. Commonly used contrastive learning models include Momentum Contrastive (MoCo) and Adversarial Contrastive (AdCo). Specifically, these models contain two encoders (but no decoder layer) to extract encoded features from two input samples of the same or different classes. These encoded features are then compared based on similarity. Leveraging the high similarity between encoded features of samples of the same class, the model aims to make the encoded features of samples of the same class as close as possible to those of samples of different classes, while keeping the encoded features of samples of different classes as separate as possible.

[0005] The effectiveness of semi-supervised classification based on contrastive learning depends on three aspects: 1) The sufficiency of comparison between samples of different classes. The more fully a sample is compared with samples of other classes, the better the encoder can extract the feature representation that distinguishes the sample from other classes. 2) The quality of data augmentation samples of the same class. Samples of the same class need to be augmented using data augmentation methods to obtain two different data augmentation samples, which are used as input samples for two encoders. These two data augmentation samples should have good quality, that is, they retain the main features of the original samples, but have certain differences from each other. 3) The sufficiency of supervised training. After the encoder is connected to the linear classifier, it can only achieve good pattern recognition results if it is sufficiently trained.

[0006] However, existing contrastive learning models only compare encoded features once using two encoders, resulting in insufficient comparison between samples of different categories. Furthermore, existing data augmentation methods in contrastive learning are mostly applicable to image data, not to one-dimensional data such as speech or vibration signals. Existing semi-supervised classification methods based on contrastive learning only train linear classifiers with limited labeled data, leading to insufficient training due to limited training data and a lack of further training in the feature extraction part.

[0007] Therefore, existing semi-supervised classification methods based on contrastive learning have at least the following drawbacks: 1) insufficient unsupervised feature extraction capability; 2) data augmentation methods are not suitable for one-dimensional data; 3) insufficient supervised training under low labeling rates; and 4) low pattern recognition accuracy.

[0008] Tunnel boring machines (TBMs) have many components, and the failure of any one of them can lead to the failure of the entire machine. Therefore, we need to monitor the health status of the components in real time and use pattern recognition methods to determine their health status category, so as to facilitate timely and accurate operation and maintenance and ensure that the TBM can operate smoothly and effectively. Summary of the Invention

[0009] To address the technical problem of insufficient supervised training and low pattern recognition accuracy in existing semi-supervised classification methods under low label rates, this invention proposes a pattern recognition method based on a dual-contrast architecture. This method constructs a dual-contrast architecture by employing three encoders to perform two comparisons on the encoded features, improving the sufficiency of the comparisons. Time-frequency transformations with different parameters are applied to one-dimensional data to obtain high-quality data augmentation samples. Limited label information is diffused to unlabeled data to increase the label rate, and the labeled data is used to simultaneously train both the encoder and the linear classifier, improving the sufficiency of supervised training and resulting in high pattern recognition accuracy.

[0010] To achieve the above objectives, the technical solution of the present invention is as follows: a pattern recognition method based on a dual-contrast architecture, comprising the following steps:

[0011] Step 1, Data Preprocessing: Perform time-frequency transformation on each sample in the dataset under three different parameters to obtain data-enhanced samples;

[0012] Step 2, Dual Contrast Structure Construction: The dual contrast architecture consists of encoder f q encoder f k and encoder f j Composed of parallel combinations;

[0013] Step 3, Negative Instance Set Initialization: There are two negative instance sets, and the initial values ​​for the two negative instance sets are encoder f. k and encoder f j A set of encoded features extracted from several randomly selected data augmentation samples;

[0014] Step 4, Dual Contrast Architecture Training: The dual contrast architecture is trained using unlabeled data samples from the dataset and a contrast method.

[0015] Step 5, Tag Diffusion: Using encoder f q Using a distance calculation function, labeled samples and a label diffusion method are used to label some unlabeled samples to obtain a diffused labeled dataset.

[0016] Step 6, supervised training of the pattern recognition model: The pattern recognition model is trained by the encoder f. q It consists of a linear classifier and a diffused labeled dataset, and the entire pattern recognition model is trained in a supervised manner.

[0017] Step 7, Online Pattern Recognition: After one round of data augmentation, the test data samples are input into the trained pattern recognition model to obtain the pattern recognition results.

[0018] Preferably, each category in the dataset contains a small number of category labels; the time-frequency transformation method is one of short-time Fourier transform, wavelet transform, and Wegener-Will transform; the encoder is constructed using one of fully connected networks, deep convolutional networks, deep belief networks, deep residual networks, generative adversarial networks, autoencoders, or flow models.

[0019] Preferably, step 1 is implemented as follows: the acquired one-dimensional vibration signal is subjected to a short-time Fourier transform to obtain a time-frequency matrix, and the time-frequency matrix is ​​trimmed to a suitable size using interpolation; the parameters of the short-time Fourier transform are randomly set, and each sample undergoes three random short-time Fourier transforms to obtain three different time-frequency signals x. q x k and x j It is divided into training set and test set.

[0020] Preferably, the encoder f in step 2 q encoder f k and encoder f j The parallel arrangement combines three encoders side by side, encoder f q encoder f k and encoder f j The inputs are three different data augmentation samples in the training set, and the output is the encoded features of the samples.

[0021] Preferably, step 3 is implemented by: establishing two empty negative example sets M. k and negative example set M j Randomly select the time-frequency signal x after data augmentation. k x j The inputs are respectively fed into encoder f k encoder f j In the process, we obtain the encoded feature k and encoded feature j, and then fill the negative example set M with the encoded feature k. k Encoded feature j is filled into the negative example set M j This continues until the predetermined negative instance set size is reached.

[0022] Preferably, the comparison method is one of Deep InfoMax, MoCo, SimCLR, BYOL, and AdCo.

[0023] Preferably, the training method for the dual-contrast architecture is as follows: 1) Randomly select a batch of data samples of size K, and after preprocessing, input the data samples into encoder f respectively. k and encoder f j 1) Obtain the corresponding sample's encoded features k and j; 2) Compare the encoded features j with the negative example set M j Combined with the encoded feature k, the encoder f is compared using a contrastive method. k The parameters and negative example set M j 3) Update; 4) Input the current batch of samples into the encoder f again after preprocessing. q and the updated encoder f k 4) Obtain the encoded features q and k of the sample; 5) Combine the encoded features k with the negative example set M k Combined with the encoded feature q, the encoder f is compared using a contrastive method. q and negative example set M k 5) Update via encoder f q Parameters and encoder f k The parameters for encoder f j Update the parameters; 6) Repeat steps 1)-5) until different data of the same sample can be augmented to correspond.

[0024] Preferably, step 4 is implemented as follows:

[0025] Step 4-1, encoder f k Parameter update: The time-frequency signal x after data augmentation in step 1 k Time-frequency signal x j The inputs are respectively fed into encoder f k encoder f j In the process, we obtain the encoded features k and j of the sample; then we compare the encoded features j with the negative example set M. j Combined, calculate the loss function:

[0026]

[0027] In the formula, j i For the negative example set M j The negative examples stored in the array, where n is the set of negative examples M. j The magnitude of the encoder f, where τ is the temperature hyperparameter; k The parameters are updated as follows:

[0028]

[0029] In the formula, θ k,epoch This represents the encoder f at epoch iterations. k The parameter, α θ This represents the learning rate used to update the encoder;

[0030] Step 4-2, Negative Example Set M j Update: Negative example set M j The update calculation is as follows:

[0031]

[0032] In the formula, j i Representative negative example set M j Negative examples, α M This indicates the learning rate for updating the negative example set;

[0033] Step 4-3, encoder f q Parameter update: The time-frequency signal x after data augmentation q Time-frequency signal x k The inputs are respectively fed into encoder f q encoder f k In the process, the encoded features q and k of the sample are obtained; the sample encoding k is then compared with the negative example set M. k Combined, calculate the loss function:

[0034]

[0035] In the formula, k iFor the negative example set M k The negative examples stored in the array, where n is the set of negative examples M. k Size of encoder f q The parameters are updated as follows:

[0036]

[0037] In the formula, θ q,epoch This represents the encoder f at epoch iterations. q Parameters;

[0038] Step 4-4, Negative example set M j Update: Negative example set M j The update calculation is as follows:

[0039]

[0040] In the formula, k i Representative negative example set M k Negative examples in;

[0041] Steps 4-5, encoder f j The update is as follows:

[0042] θ j,i+1 =mθ j,i +(1-m)(mθ k,i +(1-m)θ q,i )

[0043] In the formula, θ j,i+1 Represents encoder f j The parameter θ at the (i+1)th iteration j,i Represents encoder f j The parameter θ in the i-th iteration k,i Represents encoder f k The parameter θ in the i-th iteration q,i Represents encoder f q The parameters at the i-th iteration; i represents the current iteration number of the model, with a value of i = 0, 1, 2, ...; m is the set momentum parameter.

[0044] Preferably, the method for tag diffusion in step 5 is: using the encoder f updated in steps 4-3. q The coding features of labeled and unlabeled samples are calculated separately. The distance between the coding features of labeled and unlabeled samples is calculated using a distance calculation function. The unlabeled data with the smallest distance are labeled with the relevant labeled data and then recombined into a labeled dataset.

[0045] Preferably, step 6 is implemented as follows:

[0046] Step 6-1, Construct the pattern recognition model: Load the encoder f q Except for the parameters of the last layer, change the number of nodes in the last layer to the number of categories to be classified, and build a pattern recognition model;

[0047] Step 6-2: Use the labeled dataset obtained in Step 5 to train the pattern recognition model. After each iteration, use the test set to verify the model and select the model with the highest accuracy in the test set as the final pattern recognition model.

[0048] Compared with the prior art, the beneficial effects of the present invention are as follows: The dual-contrast architecture improves the contrast between different samples, better extracts sample features, and accelerates model convergence; the time-frequency transformation method under different parameters is used to augment one-dimensional data, and the augmented data samples do not damage the original sample information and can represent different time-frequency patterns of the same sample, which is beneficial to improving the contrast effect between samples; the label diffusion method is used to improve the labeling rate of the data, and supervised training is performed on the entire pattern recognition model, which can improve the sufficiency of model training without overfitting and improve the pattern recognition accuracy. Therefore, the method of the present invention has at least the following advantages: (1) strong data feature extraction capability; (2) less required labeled data; (3) fast model convergence speed; (4) high pattern recognition accuracy. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a flowchart illustrating the implementation of the present invention.

[0051] Figure 2 This is a distribution diagram of the bearing state pattern recognition results obtained by the present invention.

[0052] Figure 3 This is the confusion matrix of the bearing state pattern recognition results obtained by this invention. Detailed Implementation

[0053] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0054] Example 1

[0055] like Figure 1 As shown, a pattern recognition method based on a dual-contrast architecture specifically includes the following steps:

[0056] Step 101: Data preprocessing: Perform time-frequency transformation on each sample in the dataset under three different parameters to obtain three different data augmentation samples.

[0057] Each category in the dataset contains a small number of category labels, simulating a situation with extremely low labeling rates. The samples in the dataset are data-augmented two-dimensional time-frequency data, with categories being fault size + fault type, and labels being internal markers used by the model for training.

[0058] Time-frequency transformation methods include, but are not limited to, one of the following: short-time Fourier transform, wavelet transform, and Wegener-Will transform. The three different parameters are randomly selected within a certain range. The dataset is divided into training and test sets in an 8:2 ratio. One-dimensional vibration data is converted into two-dimensional time-frequency data, while data augmentation is performed and training hyperparameters are initialized.

[0059] Step 102: Building a Dual Contrast Architecture: The dual contrast architecture consists of three encoders f q f k and f j It is composed of parallel combinations; three different data augmentation samples are respectively input into the three encoders f of the dual contrast architecture. q f k and f j Each sample yields a coded feature.

[0060] Three encoders f q f k and f j The three encoders are arranged in parallel and initialized with parameters. Their inputs are three different data-augmented samples, and their outputs are the encoded features of the samples. The three encoders take different data augmentations of the same sample as input, and their output encoded features are compared and learned. This dual-contrast architecture can extract deeper levels of sample encoding, which helps improve the accuracy of the final model. The encoders can be constructed using, but are not limited to, fully connected networks, deep convolutional networks, deep belief networks, deep residual networks, generative adversarial networks, autoencoders, and streaming models.

[0061] Step 103: Negative instance set initialization: The negative instance set contains two parts: M k and M j Their initial values ​​are encoder f. k and encoder f j A set of encoded features extracted from several randomly selected data augmentation samples.

[0062] Two negative example sets are used to compare the encoded features of samples from different categories during the two contrastive learning processes. The encoder f is used... k and encoder f j The extracted data is used to augment the encoded features of the samples. A set of randomly selected data is used to initialize two negative example sets. If not initialized, the two negative example sets are empty and cannot be used for comparative training.

[0063] Step 104: Dual-contrast architecture training: Train the dual-contrast architecture using unlabeled data samples according to the given contrast method, training steps, loss function, and optimization algorithm. That is, train the dual-contrast architecture using unlabeled data samples and the contrast method.

[0064] Unlabeled data samples are those without labels. The data in step 101 contains a large number of unlabeled samples and a small number of labeled samples. In this step, all data (labeled and unlabeled data) are input into the model to train the dual-contrast architecture, but the labels for the labeled data do not need to be used.

[0065] The comparison methods mentioned include, but are not limited to, one of Deep InfoMax, MoCo, SimCLR, BYOL, and AdCo. Each of these methods has its own focus and accuracy, requiring selection based on the specific dataset and application scenario. However, the fundamental idea behind contrastive learning is the same, so it can be used directly.

[0066] The training steps are as follows: 1) Randomly select a batch of data samples of size K. After preprocessing, the data samples are input into the encoder f. k and encoder f j 1) Obtain the corresponding sample's encoded features k and j; 2) Compare the encoded features j with the negative example set M j Combined, and then with the encoded features k, the encoder f is optimized using a given contrast method, loss function, and optimization algorithm. k The parameters and negative example set M j 3) Update; 4) Input the current batch of samples into the encoder f again after preprocessing. q and the updated encoder f k 4) Obtain the encoding features q and k of the corresponding samples; 5) Combine the encoding features k with the negative example set M kCombined, and then with the encoded features q, the encoder f is optimized using a given contrast method, loss function, and optimization algorithm. q and negative example set M k 5) Update according to the given method via encoder f q Parameters and encoder f k The parameters for encoder f j Update the parameters; 6) Repeat steps 1)-5) until the model stops. Preprocessing is the method in step 101. Maximize the loss by directly updating the negative example set. The given method is the formula in step 2 of the example. The model stops when the model can augment different data of the same sample.

[0067] The loss function is a contrastive loss function, including but not limited to one of NCE loss, InfoNCE loss, Triplet loss, and SCL loss.

[0068] The optimization algorithm includes, but is not limited to, one of the following: Adaptive Moments Estimation (Adam), Stochastic Gradient Descent (SGD), and Root Mean Square Transition (RmsPorp). The optimization algorithm updates the model parameters based on the loss function.

[0069] Step 105: Tag diffusion: using encoder f q Given a distance calculation function, the labeled samples are used to label some unlabeled samples according to a given label diffusion method to obtain the diffused labeled dataset.

[0070] The label diffusion method is as follows: Labeled data augmentation samples and unlabeled data augmentation samples are respectively input into the encoder f in the trained dual-contrast architecture. q The corresponding labeled and unlabeled coded features are obtained. The distance between the labeled coded features and all unlabeled coded features is calculated using a distance calculation function. The unlabeled samples with the smallest distance are selected and labeled with the labels of the labeled samples.

[0071] The distance calculation function includes, but is not limited to, one of Mahalanobis distance, Euclidean distance, Manhattan distance, cosine similarity, and Chebyshev distance. The distance between sample features in the feature space is calculated, and the label diffusion module diffuses labels based on this distance.

[0072] Step 106: Supervised training of the pattern recognition model: The pattern recognition model is trained by the encoder f q It consists of a linear classifier and a distributed labeled dataset, and the pattern recognition model is trained in a supervised manner.

[0073] A pattern recognition model similar to a single encoder in a dual-contrast architecture is built, with the output of the last layer changed to the number of categories to be classified. To speed up training, the encoder f is loaded here. q All parameters except the last layer parameters, but not fixed. The encoder f q The initialization parameters are the encoder f in the trained dual-contrast architecture. q The parameters are optimized during supervised training along with the subsequent linear classifier. The sample codes extracted by the other two encoders are concatenated with the negative example set, but encoder f... q There's no need to concatenate with the negative example set. Supervised training involves inputting labeled data, extracting sample codes, calculating cross-entropy loss along with the labels, and updating the model parameters. The expanded labeled dataset is larger than the initial labeled dataset, improving model accuracy. After each iteration, the model is validated using a test set to prevent overfitting. Finally, the model with the highest accuracy on the test set is selected as the final pattern recognition model.

[0074] Step 107: Online pattern recognition: After the test data samples have undergone one data augmentation, they are input into the trained pattern recognition model to obtain the pattern recognition results.

[0075] The test sample is the sample to be detected, which is a one-dimensional vibration signal. The data to be pattern recognized is first subjected to data augmentation in step 1, but only once is needed at this time; then the data-augmented sample is input into the obtained pattern recognition model to obtain its category.

[0076] Example 2

[0077] To better understand the technical solution and effects of the present invention, a detailed description is provided below with reference to a specific embodiment.

[0078] A pattern recognition method based on a dual-contrast architecture is presented, taking the health status pattern recognition of a bearing as an example. The bearing model is NJ208E, driven by a motor to rotate the inner ring at a speed of 800 rpm. An accelerometer is installed on the bearing housing to collect the bearing's vibration signal, with a sampling frequency of 32768 Hz and a sampling time of 30 seconds. The experiment simulated eight health states: healthy (N), inner ring fault (I), outer ring fault (O), rolling element fault (B), inner ring rolling element fault (IB), outer ring rolling element fault (OB), inner and outer ring fault (OI), and inner and outer ring rolling element fault (OIB). Each fault is further divided into two cases based on its severity (crack width): 0.2 mm and 0.3 mm. The fault state is represented by a crack width value followed by a letter, such as 0.2I indicating a 0.2 mm crack fault in the inner ring. Therefore, the dataset in this embodiment contains 15 categories. In addition, each category includes data for three different additional loads: 0.8, 1.6, and 2.4 kN.

[0079] In the experiment, the dataset was divided into a training set and a test set. The training set contained 600 signals for each category and 200 signals for each payload, including 2 labeled data points and 198 unlabeled data points. The test set contained 150 signals for each category and 50 signals for each payload.

[0080] The experiment uses the technology disclosed in this invention to process the dataset, and the specific details are as follows:

[0081] Step (1): Data preprocessing. Perform time-frequency transformation on each sample in the dataset under three different parameters to obtain data-enhanced samples.

[0082] Each data sample consists of 5000 points. A time-frequency matrix is ​​obtained through a short-time Fourier transform (SFT). This matrix is ​​then reduced to 256×256 using interpolation, and its absolute value is taken for easier input into the model. The parameters of the SFT are randomly set: the window size is randomly selected from 125 to 130, shifting one point to the right each time. The default window in MATLAB is used, and the number of points for each SFT is 1024. Each sample undergoes three random SFTs to obtain three different time-frequency signals x. q x k and x j .

[0083] Step (2): Construction of the dual-contrast architecture. The dual-contrast architecture consists of three encoders f q f k and f j It is composed of parallel combinations.

[0084] ① The encoder uses the ResNet18 built into PyTorch. Since its original input channels were 3, they were changed to 1 channel to accommodate the faulty dataset. A normalization function was added to the encoder output to facilitate the model's calculation of the contrastive loss. The final output size of the encoder was set to 24, meaning 24 encoded features were extracted from each sample. The normalization function normalizes the data, limiting it to the range [0:1] to eliminate the adverse effects of outlier samples. Here, it's used to facilitate the subsequent calculation of the contrastive loss.

[0085] ② Encoder f j The training process does not involve backpropagation; its parameter updates are performed by the encoder f. q and f k Decision. The specific method is as follows:

[0086] θ j,i+1 =mθ j,i +(1-m)(mθ k,i +(1-m)θ q,i )

[0087] In the formula, θ j,i+1 Represents encoder f j The parameter θ at the (i+1)th iteration j,i Represents encoder f j The parameter θ in the i-th iteration k,i Represents encoder f k The parameter θ in the i-th iteration q,i Represents encoder f q The parameters at the i-th iteration. i represents the current iteration number of the model, with a value of i = 0, 1, 2, ... . m is the set momentum parameter, which is taken as m = 0.999 in this experiment.

[0088] Step (3), initialization of the negative instance set. The negative instance set consists of two parts: M k and M j Their initial values ​​are encoder f. k and f j A set of encoded features extracted from several randomly selected data augmentation samples.

[0089] The negative example set has a size of 128, which is the optimal solution for this dataset obtained after experimental testing.

[0090] The time-frequency signal x obtained in step (1) k and x j Random sampling is performed using encoder f. k and f jEncode the samples and add the corresponding codes to the negative example set M. k and M j In the process, until the preset negative instance set size is reached.

[0091] Step (4) Training the dual-contrast architecture. The dual-contrast architecture is trained using unlabeled data samples according to the given contrast method, training steps, loss function, and optimization algorithm.

[0092] The training steps are as follows: 1) Randomly select a batch of data samples of size 32. After preprocessing, the samples are input into the encoder f. k and encoder f j 1) Obtain the corresponding sample encoding features k and j; 2) Compare j with the negative example set M j Combined, and then with k, the encoder f is optimized using a given comparison method, loss function, and optimization algorithm. k Parameters and M j 3) Update; 4) Input the current batch of samples into the encoder f again after preprocessing. q And the newly updated encoder f k 4) Obtain the corresponding sample coding features q and k; 5) Combine the coding features k with the negative example set M k Combined, and then with the encoded features q, the encoder f is optimized using a given contrast method, loss function, and optimization algorithm. q and negative example set M k 5) Update according to the given method via encoder f q Parameters and encoder f k The parameters for encoder f j Update the parameters; 6) Repeat steps 1)-5) until the model stops. In this experiment, the AdCo method is used for comparison. The InfoNCE loss is used for comparison loss. Taking step 3) as an example, its form is as follows:

[0093]

[0094] In the formula, q and k are different encoded features of samples of the same class, and k i It is the negative example set M k In the negative examples set, n is the size of the negative example set, and τ is the temperature parameter; in this experiment, τ = 1.5. The optimization algorithm uses stochastic gradient descent (SGD), with the learning rate slowly decreasing from 0.01 to 0.000001. Training of the model stops when the two-contrast architecture can accurately map the different codes of each pair of the same sample.

[0095] Step (5), tag diffusion. Using encoder f... qGiven a distance calculation function, the labeled samples are used to label some unlabeled samples according to a given label diffusion method to obtain the diffused labeled dataset.

[0096] The given label diffusion method is as follows: Labeled augmented samples and unlabeled augmented samples are respectively input into the encoder f in the trained dual-contrast architecture. q In the process, the corresponding coding features are obtained, the Euclidean distance between the labeled coding features and all unlabeled coding features is calculated, and the two unlabeled samples with the smallest distance are selected and labeled with the label of the labeled sample.

[0097] Step (6): Supervised training of the pattern recognition model. The pattern recognition model is trained by the encoder f. q It consists of a linear classifier and a distributed labeled dataset, and the entire pattern recognition model is trained in a supervised manner.

[0098] The encoder f q The initialization parameters are f in the trained double contrast architecture. q The parameters are optimized during supervised training, along with the subsequent linear classifier. To prevent the model from getting stuck in local optima during supervised training and to speed up model convergence, an annealing algorithm is incorporated during training.

[0099] Supervised training optimization algorithms use stochastic gradient descent (SGD), with the learning rate slowly decreasing from 0.001 to 0.000001.

[0100] After each backpropagation, fix the model parameters, input the test set, and record the accuracy.

[0101] The supervised training process consisted of 400 iterations, and the model parameters at which the accuracy on the test set was highest were saved.

[0102] Step (7), Online Pattern Recognition. After one round of data augmentation, the test data samples are input into the trained pattern recognition model to obtain the pattern recognition results.

[0103] The distribution of mapping features of each category of data with the highest accuracy in ten pattern recognition tests in two-dimensional space, such as... Figure 2 As shown in the figure, the 15 health status data of the bearing can be clustered together while maintaining sufficient distance between each data point. The test set confusion matrix is ​​shown in the figure. Figure 3 As shown, from Figure 3 As can be seen, the vast majority of categories can be predicted accurately. Table 1 lists the average accuracy of the present invention compared to momentum contrast (MoCo) and adversarial contrast (AdCo) in ten trials, as well as the training time of the dual-contrast learning model. Table 1 shows that the present invention has the highest accuracy and the shortest total training time.

[0104] Table 1 Comparison of the results of the present invention with those of MoCo and AdCo comparative learning methods.

[0105]

[0106] In summary, the dual-contrast architecture of this invention can improve the contrast between different samples, better extract sample features, and accelerate model convergence. The time-frequency transformation method under different parameters is used to augment one-dimensional data, which can improve the contrast effect between samples. The label diffusion method can improve the labeling rate of the data, and supervise the training of the entire pattern recognition model without overfitting, thereby improving the sufficiency of model training and enhancing the accuracy of pattern recognition.

[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A pattern recognition method based on a dual-contrast architecture, characterized in that, Includes the following steps: Step 1, Data Preprocessing: Perform time-frequency transformation on each sample in the dataset under three different parameters to obtain data-enhanced samples; Step 2, Dual Contrast Structure Construction: The dual contrast architecture consists of encoder f q encoder f k and encoder f j Composed of parallel combinations; Step 3, Negative Instance Set Initialization: There are two negative instance sets, and the initial values ​​for the two negative instance sets are encoder f. k and encoder f j A set of encoded features extracted from several randomly selected data augmentation samples; Step 4, Dual Contrast Architecture Training: The dual contrast architecture is trained using unlabeled data samples from the dataset and a contrast method. The training method for the dual-contrast architecture is as follows: 1) Randomly select a batch of data samples of size K, and after preprocessing, input the data samples into the encoder f respectively. k and encoder f j 1) Obtain the corresponding sample's encoded features k and j; 2) Compare the encoded features j with the negative example set M j Combined with the encoded feature k, the encoder f is compared using a contrastive method. k The parameters and negative example set M j 3) Update; 4) Input the current batch of samples into the encoder f again after preprocessing. q and the updated encoder f k 4) Obtain the encoded features q and k of the sample; 5) Combine the encoded features k with the negative example set M k Combined with the encoded feature q, the encoder f is compared using a contrastive method. q and negative example set M k 5) Update via encoder f q Parameters and encoder f k The parameters for encoder f j Update the parameters; 6) Repeat steps 1)-5) until different data of the same sample can be augmented to correspondence; Step 5, Tag Diffusion: Using encoder f q Using a distance calculation function, labeled samples and a label diffusion method are used to label some unlabeled samples to obtain a diffused labeled dataset. Step 6, supervised training of the pattern recognition model: The pattern recognition model is trained by the encoder f. q It consists of a linear classifier and a diffused labeled dataset, and the entire pattern recognition model is trained in a supervised manner. Step 7, Online Pattern Recognition: After one round of data augmentation, the test data samples are input into the trained pattern recognition model to obtain the pattern recognition results.

2. The pattern recognition method based on a dual-contrast architecture according to claim 1, characterized in that, Each category in the dataset contains a small number of category labels; the time-frequency transformation method is one of short-time Fourier transform, wavelet transform, or Wegener-Will transform; the encoder is constructed using one of fully connected networks, deep convolutional networks, deep belief networks, deep residual networks, generative adversarial networks, autoencoders, or flow models.

3. The pattern recognition method based on a dual-contrast architecture according to claim 2, characterized in that, The implementation method of step 1 is as follows: The acquired one-dimensional vibration signal is subjected to a short-time Fourier transform to obtain a time-frequency matrix, and the time-frequency matrix is ​​trimmed to a suitable size using interpolation. The parameters of the short-time Fourier transform are randomly set, and each sample undergoes three random short-time Fourier transforms to obtain three different time-frequency signals x. q x k and x j It is divided into training set and test set.

4. The pattern recognition method based on a dual-contrast architecture according to claim 1 or 3, characterized in that, The encoder f in step 2 q encoder f k and encoder f j Parallel arrangement, encoder f q encoder f k and encoder f j The inputs are three different data augmentation samples in the training set, and the output is the encoded features of the samples.

5. The pattern recognition method based on a dual-contrast architecture according to claim 4, characterized in that, The implementation method of step 3 is as follows: establish two empty negative instance sets M. k and negative example set M j Randomly select the time-frequency signal x after data augmentation. k x j The inputs are respectively fed into encoder f k encoder f j In the process, we obtain the encoded feature k and encoded feature j, and then fill the negative example set M with the encoded feature k. k Encoded feature j is filled into the negative example set M j This continues until the predetermined negative instance set size is reached.

6. The pattern recognition method based on a dual-contrast architecture according to claim 1, characterized in that, The comparison method is one of Deep InfoMax, MoCo, SimCLR, BYOL, and AdCo.

7. The pattern recognition method based on a dual-contrast architecture according to claim 1, characterized in that, The implementation method of step 4 is as follows: Step 4-1, encoder f k Parameter update: The time-frequency signal x after data augmentation in step 1 k Time-frequency signal x j The inputs are respectively fed into encoder f k encoder f j In the process, we obtain the encoded features k and j of the sample; then we compare the encoded features j with the negative example set M. j Combined, calculate the loss function: In the formula, j i For the negative example set M j The negative examples stored in the array, where n is the set of negative examples M. j The magnitude of the encoder f, where τ is the temperature hyperparameter; k The parameters are updated as follows: In the formula, θ k,epoch This represents the encoder f at epoch iterations. k The parameter, α θ This represents the learning rate used to update the encoder; Step 4-2, Negative Example Set M j Update: Negative example set M j The update calculation is as follows: In the formula, j i Representative negative example set M j Negative examples, α M This indicates the learning rate for updating the negative example set; Step 4-3, encoder f q Parameter update: The time-frequency signal x after data augmentation q Time-frequency signal x k The inputs are respectively fed into encoder f q encoder f k In the process, the encoded features q and k of the sample are obtained; the sample encoding k is then compared with the negative example set M. k Combined, calculate the loss function: In the formula, k i For the negative example set M k The negative examples stored in the array, where n is the set of negative examples M. k Size of encoder f q The parameters are updated as follows: In the formula, θ q,epoch This represents the encoder f at epoch iterations. q Parameters; Step 4-4, Negative example set M j Update: Negative example set M j The update calculation is as follows: In the formula, k i Representative negative example set M k Negative examples in; Steps 4-5, encoder f j The update is as follows: i j,i+1 =mθ j,i +(1-m)(mθ k,i +(1-m)θ q,i ) In the formula, θ j,i+1 Represents encoder f j The parameter θ at the (i+1)th iteration j,i Represents encoder f j The parameter θ in the i-th iteration k,i Represents encoder f k The parameter θ in the i-th iteration q,i Represents encoder f q The parameters at the i-th iteration; i represents the current iteration number of the model, with a value of i = 0, 1, 2, ...; m is the set momentum parameter.

8. The pattern recognition method based on a dual-contrast architecture according to claim 7, characterized in that, The tag diffusion method in step 5 is as follows: using the encoder f updated in steps 4-3. q The coding features of labeled and unlabeled samples are calculated separately. The distance between the coding features of labeled and unlabeled samples is calculated using a distance calculation function. The unlabeled data with the smallest distance are labeled with the relevant labeled data and then recombined into a labeled dataset.

9. The pattern recognition method based on a dual-contrast architecture according to claim 1 or 8, characterized in that, The implementation method of step 6 is as follows: Step 6-1, Construct the pattern recognition model: Load the encoder f q Except for the parameters of the last layer, change the number of nodes in the last layer to the number of categories to be classified, and build a pattern recognition model; Step 6-2: Use the labeled dataset obtained in Step 5 to train the pattern recognition model. After each iteration, use the test set to verify the model and select the model with the highest accuracy in the test set as the final pattern recognition model.

Citation Information

Patent Citations

  • Hand motion frame data based gesture identification method

    CN105354532A

  • Radio frequency fingerprint identification method and system based on data enhancement and comparative learning

    CN115146670A