A method for classifying electrocardiogram signals based on decoupled twin networks
Through the electrocardiogram classification method based on the decoupled twin network, BDC is used to perform feature extraction and similarity measurement in the small sample classification model, the problems of the accuracy and resource consumption of the existing technology center are solved, and efficient electrocardiogram classification is achieved.
Patent Information
- Application Number
- CN202411062615.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-08-05
AI Technical Summary
The prior art has problems in the classification of electrocardiogram signals with large amount of data, large computing resources, and insufficient generalization ability and accuracy, especially in the case of limited ECG data, which is difficult to achieve effective classification.
Using the electrocardiogram signal classification method based on the decoupled twin network, by acquiring and preprocessing the original electrocardiogram signal, extracting specific categories of signals and constructing an improved small sample classification model, and using Brownian distance covariance (BDC) is used to perform feature extraction and similarity measurement in the embedded module and the measurement module.
It improves the accuracy of ECG signal classification, reduces the consumption of computing and storage resources, and shows good performance in small sample data.
Smart Images

Figure CN118820860B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electrocardiogram signal classification, and in particular to an electrocardiogram signal classification method based on a decoupled twin network. Background Art
[0002] In practice, although the latest neural network models have made significant progress in the field of ECG diagnosis, the large amount of data required by these models makes traditional deep learning classification networks likely to face challenges in generalization and accuracy when processing these signals, and may even fail to achieve automatic classification. In addition, deep network models based on large-scale training datasets require a lot of computing and storage resources, which further limits their feasibility in practical applications. Therefore, effectively classifying ECG signals with limited ECG data remains a challenging task. Summary of the invention
[0003] In order to overcome the deficiencies of the above technologies, the present invention provides an ECG signal classification method based on a decoupled twin network for improving the accuracy of ECG signal classification.
[0004] The technical solution adopted by the present invention to overcome the technical problems is:
[0005] A method for classifying electrocardiogram signals based on a decoupled twin network, comprising:
[0006] a) Obtain n original ECG signals and obtain the original ECG signal set D, D = {(x1, y1), (x2, y2), ..., (x i ,y i ),...,(x n ,y n )}, where x i is the i-th original ECG signal, y i is the i-th original ECG signal x i The corresponding class label, i∈{1,...,n};
[0007] b) Preprocess the original ECG signal set D to obtain a new ECG signal set D′, where D′={(x′1,y1),(x′2,y2),...,(x′ i ,y i ),...,(x′ n ,y n )}, where x′ i is the i-th downsampled ECG signal;
[0008] c) Extract the signals of AF, RBBB, and PVC categories from the new ECG signal set D′ to form the training set D train, extract the AB and STD category signals from the new ECG signal set D′ to form the verification set D val , extract the I-AVB and PAC signals from the new ECG signal set D′ to form the test set D test ;
[0009] d) The training set D train The i-th downsampled ECG signal x i ′ and validation set D val The jth downsampled ECG signal x′ j Perform normalization operations respectively to obtain the normalized ECG signal x″ i And the normalized ECG signal x″ j , j∈{1,...,n},i≠j, each normalized ECG signal constitutes the normalized training set D train ′ and the normalized validation set D val ′;
[0010] e) The normalized ECG signal constitutes the normalized training set D train Pair any two normalized ECG signals in ′ and normalize the validation set D val 'D train Any two normalized ECG signals in ′ are paired to form M sample pairs, and a sample pair set P is constructed. where ((xi″,xi+1″),Y′)i is the i-th sample pair, i∈{1,...,M}, ((xj″,xj+1″),Y′)j is the j-th sample pair, j∈{1,...,M}, y i-1 is the i-1th original ECG signal x i-1 The corresponding class label;
[0011] f) construct an improved small sample classification model consisting of an embedding module and a metric module;
[0012] g) The i-th sample pair ((x i ″,x i+1 ″),Y′) i Input into the embedding module of the improved small sample classification model, and output the feature f(x i ″) and characteristic f(x i+1 ″);
[0013] h) The feature f(x) i ″) and characteristic f(x i+1 ″) is input into the measurement module of the improved small sample classification model, and the similarity measurement value E is output. w (x i ″,xi ″ +1 );
[0014] i) using the Adam optimizer to train the improved small sample classification model through the loss function L to obtain an optimized improved small sample classification model;
[0015] j) In the test set D test The support set S is composed of K randomly sampled ECG signals from each category of I-AVB and PAC supprt , S supprt ={(s1,a1),(s2,a2),...,(s i ,a i ),...,(s 2K ,a 2K )}, where s i is the normalized ECG signal of the ith i is the normalized ECG signal s of the ith i The corresponding class label, i∈{1,...,2K};
[0016] k) In the test set D test Randomly sample Q ECG signals from each category of I-AVB and PAC to form a query set S query , S query ={(q1,b1),(q2,b2),...,(q i ,b i ),...,(q 2Q ,b 2Q )}, where q i is the normalized ECG signal of the ith i is the normalized ECG signal q of the ith i The corresponding class label, i∈{1,...,2Q};
[0017] l) The query set S query The i-th normalized ECG signal q i and support set S supprt The i-th normalized ECG signal s i The data is input into the optimized improved small sample classification model and the classification result is output.
[0018] Furthermore, in step a), n original ECG signals are obtained from the CPSC2018 dataset.
[0019] Furthermore, in step b), the i-th original ECG signal x i Downsample to 250Hz to get the i-th downsampled ECG signal x i ′.
[0020] Further, step g) comprises the following steps:
[0021] g-1) The embedding module of the improved small sample classification model consists of a first convolutional layer, a first batch normalization layer, a second convolutional layer, a second normalization layer, a third convolutional layer, a third batch normalization layer, a fourth convolutional layer, a fourth batch normalization layer, a BDC module, a dropout layer, a linear layer, and an L2 regularization layer;
[0022] g-2) The i-th sample pair ((x i ″,x i+1 ″),Y′) i The i-th normalized ECG signal x in i ″ is sequentially input into the first convolutional layer and the first batch of normalization layers of the embedding module, and the output is feature f1 1 , feature f1 1 It is input into the second convolutional layer and the second batch normalization layer of the embedding module in sequence, and the output is feature f1 2 , feature f1 2 It is input into the third convolutional layer and the third batch normalization layer of the embedding module in sequence, and the output is feature f1 3 , feature f1 3 It is input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module in sequence, and the output is feature f1 4 , feature f1 4 Input to the BDC module of the embedding module and perform Brown distance covariance operation to obtain the BDC matrix f1 5 , the BDC matrix f1 5 It is input into the dropout layer, linear layer, and L2 regularization layer of the embedding module in sequence, and the output is f(x i ″);
[0023] g-3) The i-th sample pair ((x i ″,x i+1 ″),Y′) i The i+1th normalized ECG signal x in i+1 ″ is sequentially input into the first convolutional layer and the first batch of normalization layers of the embedding module, and the output is the feature The characteristics It is input into the second convolutional layer and the second batch normalization layer of the embedding module in sequence, and the output is feature f2 2 , the feature It is input into the third convolutional layer and the third batch normalization layer of the embedding module in sequence, and the output is feature f2 3 , the feature It is input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module in sequence, and the output is the feature The feature f2 4 Input into the BDC module of the embedding module and perform Brownian distance covariance operation to obtain the BDC matrix The BDC matrix It is input into the dropout layer, linear layer, and L2 regularization layer of the embedding module in sequence, and the output is f(x i+1 ″).
[0024] In step h), the feature f(x″ i ) and characteristic f(x″ i+1 ) is input into the metric module of the improved small sample classification model, and the formula E w (x″ i ,x″ i+1 )=||f(x″ i )-f(x″ i+1 )||Calculate the similarity measure E w (x″ i ,x″ i+1 ), where ||·|| is the operation for calculating the Euclidean distance. If the similarity metric E w (x″ i ,x″ i+1 ) and Y′ is less than 0.5, then the i-th normalized ECG signal x i ″ and the normalized ECG signal x of the i+1th i+1 ″ belong to the same category, if the similarity measure E w (x″ i ,x″ i+1 ) and Y′ is greater than or equal to 0.5, then the i-th normalized ECG signal x i ″ and the normalized ECG signal x of the i+1th i+1 “Not in the same category.
[0025] Preferably, the convolution kernel size of the first convolution layer of the embedding module is 25×25, the convolution kernel size of the second convolution layer of the embedding module is 12×12, the convolution kernel size of the third convolution layer of the embedding module is 6×6, and the convolution kernel size of the fourth convolution layer of the embedding module is 3×3.
[0026] Furthermore, the loss function L in step i) is a focal loss function.
[0027] Further, step 1) comprises the following steps:
[0028] l-1) The normalized ECG signal s of the i-th class u iThe input is input into the optimized improved small sample classification model, and then into the first convolution layer and the first batch of normalization layers of the embedding module of the optimized improved small sample classification model, and the output is feature f3. 1 , feature f3 1 It is sequentially input into the second convolutional layer and the second batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is feature f3 2 , feature f3 2 The data are sequentially input into the third convolutional layer and the third batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is feature f3. 3 , feature f3 3 The data are sequentially input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is feature f3. 4 , feature f3 4 Input it into the BDC module of the embedding module of the optimized improved small sample classification model, and after the Brown distance covariance operation, the BDC matrix f3 is obtained. 5 , the BDC matrix f3 5 It is sequentially input into the dropout layer, linear layer, and L2 regularization layer of the embedding module of the optimized improved small sample classification model, and the output is f(s i ) u , u∈{1,2}, when u is 1, it is I-AVB category, when u is 2, it is PAC category, all K features f(s1) of the uth category u ,f(s2) u ,...,f(s i ) u ,...,f(s K ) u The eigenvector μ is obtained by averaging through the mean() function in Python. u ;
[0029] l-2) The normalized ECG signal q i The first convolutional layer and the first batch of normalization layers of the embedding module of the optimized improved small sample classification model are input in sequence, and the feature The characteristics The optimized small sample classification model is sequentially input into the second convolutional layer and the second batch normalization layer of the embedding module, and the output is the feature The characteristics The data are sequentially input into the third convolutional layer and the third batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics The data are sequentially input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics Input it into the BDC module of the embedding module of the optimized improved small sample classification model, and then perform Brown distance covariance operation to obtain the BDC matrix. The BDC matrix It is sequentially input into the dropout layer, linear layer, and L2 regularization layer of the embedding module of the optimized improved small sample classification model, and the output is f(q i );
[0030] l-3) The eigenvector μ u And the characteristic f(q i ) is input into the metric module of the optimized improved small sample classification model, and the formula E w (μ u ,f(q i ))=||μ u -f(q i )||Calculate the similarity measure E w (μ u ,f(q i ));
[0031] l-4) Through the formula Calculate the i-th normalized ECG signal q i Class label The class labels of all 2Q normalized ECG signals constitute the classification results.
[0032] The invention has the beneficial effect of introducing the basic but largely neglected dependency modeling method Brownian distance covariance (BDC) into the small sample ECG signal classification model, and constructing an improved small sample classification model with a new structure. Unlike the traditional CNN model, no pooling layer is used, which reduces the loss of valuable information and improves the performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of the method of the present invention;
[0034] Figure 2 It is a bar graph comparing the average F1 value of the present invention. DETAILED DESCRIPTION
[0035] The following is combined with Figure 1 , Attachment Figure 2 The present invention is further described.
[0036] A method for classifying electrocardiogram signals based on a decoupled twin network, comprising:
[0037] a) Obtain n original ECG signals and obtain the original ECG signal set D, D = {(x1, y1), (x2, y2), ..., (x i ,y i ),...,(x n ,y n )}, where xi is the ith original ECG signal, y i is the i-th original ECG signal x i The corresponding class label, i∈{1,...,n}.
[0038] b) Preprocess the original ECG signal set D to obtain a new ECG signal set D′, where D′={(x′1,y1),(x′2,y2),...,(x′ i ,y i ),...,(x′ n ,y n )}, where x′ i is the i-th downsampled ECG signal.
[0039] c) Extract the signals of AF, RBBB, and PVC categories from the new ECG signal set D′ to form the training set D train , extract the AB and STD category signals from the new ECG signal set D′ to form the verification set D val , extract the I-AVB and PAC signals from the new ECG signal set D′ to form the test set D test .
[0040] d) The training set D train The i-th downsampled ECG signal x i ′ and validation set D val The jth downsampled ECG signal x′ j Perform normalization operations respectively to obtain the normalized ECG signal x i ″ and the normalized ECG signal x j ″, j∈{1,…,n}, i≠j, each normalized ECG signal constitutes the normalized training set D train ′ and the normalized validation set D val ′.
[0041] e) The normalized ECG signal constitutes the normalized training set D train Pair any two normalized ECG signals in ′ and normalize the validation set D val 'D train Any two normalized ECG signals in ′ are paired to form M sample pairs, and a sample pair set P is constructed. Where ((xi ″,x i+1 ″),Y′) i is the i-th sample pair, i∈{1,...,M}, ((x j ″,x j+1 ″),Y′) j is the jth sample pair, j∈{1,…,M}, y i-1 is the i-1th original ECG signal x i-1 The corresponding class label.
[0042] f) Construct an improved small sample classification model consisting of an embedding module and a metric module.
[0043] g) The i-th sample pair ((x i ″,x i+1 ″),Y′) i Input into the embedding module of the improved small sample classification model, and output the feature f(x i ″) and characteristic f(x i+1 ″).
[0044] h) The feature f(x) i ″) and characteristic f(x i+1 ″) is input into the measurement module of the improved small sample classification model, and the similarity measurement value E is output. w (x i ″,x i ″ +1 ).
[0045] i) The improved small sample classification model is trained using the Adam optimizer through the loss function L to obtain the optimized improved small sample classification model.
[0046] j) In the test set D test The support set S is composed of K randomly sampled ECG signals from each category of I-AVB and PAC supprt , S supprt ={(s1,a1),(s2,a2),…,(s i ,a i ),...,(s 2K ,a 2K )}, where s i is the normalized ECG signal of the ith i is the normalized ECG signal s of the ith i The corresponding class label, i∈{1,...,2K}.
[0047] k) In the test set D testRandomly sample Q ECG signals from each category of I-AVB and PAC to form a query set S query , S query ={(q1,b1),(q2,b2),...,(q i ,b i ),...,(q 2Q ,b 2Q )}, where q i is the normalized ECG signal of the ith i is the normalized ECG signal q of the ith i The corresponding class label, i∈{1,...,2Q}.
[0048] l) The query set S query The i-th normalized ECG signal q i and support set S supprt The i-th normalized ECG signal s i The data is input into the optimized improved small sample classification model and the classification result is output.
[0049] Table 1 Comparison of average accuracy
[0050]
[0051] Table 2 Comparison of average precision and recall
[0052]
[0053] In order to more comprehensively evaluate the superiority of our model, we extensively considered several currently popular models, including SCNN, SCEM, LSTM-FCN, and compared them with our model DSNet. The final result is the average of 10 results. We always train and test on the same dataset to ensure fair comparison and evaluate the effectiveness of the proposed strategy. We changed the value of K and observed its impact on the results. In the 2-way K-shot task, we compared our model with three other mainstream models. Table 1 and Appendix Figure 2 The average accuracy and F1 score are shown. We observe that in most cases, our model outperforms the other three models. In the 2-way 2-shot task, DSNet improves the average accuracy by about 36.25%, 22.7%, and 34.2% compared to SCNN, SCEM, and LSTM-FCN. In other tasks, our method also outperforms other models. In addition, LSTM-FCN shows promising performance and has the potential to surpass our method with more data, but performs poorly with less data. Figure 2Among them, the DSNet with K=50 has the highest F1 value, and DSNet has the highest F1 value at different K. Table 2 shows the precision and recall rate indicators, and the results show that both indicators of DSNet are higher than those of the other three models.
[0054] In summary, from the four indicator results of the method, it can be seen that when there are fewer samples, our method has a good ability to distinguish different ECG signals.
[0055] In one embodiment of the present invention, in step a), n original ECG signals are obtained from the CPSC2018 dataset.
[0056] In one embodiment of the present invention, in step b), the i-th original ECG signal x i Downsample to 250Hz to get the i-th downsampled ECG signal x i ′.
[0057] In one embodiment of the present invention, step g) comprises the following steps:
[0058] g-1) The embedding module of the improved small sample classification model consists of the first convolutional layer, the first batch normalization layer, the second convolutional layer, the second normalization layer, the third convolutional layer, the third batch normalization layer, the fourth convolutional layer, the fourth batch normalization layer, the BDC module, the dropout layer, the linear layer, and the L2 regularization layer.
[0059] g-2) The i-th sample pair ((x i ″,x i+1 ″),Y′) i The i-th normalized ECG signal x in i ″ is sequentially input into the first convolutional layer and the first batch of normalization layers of the embedding module, and the output is feature f1 1 , feature f1 1 It is input into the second convolutional layer and the second batch normalization layer of the embedding module in sequence, and the output is feature f1 2 , feature f1 2 It is input into the third convolutional layer and the third batch normalization layer of the embedding module in sequence, and the output is feature f1 3 , feature f1 3 It is input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module in sequence, and the output is feature f1 4 , feature f1 4 Input to the BDC module of the embedding module and perform Brown distance covariance operation to obtain the BDC matrix f1 5 , the BDC matrix f1 5It is input into the dropout layer, linear layer, and L2 regularization layer of the embedding module in sequence, and the output is f(x i ″).
[0060] g-3) The i-th sample pair ((x i ″,x i+1 ″),Y′) i The i+1th normalized ECG signal x in i+1 ″ is sequentially input into the first convolutional layer and the first batch of normalization layers of the embedding module, and the output is the feature The characteristics It is input into the second convolutional layer and the second batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics It is input into the third convolutional layer and the third batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics It is input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics Input into the BDC module of the embedding module and perform Brownian distance covariance operation to obtain the BDC matrix The BDC matrix It is input into the dropout layer, linear layer, and L2 regularization layer of the embedding module in sequence, and the output is f(x i+1 ″).
[0061] In one embodiment of the present invention, in step h), the feature f(x i ″) and characteristic f(x i ″ +1 ) is input into the metric module of the improved small sample classification model, and the formula E w (x″ i ,x″ i+1 )=||f(x″ i )-f(x″ i+1 )||Calculate the similarity measure E w (x″ i ,x″ i+1 ), where ||·|| is the operation for calculating the Euclidean distance. If the similarity metric E w (x″ i ,x″ i+1 ) and Y′ is less than 0.5, then the i-th normalized ECG signal x i ″ and the normalized ECG signal x of the i+1th i+1 ″ belong to the same category, if the similarity measure E w (x″ i ,x″i+1 ) and Y′ is greater than or equal to 0.5, then the i-th normalized ECG signal x i ″ and the normalized ECG signal x of the i+1th i+1 “Not in the same category.
[0062] Preferably, in this embodiment, the convolution kernel size of the first convolution layer of the embedding module is 25×25, the convolution kernel size of the second convolution layer of the embedding module is 12×12, the convolution kernel size of the third convolution layer of the embedding module is 6×6, and the convolution kernel size of the fourth convolution layer of the embedding module is 3×3.
[0063] The loss function L in step i) is the Focal loss function.
[0064] In one embodiment of the present invention, step 1) comprises the following steps:
[0065] l-1) The normalized ECG signal s of the i-th class u i The input is input into the optimized improved small sample classification model, and then into the first convolution layer and the first batch of normalization layers of the embedding module of the optimized improved small sample classification model, and the output is feature f3. 1 , feature f3 1 It is sequentially input into the second convolutional layer and the second batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is feature f3 2 , feature f3 2 The data are sequentially input into the third convolutional layer and the third batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is feature f3. 3 , feature f3 3 The data are sequentially input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is feature f3. 4 , feature f3 4 Input it into the BDC module of the embedding module of the optimized improved small sample classification model, and after the Brown distance covariance operation, the BDC matrix f3 is obtained. 5 , the BDC matrix f3 5 It is sequentially input into the dropout layer, linear layer, and L2 regularization layer of the embedding module of the optimized improved small sample classification model, and the output is f(s i ) u , u∈{1,2}, when u is 1, it is I-AVB category, when u is 2, it is PAC category, all K features f(s1) of the uth category u ,f(s2) u ,...,f(s i ) u,...,f(s K ) u The eigenvector μ is obtained by averaging through the mean() function in Python. u .
[0066] l-2) The normalized ECG signal q i The first convolutional layer and the first batch of normalization layers of the embedding module of the optimized improved small sample classification model are input in sequence, and the feature The characteristics The optimized small sample classification model is sequentially input into the second convolutional layer and the second batch normalization layer of the embedding module, and the output is the feature The characteristics The data are sequentially input into the third convolutional layer and the third batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics The data are sequentially input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics Input it into the BDC module of the embedding module of the optimized improved small sample classification model, and then perform Brown distance covariance operation to obtain the BDC matrix. The BDC matrix It is sequentially input into the dropout layer, linear layer, and L2 regularization layer of the embedding module of the optimized improved small sample classification model, and the output is f(q i ).
[0067] l-3) The eigenvector μ u And the characteristic f(q i ) is input into the metric module of the optimized improved small sample classification model, and the formula E w (μ u ,f(q i ))=||μ u -f(q i )||Calculate the similarity measure E w (μ u ,f(q i )).
[0068] l-4) Through the formula Calculate the i-th normalized ECG signal q i Class label The class labels of all 2Q normalized ECG signals constitute the classification results.
[0069] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for classifying electrocardiogram signals based on a decoupled twin network, characterized in that: include: a) Obtain n original ECG signals and obtain the original ECG signal set D, D = {(x1, y1), (x2, y2), ..., (x i ,y i ),...,(x n ,y n )}, where x i is the i-th original ECG signal, y i is the i-th original ECG signal x i The corresponding class label, i∈{1,...,n}; b) Preprocess the original ECG signal set D to obtain a new ECG signal set D′, where D′={(x′1,y1),(x′2,y2),...,(x′ i ,y i ),...,(x′ n ,y n )}, where x′ i is the i-th downsampled ECG signal; c) Extract the signals of AF, RBBB, and PVC categories from the new ECG signal set D′ to form the training set D train , extract the AB and STD signals from the new ECG signal set D′ to form the validation set D val , extract the I-AVB and PAC signals from the new ECG signal set D′ to form the test set D test ; d) The training set D train The i-th downsampled ECG signal x′ i And the validation set D val The jth downsampled ECG signal x′ j Perform normalization operations respectively to obtain the normalized ECG signal x i ″ and the normalized ECG signal x j ″, j∈{1,...,n}, i≠j, each normalized ECG signal constitutes the normalized training set D train ′ and the normalized validation set D val ′; e) The normalized ECG signal constitutes the normalized training set D train Pair any two normalized ECG signals in ′ and normalize the validation set D val 'D train Any two normalized ECG signals in ′ are paired to form M sample pairs, and a sample pair set P is constructed. Where ((x i ″,x i+1 ″),Y′) i is the i-th sample pair, i∈{1,...,M}, ((x j ″,x j+1 ″),Y′) j is the jth sample pair, j∈{1,...,M}, y i-1 is the i-1th original ECG signal x i-1 The corresponding class label; f) construct an improved small sample classification model consisting of an embedding module and a metric module; g) The i-th sample pair ((x i ″,x i+1 ″),Y′) i Input into the embedding module of the improved small sample classification model, and output the feature f(x i ″) and characteristic f(x i+1 ″); h) The feature f(x) i ″) and characteristic f(x i+1 ″) is input into the measurement module of the improved small sample classification model, and the similarity measurement value E is output. w (x″ i ,x″ i+1 ); i) using the Adam optimizer to train the improved small sample classification model through the loss function L to obtain an optimized improved small sample classification model; j) In the test set D test The support set S is composed of K randomly sampled ECG signals from each category of I-AVB and PAC supprt , S supprt ={(s1,a1),(s2,a2),...,(s i ,a i ),...,(s 2K ,a 2K )}, where s i is the normalized ECG signal of the ith i is the normalized ECG signal s of the ith i The corresponding class label, i∈{1,...,2K}; k) In the test set D test Randomly sample Q ECG signals from each category of I-AVB and PAC to form a query set S query , S query ={(q1,b1),(q2,b2),...,(q i ,b i ),...,(q 2Q ,b 2Q )}, where q i is the normalized ECG signal of the ith i is the normalized ECG signal q of the ith i The corresponding class label, i∈{1,...,2Q}; l) The query set S query The i-th normalized ECG signal q i and support set S supprt The i-th normalized ECG signal s i Input it into the optimized improved small sample classification model, and output the classification result; Step g) comprises the following steps: g-1) The embedding module of the improved small sample classification model consists of a first convolutional layer, a first batch normalization layer, a second convolutional layer, a second normalization layer, a third convolutional layer, a third batch normalization layer, a fourth convolutional layer, a fourth batch normalization layer, a BDC module, a dropout layer, a linear layer, and an L2 regularization layer; g-2) The i-th sample pair ((x i ″,x i+1 ″),Y′) i The i-th normalized ECG signal x in i ″ is sequentially input into the first convolutional layer and the first batch of normalization layers of the embedding module, and the output is the feature The characteristics It is input into the second convolutional layer and the second batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics It is input into the third convolutional layer and the third batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics It is input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics Input into the BDC module of the embedding module and perform Brownian distance covariance operation to obtain the BDC matrix The BDC matrix It is input into the dropout layer, linear layer, and L2 regularization layer of the embedding module in sequence, and the output is f(x i ″); g-3) The i-th sample pair ((x i ″,x i+1 ″),Y′) i The i+1th normalized ECG signal x in i+1 ″ is sequentially input into the first convolutional layer and the first batch of normalization layers of the embedding module, and the output is the feature The characteristics It is input into the second convolutional layer and the second batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics It is input into the third convolutional layer and the third batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics It is input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module in sequence, and the output is the feature The characteristics Input into the BDC module of the embedding module and perform Brownian distance covariance operation to obtain the BDC matrix The BDC matrix It is input into the dropout layer, linear layer, and L2 regularization layer of the embedding module in sequence, and the output is f(x i+1 ″).
2. The electrocardiogram signal classification method based on the decoupled twin network according to claim 1 is characterized in that: In step a), n original ECG signals are obtained from the CPSC2018 dataset.
3. The electrocardiogram signal classification method based on the decoupled twin network according to claim 1 is characterized in that: In step b), the i-th original ECG signal x i Downsample to 250Hz to get the i-th downsampled ECG signal x i ′.
4. The ECG signal classification method based on decoupled twin network according to claim 1 is characterized by: In step h), the feature f(x″ i ) and characteristic f(x″ i+1 ) is input into the metric module of the improved small sample classification model, and the formula E w (x″ i ,x″ i+1 )=||f(x″ i )-f(x″ i+1 )||Calculate the similarity measure E w (x″ i ,x″ i+1 ), where ||·|| is the operation for calculating the Euclidean distance. If the similarity metric E w (x″ i ,x″ i+1 ) and Y′ is less than 0.5, then the i-th normalized ECG signal x i ″ and the normalized ECG signal x of the i+1th i+1 ″ belong to the same category, if the similarity measure E w (x″ i ,x″ i+1 ) and Y′ is greater than or equal to 0.5, then the i-th normalized ECG signal x i ″ and the normalized ECG signal x of the i+1th i+1 “Not in the same category.
5. The electrocardiogram signal classification method based on decoupled twin network according to claim 1, characterized in that: The convolution kernel size of the first convolution layer of the embedding module is 25×25, the convolution kernel size of the second convolution layer of the embedding module is 12×12, the convolution kernel size of the third convolution layer of the embedding module is 6×6, and the convolution kernel size of the fourth convolution layer of the embedding module is 3×3.
6. The electrocardiogram signal classification method based on decoupled twin network according to claim 1, characterized in that: The loss function L in step i) is the Focal loss function.
7. The electrocardiogram signal classification method based on decoupled twin network according to claim 1, characterized in that: Step 1) comprises the following steps: l-1) The normalized ECG signal s of the i-th class u i The input is input into the optimized improved small sample classification model, and then into the first convolution layer and the first batch of normalization layers of the embedding module of the optimized improved small sample classification model, and the feature is output. The characteristics The optimized small sample classification model is sequentially input into the second convolutional layer and the second batch normalization layer of the embedding module, and the output is the feature The characteristics The data are sequentially input into the third convolutional layer and the third batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics The data are sequentially input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics Input it into the BDC module of the embedding module of the optimized improved small sample classification model, and then perform Brown distance covariance operation to obtain the BDC matrix. The BDC matrix It is sequentially input into the dropout layer, linear layer, and L2 regularization layer of the embedding module of the optimized improved small sample classification model, and the output is f(s i ) u , u∈{1,2}, when u is 1, it is I-AVB category, when u is 2, it is PAC category, all K features f(s1) of the uth category u ,f(s2) u ,...,f(s i ) u ,...,f(s K ) u The eigenvector μ is obtained by averaging through the mean() function in Python. u ; l-2) The normalized ECG signal q i The first convolutional layer and the first batch of normalization layers of the embedding module of the optimized improved small sample classification model are input in sequence, and the feature The characteristics The optimized small sample classification model is sequentially input into the second convolutional layer and the second batch normalization layer of the embedding module, and the output is the feature The characteristics The data are sequentially input into the third convolutional layer and the third batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics The data are sequentially input into the fourth convolutional layer and the fourth batch normalization layer of the embedding module of the optimized improved small sample classification model, and the output is the feature The characteristics Input it into the BDC module of the embedding module of the optimized improved small sample classification model, and then perform Brown distance covariance operation to obtain the BDC matrix. The BDC matrix It is sequentially input into the dropout layer, linear layer, and L2 regularization layer of the embedding module of the optimized improved small sample classification model, and the output is f(q i ); l-3) The eigenvector μ u And the characteristic f(q i ) is input into the metric module of the optimized improved small sample classification model, and the formula E w (μ u ,f(q i ))=||μ u -f(q i )||Calculate the similarity measure E w (μ u ,f(q i )); l-4) Through the formula Calculate the i-th normalized ECG signal q i Class label The class labels of all 2Q normalized ECG signals constitute the classification results.
Citation Information
Patent Citations
Aero-engine rolling bearing fault diagnosis method based on twin network metric learning
CN114818811A
Bearing small sample fault diagnosis method based on improved twin network
CN117195726A