Construction method and system of small sample ECG signal recognition model based on Shapelet
By combining shapelet analysis and small sample learning with the attention mechanism, an ECG signal recognition model is constructed, which solves the problems of high computational complexity and insufficient sample number in ECG signal processing technology, and achieves efficient recognition of ECG signals and improved diagnostic accuracy.
Patent Information
- Application Number
- CN202411870587.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-12-18
AI Technical Summary
Existing ECG signal processing technology has problems in the diagnosis of heart disease, such as high computational complexity, sensitivity to data deformation, and the need for a large number of sample training. Deep learning algorithms are difficult to apply in the field of medical signals.
The shapelet analysis method and small sample learning are combined with the attention mechanism. Through local feature extraction and weighting, a small sample ECG signal recognition model is constructed to improve the accuracy of ECG signal recognition.
In the case of limited samples, the accuracy of ECG signal recognition and the generalization ability of the model are improved, overfitting is avoided, and the ability to capture key local features of ECG signals is enhanced.
Smart Images

Figure CN119700134B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of integration of computer and biomedical processing, and in particular to a method and system for constructing a small sample electrocardiogram signal recognition model based on shapelet. Background Art
[0002] Electrocardiogram (ECG) signal processing is a key technology in medical diagnostics. It records and analyzes the heart's electrical activity to aid in the diagnosis and treatment of heart disease. The acquisition and analysis of ECG signals are crucial for understanding cardiac function and diagnosing heart disease. However, existing ECG signal processing technologies have several drawbacks and limitations.
[0003] Traditional ECG signal processing treats ECG signals as time series data. Time series classification methods include dynamic time wrapping (DTW), Fourier transform, and principal component analysis (PCA). While these methods are effective in processing time series data, they also have limitations, such as high computational complexity and sensitivity to data deformation.
[0004] To address this issue, deep learning algorithms are currently being used to process ECG signals. While deep learning algorithms offer high accuracy in ECG classification, they typically require a large number of training samples. However, in the medical field, obtaining large numbers of labeled samples is difficult, which limits the performance of deep learning algorithms. Summary of the Invention
[0005] The present invention aims to solve one of the technical problems existing in the related art at least to a certain extent.
[0006] One purpose of the present invention is to provide a method for constructing a small sample ECG signal recognition model based on shapelet, combining shapelet and small sample learning methods to construct an ECG signal recognition model for small samples, thereby improving the accuracy of ECG signal recognition when the number of samples is limited.
[0007] Another object of the present invention is to provide a system for constructing a small sample electrocardiogram signal recognition model based on shapelet.
[0008] In order to achieve the above-mentioned objectives, the present invention provides, on one hand, a method for constructing a small sample electrocardiogram signal recognition model based on shapelet, comprising:
[0009] S100, collecting ECG signals, preprocessing the ECG signals, extracting features of time series data, and forming a feature data set;
[0010] S200, using the shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag;
[0011] S300, apply the attention mechanism to weight the local features in the pattern bag to highlight the key features;
[0012] S400: training a small sample ECG recognition model based on features in the pattern bag, and using the model to recognize and classify ECG signals.
[0013] A further preferred technical solution of the present invention is that step S100 collects ECG signals, pre-processes the ECG signals, extracts features of time series data, and forms a feature data set, including:
[0014] S110, performing segment processing on each lead of the electrocardiogram signal;
[0015] S120 , extracting statistical features and frequency domain features from each segment of the ECG signal to form a feature data set.
[0016] Preferably, the step S200 of using the shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag includes:
[0017] S210, performing shapelet analysis on the features of the ECG signal of each lead, identifying and extracting local features, and obtaining a plurality of shapelets representing the local features of the time series data of the lead;
[0018] S220, calculating the weight of each shapelet, and selecting one or more shapelets with the highest weight;
[0019] S230 , repeating steps S210 - S220 to form a pattern bag representing the key features of the ECG signal of the lead using the selected shapelets.
[0020] Preferably, the shapelet weight calculation formula in step S220 is:
[0021]
[0022] Among them, W j is the weight of the j-th shapelet; f j is the feature importance score of the shapelet; f k is the feature importance score of the k-th shapelet; α is an adjustable parameter that controls the concentration of the weight distribution; N is the total number of shapelets in the pattern bag.
[0023] Preferably, the step S300 of applying the attention mechanism to weight the local features in the pattern bag to highlight the key features includes:
[0024] S310, introduce an attention mechanism to perform attention weighting on the ECG signal features of each lead;
[0025] S320: Update the ECG signal features of the corresponding lead using the weighted features.
[0026] Preferably, the calculation formula for attention weighting in step S310 is:
[0027]
[0028] Among them, a j is the attention weight of the jth feature; g j is the local importance score of the feature; g k is the local importance score of the kth feature; β is an adjustable parameter that controls the degree of centralization of the weight distribution; M is the total number of features considered.
[0029] Preferably, the step S400 of training a small sample ECG recognition model based on the features in the pattern bag and identifying and classifying the ECG signal using the model includes:
[0030] The updated ECG signal features are used to train a small sample ECG recognition model, and the hyperparameters are adjusted through the validation set and test set in the feature dataset to evaluate the generalization ability of the model.
[0031] Another aspect of the present invention provides a system for constructing a small sample electrocardiogram signal recognition model based on shapelet, comprising:
[0032] The data acquisition module is used to collect and preprocess the ECG signals, extract the features of the time series data, and form a feature data set;
[0033] The local feature extraction module is used to identify and extract representative local patterns from the feature data set using the shapelet analysis method to form a pattern bag;
[0034] The data weighting calculation module is used to apply the attention mechanism to weight the local features in the pattern bag and highlight the key features;
[0035] The model building module is used to train a small sample ECG recognition model based on the features in the pattern bag to obtain a trained ECG recognition model.
[0036] Preferably, the data acquisition module collects ECG signals, preprocesses the ECG signals, extracts features of time series data, and forms a feature data set. The specific method includes:
[0037] S110, performing segment processing on each lead of the electrocardiogram signal;
[0038] S120 , extracting statistical features and frequency domain features from each segment of the ECG signal to form a feature data set.
[0039] Preferably, the local feature extraction module uses a shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag. The specific method includes:
[0040] S210, performing shapelet analysis on the features of the ECG signal of each lead, identifying and extracting local features, and obtaining a plurality of shapelets representing the local features of the time series data of the lead;
[0041] S220, calculating the weight of each shapelet, and selecting one or more shapelets with the highest weight;
[0042] S230 , repeating steps S210 - S220 to form a pattern bag representing the key features of the ECG signal of the lead using the selected shapelets.
[0043] As a preference, the shapelet weight calculation formula is:
[0044]
[0045] Among them, W j is the weight of the j-th shapelet; f j is the feature importance score of the shapelet; f k is the feature importance score of the k-th shapelet; α is an adjustable parameter that controls the concentration of the weight distribution; N is the total number of shapelets in the pattern bag.
[0046] Preferably, the data weighted calculation module applies an attention mechanism to weight local features in the pattern bag to highlight key features. The specific method includes:
[0047] S310, introduce an attention mechanism to perform attention weighting on the ECG signal features of each lead;
[0048] S320: Update the ECG signal features of the corresponding lead using the weighted features.
[0049] As a preference, the attention weighted calculation formula is:
[0050]
[0051] Among them, aj is the attention weight of the jth feature; g j is the local importance score of the feature; g k is the local importance score of the kth feature; β is an adjustable parameter that controls the degree of centralization of the weight distribution; M is the total number of features considered.
[0052] Preferably, the model building module trains a small sample ECG recognition model based on the features in the pattern bag, and uses the model to identify and classify ECG signals. The specific method is:
[0053] The updated ECG signal features are used to train a small sample ECG recognition model, and the hyperparameters are adjusted through the validation set and test set in the feature dataset to evaluate the generalization ability of the model.
[0054] Another aspect of the present invention provides a non-transitory computer-readable storage medium having computer instructions stored thereon, which enable a computer to execute the above-mentioned method for constructing a small sample electrocardiogram signal recognition model based on shapelet.
[0055] Another aspect of the present invention provides an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus, and the processor calls the logic instructions in the memory to execute the above-mentioned method for constructing a small sample electrocardiogram signal recognition model based on shapelet.
[0056] On the other hand, the present invention provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer executes the above-mentioned method for constructing a small sample electrocardiogram signal recognition model based on shapelet.
[0057] Beneficial effects: (1) The present invention extracts local features of ECG signals through shapelet analysis method, defines shapelet as the local feature representation of time series data, and can capture local patterns in ECG signals, which helps to construct pattern bags. By identifying and extracting local features and calculating the weight of each shapelet, shapelets are sorted according to the weights, and shapelets with the highest weights are selected to form pattern bags to represent the key features of ECG signals;
[0058] (2) The present invention further enhances the ability to capture local features of ECG signals by using the attention mechanism, which is used to highlight key local features in ECG signals. By weighting the ECG signal features of each lead, the model can pay more attention to the key local features in ECG signals, thereby improving the accuracy of recognition.
[0059] (3) The ECG signal recognition model constructed by the present invention is trained with small sample data. For the same disease, multiple pattern bags are mined to improve the generalization ability of the model and avoid overfitting. The diagnostic accuracy of the model is improved through continuous parameter adjustment and structural optimization. The performance of the ECG signal recognition model is further improved by weighted fusion of features from different leads. The features from different leads are weightedly fused based on the importance of the features or the signal quality of the leads, so that the fused features have richer information and can better capture the complexity of the ECG signals. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 This is a flowchart of the method for constructing a small sample electrocardiogram signal recognition model based on shapelet of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the embodiments described are part of the embodiments of the present invention, not all of the embodiments, and they should not be understood as limitations on the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In the description of the present invention, it should be understood that the terms used are only for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0062] The following combination Figure 1 The present invention describes a method and system for constructing a small sample electrocardiogram (ECG) signal recognition model based on shapelet.
[0063] Before describing the technical solution of the present invention in detail, the technology involved in the present invention is first described.
[0064] The technical problem faced by the present invention is that the construction of deep learning models generally requires a large number of samples for training. However, in the field of medical signals, obtaining a large number of labeled samples is difficult, resulting in difficulties in model construction and low model prediction accuracy.
[0065] Based on this, the present invention provides a method and system for constructing a small-sample ECG signal recognition model based on shapelet, which applies algorithms such as shapelet, small-sample learning, and attention mechanism.
[0066] Among them, Shapelet is a technology used for time series data mining and analysis, and has been widely used in time series classification tasks. The core idea of Shapelet technology is to extract subsequences (shapelets) of different lengths from the original time series, and use Euclidean distance, DTW distance, etc. to calculate the similarity between the time series. Shapelets with high discriminative ability are selected as features, and classification models such as decision trees, random forests, and support vector machines are constructed using the selected shapelets. The advantage of Shapelet technology is that it can greatly reduce computing time and improve classification efficiency by extracting subsequences. Shapelet technology has been applied in many fields, including assisting disease diagnosis by analyzing medical signals such as electrocardiograms and electroencephalograms. In general, Shapelet technology provides an effective method for the classification and pattern recognition of time series data by extracting the most representative subsequences, and has broad application prospects and research value.
[0067] Few-shot learning (FSL) is also a key research direction in machine learning, aiming to effectively learn and predict using very small amounts of training data. This technique is critical for many applications, such as medical image analysis, rare language processing, and any field where obtaining labeled data is expensive. Traditional machine learning methods typically rely on large amounts of labeled data to train models. These methods perform well on large datasets, but performance often degrades significantly when data is scarce. Few-shot learning research addresses this challenge. To train effective models even in data-scarce environments, the goal is to enable models to quickly learn and generalize using a small number of examples. Few-shot learning methods can be broadly categorized as follows: 1. Data augmentation-based methods: These methods generate more training examples by transforming existing data (such as rotation, scaling, and flipping). 2. Prior knowledge-based methods: These methods use a framework for learning how to learn, training a meta-model that can quickly adapt to new tasks. 3. Model design-based methods: These methods introduce attention mechanisms to enable models to focus on key features of a small number of examples.
[0068] The attention mechanism is a technique that has made significant progress in deep learning in recent years, particularly in natural language processing (NLP) and computer vision. When processing input information, the model selectively focuses on the most relevant parts of the task at hand while ignoring irrelevant or less important information. The core idea of the attention mechanism is to compute a set of attention weights, which represent the importance of each element in the input sequence to the task at hand. The basic attention mechanism can be divided into the following steps: 1. Calculating a similarity score: For each element in the input sequence, a similarity score is calculated between it and the query. Common methods include dot products and additive attention. 2. Normalizing the scores: Using the softmax function, the similarity scores are normalized into a probability distribution. These normalized scores are called attention weights. 3. Weighted summation: The attention weights are used to perform a weighted sum of the input sequence to obtain a new representation, which is the output of the attention operation. The Transformer model represents a major breakthrough in the attention mechanism. It completely abandons the RNN structure and relies on a self-attention mechanism to capture dependencies within the sequence. The Transformer model not only solves the problem of long-distance dependency, but also greatly improves computing efficiency, making parallel computing possible.
[0069] The present invention combines shapelet technology and small sample learning technology. For the same disease, the key features extracted by shapelet are combined into multiple representative pattern bags. The generalization ability of the small sample ECG disease determination method is improved by expanding the small sample ECG dataset.
[0070] Example 1: This example provides a method for constructing a small sample ECG signal recognition model based on shapelet, such as Figure 1 Shown, including:
[0071] S100, collecting ECG signals, preprocessing the ECG signals, extracting features of time series data, and forming a feature data set; including:
[0072] S110, performing segment processing on each lead of the electrocardiogram signal;
[0073] S120 , extracting statistical features and frequency domain features from each segment of the ECG signal to form a feature data set.
[0074] S200. Define shapelet as a local feature representation of time series data that can capture local patterns in electrocardiogram signals. Use shapelet analysis to identify and extract representative local patterns from feature datasets to form a pattern bag; including:
[0075] S210, performing shapelet analysis on the features of the ECG signal of each lead, identifying and extracting local features, and obtaining a plurality of shapelets representing the local features of the time series data of the lead;
[0076] S220. Calculate the weight of each shapelet. The shapelet weight calculation formula is:
[0077]
[0078] Among them, W j is the weight of the j-th shapelet; f j is the feature importance score of the shapelet; f k is the feature importance score of the k-th shapelet; α is an adjustable parameter that controls the concentration of the weight distribution; N is the total number of shapelets in the pattern bag;
[0079] S230, sorting the shapelets according to the weights, and selecting the shapelets with the highest weights to form a pattern bag to represent the key features of the ECG signal of the lead;
[0080] S240: Repeat steps S210-S230 to form a pattern bag representing the key features of the ECG signal of the lead using the selected shapelets. Mining representative pattern bags improves the generalization ability of small sample methods by expanding the small sample dataset.
[0081] S300. Define the attention mechanism as a dynamic weighting method for highlighting key local features in the ECG signal. Apply the attention mechanism to weight the local features in the pattern bag. The specific method includes:
[0082] S310. Introduce the attention mechanism to perform attention weighting on the ECG signal features of each lead; the calculation formula for attention weighting is:
[0083]
[0084] Among them, a j is the attention weight of the jth feature; g j is the local importance score of the feature; g k is the local importance score of the kth feature; β is an adjustable parameter that controls the degree of concentration of the weight distribution; M is the total number of features considered;
[0085] S320. Update the ECG signal features of the corresponding lead using the weighted features to enhance the model's sensitivity to key local features.
[0086] S400. Use the updated ECG signal features to train a small sample ECG recognition model, and adjust hyperparameters using the validation set and test set in the feature dataset to evaluate the generalization ability of the model.
[0087] Example 2: A system for constructing a small sample electrocardiogram signal recognition model based on shapelet, comprising:
[0088] The data acquisition module is used to collect and preprocess the ECG signals, extract the features of the time series data, and form a feature data set;
[0089] The local feature extraction module is used to identify and extract representative local patterns from the feature data set using the shapelet analysis method to form a pattern bag;
[0090] The data weighting calculation module is used to apply the attention mechanism to weight the local features in the pattern bag and highlight the key features;
[0091] The model building module is used to train a small sample ECG recognition model based on the features in the pattern bag to obtain a trained ECG recognition model.
[0092] The data acquisition module is specifically used for:
[0093] (1) Segment processing of each lead of the ECG signal;
[0094] (2) Extract statistical features and frequency domain features from each segment of ECG signal to form a feature data set.
[0095] The local feature extraction module is specifically used for:
[0096] (1) Perform shapelet analysis on the characteristics of the ECG signal of each lead, identify and extract local features, and obtain several shapelets representing the local features of the lead time series data;
[0097] (2) Calculate the weight of each shapelet and select one or more shapelets with the highest weight. The shapelet weight calculation formula is:
[0098]
[0099] Among them, W j is the weight of the j-th shapelet; f j is the feature importance score of the shapelet; f k is the feature importance score of the k-th shapelet; α is an adjustable parameter that controls the concentration of the weight distribution; N is the total number of shapelets in the pattern bag.
[0100] (3) Repeat the local feature extraction to form a pattern bag representing the key features of the ECG signal of the lead with the selected shapelets.
[0101] The data weighted calculation module is specifically used for:
[0102] (1) Introduce the attention mechanism to perform attention weighting on the ECG signal features of each lead; the calculation formula for attention weighting is:
[0103]
[0104] Among them, a j is the attention weight of the jth feature; g j is the local importance score of the feature; g k is the local importance score of the kth feature; β is an adjustable parameter that controls the degree of centralization of the weight distribution; M is the total number of features considered.
[0105] (2) Update the ECG signal features of the corresponding lead using the weighted features.
[0106] The model building module is specifically used to:
[0107] The updated ECG signal features are used to train a small sample ECG recognition model, and the hyperparameters are adjusted through the validation set and test set in the feature dataset to evaluate the generalization ability of the model.
[0108] Embodiment 3: This embodiment provides a non-transitory computer-readable storage medium having computer instructions stored thereon, which enable a computer to execute a method for constructing a small sample electrocardiogram signal recognition model based on shapelet, the method comprising the following steps:
[0109] S100, collecting ECG signals, preprocessing the ECG signals, extracting features of time series data, and forming a feature data set;
[0110] S200, using the shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag;
[0111] S300, apply the attention mechanism to weight the local features in the pattern bag to highlight the key features;
[0112] S400: training a small sample ECG recognition model based on features in the pattern bag, and using the model to recognize and classify ECG signals.
[0113] Example 4: This embodiment provides an electronic device, which may include: a processor, a communications interface, a memory, and a communications bus, wherein the processor, the communications interface, and the memory communicate with each other via the communications bus. The processor may call logic instructions in the memory to execute a method for constructing a small sample electrocardiogram signal recognition model based on shapelets, the method comprising the following steps:
[0114] S100, collecting ECG signals, preprocessing the ECG signals, extracting features of time series data, and forming a feature data set;
[0115] S200, using the shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag;
[0116] S300, apply the attention mechanism to weight the local features in the pattern bag to highlight the key features;
[0117] S400: training a small sample ECG recognition model based on features in the pattern bag, and using the model to recognize and classify ECG signals.
[0118] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0119] Embodiment 5: This embodiment provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform a method for constructing a small sample electrocardiogram signal recognition model based on shapelet, which includes the following steps:
[0120] S100, collecting ECG signals, preprocessing the ECG signals, extracting features of time series data, and forming a feature data set;
[0121] S200, using the shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag;
[0122] S300, apply the attention mechanism to weight the local features in the pattern bag to highlight the key features;
[0123] S400: training a small sample ECG recognition model based on features in the pattern bag, and using the model to recognize and classify ECG signals.
[0124] The present invention extracts local features of ECG signals through the shapelet analysis method, defines shapelet as a local feature representation of time series data, can capture local patterns in ECG signals, and helps to build a pattern bag. By identifying and extracting local features and calculating the weight of each shapelet, the shapelets are sorted according to the weight, and the shapelets with the highest weight are selected to form a pattern bag, which represents the key features of the ECG signal. The present invention further enhances the ability to capture local features of ECG signals by using the attention mechanism, and highlights the key local features in the ECG signal by weighting the ECG signal features of each lead. The ECG recognition model of the present invention is trained with small sample data, and the generalization ability of the model is evaluated by methods such as cross-validation to avoid overfitting and improve the generalization ability and diagnostic accuracy of the model.
[0125] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0126] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for constructing a small sample electrocardiogram signal recognition model based on shapelet, characterized in that: include: S100, collecting ECG signals, preprocessing the ECG signals, extracting features of time series data, and forming a feature data set; S200, using the shapelet analysis method to identify and extract representative local patterns from the feature data set to form a pattern bag; including: S210, performing shapelet analysis on the features of the ECG signal of each lead, identifying and extracting local features, and obtaining a plurality of shapelets representing the local features of the time series data of the lead; S220, calculate the weight of each shapelet, and select one or more shapelets with the highest weight; the shapelet weight calculation formula is: ; in, It is The weight of each shapelet; is the feature importance score of the shapelet; It is The feature importance score of each shapelet; It is an adjustable parameter that controls the concentration of weight distribution; is the total number of shapelets in the pattern bag; S230, repeating steps S210-S220, and using the selected shapelets to form a pattern bag representing the key features of the ECG signal of the lead; S300: Apply the attention mechanism to weight the local features in the pattern bag to highlight the key features; including: S310. Introduce the attention mechanism to perform attention weighting on the ECG signal features of each lead; the calculation formula for attention weighting is: ; in, It is The attention weight of each feature; is the local importance score of the feature; It is The local importance score of each feature; It is an adjustable parameter that controls the concentration of weight distribution; is the total number of features considered; S320, updating the ECG signal features of the corresponding lead using the weighted features; S400: training a small sample ECG recognition model based on features in the pattern bag, and using the model to recognize and classify ECG signals.
2. The method for constructing a small sample electrocardiogram signal recognition model based on shapelet according to claim 1, characterized in that: Step S100 collects ECG signals, pre-processes the ECG signals, extracts features of the time series data, and forms a feature data set, including: S110, performing segment processing on each lead of the electrocardiogram signal; S120 , extracting statistical features and frequency domain features from each segment of the ECG signal to form a feature data set.
3. The method for constructing a small sample electrocardiogram signal recognition model based on shapelet according to claim 1, characterized in that: The step S400 of training a small sample ECG recognition model based on the features in the pattern bag and using the model to recognize and classify ECG signals includes: The small sample ECG recognition model is trained with the updated ECG signal features, and the hyperparameters are adjusted through the validation set and test set in the feature dataset to evaluate the generalization ability of the model.
4. A system for constructing a small sample ECG signal recognition model based on shapelet, characterized in that: include: The data acquisition module is used to collect and preprocess the ECG signals, extract the features of the time series data, and form a feature data set; The local feature extraction module is used to identify and extract representative local patterns from the feature dataset using the shapelet analysis method to form a pattern bag; it includes: Perform shapelet analysis on the features of the ECG signal of each lead, identify and extract local features, and obtain several shapelets representing the local features of the lead time series data; Calculate the weight of each shapelet and select one or more shapelets with the highest weight. The shapelet weight calculation formula is: ; in, It is The weight of each shapelet; is the feature importance score of the shapelet; It is The feature importance score of each shapelet; It is an adjustable parameter that controls the concentration of weight distribution; is the total number of shapelets in the pattern bag; Repeat the above shapelet analysis and screening process to form a pattern bag representing the key features of the ECG signal of the lead with the selected shapelets; The data weighting calculation module is used to apply the attention mechanism to weight the local features in the pattern bag and highlight the key features. It includes: The attention mechanism is introduced to perform attention weighting on the ECG signal features of each lead; the calculation formula for attention weighting is: ; in, It is The attention weight of each feature; is the local importance score of the feature; It is The local importance score of each feature; It is an adjustable parameter that controls the concentration of weight distribution; is the total number of features considered; Update the ECG signal features of the corresponding lead with the weighted features; The model building module is used to train a small sample ECG recognition model based on the features in the pattern bag to obtain a trained ECG recognition model.
5. A non-transitory computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions enable a computer to execute the method for constructing a small sample electrocardiogram signal recognition model based on shapelet according to any one of claims 1 to 3.
6. An electronic device comprising: A processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus, and the processor calls logic instructions in the memory to execute the method for constructing a small sample electrocardiogram signal recognition model based on shapelet according to any one of claims 1 to 3.
Citation Information
Patent Citations
Arrhythmia classification method based on self-attention mechanism
CN115530788A
CNN-GRU ECG signal classification method based on attention mechanism
CN119014878A