Electrocardiosignal feature extraction method and device, readable storage medium and terminal equipment
By employing multi-scale feature extraction and fusion methods, the problem of insufficient comprehensiveness and accuracy in electrocardiogram signal analysis was solved, enabling more comprehensive feature extraction and cardiac activity research.
Patent Information
- Application Number
- CN202511030499.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-11-18
AI Technical Summary
The lack of effective methods for extracting ECG signal features in existing technologies leads to incomplete and inaccurate ECG signal analysis.
A multi-scale feature extraction method is adopted, including low-level feature extraction, block embedding processing, positional encoding processing and efficient transformer processing, combined with multi-scale feature fusion to obtain target multi-scale fused features.
Multi-scale feature extraction and fusion can extract the features of electrocardiogram signals more comprehensively and accurately, which helps to better study cardiac activity.
Smart Images

Figure CN120974401A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of signal processing technology, and in particular relates to a method, apparatus, computer-readable storage medium and terminal device for extracting electrocardiogram signal features. Background Technology
[0002] Electrocardiogram (ECG) signals are important bioelectrical signals of cardiac activity. They are generated through the electrophysiological activity of the heart and form detectable potential changes on the body surface. ECG signals are of great significance for studying cardiac activity. After capturing ECG signals, feature extraction is usually required for better analysis and research of cardiac activity; however, current technologies lack effective ECG signal feature extraction methods. Summary of the Invention
[0003] In view of this, embodiments of this application provide a method, apparatus, computer-readable storage medium, and terminal device for extracting electrocardiogram (ECG) signal features, in order to solve the problem of the lack of effective ECG signal feature extraction methods in the prior art.
[0004] A first aspect of this application provides a method for extracting electrocardiogram (ECG) signal features, which may include: Acquire the target electrocardiogram signal; Low-level features are extracted from the target electrocardiogram signal to obtain the target low-level features; Multi-scale feature extraction is performed on the target's low-level features to obtain multi-scale features for each target; wherein, the multi-scale feature extraction includes a preset number of multi-scale feature extraction stages, and each multi-scale feature extraction stage includes block embedding processing, position encoding processing, and efficient transformer processing; Multi-scale feature fusion is performed on the multi-scale features of each target to obtain the multi-scale fused features of the targets.
[0005] In one specific implementation of the first aspect, the multi-scale feature extraction of the target's low-level features to obtain various target multi-scale features includes: The previous output feature is processed by block embedding to obtain the current block embedding feature; wherein, the previous output feature is the target low-level feature or the target multi-scale feature obtained in the previous multi-scale feature extraction stage; The current block embedding features are subjected to position encoding processing to obtain the current position encoded features; The current position encoded features are processed by an efficient transformer to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0006] In one specific implementation of the first aspect, the step of performing block embedding processing on the previous output feature to obtain the current block embedding feature includes: The previous output feature is downsampled to obtain the current downsampled feature; Channel expansion is performed on the current downsampling features to obtain the current block embedding features.
[0007] In one specific implementation of the first aspect, the step of performing position encoding processing on the current block embedding features to obtain current position encoded features includes: The current block embedding features are encoded with absolute positions to obtain the current absolute position encoding information; The current absolute position encoding information and the current block embedding feature are fused to obtain the current position encoding feature; or, The current block embedding features are encoded with relative positions to obtain the current relative position encoding information; The current relative position encoding information and the current block embedding feature are fused to obtain the current position encoding feature.
[0008] In one specific implementation of the first aspect, the step of performing efficient transformer processing on the current position encoded features to obtain the target multi-scale features in the current multi-scale feature extraction stage includes: The current position encoded features are processed using a self-attention mechanism to obtain the current self-attention processed features; The current self-attention processing features are processed by a feedforward neural network to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0009] In one specific implementation of the first aspect, the step of fusing multi-scale features of each of the target multi-scale features to obtain target multi-scale fused features includes: The previous multi-scale fusion feature and the current target multi-scale feature to be fused are fused to obtain the current multi-scale fusion feature; The target multi-scale fusion feature is obtained by connecting the various multi-scale fusion features.
[0010] In one specific implementation of the first aspect, the step of extracting low-level features from the target electrocardiogram signal to obtain target low-level features includes: Perform a convolution operation on the target electrocardiogram signal to obtain the target convolutional features; The target convolutional features are batch normalized to obtain the target batch normalized features; The target batch normalized features are activated to obtain the target bottom-level features.
[0011] A second aspect of this application provides an electrocardiogram (ECG) signal feature extraction device, which may include: The target ECG signal acquisition module is used to acquire the target ECG signal. The low-level feature extraction module is used to extract low-level features from the target electrocardiogram signal to obtain the target low-level features; A multi-scale feature extraction module is used to perform multi-scale feature extraction on the target's low-level features to obtain multi-scale features of each target; wherein, the multi-scale feature extraction includes a preset number of multi-scale feature extraction stages, and each multi-scale feature extraction stage includes block embedding processing, position encoding processing, and efficient transformer processing; The multi-scale feature fusion module is used to perform multi-scale feature fusion on each of the target multi-scale features to obtain target multi-scale fused features.
[0012] In one specific implementation of the second aspect, the multi-scale feature extraction module may include: The block embedding processing submodule is used to perform block embedding processing on the previous output feature to obtain the current block embedding feature; wherein, the previous output feature is the target low-level feature or the target multi-scale feature obtained in the previous multi-scale feature extraction stage; The position encoding processing submodule is used to perform position encoding processing on the current block embedding features to obtain the current position encoded features; The efficient transformer processing submodule is used to perform efficient transformer processing on the current position encoded features to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0013] In one specific implementation of the second aspect, the block embedding processing submodule includes: The downsampling processing unit is used to downsample the previous output feature to obtain the current downsampled feature. The channel expansion unit is used to expand the current downsampling feature to obtain the current block embedding feature.
[0014] In one specific implementation of the second aspect, the position encoding processing submodule includes: An absolute position encoding unit is used to encode the current block embedding features with absolute position to obtain current absolute position encoding information; The first feature fusion unit is used to fuse the current absolute position encoding information and the current block embedding feature to obtain the current position encoding feature; A relative position encoding unit is used to encode the current block embedding features in a relative position to obtain current relative position encoding information; The second feature fusion unit is used to fuse the current relative position encoding information and the current block embedding feature to obtain the current position encoding feature.
[0015] In one specific implementation of the second aspect, the efficient transformer processing submodule includes: The self-attention mechanism processing unit is used to perform self-attention mechanism processing on the current position encoded features to obtain the current self-attention processed features; The feedforward neural network processing unit is used to perform feedforward neural network processing on the current self-attention processing features to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0016] In one specific implementation of the second aspect, the multi-scale feature fusion module includes: The multi-scale feature fusion submodule is used to fuse the previous multi-scale fusion feature and the current target multi-scale feature to be fused to obtain the current multi-scale fusion feature. The multi-scale fusion connection submodule is used to connect the various multi-scale fusion features to obtain the target multi-scale fusion feature.
[0017] In one specific implementation of the second aspect, the underlying feature extraction module includes: The convolution operation submodule is used to perform convolution operations on the target electrocardiogram signal to obtain the target convolution features; The batch normalization processing submodule is used to perform batch normalization processing on the target convolutional features to obtain the target batch normalized features; The feature activation submodule is used to activate the target batch normalized features to obtain the target low-level features.
[0018] A third aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the above-described electrocardiogram signal feature extraction methods.
[0019] A fourth aspect of this application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above-described electrocardiogram signal feature extraction methods.
[0020] The fifth aspect of this application provides a computer program product that, when run on a terminal device, causes the terminal device to execute the steps of any of the above-described electrocardiogram signal feature extraction methods.
[0021] The beneficial effects of this application embodiment compared with the prior art are as follows: This application embodiment acquires a target electrocardiogram (ECG) signal; performs low-level feature extraction on the target ECG signal to obtain target low-level features; performs multi-scale feature extraction on the target low-level features to obtain various target multi-scale features; wherein, the multi-scale feature extraction includes a preset number of multi-scale feature extraction stages, each of the multi-scale feature extraction stages including block embedding processing, positional encoding processing, and efficient transformer processing; and performs multi-scale feature fusion on the various target multi-scale features to obtain target multi-scale fused features. Through the multi-scale feature extraction of this application embodiment, ECG signal features can be extracted from multiple dimensions, which helps to conduct ECG signal research more comprehensively and accurately. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of a standard electrocardiogram (ECG) signal. Figure 2 This is a flowchart of one embodiment of an electrocardiogram signal feature extraction method in this application. Figure 3 This is a schematic diagram of the underlying feature extraction module in an embodiment of this application; Figure 4 This is a schematic diagram of a low-level feature extraction submodule in an embodiment of this application; Figure 5 This is another schematic diagram of the underlying feature extraction submodule in an embodiment of this application; Figure 6 This is a schematic diagram of a multi-scale feature extraction module in an embodiment of this application; Figure 7 This is another schematic diagram of the multi-scale feature extraction module in the embodiments of this application; Figure 8 This is a schematic diagram of the multi-scale feature fusion process in an embodiment of this application; Figure 9 This is a schematic diagram of the feature extraction process of the target electrocardiogram signal in an embodiment of this application; Figure 10 This is a structural diagram of one embodiment of an electrocardiogram signal feature extraction device according to the present application. Figure 11 This is a schematic block diagram of a terminal device in an embodiment of this application. Detailed Implementation
[0024] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0026] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0027] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0028] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."
[0029] Furthermore, in the description of this application, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0030] Electrocardiogram (ECG) signals are important bioelectrical signals of cardiac activity. They are generated through the electrophysiological activity of the heart and form detectable potential changes on the body surface.
[0031] Figure 1 A schematic diagram of a standard electrocardiogram (ECG) signal is shown. Specifically, a standard ECG signal mainly consists of the PR interval and the QT interval. The PR interval specifically includes the P wave and the PR segment, while the QT interval specifically includes the QRS complex and the ST interval. The QRS complex consists of the Q wave, R wave, S wave, and J point, while the ST interval consists of the ST segment and the T wave.
[0032] Electrocardiogram (ECG) signals are crucial for studying cardiac activity; changes in ECG signals may indicate specific cardiac events. However, due to the uneven distribution and inconsistent amplitude of ECG signal characteristics, the signal features often differ at different stages. Therefore, after capturing an ECG signal, feature extraction is typically required for better analysis and research of cardiac activity. However, current technologies lack effective ECG signal feature extraction methods.
[0033] In view of this, embodiments of this application provide a method, apparatus, computer-readable storage medium, and terminal device for extracting electrocardiogram (ECG) signal features, in order to solve the problem of the lack of effective ECG signal feature extraction methods in the prior art.
[0034] It should be noted that the subject of execution of the method in this application is a terminal device, which can be a common computing device such as a desktop computer, workstation, laptop, handheld computer, smartphone, tablet, or other computing devices.
[0035] Typically, the peak portion of an electrocardiogram (ECG) signal has high resolution, while the portion outside the peak has lower resolution. The peak portion of an ECG signal has rich spatial features and significant scale variations, while the portion outside the peak has smaller scale variations but richer semantic information. Therefore, in order to extract features from all parts of the ECG signal more comprehensively, this application embodiment can perform multi-scale feature extraction on the ECG signal to obtain multi-scale features of the ECG signal, and can perform feature fusion on the extracted multi-scale features, thereby enabling a full and comprehensive interpretation of all parts of the ECG signal.
[0036] Please see Figure 2 An embodiment of an electrocardiogram signal feature extraction method in this application may include the following steps S201 to S204: Step S201: Obtain the target electrocardiogram signal.
[0037] In this embodiment of the application, an electrocardiogram (ECG) signal can be acquired using a preset ECG signal acquisition device; wherein, the ECG signal acquisition device can be any common lead in the prior art, and this embodiment of the application does not specifically limit it.
[0038] For ease of description, the electrocardiogram (ECG) signal collected for feature extraction in this application embodiment can be referred to as the target ECG signal.
[0039] Since the target ECG signal exists in the form of a time series, that is, the target ECG signal is essentially a one-dimensional signal, in order to perform multi-scale feature extraction and feature fusion operations on the target ECG signal, the target ECG signal can be mapped to a higher-dimensional feature space after it is acquired.
[0040] Specifically, after acquiring the target ECG signal, its format can be adjusted to meet the requirements of multi-scale feature extraction. Here, the ECG signals acquired from each lead can be considered as a channel of a matrix. If the ECG signal acquired from one lead has T time steps, then the ECG signals acquired from all leads can form an L*T two-dimensional matrix, where L is the number of leads in the ECG signal acquisition device; for example, if the ECG signal acquisition device includes 12 leads, then a 12*T matrix can be formed.
[0041] Then, the obtained two-dimensional matrix can be expanded in dimensions to obtain the corresponding three-dimensional matrix; specifically, an L*T two-dimensional matrix can be expanded in dimensions to form an L*1*T three-dimensional matrix. For example, if the two-dimensional matrix is 12*T, then the corresponding 12*1*T three-dimensional matrix can be obtained after dimensional expansion.
[0042] To facilitate feature extraction, embodiments of this application can map the three-dimensional matrix corresponding to the target electrocardiogram signal to the representation of image data.
[0043] Typically, image data can be represented in the format H*W*C; where H is the height of the image data, W is the width of the image data, and C is the channel of the image data. In this embodiment, the number of leads can be correlated with the height H of the image data, the time step of the target ECG signal can be correlated with the width W of the image data, and the extended dimension can be correlated with the channel C of the image data.
[0044] Specifically, the shape of the three-dimensional matrix corresponding to the target ECG signal can be adjusted, changing the L*1*T three-dimensional matrix to a T*L*1 three-dimensional matrix. Then, the three-dimensional matrix with the adjusted shape can be copied to form a three-channel three-dimensional matrix. That is, T*L*1 can be copied twice and spliced with the original three-dimensional matrix T*L*1 to obtain a T*L*3 three-dimensional matrix.
[0045] As an example, the three-dimensional matrix corresponding to the formatted target ECG signal can be represented as: , in, The vector is the three-dimensional matrix corresponding to the target ECG signal after format adjustment. For the first ECG signals acquired from each lead For the number of leads, For the first The first target electrocardiogram signal acquired by the first lead The specific values for each time step.
[0046] It should be noted that, unless otherwise specified, the target ECG signals mentioned below are all formatted target ECG signals.
[0047] Step S202: Extract the low-level features of the target electrocardiogram signal to obtain the target low-level features.
[0048] In this embodiment of the application, a preset low-level feature extraction module can be used to extract features from the target electrocardiogram signal to obtain the target low-level features.
[0049] The underlying feature extraction module in this embodiment can be a feature extraction module based on a STEM network structure; specifically, the underlying feature extraction module may include a preset number of underlying feature extraction sub-modules, such as... Figure 3 As shown, by utilizing the various low-level feature extraction sub-modules within the low-level feature extraction module, low-level features can be extracted from the target electrocardiogram signal to obtain the target low-level features. The number of low-level feature extraction sub-modules can be set according to actual needs, and this application does not impose a limitation on this.
[0050] In this embodiment, each low-level feature extraction submodule may specifically include convolutional layers, batch normalization layers, and activation layers, such as... Figure 4 As shown.
[0051] The convolutional layer in the low-level feature extraction submodule can be used to perform a one-dimensional convolution operation with a preset stride on the target ECG signal to reduce the spatial size of the target ECG signal and output the target convolutional features. The stride of the one-dimensional convolution operation can be set according to actual needs, and this embodiment does not limit it. For example, the stride of the one-dimensional convolution operation can be set to a value of 1 or 2.
[0052] The batch normalization layer in the low-level feature extraction submodule can be used to batch normalize the target convolutional features to obtain the target normalized features. Based on this, the data distribution of the target convolutional features can be standardized, which helps to reduce the instability in the feature extraction process.
[0053] The activation layer in the low-level feature extraction submodule can be used to perform nonlinear transformations on the features output by the batch normalization layer to activate the target normalized features and obtain the target low-level features.
[0054] For example only, please refer to Figure 5 The low-level feature extraction module can include two low-level feature extraction sub-modules, namely the first low-level feature extraction sub-module and the second low-level feature extraction sub-module. The first low-level feature extraction sub-module can specifically include a first convolutional layer, a first batch normalization layer and a first activation layer, and the second low-level feature extraction sub-module can specifically include a second convolutional layer, a second batch normalization layer and a second activation layer.
[0055] In the example above, the first low-level feature extraction submodule can be used to perform the first low-level feature extraction on the target ECG signal, and then the second low-level feature extraction submodule can be used to perform the second low-level feature extraction on the low-level features output by the first low-level feature extraction submodule to obtain the target low-level features.
[0056] Specifically, in the example above, when performing the first low-level feature extraction using the first low-level feature extraction submodule, the first convolutional layer can be used to perform a convolution operation with a stride of 2 on the target ECG signal to obtain the first target convolutional feature. Then, the first batch normalization layer can be used to perform batch normalization processing on the first target convolutional feature to standardize the data distribution of the first target convolutional feature and obtain the first target batch normalized feature. Accordingly, the instability in the convolution operation process can be reduced. Then, the first activation layer can be used to activate the first target batch normalized feature to obtain the first target low-level feature.
[0057] In the example above, after obtaining the first target low-level feature, it can be used as the input to the second low-level feature extraction submodule for a second low-level feature extraction. Specifically, the second convolutional layer can perform a convolution operation with a stride of 2 on the first target low-level feature to obtain the second target convolutional feature; then, the second batch normalization layer can be used to batch normalize the second target convolutional feature to obtain the second target batch normalized feature; finally, the second activation layer can be used to activate the second target batch normalized feature to obtain the second target low-level feature. The second target low-level feature is the final output target low-level feature in the low-level feature extraction process.
[0058] Step S203: Extract multi-scale features from the target's low-level features to obtain multi-scale features for each target.
[0059] The multi-scale feature extraction in this embodiment may include a preset number of multi-scale feature extraction stages, and the output of each multi-scale feature extraction stage can be used as the input of the next multi-scale feature extraction stage.
[0060] The number of multi-scale feature extraction stages can be customized and context-specific according to actual needs, and this application does not impose any limitation on this. In the embodiments of this application, three multi-scale feature extraction stages are preferably set.
[0061] Specifically, in this application embodiment, a preset multi-scale feature extraction module can be used to extract multi-scale features of the target low-level features. The multi-scale feature extraction module can specifically include various multi-scale feature extraction sub-modules. Each multi-scale feature extraction sub-module can correspond to a multi-scale feature extraction stage and is used to perform multi-scale feature extraction in that multi-scale feature extraction stage.
[0062] For example, the multi-scale feature extraction process includes three multi-scale feature extraction stages: a first multi-scale feature extraction stage, a second multi-scale feature extraction stage, and a third multi-scale feature extraction stage. These three stages correspond one-to-one with the first, second, and third multi-scale feature extraction sub-modules, respectively. Figure 6As shown, during multi-scale feature extraction, the first multi-scale feature extraction submodule can be used to perform the first multi-scale feature extraction in the first multi-scale feature extraction stage to obtain the first target multi-scale feature; then, the second multi-scale feature extraction submodule can be used to perform the second multi-scale feature extraction on the first target multi-scale feature in the second multi-scale feature extraction stage to obtain the second target multi-scale feature; then, the third multi-scale feature extraction submodule can be used to perform the third multi-scale feature extraction on the second target multi-scale feature in the third multi-scale feature extraction stage to obtain the third target multi-scale feature.
[0063] In the embodiments of this application, each multi-scale feature extraction stage may specifically include block embedding processing, positional encoding processing, and efficient transformer processing.
[0064] For example, the multi-scale feature extraction process includes three multi-scale feature extraction stages: a first multi-scale feature extraction stage, a second multi-scale feature extraction stage, and a third multi-scale feature extraction stage. The multi-scale feature extraction process can be described as follows: Figure 7 As shown, each multi-scale feature extraction stage can include block embedding processing, positional encoding processing, and efficient transformer processing.
[0065] For ease of description, the following will take any one of the multi-scale feature extraction stages as an example to introduce the block embedding process, positional encoding process, and efficient transformer process in detail.
[0066] In the embodiments of this application, when performing multi-scale feature extraction, the previous output feature can be first processed by block embedding to reduce the resolution of the previous output feature and expand the dimension of the channel; here, the target low-level feature or the target multi-scale feature obtained in the previous multi-scale feature extraction stage can be referred to as the previous output feature.
[0067] Specifically, during the first multi-scale feature extraction, the target low-level feature can be used as the input for the first multi-scale feature extraction stage. That is, in the first multi-scale feature extraction stage, the previous output feature is the target low-level feature; in subsequent multi-scale feature extraction stages, the previous output feature is the target multi-scale feature obtained in the previous multi-scale feature extraction stage.
[0068] For example, the multi-scale feature extraction process includes three stages: the first stage, the second stage, and the third stage. In the first stage, the previous output feature is the target low-level feature; in the second stage, the previous output feature is the target multi-scale feature obtained in the previous stage, i.e., the previous output feature is the target multi-scale feature obtained in the first stage; and in the third stage, the previous output feature is the target multi-scale feature obtained in the previous stage, i.e., the previous output feature is the target multi-scale feature obtained in the second stage.
[0069] When performing block embedding processing on the previous output feature, the previous output feature can be downsampled to obtain the current downsampled feature. Specifically, the previous output feature can be downsampled using a convolution operation. The size and stride of the convolution kernel used in the downsampling process can be set according to actual needs, and this application does not impose specific limitations on them.
[0070] Here, the previous output feature can be represented as ;in, For the previous output feature, This is the time step of the previous output feature. Let be the number of channels of the previous output feature. Then, downsampling the previous output feature can be expressed as: ;in, For the current downsampling processing features, This represents the convolution operation. This refers to the size of the convolution kernel used in the downsampling process. This refers to the stride of the convolution kernel used in the downsampling process; here, It can also be expressed as: ;in, This represents the number of channels for the current downsampling feature. This is the time step for the current downsampling feature processing. As can be seen, the time dimension of the previous output feature can be reduced (i.e., the time steps are reduced) through convolution operations.
[0071] After obtaining the current downsampling features, channel expansion can be performed on the current downsampling features to obtain the current block embedding features.
[0072] Specifically, a preset convolutional kernel can be used to expand the number of channels of the current downsampled feature. The size and stride of the convolutional kernel used in the channel expansion process can be set according to actual needs, and this application does not impose specific limitations on them.
[0073] Here, the current block embedding feature can be represented as: ;in, For the current block embedding features, The size of the convolution kernel used in the channel expansion process. The stride used during the channel expansion process.
[0074] After obtaining the current block embedding features, positional encoding can be performed on these features to obtain the current position-encoded features. By performing positional encoding on the current block embedding features, the perception of spatial features can be enhanced, leading to a better understanding of the positional and sequential characteristics of the target ECG signal.
[0075] In one specific implementation of this application, the current block embedding feature can be absolutely position encoded to obtain current absolute position encoding information. Then, the current absolute position encoding information and the current block embedding feature can be fused to obtain the current position encoding feature. Specifically, a unique code can be assigned to each position in the current block embedding feature using sine and cosine functions to obtain the current position encoding feature. Then, the current absolute position encoding information and the current block embedding feature can be fused by element-wise addition or concatenation to obtain the current position encoding feature.
[0076] In another specific implementation of this application, the relative position encoding of the current block embedding feature can be performed to obtain relative absolute position encoding information. Then, the current relative position encoding information and the current block embedding feature can be fused to obtain the current position encoding feature. Specifically, the distance between each element in the current block embedding feature can be used to represent the relative positional relationship between each element to obtain the current relative position encoding information. Then, the current relative position encoding information and the current block embedding feature can be fused by adding or concatenating elements to obtain the current position encoding feature. By performing relative position encoding on the current block embedding feature, the long-distance dependencies of the current block embedding feature can be captured, allowing for a more flexible representation of the structural information in the current block embedding feature.
[0077] Here, the current location encoding feature can be represented as: ;in, Encode features for the current location. This is either the current absolute position encoding information or the current relative position encoding information. , This represents the number of channels for the current block's embedded features.
[0078] After obtaining the encoded features at the current location, efficient transformer processing can be applied to these features to obtain the target multi-scale features for the current multi-scale feature extraction stage. Compared to traditional transformers, efficient transformers can reduce computational complexity while retaining the advantages of traditional transformers in capturing global information. In this embodiment, by applying efficient transformer processing to the encoded features at the current location, the efficiency of multi-scale feature extraction can be improved.
[0079] Specifically, the encoded features at the current position can be processed using a self-attention mechanism to obtain the current self-attention processed features. Here, the weights of the attention can be calculated, and then, based on these weights, the attention matrix can be calculated. The current self-attention processed features can be calculated based on the attention matrix and the attention weights.
[0080] In this embodiment of the application, a query vector can be calculated ( ), key vector ( ) and value vector ( The corresponding weights are calculated using the following formula: , in, The weight matrix corresponding to the query vector. This is the weight matrix corresponding to the key vector. The three weight matrices are the weight matrices corresponding to the value vectors; all three can be obtained through training. Then, the attention matrix can be calculated based on the attention weights. : , in, To query the dimensions of the vector, key vector, and value vector, This is the scaling factor. This can be used to prevent gradient vanishing due to excessively large dot product values during computation. Afterwards, the current self-attention processing features can be calculated based on the attention matrix and the attention weights. : .
[0081] In this embodiment of the application, after obtaining the current self-attention processing features, the current self-attention processing features can be processed by a feed-forward network (FFN) to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0082] Specifically, in this embodiment, the feedforward neural network for FFN processing may include two fully connected layers and an activation layer. When processing the current self-attention features using the feedforward neural network, the current self-attention features can first be fully processed using two fully connected layers. Then, the output obtained from the fully connected processing can be activated using an activation layer to obtain the target multi-scale features for the current multi-scale feature extraction stage. Here, the target multi-scale features for the current multi-scale feature extraction stage can be represented as: , in, The target multi-scale features in the current multi-scale feature extraction stage are... This indicates that the feedforward neural network is being processed. , These are the weights and biases of the first fully connected layer, respectively. , These are the weights and biases of the second fully connected layer, respectively. The preset activation function, , , , Both the activation function and the activation function can be set according to actual needs, and this application does not impose any restrictions on them.
[0083] Each multi-scale feature extraction stage in the embodiments of this application can be performed by referring to the above process to extract multi-scale features, thereby obtaining the multi-scale features of each target.
[0084] Step S204: Perform multi-scale feature fusion on the multi-scale features of each target to obtain the multi-scale fused features of the targets.
[0085] In the embodiments of this application, the target multi-scale features at each multi-scale feature extraction stage can be fused to fuse the semantic information of the low-resolution part and the spatial information of the high-resolution part in the target electrocardiogram signal.
[0086] Specifically, the previous multi-scale fusion feature and the current target multi-scale feature to be fused can be fused to obtain the corresponding multi-scale fusion feature; then, the various multi-scale fusion features can be connected to obtain the target multi-scale fusion feature of this application embodiment.
[0087] For example, please see Figure 8 There are three multi-scale fusion features, namely multi-scale fusion feature 1, multi-scale fusion feature 2 and multi-scale fusion feature 3. These three multi-scale fusion features can be connected (specifically, in series) to obtain the target multi-scale fusion feature of this application embodiment.
[0088] The following section will take the example of three target multi-scale features to describe in detail the multi-scale feature fusion process in the embodiments of this application.
[0089] In this example, there are three target multi-scale features, namely: , , ;in, , , Then, feature mapping can be performed on the three target multi-scale features to obtain the target multi-scale mapped features. Target multi-scale mapping features Target multi-scale mapping features .
[0090] When performing multi-scale feature fusion, the target multi-scale mapping features can be directly applied. As the first multi-scale fusion feature Here, It can be represented as: .
[0091] Then, the previous multi-scale fused feature can be... With the target multi-scale features to be fused (i.e., target multi-scale mapping features) Multi-scale feature fusion is performed to obtain a second multi-scale fused feature. Specifically, features can be mapped to the target at multiple scales. After performing upsampling, the upsampling result can be combined with the previous multi-scale fused feature. Multi-scale feature fusion is performed to obtain a second multi-scale fused feature. Here, It can be represented as: .
[0092] in, This indicates an asymmetric fusion operation. This indicates an upsampling operation.
[0093] Then, the previous multi-scale fused feature can be... With the target multi-scale features to be fused (i.e., target multi-scale mapping features) Multi-scale feature fusion is performed to obtain a third multi-scale fused feature. Specifically, features can be mapped to the target at multiple scales. After performing upsampling, the upsampling result can be mapped to the target multi-scale features. After performing multi-scale feature fusion, the result of the multi-scale feature fusion can be upsampled, and the upsampled result can be combined with the first multi-scale fused feature. Multi-scale feature fusion is performed to obtain a third multi-scale fused feature. Here, It can be represented as: .
[0094] Then, the first multi-scale fusion feature can be... The second multi-scale fusion feature The third multi-scale fusion feature By connecting the components through a series operation, the multi-scale fusion features of the target are obtained.
[0095] Therefore, feature information corresponding to different resolutions in the target ECG signal can be fused to obtain more comprehensive and accurate features of the target ECG signal.
[0096] In one specific implementation, after obtaining the target multi-scale fusion features, the target electrocardiogram (ECG) signal can be classified based on these features to better study and analyze cardiac activity. Specifically, the target multi-scale fusion features can be downsampled and dimensionality reduced. Here, the target multi-scale fusion features can be globally averaged to obtain a one-dimensional vector, which can be used to represent global features. Then, this one-dimensional vector can be input into a pre-defined fully connected layer for further dimensionality reduction and feature combination. Finally, a classification layer (specifically a softmax layer or a logistic regression layer) can be used to classify the output of the fully connected layer to identify the type of the target ECG signal.
[0097] Figure 9 This paper illustrates the feature extraction process of the target electrocardiogram (ECG) signal in an embodiment of this application. In this embodiment, low-level features are extracted from the acquired target ECG signal to obtain initial features (target low-level features). Subsequently, multi-scale feature extraction is performed on the target low-level features at various stages to further extract features at different dimensions, resulting in various target multi-scale features. After obtaining these multi-scale features, they are fused to integrate features at different scales, yielding the target multi-scale fused features of the target ECG signal. Through the multi-scale feature extraction in this embodiment, various features of the ECG signal can be extracted relatively comprehensively, laying the foundation for the study of cardiac activity.
[0098] In summary, the embodiments of this application acquire target electrocardiogram (ECG) signals; perform low-level feature extraction on the target ECG signals to obtain target low-level features; perform multi-scale feature extraction on the target low-level features to obtain various target multi-scale features; wherein, the multi-scale feature extraction includes a preset number of multi-scale feature extraction stages, each of which includes block embedding processing, positional encoding processing, and efficient transformer processing; and perform multi-scale feature fusion on the various target multi-scale features to obtain target multi-scale fused features. Through the multi-scale feature extraction of the embodiments of this application, ECG signal features can be extracted from multiple dimensions, which helps to conduct more comprehensive and accurate research on ECG signals.
[0099] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0100] Corresponding to the electrocardiogram signal feature extraction method described in the above embodiments, Figure 10 This paper shows a structural diagram of an embodiment of an electrocardiogram signal feature extraction device provided in this application.
[0101] In this embodiment of the application, an electrocardiogram signal feature extraction device may include: The target electrocardiogram signal acquisition module 1001 is used to acquire the target electrocardiogram signal; The low-level feature extraction module 1002 is used to extract low-level features from the target electrocardiogram signal to obtain the target low-level features; The multi-scale feature extraction module 1003 is used to perform multi-scale feature extraction on the target's low-level features to obtain various target multi-scale features; wherein, the multi-scale feature extraction includes a preset number of multi-scale feature extraction stages, and each multi-scale feature extraction stage includes block embedding processing, position encoding processing, and efficient transformer processing; The multi-scale feature fusion module 1004 is used to perform multi-scale feature fusion on each of the target multi-scale features to obtain target multi-scale fused features.
[0102] In one specific implementation of this application embodiment, the multi-scale feature extraction module may include: The block embedding processing submodule is used to perform block embedding processing on the previous output feature to obtain the current block embedding feature; wherein, the previous output feature is the target low-level feature or the target multi-scale feature obtained in the previous multi-scale feature extraction stage; The position encoding processing submodule is used to perform position encoding processing on the current block embedding features to obtain the current position encoded features; The efficient transformer processing submodule is used to perform efficient transformer processing on the current position encoded features to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0103] In one specific implementation of this application embodiment, the block embedding processing submodule includes: The downsampling processing unit is used to downsample the previous output feature to obtain the current downsampled feature. The channel expansion unit is used to expand the current downsampling feature to obtain the current block embedding feature.
[0104] In one specific implementation of this application embodiment, the position encoding processing submodule includes: An absolute position encoding unit is used to encode the current block embedding features with absolute position to obtain current absolute position encoding information; The first feature fusion unit is used to fuse the current absolute position encoding information and the current block embedding feature to obtain the current position encoding feature; A relative position encoding unit is used to encode the current block embedding features in a relative position to obtain current relative position encoding information; The second feature fusion unit is used to fuse the current relative position encoding information and the current block embedding feature to obtain the current position encoding feature.
[0105] In one specific implementation of this application embodiment, the high-efficiency transformer processing submodule includes: The self-attention mechanism processing unit is used to perform self-attention mechanism processing on the current position encoded features to obtain the current self-attention processed features; The feedforward neural network processing unit is used to perform feedforward neural network processing on the current self-attention processing features to obtain the target multi-scale features in the current multi-scale feature extraction stage.
[0106] In one specific implementation of this application embodiment, the multi-scale feature fusion module includes: The multi-scale feature fusion submodule is used to fuse the previous multi-scale fusion feature and the current target multi-scale feature to be fused to obtain the current multi-scale fusion feature. The multi-scale fusion connection submodule is used to connect the various multi-scale fusion features to obtain the target multi-scale fusion feature.
[0107] In one specific implementation of this application embodiment, the underlying feature extraction module includes: The convolution operation submodule is used to perform convolution operations on the target electrocardiogram signal to obtain the target convolution features; The batch normalization processing submodule is used to perform batch normalization processing on the target convolutional features to obtain the target batch normalized features; The feature activation submodule is used to activate the target batch normalized features to obtain the target low-level features.
[0108] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0109] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0110] Figure 11 A schematic block diagram of a terminal device provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiment of this application are shown.
[0111] like Figure 11 As shown, the terminal device 11 in this embodiment includes: a processor 110, a memory 111, and a computer program 112 stored in the memory 111 and executable on the processor 110. When the processor 110 executes the computer program 112, it implements the steps in the various ECG signal feature extraction method embodiments described above, for example... Figure 2 Steps S201 to S204 are shown. Alternatively, when the processor 110 executes the computer program 112, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 10 The functions of the target ECG signal acquisition module 1001 to the multi-scale feature fusion module 1004 are shown.
[0112] For example, the computer program 112 may be divided into one or more modules / units, which are stored in the memory 111 and executed by the processor 110 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program 112 in the terminal device 11.
[0113] Those skilled in the art will understand that Figure 11This is merely an example of terminal device 11 and does not constitute a limitation on terminal device 11. It may include more or fewer components than shown, or combine certain components, or different components. For example, terminal device 11 may also include input / output devices, network access devices, buses, etc.
[0114] The processor 110 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0115] The memory 111 can be an internal storage unit of the terminal device 11, such as a hard disk or memory of the terminal device 11. The memory 111 can also be an external storage device of the terminal device 11, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the terminal device 11. Furthermore, the memory 111 can include both internal and external storage units of the terminal device 11. The memory 111 is used to store the computer program and other programs and data required by the terminal device 11. The memory 111 can also be used to temporarily store data that has been output or will be output.
[0116] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0117] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0118] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0119] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0120] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0121] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0122] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.
[0123] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method of electrocardiosignal feature extraction, characterized in that, The method comprises the following steps: acquiring a target electrocardio signal; performing bottom layer feature extraction on the target electrocardio signal to obtain a target bottom layer feature; performing multi-scale feature extraction on the target bottom layer feature to obtain each target multi-scale feature; wherein the multi-scale feature extraction comprises a preset number of multi-scale feature extraction stages, and each multi-scale feature extraction stage comprises block embedding processing, position encoding processing and efficient transformer processing; performing multi-scale feature fusion on each target multi-scale feature to obtain a target multi-scale fusion feature.
2. The electrocardiosignal feature extraction method of claim 1, wherein, The method of performing multi-scale feature extraction on the target bottom layer feature to obtain each target multi-scale feature comprises: performing block embedding processing on a previous output feature to obtain a current block embedding feature; wherein the previous output feature is the target bottom layer feature or the target multi-scale feature obtained in a previous multi-scale feature extraction stage; performing position encoding processing on the current block embedding feature to obtain a current position encoding feature; performing efficient transformer processing on the current position encoding feature to obtain the target multi-scale feature of the current multi-scale feature extraction stage.
3. The electrocardiosignal feature extraction method of claim 2, wherein, The method of performing block embedding processing on the previous output feature to obtain the current block embedding feature comprises: performing down-sampling processing on the previous output feature to obtain a current down-sampling processing feature; performing channel expansion on the current down-sampling processing feature to obtain the current block embedding feature.
4. The electrocardiosignal feature extraction method of claim 2, wherein, The method of performing position encoding processing on the current block embedding feature to obtain the current position encoding feature comprises: performing absolute position encoding on the current block embedding feature to obtain current absolute position encoding information; performing feature fusion on the current absolute position encoding information and the current block embedding feature to obtain the current position encoding feature; or performing relative position encoding on the current block embedding feature to obtain current relative position encoding information; performing feature fusion on the current relative position encoding information and the current block embedding feature to obtain the current position encoding feature. The method of performing efficient transformer processing on the current position encoding feature to obtain the target multi-scale feature of the current multi-scale feature extraction stage comprises:
5. The electrocardiosignal feature extraction method of claim 2, wherein, performing self-attention mechanism processing on the current position encoding feature to obtain a current self-attention processing feature; performing feedforward neural network processing on the current self-attention processing feature to obtain the target multi-scale feature of the current multi-scale feature extraction stage. The method of performing multi-scale feature fusion on each target multi-scale feature to obtain a target multi-scale fusion feature comprises:
6. The electrocardiosignal feature extraction method of claim 2, wherein, performing feature fusion on a previous multi-scale fusion feature and the target multi-scale feature to be fused to obtain the current multi-scale fusion feature; connecting each multi-scale fusion feature to obtain the target multi-scale fusion feature. The method of performing bottom layer feature extraction on the target electrocardio signal to obtain a target bottom layer feature comprises:
7. The electrocardiosignal feature extraction method according to any one of claims 1 to 6, characterized in that, performing convolution operation on the target electrocardio signal to obtain a target convolution feature; The target convolutional feature is subjected to batch normalization processing to obtain a target batch normalization feature; The target batch normalization feature is activated to obtain the target bottom-level feature.
8. An electrocardiosignal feature extraction apparatus, characterized by The method comprises the following steps: An object electrocardiosignal acquisition module is configured to acquire a target electrocardiosignal; A bottom-level feature extraction module is configured to extract a bottom-level feature from the target electrocardiosignal to obtain a target bottom-level feature; A multi-scale feature extraction module is configured to extract a multi-scale feature from the target bottom-level feature to obtain a plurality of target multi-scale features; wherein the multi-scale feature extraction comprises a preset number of multi-scale feature extraction stages, each of which comprises block embedding processing, position encoding processing, and high-efficiency transformer processing; A multi-scale feature fusion module is configured to fuse the plurality of target multi-scale features to obtain a target multi-scale fusion feature.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program, when executed by a processor, implements the steps of the electrocardiosignal feature extraction method according to any one of claims 1 to 7.
10. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor, when executing the computer program, implements the steps of the electrocardiosignal feature extraction method according to any one of claims 1 to 7.