Electrocardio abnormal event detection method based on open set recognition
By constructing an ECG abnormal event detection method that combines closed sets and unknown detection heads, and utilizing morphological, rhythmic, and frequency domain feature extraction modules, the problem of incomplete coverage of the training dataset is solved, enabling real-time detection and interception of unknown ECG events and reducing the risk of misjudgment.
Patent Information
- Application Number
- CN202511488127.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-01-23
AI Technical Summary
In existing ECG recognition methods, the training dataset cannot cover all types of abnormal ECG events. This causes the model to easily misclassify unfamiliar event types as the most similar known categories, leading to increased false positive and false negative rates.
An ECG abnormal event detection method based on open set recognition is adopted. A closed set classification head and an unknown detection head are constructed. Combined with morphological, rhythm and frequency domain feature extraction modules, the ability to identify unknown types of events is improved by using closed set training data and open set training data, and by using external abnormality exposure methods and self-supervised training methods.
With only a limited number of label categories (AF, VT, SVT), this method enables real-time detection and interception of unknown ECG events, reduces the risk of misjudgment, and improves the ability to detect unknown events and the accuracy of identifying known events.
Smart Images

Figure CN121370180A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electrocardiosignal recognition, in particular to an electrocardio abnormal event detection method based on open set recognition. BACKGROUND
[0002] Electrocardiogram is an important basis for clinical diagnosis of cardiovascular diseases, and is widely used for detection and evaluation of various abnormal events such as arrhythmia, myocardial ischemia, and cardiac conduction block. In recent years, deep learning-based automatic electrocardio analysis technology has made significant progress. Through convolutional neural network, recurrent neural network, and Transformer model structure, specific abnormal rhythms in long-term dynamic electrocardio (such as Holter recording) can be automatically identified and classified.
[0003] The training process of most existing algorithms relies on a large number of manually labeled electrocardio data sets. However, labeling work requires the participation of professional doctors, which is costly and time-consuming. Therefore, in actual research and development, the training data often only covers a few types of clinically common electrocardio abnormal events, such as atrial fibrillation (AF), ventricular tachycardia (VT), and supraventricular tachycardia (SVT). Due to the lack of large-scale labeled samples for other types of arrhythmia, such as premature atrial contraction (PAC), premature ventricular contraction (PVC), atrial flutter, sinus arrest, and junctional rhythm, traditional "closed set classification" models often misclassify the event types not present in the training set as the most similar known category, resulting in increased false positives and false negatives.
[0004] Technicians have proposed a technique for detecting unknown targets based on open set detection. Open set detection algorithms focus on distinguishing between unknown and known objects. Open set detection typically uses closed set images for training and open set images for testing. Closed set images are samples belonging to known categories; they are used during training to build the model's ability to classify these known categories. Closed set training data usually contains samples of known categories and their corresponding labels, guiding the model to learn the correct category classification. The open set consists of samples outside the known categories, unknown samples, or samples of different categories. These samples are usually not directly used for model training because the model cannot obtain category label information from them. The open set is used during testing to evaluate the model's performance when handling unknown samples. The goal of open set detection is to identify open set samples that do not belong to any known category; therefore, the training process primarily focuses on the ability to classify known categories, rather than the ability to specifically classify open set images.
[0005] However, most ECG training data only covers a few common clinical ECG abnormalities, making it suitable as closed-set training data for use in open-set detection algorithms. Therefore, how to apply open-set detection algorithms to ECG data recognition has become a pressing technical problem in the field of intelligent ECG analysis. Summary of the Invention
[0006] To address the problem that existing ECG recognition methods often fail to include all types of labeled sample data in their training datasets, leading to incorrect classification of events not present in the training set into the most similar known categories and resulting in misjudgments, this invention provides an ECG abnormal event detection method based on open set recognition. This method can utilize existing ECG training datasets to accurately identify known types of data while improving the ability to identify unknown types of events and reducing the probability of misjudgment.
[0007] The technical solution of this invention is as follows: a method for detecting abnormal electrocardiogram events based on open set recognition, characterized by comprising the following steps: S1: Data acquisition and preprocessing; Multi-lead dynamic electrocardiogram (ECG) signals are acquired, and the acquired ECG data is preprocessed to obtain the preprocessed ECG signal, denoted as: preprocessed ECG signal; S2: Extract the R peak position from the ECG signal to be preprocessed and generate the RR interval sequence, denoted as: the RR interval sequence to be processed; S3: Construct the feature extraction module; The feature extraction module includes three parallel sub-modules: a morphological feature extraction sub-module, a rhythm feature extraction sub-module, and a frequency domain feature extraction sub-module; the outputs of the three sub-modules are concatenated to form the output features of the feature extraction module. The morphological feature extraction submodule takes the waveform of the preprocessed electrocardiogram signal as input and uses a convolutional neural network to extract the morphological features of the electrocardiogram signal. The morphological features include: P-wave features, QRS wave features and T-wave features. The rhythm feature extraction submodule takes the RR interval sequence to be processed as input, calculates the statistical features of the RR interval sequence, and constructs the temporal dependency between the RR interval sequences; the statistical features include: mean, variance, coefficient of variation (CV), and RMSSD; The frequency domain feature extraction submodule takes the waveform of the preprocessed ECG signal as input, performs time-frequency analysis on the ECG signal, and extracts the frequency domain features of the ECG signal. The frequency domain features include: the energy ratio and dominant frequency of a specific frequency band. S4: Construct a classification detection head; The classification detection head includes a closed set classification head and an unknown detection head; the output of the feature extraction module is concatenated and then sent to the classification detection head. The closed-set classification head outputs the classification probability of known ECG signal types. Assuming the classification detection head is preset to detect K known ECG signal types, then for each input feature x, whether it belongs to each known ECG type, a raw unnormalized score logit value is output. Each logit value is then processed by Softmax to obtain the classification probability. The unknown detection head calculates and outputs a total energy score E based on the logit value output by the closed-set classification head to determine whether the input sample belongs to an unknown category; the formula for calculating the total energy score is: ; In the formula, E(x) represents the total energy value of the K known types corresponding to the input feature x; f k (x) represents the logit value corresponding to whether the input feature x belongs to the kth known ECG signal type, and T is the temperature coefficient; S5: After combining the feature extraction module and the classification detection head, an electrocardiogram signal detection model is constructed; S6: Construct a training dataset, which includes: closed-set training data and open-set training data; The closed-set training data is a training dataset labeled with the type of ECG signal; the closed-set training data is divided into a training set and a validation set; the open-set training data is an unlabeled ECG signal dataset. S7: Train the ECG signal detection model using the training dataset to obtain a trained ECG signal detection model; During the training process, the closed-set training data is used to train the closed-set classification head in the electrocardiogram signal detection model; the closed-set training data and the open-set training data are used to train the unknown detection head in the electrocardiogram signal detection model; S8: Obtain the electrocardiogram signal to be judged, extract the RR interval sequence, denoted as: the to-be-judged RR interval sequence; Send the to-be-judged electrocardiogram signal and the to-be-judged RR interval sequence into the trained electrocardiogram signal detection model to obtain the outputs of the two detection heads; The output of the closed-set classification head includes: the classification probabilities CP corresponding to K known electrocardiogram signal types; The output of the unknown detection head includes: the total energy score E for K known electrocardiogram signal types; S9: Read the preset energy threshold m; Compare the total energy score E corresponding to the to-be-judged electrocardiogram signal with the threshold m; When E < m, mark the to-be-judged electrocardiogram signal as an electrocardiogram signal with an unknown classification; Otherwise, among the K classification probabilities CP of the closed-set classification head, find the maximum value, and the corresponding electrocardiogram signal type is the electrocardiogram signal type to which the to-be-judged electrocardiogram signal belongs, and output the type and the corresponding classification probability CP as the final classification result.
[0008] Its further feature is that: In the frequency domain feature extraction sub-module, the time-frequency analysis method of the electrocardiogram signal includes: short-time Fourier transform (STFT) or wavelet packet decomposition; In the feature extraction module, the morphological feature extraction sub-module extracts morphological features based on a CNN model; the rhythm feature extraction sub-module models the temporal dependence between RR interval sequences based on a neural network combined with Transformer; the frequency domain feature extraction sub-module based on a neural network combined with Transformer establishes consistency between the output of the frequency domain feature extraction sub-module and the outputs of the other two sub-modules; The structure of the closed-set classification head includes: a fully connected layer FC1, a non-linear activation function ReLu, a Dropout, and a fully connected layer FC2 connected in sequence; for the input feature x, the fully connected layer FC2 outputs K logit values and sends them to the unknown detection head; During the training process of the unknown detection head, an external anomaly exposure method is introduced and combined with a self-supervised training method for training; In the training stage, electrocardiogram segments other than K known electrocardiogram signal types are introduced to construct an external data set D out , and the samples in the external data set are used as outlier samples, and an unknown class detection loss L is addedOE : ; In the formula, E in [CE] is the standard cross-entropy loss function, λ is the weighting coefficient, and E out [max(0,mE(x out ))] is for exogenous abnormal sample x out The loss, E(x) out For exogenous abnormal samples x out The energy fraction, m is the preset threshold for E(x); In step S7, Group-Lasso constraints are introduced during model training to sparsify the path parameter groups of each sub-module of the feature extraction module and automatically select the most discriminative feature pathways. The method for setting the energy threshold m specifically includes the following steps: a1: Locate the normal ECG region of the test subject, collect N minutes of ECG signal from the test subject, slice it, and obtain ECG segments; a2: Calculate the energy score E for each segment and arrange these energy scores in ascending order from smallest to largest; a3: Obtain the energy fraction located at the 95th percentile and set it as the energy threshold m of the detected object; The known ECG signal types include: atrial fibrillation (AF), ventricular tachycardia (VT), and supraventricular tachycardia (SVT).
[0009] This application provides a method for detecting abnormal ECG events based on open set recognition. An ECG signal detection model is constructed, which includes a closed set classification head and an unknown detection head. Classification and detection are performed using these two heads, combining accurate classification of known categories with anomaly detection of unknown categories. This allows for the automatic labeling or interception of new ECG signal types not present in the training set while simultaneously recognizing known types of ECG signals. This method combines open set recognition (OSR) with dynamic ECG anomaly detection, achieving real-time discovery and interception of unknown ECG events under training conditions with only limited label categories such as AF, VT, and SVT, reducing the risk of clinical misjudgment. Furthermore, the ECG signal detection model includes three sub-modules for feature extraction, which respectively collect morphological features, rhythm features, and frequency domain features of the input ECG signal. After merging the multi-path feature extraction results, these features are extracted separately using the two detection heads. This improves the accuracy of known category recognition while enhancing the ability to detect unknown events, further reducing the probability of misjudgment. Attached Figure Description
[0010] Figure 1This is a schematic diagram of the structure of the electrical signal detection model in this application. Detailed Implementation
[0011] This application includes a method for detecting abnormal electrocardiogram events based on open set recognition, which includes the following steps.
[0012] S1: Data acquisition and preprocessing; It can acquire multi-lead Holter ECG signals with sampling rates of 128 Hz, 256 Hz, or 500 Hz.
[0013] The acquired electrocardiogram (ECG) data is preprocessed to obtain a preprocessed ECG signal, denoted as: preprocessed ECG signal. The preprocessing method is based on existing technology. In this embodiment, it includes: using a bandpass filter (0.5–40 Hz) to remove baseline drift and high-frequency noise; performing power frequency suppression (50 Hz / 60 Hz Notch); and normalizing the amplitude of the lead signals to eliminate sampling constant differences.
[0014] S2: Extract the R peak position from the preprocessed ECG signal and generate the RR interval sequence, denoted as: the RR interval sequence to be processed.
[0015] S3: Construct the feature extraction module.
[0016] like Figure 1 The feature extraction module shown includes three parallel sub-modules: morphological feature extraction sub-module, rhythm feature extraction sub-module, and frequency domain feature extraction sub-module; the outputs of the three sub-modules are concatenated to form the output features of the feature extraction module. The morphological feature extraction submodule takes the waveform of the preprocessed ECG signal as input and uses a convolutional neural network to extract the morphological features of the ECG signal. The morphological features include: P-wave, QRS wave features and T wave features. In this embodiment, a CNN model is used to extract the morphological features.
[0017] The rhythm feature extraction submodule takes the RR interval sequence to be processed as input, calculates the statistical features of the RR interval sequence, and constructs the temporal dependency between the RR interval sequences. The statistical features include: mean, variance, coefficient of variation (CV), and root mean square (RMSSD) of the difference between adjacent RR intervals. After the statistical features are calculated, the temporal dependency between the RR interval sequences is modeled based on the neural network CNN model in conjunction with the Transformer.
[0018] The frequency domain feature extraction submodule takes the waveform of the preprocessed ECG signal as input, performs time-frequency analysis on the ECG signal, and extracts the frequency domain features of the ECG signal. These features include the energy proportion and dominant frequency of a specific frequency band. The specific ECG signal video analysis method is implemented based on existing technology. In this embodiment, the time-frequency analysis method for the ECG signal includes Short-Time Fourier Transform (STFT) or wavelet packet decomposition. After the frequency domain features are extracted, a neural network combined with a Transformer is used to establish consistency between the output of the frequency domain feature extraction submodule and the outputs of the other two submodules. This ensures that the frequency domain features are represented in a consistent way with the output feature values of the other two submodules, enabling feature concatenation and simultaneous participation in subsequent calculations.
[0019] S4: Construct a classification detection head; As shown in the figure, the classification detection head includes a closed set classification head and an unknown detection head; the output features of the feature extraction module are concatenated and then sent to the classification detection head. The structure of the closed-set classification head includes: a fully connected layer FC1, a non-linear activation function ReLU, Dropout, and a fully connected layer FC2 connected sequentially; for the input feature x, the fully connected layer FC2 outputs K logit values, which are then sent to the unknown detection head. In this embodiment, the input of the fully connected layer FC1 is 512-dimensional, and the output is 128-dimensional; the input of the fully connected layer FC2 is 128-dimensional, and the output is 3-dimensional, corresponding to the three classification types AF, VT, and SVT, respectively.
[0020] Closed-set classification head: Outputs the classification probability of known ECG signal types; Assuming the classification detection head is preset to detect K known ECG signal types, for each input feature x, a raw unnormalized score logit value is output to determine whether it belongs to each known ECG type. Each logit value is then processed by Softmax to obtain the classification probability. In this embodiment, the known ECG signal types include: atrial fibrillation (AF), ventricular tachycardia (VT), and supraventricular tachycardia (SVT).
[0021] The unknown detection head calculates and outputs a total energy score (EnergyScore) E based on the logit value output by the closed-set classification head to determine whether the input sample belongs to an unknown category; the formula for calculating the total energy score is: ; In the formula, E(x) represents the total energy value of the K known types corresponding to the input feature x; f k (x) represents the logit value corresponding to whether the input feature x belongs to the kth known ECG signal type, and T is the temperature coefficient.
[0022] S5: After combining the feature extraction module and the classification detection head, an electrocardiogram signal detection model is constructed.
[0023] S6: Construct the training dataset, which includes closed-set training data and open-set training data; The closed-set training data consists of a training dataset labeled with ECG signal types; the closed-set training data is divided into a training set and a validation set; the open-set training data consists of an unlabeled ECG signal dataset.
[0024] S7: Use the training dataset to train the ECG signal detection model to obtain a trained ECG signal detection model.
[0025] During training, closed-set training data is used to train the closed-set classification head in the ECG signal detection model; closed-set training data and open-set training data are used to train the unknown detection head in the ECG signal detection model. Simultaneously, Group-Lasso constraints are introduced during model training to sparsify the pathway parameter sets of each submodule of the feature extraction module, automatically selecting the most discriminative feature pathways.
[0026] Specifically, the closed-set classification head is trained using Softmax combined with Cross Entropy Loss.
[0027] One of the training methods for Open Set Recognition (OSR) is the Outlier Exposure (OE) method. A common implementation of the OE method is to treat small sample classes as outliers, classifying them as open set content, and the remaining samples as closed set content. During prediction, the classes of these small samples are directly predicted as open set content.
[0028] In the training process of the unknown detection head, this method introduces an external anomaly exposure method combined with a self-supervised training method. During the training phase, external dataset D is constructed by introducing ECG segments other than K known ECG signal types. out Samples from the external dataset are used as outlier samples, and an unknown class detection loss L is added. OE Typically, external datasets D out This will include unlabeled EGG segments, abnormal data in leads, strong noise, and other ECG data segments that do not belong to the known types of AT, VT, and SVT.
[0029] ; In the formula, E in[CE] is the standard cross-entropy loss function, where λ is a weighting coefficient that balances the loss ratio between known class classification and unknown class detection; a larger value indicates that the model prioritizes class detection over unknown classes, while a smaller value indicates that the model prioritizes class classification. out [max(0,mE(x out ))] is for exogenous abnormal sample x out The loss, E(x) out For exogenous abnormal samples x out The energy fraction is m, which is the preset threshold for E(x).
[0030] During network model training, it's desirable to minimize the loss function. Max(0, mE(x)) is a hinge-style loss; if the energy score E(x) is less than a threshold m during training, a penalty is applied, pushing the network to increase the energy score of unknown samples above m. Therefore, in this community, the loss function max(0, mE(x)) can be used to separate unknown and known samples in terms of energy distribution.
[0031] In practice, a portion of unlabeled ECG data of a different type than the training dataset can be introduced. This ECG data may not have a specific type label, but it must be of a different type than the known ECG data. These are used as outlier samples. Augmentation methods are then applied to these outlier samples to obtain augmented outlier samples. Training the model with these augmented outlier samples along with the training set can effectively improve the detection accuracy of the detector. Specific ECG data augmentation methods can be implemented using existing techniques such as temporal occlusion prediction, signal time shifting, and lead discarding.
[0032] Once the ECG signal detection model is trained, it can be deployed in the device for ECG signal classification and detection.
[0033] S8: Obtain the ECG signal to be judged, extract the RR interval sequence, and denot it as: RR interval sequence to be judged; The ECG signal to be judged and the RR interval sequence to be judged are fed into the trained ECG signal detection model to obtain two detection head outputs. The output of the closed-set classification head includes: the classification probability CP corresponding to K known ECG signal types; The output of the unknown detection head includes: the total energy fraction E for K known ECG signal types.
[0034] S9: Read the preset energy threshold m; Compare the total energy fraction E corresponding to the ECG signal to be judged with the threshold m; When E < m, mark the electrocardiogram (ECG) signal to be judged as an ECG signal of unknown classification; Otherwise, among the K classification probabilities CP of the closed-set classification head, find the maximum value, and the corresponding ECG signal type is the ECG signal type to which the ECG signal to be judged belongs. Output the type and the corresponding classification probability CP as the final classification result.
[0035] In practical applications, in order to improve the detection accuracy, different decision thresholds m can be set for different detection objects.
[0036] The energy fraction threshold E is the boundary used to distinguish known classes and unknown classes. The ECG baselines of different patients vary greatly (for example, some people have inherently unstable heart rates, and some people have more lead noises). If a fixed threshold is used, false alarms or missed detections are likely to occur.
[0037] a1: At the device segment where the ECG signal detection model of this method is deployed, find the segment of normal sinus rhythm for the detection object, and in the N minutes (for example, 5 minutes) of ECG collected, cut it into several 10-second ECG segments; a2: Calculate the energy fraction E of each ECG segment; obtain a batch of energy fractions to form the baseline energy distribution of this patient; a3: Sort these energy fractions E in ascending order from smallest to largest, obtain the energy fraction at the 95% percentile, and set it as the energy threshold m of the detection object.
[0038] In this method, by making individualized adjustments to the energy fraction threshold according to the baseline ECG data distribution for different detection objects, false alarms caused by individual differences are reduced, and the clinical applicability is improved.
[0039] Specifically in implementation, the unknown ECG types discovered by the unknown detection head can also be used to perform embedded vector clustering on the unknown events detected in the inference stage, automatically generate candidate event families, and provide a data basis for clinicians to identify ECG times. Specifically, it includes the following steps: b1: Obtain the feature vector output by the fully connected layer FC1 in the structure of the closed-set classification head, denoted as: embedded representation; In this embodiment, the fully connected layer FC1 in the structure of the closed-set classification head outputs a 128-dimensional hidden feature vector.
[0040] b2: Periodically perform HDBSCAN or spectral clustering on the unknown sample embeddings to form candidate event clusters; b3: Generate the representative waveforms and rhythm feature summaries of each cluster for the candidate time clusters for clinicians to quickly determine whether they are new ECG event types.
[0041] To avoid forgetting time in the ECG signal detection model, a portion of representative samples are selected from the original AF, VT, and SVT samples to form a replay buffer during each model training. Simultaneously, when new classes are included, the output of the old model is used as a soft label to guide the new model to retain the discrimination boundaries of the original classes.
[0042] By combining open set identification with dynamic ECG abnormality detection using the technical solution of this invention, for the first time, real-time detection and interception of unknown ECG events are achieved under training conditions with only limited label categories such as AF, VT, and SVT, reducing the risk of clinical misjudgment. Simultaneously, a multi-pathway feature extraction structure including morphology, rhythm, and frequency domain is adopted, and Group-Lasso sparse regularization is introduced to automatically screen key pathways, reducing the model's dependence on redundant features and improving deployment efficiency on low-computing-power devices.
[0043] The ECG signal detection model in this application adopts a dual-head output structure: a closed-set classification head and an unknown detection head. The model simultaneously outputs the classification results of known categories and the energy scores of unknown events as confidence scores, constructing a joint decision mechanism that balances high-precision recognition of known categories and high-sensitivity detection of unknown categories. Furthermore, during the training process of the unknown detection head, this application introduces an exogenous abnormality exposure method, utilizing unlabeled or non-target category ECG segments as external samples to enhance the detection capability of unknown categories. Combined with a self-supervised training method, a general ECG representation is obtained, improving the model's generalization performance to unseen rhythm patterns.
Claims
1. A method for detecting abnormal electrocardiogram events based on open set recognition, characterized in that, It includes the following steps: S1: Data acquisition and preprocessing; Multi-lead dynamic electrocardiogram (ECG) signals are acquired, and the acquired ECG data is preprocessed to obtain the preprocessed ECG signal, denoted as: preprocessed ECG signal; S2: Extract the R peak position from the ECG signal to be preprocessed and generate the RR interval sequence, denoted as: the RR interval sequence to be processed; S3: Construct the feature extraction module; The feature extraction module includes three parallel sub-modules: a morphological feature extraction sub-module, a rhythm feature extraction sub-module, and a frequency domain feature extraction sub-module; The outputs of the three sub-modules are concatenated and used as the output features of the feature extraction module. The morphological feature extraction submodule takes the waveform of the preprocessed electrocardiogram signal as input and uses a convolutional neural network to extract the morphological features of the electrocardiogram signal. The morphological features include: P-wave features, QRS wave features and T-wave features. The rhythm feature extraction submodule takes the RR interval sequence to be processed as input, calculates the statistical features of the RR interval sequence, and constructs the temporal dependency between the RR interval sequences; the statistical features include: mean, variance, coefficient of variation (CV), and RMSSD; The frequency domain feature extraction submodule takes the waveform of the preprocessed ECG signal as input, performs time-frequency analysis on the ECG signal, and extracts the frequency domain features of the ECG signal. The frequency domain features include: the energy ratio and dominant frequency of a specific frequency band. S4: Construct a classification detection head; The classification detection head includes a closed set classification head and an unknown detection head; the output of the feature extraction module is concatenated and then sent to the classification detection head. The closed-set classification head outputs the classification probability of known ECG signal types. Assuming the classification detection head is preset to detect K known ECG signal types, then for each input feature x, whether it belongs to each known ECG type, a raw unnormalized score logit value is output. Each logit value is then processed by Softmax to obtain the classification probability. The unknown detection head calculates and outputs a total energy score E based on the logit value output by the closed-set classification head to determine whether the input sample belongs to an unknown category; the formula for calculating the total energy score is: ; In the formula, E(x) represents the total energy value of the K known types corresponding to the input feature x; f k (x) represents the logit value corresponding to whether the input feature x belongs to the kth known ECG signal type, and T is the temperature coefficient; S5: After combining the feature extraction module and the classification detection head, an electrocardiogram signal detection model is constructed; S6: Construct a training dataset, which includes: closed-set training data and open-set training data; The closed-set training data is a training dataset labeled with the type of ECG signal; the closed-set training data is divided into a training set and a validation set; the open-set training data is an unlabeled ECG signal dataset. S7: Train the ECG signal detection model using the training dataset to obtain a trained ECG signal detection model; During training, the closed-set training data is used to train the closed-set classification head in the ECG signal detection model; the closed-set training data and the open-set training data are used to train the unknown detection head in the ECG signal detection model. S8: Obtain the electrocardiogram (ECG) signal to be judged, extract the RR interval sequence, denoted as: the RR interval sequence to be judged; Send the ECG signal to be judged and the RR interval sequence to be judged into the trained ECG signal detection model to obtain the outputs of two detection heads; The output of the closed-set classification head includes: the classification probabilities CP corresponding to K known ECG signal types; The output of the unknown detection head includes: the total energy fraction E for K known ECG signal types; S9: Read the preset energy threshold m; Compare the total energy fraction E corresponding to the ECG signal to be judged with the threshold m; When E < m, label the ECG signal to be judged as an ECG signal with an unknown classification; Otherwise, find the maximum value among the K classification probabilities CP in the closed-set classification head, and the corresponding ECG signal type is the ECG signal type to which the ECG signal to be judged belongs. Output the type and the corresponding classification probability CP as the final classification result.
2. The ECG abnormality event detection method based on open set recognition according to claim 1, characterized in that: In the frequency-domain feature extraction sub-module, the time-frequency analysis method of the ECG signal includes: short-time Fourier transform (STFT) or wavelet packet decomposition.
3. The ECG abnormality event detection method based on open set recognition according to claim 1, characterized in that: In the feature extraction module, the morphological feature extraction sub-module extracts morphological features based on a CNN model; the rhythm feature extraction sub-module models the temporal dependence between RR interval sequences based on a neural network combined with Transformer; the frequency-domain feature extraction sub-module based on a neural network combined with Transformer establishes consistency between the output of the frequency-domain feature extraction sub-module and the outputs of the other two sub-modules.
4. The ECG abnormal event detection method based on open set recognition according to claim 1, characterized in that: The structure of the closed-set classification head includes: a fully connected layer FC1, a non-linear activation function ReLu, a Dropout, and a fully connected layer FC2 connected in sequence; the fully connected layer FC2 outputs K logit values for the input feature x and sends them to the unknown detection head.
5. The ECG abnormality event detection method based on open set recognition according to claim 1, characterized in that: In the training process of the unknown detection head, an exogenous anomaly exposure method is introduced and combined with a self-supervised training method for training; During the training phase, external dataset D is constructed by introducing ECG segments other than K known ECG signal types. out Samples from the external dataset are used as outlier samples, and an unknown class detection loss L is added. OE : ; In the formula, E in [CE] is the standard cross-entropy loss function, λ is the weighting coefficient, and E out [max(0,mE(x out ))] is for exogenous abnormal sample x out The loss, E(x) out For exogenous abnormal samples x out The energy fraction is m, which is the preset energy threshold for E(x).
6. The method for detecting abnormal electrocardiogram events based on open set recognition according to claim 1, characterized in that: In step S7, during the model training process, a Group-Lasso constraint is introduced to sparsify the path parameter groups of each sub-module of the feature extraction module, and automatically screen the most discriminative feature paths.
7. The ECG abnormality event detection method based on open set recognition according to claim 1, characterized in that: The method for setting the energy threshold m specifically includes the following steps: a1: Find the normal ECG region of the detection object, collect the ECG signal of the detection object for N minutes, slice it to obtain ECG segments; a2: Calculate the energy fraction E of each segment, and arrange these energy fractions in ascending order from smallest to largest; a3: Obtain the energy fraction at the 95% percentile and set it as the energy threshold m of the detection object.
8. The ECG abnormality event detection method based on open set recognition according to claim 1, characterized in that: The known ECG signal types include: atrial fibrillation AF, ventricular tachycardia VT, and supraventricular tachycardia SVT.