Bio-electricity signal classification method and device, electronic equipment and storage medium

This bioelectric signal classification method, which employs multi-scale convolutional layers, channel attention enhancement layers, and bidirectional context transformation layers, addresses the problem of capturing local details and global temporal features in existing technologies, achieving efficient classification of bioelectric signals and accurate identification of anomalous samples.

CN121765504APending Publication Date: 2026-03-31QUANZHOU INST OF INFORMATION ENG
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-05
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing bioelectric signal classification methods struggle to simultaneously capture local details and global temporal features, and are insufficient in handling imbalanced data, resulting in low accuracy in minority class identification and poor system reliability.

Method used

A bioelectric signal classification method employing multi-scale convolutional layers, channel attention enhancement layers, and bidirectional context transformation layers is proposed. By constructing a balanced training set through multi-scale feature extraction, feature enhancement, and temporal dependency modeling, the accuracy of feature extraction and classification performance are improved.

Benefits of technology

It improved the accuracy and recall of bioelectrical signal classification, especially the accuracy of identifying abnormal signals, thus enhancing the model's detection efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121765504A_ABST
    Figure CN121765504A_ABST
Patent Text Reader

Abstract

The invention provides a bio-electricity signal classification method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining and processing a bio-electricity signal original data set, and obtaining a balanced training set; performing multi-scale feature extraction on the balanced training set to obtain a multi-scale feature map; performing feature enhancement on the multi-scale feature map to obtain a key feature map; performing time sequence dependence modeling on the key feature map to generate a global feature vector; and performing classification mapping on the global feature vector, and outputting a category prediction result. According to the method, the original data set of the bio-electricity signals is subjected to equalization processing, and the key features are extracted and enhanced, so that the accuracy of abnormal sample signal detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of signal processing technology, and in particular to a method and apparatus for classifying bioelectrical signals, an electronic device, and a storage medium. Background Technology

[0002] Bioelectrical signal classification is a key technology in intelligent signal processing, involving the classification and analysis of time-series data such as electrocardiogram (ECG), electroencephalogram (EEG), and electromyogram (EMG). Existing methods mostly employ single convolutional neural networks or traditional Transformer models for feature extraction and temporal modeling. However, this approach struggles to simultaneously capture both local details and global temporal features of bioelectrical signals, and its ability to handle imbalanced data is insufficient, resulting in low accuracy in minority class identification and poor system reliability. Summary of the Invention

[0003] In view of this, this application provides a method and apparatus for classifying bioelectrical signals, an electronic device and a storage medium, which improves feature extraction accuracy, balances sample data and enhances the classification performance of the model.

[0004] In a first aspect, embodiments of this application provide a method for classifying bioelectrical signals. The method includes: acquiring an original dataset of bioelectrical signals and selecting a portion of the original dataset used for model training as a training sample set; processing the training sample set to obtain a balanced training set; training an initial training model using the balanced training set to obtain a classification model, the classification model including a multi-scale convolutional layer, a channel attention enhancement layer, and a bidirectional context transformation layer; acquiring a bioelectrical signal to be detected and inputting the bioelectrical signal to be detected into the classification model, so that the multi-scale convolutional layer performs multi-scale feature extraction on the bioelectrical signal to be detected to obtain a multi-scale feature map; the channel attention enhancement layer enhances the features of the multi-scale feature map to obtain a key feature map; the bidirectional context transformation layer performs temporal dependency modeling on the key feature map to generate a global feature vector; performing classification mapping on the global feature vector and outputting a category prediction result, the category prediction result including the probability distribution of each category and the target category determined based on the probability distribution, the categories including normal, abnormal, and unknown categories.

[0005] Secondly, embodiments of this application provide a bioelectrical signal classification device. The bioelectrical signal classification device includes a data preprocessing module, a model training module, a signal acquisition module, and a classification output module. The data preprocessing module acquires a raw dataset of bioelectrical signals and selects a portion of the raw dataset for model training as a training sample set; and processes the training sample set to obtain a balanced training set. The model training module uses the balanced training set to train an initial training model to obtain a classification model, the classification model including a multi-scale convolutional layer, a channel attention enhancement layer, and a bidirectional context transformation layer. The signal acquisition module acquires the signal to be detected. A bioelectrical signal is measured and input into the classification model. The multi-scale convolutional layer extracts multi-scale features from the bioelectrical signal to obtain a multi-scale feature map. The channel attention enhancement layer enhances the multi-scale feature map to obtain a key feature map. The bidirectional context transformation layer models the key feature map for temporal dependency and generates a global feature vector. The classification output module performs classification mapping on the global feature vector and outputs a category prediction result. The category prediction result includes the probability distribution of each category and the target category determined based on the probability distribution. Each category includes normal, abnormal, and unknown categories.

[0006] Thirdly, this application provides an electronic device, which includes an electronic device body and a main control device. The electronic device body is used to collect bioelectric signals, and the main control device is communicatively connected to the electronic device body. The main control device includes a memory and a processor. The memory is used to store a computer program, and the processor is used to execute the computer program to implement the above-mentioned bioelectric signal classification method.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium for storing a computer program that is executed to implement the above-described method for classifying bioelectrical signals.

[0008] The aforementioned bioelectrical signal classification methods, devices, electronic equipment, and storage media have performed equalization processing on anomalous samples, improving the recall and accuracy of anomalous signals. By setting multiple parallel convolutional branches in the model, using different convolutional kernels in different branches to comprehensively capture signal features of bioelectrical signals at different details, setting multi-matrix fusion to enhance key features, and performing temporal dependency modeling on key feature maps, the efficiency of the model in detecting bioelectrical signals and the accuracy of bioelectrical signal classification have been improved. Attached Figure Description

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

[0010] Figure 1 A flowchart of a bioelectric signal classification method provided in an embodiment of this application.

[0011] Figure 2 A flowchart of step S102 provided in the embodiments of this application.

[0012] Figure 3 A flowchart of step S202 provided for an embodiment of this application.

[0013] Figure 4 A flowchart of step S104 provided in the embodiments of this application.

[0014] Figure 5 A flowchart of step S105 provided in the embodiments of this application.

[0015] Figure 6 A flowchart of step S106 provided in the embodiments of this application.

[0016] Figure 7 A flowchart of step S107 provided in the embodiments of this application.

[0017] Figure 8 This is a structural block diagram of the bioelectric signal classification device provided in the embodiments of this application.

[0018] Figure 9 A structural block diagram of an electronic device provided in an embodiment of this application.

[0019] Figure 10 A schematic diagram of the internal structure of the main control device for the application of the bioelectric signal classification method provided in the embodiments of this application.

[0020] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0022] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar planned objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data are interchangeable where appropriate; in other words, the described embodiments are implemented according to a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, may also include other content; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0023] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of a person skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0024] Please refer to Figure 1 This is a flowchart of a bioelectrical signal classification method provided in an embodiment of this application. This application provides a bioelectrical signal classification method, which can be executed by an electronic device to avoid missing abnormal samples when using a preset model for detection by constructing a balanced dataset related to bioelectrical signals. In this application, the electronic device can be a wearable device (such as a smart bracelet, a finger clip sensor, etc.) or a non-wearable device (such as a desktop electrocardiograph, a bedside detector, etc.). Bioelectrical signals can be electrocardiogram (ECG) signals, electroencephalogram (EEG) signals, electromyogram (EMG) signals, etc. Detection using a preset model can determine whether the signal is normal or abnormal, or which specific category it belongs to. Samples can be ECG signal samples, EEG signal samples, or EMG signal samples, etc. The following will use an ECG signal as an example to illustrate in detail how to implement the bioelectrical signal classification method. The bioelectrical signal classification method includes steps S101-S107.

[0025] Step S101: Obtain the original dataset of bioelectrical signals, and select a portion of the original dataset for model training as the training sample set.

[0026] In step S101, bioelectrical signals are acquired using electronic devices to obtain a raw dataset of bioelectrical signals. In this application, the raw dataset contains classified and labeled data from existing datasets, such as signal data from the MIT-BIH dataset. The classified and labeled data from the raw dataset is used as a training sample set to train the model.

[0027] Step S102: Process the training sample set to obtain a balanced training set.

[0028] Please refer to the following: Figure 2 This is a flowchart of step S102 provided in the embodiments of this application. Processing the training sample set to obtain a balanced training set includes steps S201-S202.

[0029] Step S201: Obtain the original bioelectric signal dataset and perform multi-scale decomposition and denoising on the original bioelectric signal dataset to obtain denoised signal data.

[0030] In step S201, the electronic device acquires continuous electrocardiogram (ECG) signals from an existing dataset, and extracts fixed-length signal segments containing a single complete heartbeat from the continuous ECG signals according to a preset algorithm, which serve as the original bioelectrical signal dataset. The preset algorithm can be a sliding window extraction algorithm. This application uses the Daubechies 5 (db5) wavelet basis function to sequentially perform multi-scale decomposition on each signal segment to separate the low-frequency effective components corresponding to the signal waveform and the high-frequency noise components corresponding to motion and environmental interference in each signal segment. After filtering the high-frequency noise components according to a preset threshold, each signal segment is reconstructed through inverse transform of the db5 wavelet basis function to obtain a set of denoised clean signal segments as denoised signal data.

[0031] Step S202: Use a preset hybrid algorithm to perform sample equalization processing on the denoised signal data to construct an equalized training set.

[0032] In step S202, the preset mixing algorithm can be the SMOTE-Tomek mixing algorithm. The specific process of using the SMOTE-Tomek mixing algorithm to process denoised signal data, increase the number of outlier samples, and expand the dataset to construct a balanced training set will be described in detail below.

[0033] In the above embodiments, the real-time acquired signal segments are denoised using the db5 wavelet basis function. This denoising method can effectively remove complex noise and ensure improved accuracy of signal feature extraction.

[0034] Please refer to the following: Figure 3 This is a flowchart of step S202 provided in the embodiments of this application. The process of using a preset mixing algorithm to perform sample equalization processing on the denoised signal data and constructing an equalized training set specifically includes steps S301-S303.

[0035] Step S301: Identify normal and abnormal samples in the denoised signal data.

[0036] In step S301, normal samples correspond to the normal class, and abnormal samples correspond to the abnormal class. The abnormal class includes multiple abnormal subclasses. For electrocardiogram signals, normal samples can be normal non-ectopic heartbeats (N), and abnormal samples can be supraventricular abnormal heartbeats (S), ventricular abnormal heartbeats (V), and fused heartbeats (F). There is also an unknown class of unknown heartbeats (Q). The number of samples corresponding to each type of sample in this application is different.

[0037] Step S302: Based on the distribution of each abnormal subclass in the feature space, perform synthetic oversampling on each abnormal subclass to expand the number of samples of each abnormal subclass to the number of samples of the normal class, thereby obtaining an expanded dataset.

[0038] In step S302, the number of samples in each abnormal subclass is usually less than the number of samples in the normal class. Therefore, it is necessary to oversample each abnormal subclass to balance the number of samples in the abnormal class with the number of samples in the normal class, so as to avoid the trained model having low prediction accuracy for the category with fewer samples, thus resulting in missed diagnoses. In this application, SMOTE technology is used to synthesize virtual samples for each abnormal subclass and increase the number of samples in each abnormal subclass to be comparable to the number of samples in the normal class.

[0039] Step S303: Identify two sample pairs in the expanded dataset that are each other's nearest neighbors and have different classes as boundary redundant sample pairs, and delete samples belonging to the normal class from the boundary redundant sample pairs to construct a balanced training set.

[0040] In step S303, normal class samples in boundary redundant sample pairs are identified and deleted through Tomek Links. While increasing the number of abnormal class samples, the number of normal class samples is not increased, thus constructing a balanced training set.

[0041] In the above embodiments, since the number of abnormal samples is less than the number of normal samples, after expanding the dataset, a large number of highly similar but different samples appear in the boundary region of the feature space between the normal samples and the expanded abnormal samples. These samples will cause the model's recognition accuracy of abnormal samples to decrease. Therefore, the SMOTE technique is first used to synthesize virtual samples for each abnormal subclass to increase the number of abnormal samples. Then, Tomek Links is used to identify and delete normal samples in the redundant boundary sample pairs, thereby constructing a balanced training set. After training the model with this balanced training set, the trained model can effectively avoid boundary sample interference, improve classification accuracy, and reduce the risk of missing abnormal samples.

[0042] Step S103: Train the initial training model using a balanced training set to obtain a classification model.

[0043] In step S103, the classification model includes multi-scale convolutional layers, channel attention enhancement layers, and bidirectional context transformation layers. The initial training model in this application has a structure largely consistent with the classification model. In the initial training model, the learnable parameters in each formula and matrix are not yet fixed; they are initially randomly selected and gradually optimized as the classification accuracy of samples in the balanced training set is tested, until the optimal parameters that maximize the model's accuracy are obtained. Once the optimal parameters are determined, the training of the classification model is complete. The specific training process of the classification model is largely the same as that of a conventional model and will not be elaborated upon here.

[0044] Step S104: Obtain the bioelectric signal to be detected and input the bioelectric signal to be detected into the classification model so that the multi-scale convolutional layer can extract multi-scale features from the bioelectric signal to be detected and obtain a multi-scale feature map.

[0045] In step S104, the bioelectrical signal to be detected is acquired through the main body of the electronic device. The multi-scale convolutional layer includes multiple convolutional branches. Each convolutional branch is configured with a convolutional kernel of a different size to capture the local detailed features and global temporal features of the bioelectrical signal to be detected, respectively.

[0046] Please refer to the following: Figure 4 The flowchart below shows step S104, which is a sub-step provided in the embodiments of this application. The process of extracting multi-scale features from the balanced training set to obtain a multi-scale feature map specifically includes steps S401-S402.

[0047] Step S401: Input each sample in the balanced training set into multiple convolutional kernels in parallel to extract features and obtain feature maps at multiple scales.

[0048] In step S401, the classification model sets up multiple parallel convolutional branches in its multi-scale convolutional layers, with different convolutional kernels on each branch. Samples from the balanced training set are input in parallel into multiple convolutional kernels of different sizes in the model for local and global feature extraction. Specifically, smaller convolutional kernels have smaller receptive fields and focus on local scale features of bioelectrical signals. Mid-range convolutional kernels have moderate receptive fields and focus on extracting mid-range scale features. Large convolutional kernels have the largest receptive field and focus on capturing global scale features. After completing the convolution calculation, each convolutional branch is connected to a BatchNormalization layer to standardize the initial feature maps output by the convolutional branches, ensuring that the feature scales of each branch are consistent. A ReLU activation function is then applied to introduce a non-linear transformation, suppressing invalid features and ensuring that each branch outputs a scale feature map with a uniform dimensionality.

[0049] Step S402: The feature maps of multiple scales are spliced ​​and fused along the channel dimension to obtain a multi-scale feature map.

[0050] In the above embodiments, convolution kernels of different sizes are set in the multi-scale convolutional layers of the classification model to obtain multi-scale feature maps. The multi-scale feature maps integrate bioelectrical signals with information from microscopic details to macroscopic trends.

[0051] Step S105: The channel attention enhancement layer enhances the features of the multi-scale feature map to obtain the key feature map.

[0052] In step S105, initial attention weights are obtained based on the multi-scale feature map. The identity matrix and learnable parameter matrix are introduced and fused with the initial attention weights to enhance key features, thereby obtaining the key feature map.

[0053] Please refer to the following: Figure 5 This is a flowchart of step S105 provided in the embodiments of this application. The channel attention enhancement layer enhances the features of the multi-scale feature map to obtain the key feature map, specifically including steps S501-S505.

[0054] Step S501: Perform global pooling compression on the multi-scale feature map to obtain the feature description values ​​of each channel.

[0055] In step S501, global average pooling is performed on the multi-scale feature map along the temporal dimension, and the feature values ​​of each channel at all temporal sampling points are averaged to obtain the feature description values ​​of each channel.

[0056] Step S502: Perform dimensional transformation on the feature description values ​​of each channel, and generate initial attention weights by processing them with an activation function.

[0057] In step S502, the channel dimension of the feature map after global average pooling is reduced to obtain a low-dimensional multi-scale fusion feature set. The low-dimensional fusion features contained in the feature map after dimensionality reduction are non-linearly filtered element by element to enhance effective information and obtain activated low-dimensional multi-scale fusion features. The multi-scale fusion features after dimensionality increase are normalized to finally generate the initial attention weights.

[0058] In this embodiment, global average pooling compresses the original 3D feature map containing temporal information into a 2D feature tensor that retains only channel-dimensional features. Then, a 1D convolutional layer with fixed parameters and a 1×1 kernel is used for channel-dimensionality reduction. The resulting low-dimensional multi-scale fusion feature set is then input to a ReLU activation function for element-wise nonlinear filtering. This suppresses the negative impact of noise or invalid channels in the low-dimensional features and introduces nonlinear expressive power to strengthen key features, ultimately outputting the activated low-dimensional multi-scale fusion features. The activated low-dimensional features are then subjected to another 1D convolutional layer with fixed parameters and a 1×1 kernel to perform channel-dimensionality upscaling, restoring the output channel number to the original channel number of the multi-scale feature map. After upscaling, Softmax normalization is performed along the channel dimension to output the initial attention weights.

[0059] Understandably, this application first performs global average pooling on the spliced ​​multi-scale feature maps in the temporal dimension, then uses 1D convolutional layers for dimensionality reduction, introduces non-linear filtering, and then performs dimensionality increase to suppress the influence of invalid channels, strengthen key features, and finally performs normalization to obtain initial attention weights, which dynamically reflect the contribution of different channels to the classification task, providing high-quality feature support for subsequent temporal modeling and classification decisions.

[0060] Step S503: The identity matrix and the learnable parameter matrix are combined with the initial attention weights and weighted summation to obtain the fused attention weights.

[0061] In step S503, the identity matrix used to retain the original feature base weights is weighted and summed with the learnable parameter matrix used to adaptively adjust the contribution of each channel to obtain the final fusion attention weights.

[0062] Step S504: The multi-scale feature map is weighted channel by channel based on the fused attention weights to obtain a weighted feature map.

[0063] In step S504, in the fused attention weights, each value corresponds to a channel weight value. Key channels have higher weight values, and noisy channels have lower weight values. The fused attention weights are first broadcast in the temporal dimension to align their dimensionality with the multi-scale features. Figure 1Then, it is multiplied with the multi-scale feature map channel by channel, that is, all time-series feature values ​​of each channel are multiplied by the weight corresponding to that channel, so as to amplify the features of key channels and reduce the features of interference channels, thus obtaining a weighted feature map.

[0064] Step S505: Perform a convolution transformation on the weighted feature map to restore the feature channel dimensions to the multi-scale feature dimensions. Figure 1 This yields the key feature map.

[0065] In step S505, in this embodiment, the following is adopted: The 1D convolutional kernel linearly integrates the weighted feature map only in the channel dimension, eliminating channel redundancy caused by multi-scale convolutional branch splicing, and standardizing the number of channels to a target value that can be directly received by subsequent Transformer layers. The final output is a key feature map that is feature-focused, dimension-compatible, and whose temporal correlation is not destroyed.

[0066] In the above embodiments, the classification model enhances key features in multi-scale convolutional layers and suppresses features in invalid channels, thereby improving the overall classification performance of the classification model.

[0067] Step S106: The bidirectional context transformation layer performs temporal dependency modeling on the key feature maps to generate global feature vectors.

[0068] In step S106, the temporal modeling unit in the bidirectional context transform layer processes the key feature map to obtain a global feature vector. In this embodiment, the temporal modeling unit is a bidirectional Transformer temporal modeling unit. The bidirectional context transform layer includes multiple parallel attention heads, each configured with a different feature segmentation strategy.

[0069] Please refer to the following: Figure 6 , Figure 6 The flowchart for step S106 provided in the embodiments of this application is as follows. The bidirectional context transformation layer performs temporal dependency modeling on the key feature map to generate a global feature vector, specifically including steps S601-S605.

[0070] Step S601: Input the key feature map into multiple parallel context-aware attention heads.

[0071] In step S601, the bidirectional Transformer temporal modeling unit is equipped with multiple parallel context-aware attention heads. Temporal dimension processing is performed on the key feature maps within the bidirectional Transformer temporal modeling unit to obtain bidirectional input feature maps. In this application, the bidirectional input feature map is represented as follows: ,in, Represents bidirectional input feature maps. Represents the key feature map. This represents the feature map after flipping the key feature map along the temporal dimension. It's understandable that the Transformer attention mechanism is centered on the temporal dimension, therefore the channel dimension must come first, with a dimension of [missing information]. Bidirectional input feature map Perform a dimension transpose, transforming it so that the time-series dimension comes first, and the dimension is... The feature data, the transposed bidirectional input feature map is denoted as... .Will Input is fed into multiple parallel context-aware attention heads.

[0072] Step S602: Based on the corresponding feature segmentation strategy, the key feature maps in each context-aware attention head are segmented temporally to obtain multiple segmented feature sequences.

[0073] In step S602, each attention head is equipped with three dedicated learnable weight matrices. This ensures that each attention head focuses on the input sequence, that is... This involves different types of information or focusing on features at different locations. Depending on the different input sequences that each attention head focuses on, [the following will be done / then / etc.]. The feature sequence is divided into multiple segments, and these segments are assigned to different attention heads according to their indices.

[0074] Step S603: Perform local context encoding on each segment feature sequence to obtain multiple local context feature vectors.

[0075] In step S603, As vectors (Query vector) (key vector) The basic input elements of the (value vector) are used to linearly transform the learnable weight matrix of each attention head using Formula 1, resulting in the values ​​for each attention head. (Query vector) (key vector) (Value vector). Specifically, Formula 1 is: in, For the index of attention head, All dimensions ( for vector( (dimensions) Definition of the first The time-series correlation types to be captured. Will Features are transformed into a feature index library, for It provides a unified benchmark, enabling it to efficiently match the most similar features in sequences. Store the valid information to be extracted after matching the target association. The output of this application... , , All dimensions .

[0076] After calculating each attention head , , Then, each attention head independently calculates its local context feature vector using Formula 2. Specifically, Formula 2 is as follows: in, for The transpose of the matrix, and The initial fractional matrix obtained by performing the dot product operation is denoted as . To avoid due to An excessively large value can cause the dot product result to overflow, leading to... The vanishing gradient of the function will cause the initial fraction matrix to... Divide by Scaling is applied. The scaled fraction matrix is ​​then processed. Execute line by line The function transforms each row of values ​​into a probability distribution in the range of 0 to 1 (with the sum of elements in each row being 1), resulting in the attention weight matrix denoted as... The normalized attention weight matrix and Perform matrix multiplication to obtain the first... Local context feature vectors of each attention head.

[0077] Step S604: Fuse multiple local context feature vectors with the key feature map to obtain a fused feature representation.

[0078] In step S604, the local context feature vector output by each attention head is compared with the feature map input to that attention head. Element-wise addition and fusion are performed to obtain a fused feature representation that retains both the original feature information and the local contextual feature information. This fusion operation can preserve the effective features of the original bioelectrical signals in the key feature map, avoiding feature loss, and can also introduce the local temporal contextual features extracted by the attention head, improving the accuracy of subsequent bidirectional temporal modeling in capturing long-distance dependencies.

[0079] Step S605: Perform bidirectional temporal modeling on the fused feature representation to capture long-distance temporal dependencies and generate a global feature vector.

[0080] In step S605, within the bidirectional Transformer temporal modeling unit, a single model is used to process superimposed features to simulate the bidirectional context, reducing parameters and improving efficiency. The fused feature representations of multiple attention heads are concatenated along the channel dimension, and a learnable linear transformation matrix is ​​introduced to perform a linear transformation to integrate the features from different heads, outputting a global feature vector containing long-range temporal dependencies.

[0081] Understandably, since the classification model used is a trained model, the weight matrix can be learned. The learnable linear transformation matrices are all fixed values, and the values ​​of these matrices are different in classification models trained on different datasets.

[0082] In the above embodiments, the construction method of bidirectional input feature maps does not require building two independent models, forward and backward, but only uses key feature maps. With horizontally flipped feature map By overlaying channels, a single model can efficiently simulate bidirectional context, fully capturing the forward temporal trend and reverse correlation information of ECG signals, avoiding the omission of temporal dependencies caused by unidirectional processing. This significantly reduces model parameter redundancy, avoiding the double parameter overhead of traditional bidirectional modeling schemes, and is suitable for real-time detection in wearable ECG devices. The overlaid feature map retains the enhanced key features while supplementing the reverse temporal feature responses, providing more comprehensive feature support for subsequent Transformer layers to accurately identify long-distance temporal dependencies.

[0083] Step S107: Perform classification mapping on the global feature vector and output the category prediction result.

[0084] In step S107, the category prediction results include the probability distribution of each category and the target category determined based on the probability distribution. Each category includes normal, abnormal, and unknown categories. In this embodiment, the model trained on the MIT-BIH dataset achieves an overall classification accuracy of 98.88% and a macro-average F1 score of 93.97%. Among them, the F1 score for normal non-ectopic (N) and unknown (Q) classes exceeds 99%, and the F1 score for ventricular abnormal (V) class reaches 97.47%, which is significantly better than most existing models.

[0085] Please refer to the following: Figure 7 , Figure 7 The flowchart for step S107 provided in the embodiments of this application is as follows. The specific process of classifying and mapping the global feature vector and outputting the category prediction result includes steps S701-S704.

[0086] Step S701: Input the global feature vector into the classification mapping layer and perform a fully connected transformation to obtain the category response vector.

[0087] In step S701, the global feature vector is input into the classification mapping layer of multiple hidden units. A nonlinear transformation is introduced through the ReLU activation function to optimize the mapping of high-dimensional features and output a high-dimensional refined feature vector, which is then transformed into a category response vector through linear mapping.

[0088] Step S702: Normalize the category response vectors to obtain the probability distributions of each category.

[0089] In step S702, the category response vector is normalized using the Softmax function to obtain three probability distributions: normal, abnormal, and unknown, with values ​​ranging from 0 to 1 and a sum of 1. Each probability value accurately reflects the confidence that the input bioelectric signal sample belongs to the corresponding category.

[0090] Step S703: Based on the probability distribution of each category, determine the category with the highest probability value as the target category.

[0091] In step S703, based on the maximum confidence decision principle, the probability value with the largest value is selected from the three probability distributions, and the corresponding signal category is determined as the target category of the input bioelectric signal.

[0092] Step S704: Output the category prediction results.

[0093] In the above embodiments, by processing the global feature vector in the fully connected layer, the probability distribution of each category is obtained, and the target category of the bioelectric signal can be determined based on the maximum confidence decision principle.

[0094] Please refer to Figure 8 , Figure 8 This is a schematic diagram of a bioelectric signal classification device module provided in an embodiment of this application. The bioelectric signal classification device 2 includes a data preprocessing module 21, a model training module 22, a signal acquisition module 23, and a classification output module 24.

[0095] The data preprocessing module 21 is used to acquire the raw dataset of bioelectric signals, select a portion of the raw dataset for model training as the training sample set, and process the training sample set to obtain a balanced training set.

[0096] Specifically, the electronic device acquires continuous raw bioelectrical signals, and extracts fixed-length signal segments containing a single complete heartbeat from the continuous raw bioelectrical signals according to a preset algorithm, which serve as the raw bioelectrical signal dataset. The Daubechies 5 (db5) wavelet basis function is used to denoise the raw bioelectrical signal dataset, and the dataset is expanded using the SMOTE-Tomek hybrid algorithm to construct a balanced dataset.

[0097] The model training module 22 is used to train the initial training model using a balanced training set to obtain a classification model. The classification model includes a multi-scale convolutional layer, a channel attention enhancement layer, and a bidirectional context transformation layer.

[0098] The signal acquisition module 23 acquires the bioelectrical signal to be detected and inputs it into the classification model so that the multi-scale convolutional layer can extract multi-scale features from the bioelectrical signal to be detected, obtaining a multi-scale feature map. The channel attention enhancement layer enhances the features of the multi-scale feature map to obtain a key feature map. And the bidirectional context transformation layer performs temporal dependency modeling on the key feature map to generate a global feature vector.

[0099] Specifically, samples from the balanced training set are input in parallel to multiple convolutional kernels for feature extraction, resulting in feature maps at multiple scales. These kernels have different sizes to capture both local detail features and global temporal features of each sample. The feature maps at multiple scales are then concatenated and fused along the channel dimension to obtain a multi-scale feature map. Global pooling compression is applied to the multi-scale feature map to obtain feature description values ​​for each channel. Initial attention weights are generated based on these channel description values. The identity matrix and learnable parameter matrix are fused into these initial attention weights to obtain fused attention weights. The multi-scale feature map is then weighted channel-wise based on these fused attention weights to obtain a weighted feature map. Finally, channel restoration processing is performed on the weighted feature map to obtain the key feature map. The key feature map is input into multiple parallel context-aware attention heads. Based on different feature segmentation strategies, the key feature map in each context-aware attention head is segmented to obtain multiple segmented feature sequences. Local context encoding is performed on each segmented feature sequence to obtain multiple local context feature vectors. The multiple local context feature vectors are fused with the key feature map to obtain a fused feature representation. Bidirectional temporal modeling is performed on the fused feature representation to capture long-distance temporal dependencies and generate a global feature vector.

[0100] The classification output module 24 is used to classify and map the global feature vector and output the category prediction results. The category prediction results include the probability distribution of each category and the target category determined based on the probability distribution. Each category includes normal class, abnormal class and unknown class.

[0101] In the above embodiments, the classification model captures signal features at various scales of the ECG signal by setting different convolution kernels in different convolution branches. Initial attention weights are obtained based on the multi-scale feature maps output by the convolution branches. An identity matrix and a learnable parameter matrix are introduced, and the three matrices are fused to obtain the fused attention weights. Key features are enhanced, and features from ineffective channels are suppressed, improving the overall classification performance of the model. The construction of bidirectional input feature maps allows this application to efficiently simulate bidirectional contexts using a single model. It retains the enhanced key features while supplementing the reverse temporal feature responses, fully capturing the forward temporal trend and reverse correlation information of the ECG signal. This avoids the temporal dependency omission caused by unidirectional processing, significantly reducing model parameter redundancy and avoiding the double parameter overhead of traditional bidirectional modeling schemes, while providing more comprehensive feature support for the Transformer layer to accurately identify long-distance temporal dependencies.

[0102] Please refer to Figure 9 This is a structural block diagram of the electronic device provided in the embodiments of this application. This application also provides an electronic device. The electronic device 1 includes an electronic device body 11 and a main control device 12. The electronic device body 11 is used to collect bioelectrical signals, and the main control device 12 is communicatively connected to the electronic device body 11. In this application, the main control device 12 can be a computer device.

[0103] Please refer to the following: Figure 9 and Figure 10 , Figure 10 A schematic diagram of the internal structure of the main control device for the application of the bioelectric signal classification method provided in the embodiments of this application.

[0104] like Figure 10 As shown, the main control device 12 specifically includes a memory 122 and a processor 121. In some embodiments, the processor 121 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip, used to run program instructions stored in the memory 122 to implement the bioelectric signal classification method of this application.

[0105] The memory 122 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 122 may be an internal storage unit of a computer device, such as a hard disk. In other embodiments, the memory 122 may be an external storage device of a computer device, such as a plug-in hard disk, SmartMediaCard (SMC), SecureDigital (SD) card, FlashCard, etc., provided on the computer device. Furthermore, the memory 122 may include both internal and external storage units of the computer device. The memory 122 can be used not only to store application software and various types of data installed on the computer device, such as code implementing arrhythmia detection methods, but also to temporarily store data that has been output or will be output.

[0106] Furthermore, the main control device 12 also includes a bus 123. Bus 123 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0107] Furthermore, the main control device 12 may also include a display component 124. The display component 124 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touch screen, etc. The display component 124 may also be appropriately referred to as a display device or display unit, used to display information processed in the main control device 12 and to display a visual user interface.

[0108] Furthermore, the main control device 12 may also include a communication component 125. The communication component 125 may optionally include a wired communication component and / or a wireless communication component (such as a Wi-Fi communication component, a Bluetooth communication component, etc.), which is typically used to establish a communication connection between the main control device 12 and other computer devices.

[0109] Figure 10 Only a portion of the components and the main control device 12 for classifying bioelectrical signals are shown; those skilled in the art will understand that... Figure 10The structure shown does not constitute a limitation on the main control device 12, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0110] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, in the form of a computer program product.

[0111] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to embodiments of the present invention is generated. The computer device may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).

[0112] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0113] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of 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 an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.

[0114] The unit described as a separate component may or may not be physically separate. The component shown as a unit may or may not be a physical unit; that is, it 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.

[0115] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist independently, 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.

[0116] If the integrated 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, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard disks, read-only storage media (ROM), random access storage media (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0117] In the above embodiments, equalization processing was performed on abnormal samples, which improved the recall and accuracy of abnormal signals. By setting up multiple parallel convolution branches in the model, using different convolution kernels in different convolution branches to comprehensively capture the signal features of bioelectrical signals at different details, setting up multi-matrix fusion to enhance key features, and performing time-dependent modeling of key feature maps, the efficiency of the model in detecting bioelectrical signals and the accuracy of bioelectrical signal classification were improved.

[0118] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

[0119] The above-listed embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, any equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for classifying bioelectrical signals, characterized in that, The classification methods for the bioelectric signals include: Obtain the raw dataset of bioelectrical signals, and select a portion of the raw dataset for model training as the training sample set; The training sample set is processed to obtain a balanced training set; The initial training model is trained using the balanced training set to obtain a classification model, which includes a multi-scale convolutional layer, a channel attention enhancement layer, and a bidirectional context transformation layer. The bioelectric signal to be detected is acquired and input into the classification model so that the multi-scale convolutional layer can extract multi-scale features from the bioelectric signal to be detected to obtain a multi-scale feature map. The channel attention enhancement layer enhances the features of the multi-scale feature map to obtain a key feature map. The bidirectional context transformation layer performs temporal dependency modeling on the key feature map to generate a global feature vector. The global feature vector is classified and mapped, and the category prediction result is output. The category prediction result includes the probability distribution of each category and the target category determined based on the probability distribution. Each category includes normal class, abnormal class and unknown class.

2. The method for classifying bioelectrical signals as described in claim 1, characterized in that, The training sample set is processed to obtain a balanced training set, including: The original dataset is decomposed and denoised using a multi-scale method to obtain denoised signal data. The denoised signal data is processed by sample equalization using a preset mixing algorithm to construct the equalization training set.

3. The method for classifying bioelectrical signals as described in claim 2, characterized in that, The denoised signal data is subjected to sample equalization processing using a preset mixing algorithm to construct the equalization training set, including: Identify normal and abnormal samples in the denoised signal data. The normal samples correspond to the normal class, and the abnormal samples correspond to the abnormal class. The abnormal class includes multiple abnormal subclasses, and the number of samples corresponding to each abnormal subclass is less than the number of samples in the normal class. Based on the distribution of each abnormal subclass in the feature space, each abnormal subclass is subjected to synthetic oversampling so that the ratio of the number of samples of each abnormal subclass to the number of samples of the normal class is within a preset threshold range, thereby obtaining an expanded dataset. Identify two sample pairs in the augmented dataset that are each other's nearest neighbors and have different classes as boundary redundant sample pairs, delete the boundary redundant sample pairs, and construct the balanced training set.

4. The method for classifying bioelectrical signals as described in claim 1, characterized in that, The multi-scale convolutional layer includes multiple convolutional branches, each configured with convolutional kernels of different sizes to capture local detail features and global temporal features of the bioelectrical signal to be detected, respectively. The multi-scale convolutional layer performs multi-scale feature extraction on the bioelectrical signal to be detected, obtaining a multi-scale feature map, including: The bioelectrical signal to be detected is input in parallel into the multiple convolutional branches to obtain multiple scale feature maps; The multiple scale feature maps are spliced ​​and fused along the channel dimension to obtain the multi-scale feature map.

5. The method for classifying bioelectrical signals as described in claim 1, characterized in that, The channel attention enhancement layer enhances the multi-scale feature map to obtain a key feature map, including: The multi-scale feature map is compressed using global pooling to obtain the feature description values ​​for each channel; The feature description values ​​of each channel are transformed in dimension and then processed by an activation function to generate initial attention weights; The identity matrix and the learnable parameter matrix are combined with the initial attention weights and weighted summation to obtain the fused attention weights. The identity matrix is ​​used to retain the original feature weights, and the learnable parameter matrix is ​​used to adjust the contribution of each channel. Based on the fused attention weights, the multi-scale feature map is weighted channel by channel to obtain a weighted feature map; The weighted feature map is subjected to a convolutional transformation to restore the feature channel dimension to be consistent with the multi-scale feature map, thereby obtaining the key feature map.

6. The method for classifying bioelectrical signals as described in claim 1, characterized in that, The bidirectional context transformation layer includes multiple parallel attention heads, each configured with a different feature segmentation strategy; the bidirectional context transformation layer performs temporal dependency modeling on the key feature maps to generate a global feature vector, including: The key feature maps are respectively input into the multiple parallel attention heads; Based on the corresponding feature segmentation strategy, the key feature maps in each attention head are temporally segmented to obtain multiple segmented feature sequences. Local context encoding is performed on each segment of the feature sequence to obtain multiple local context feature vectors; The multiple local context feature vectors are fused with the key feature map to obtain a fused feature representation; The fused feature representation is subjected to bidirectional temporal modeling to capture long-distance temporal dependencies and generate the global feature vector.

7. The method for classifying bioelectrical signals as described in claim 1, characterized in that, The global feature vector is classified and mapped, and the category prediction result is output, including: The global feature vector is input into the classification mapping layer for fully connected transformation to obtain the category response vector; The category response vectors are normalized to obtain the probability distributions of each category; Based on the probability distribution of the aforementioned categories, the category with the highest probability value is determined as the target category; Output the category prediction results.

8. A bioelectrical signal classification device, characterized in that, The bioelectric signal classification device includes: The data preprocessing module is used to acquire the raw dataset of bioelectrical signals, select a portion of the raw dataset for model training as a training sample set, and process the training sample set to obtain a balanced training set. The model training module is used to train the initial training model using the balanced training set to obtain a classification model, which includes a multi-scale convolutional layer, a channel attention enhancement layer, and a bidirectional context transformation layer. The signal acquisition module is used to acquire the bioelectrical signal to be detected and input the bioelectrical signal to be detected into the classification model, so that the multi-scale convolutional layer performs multi-scale feature extraction on the bioelectrical signal to be detected to obtain a multi-scale feature map; the channel attention enhancement layer enhances the features of the multi-scale feature map to obtain a key feature map; and the bidirectional context transformation layer performs temporal dependency modeling on the key feature map to generate a global feature vector; and The classification output module is used to perform classification mapping on the global feature vector and output the category prediction result. The category prediction result includes the probability distribution of each category and the target category determined based on the probability distribution. Each category includes normal class, abnormal class and unknown class.

9. An electronic device, characterized in that, The electronic device includes: The main body of the electronic device is used to collect bioelectrical signals; and The main control device, which is communicatively connected to the main body of the electronic device, includes: Memory, used to store computer programs; and A processor for executing the computer program to implement the method for classifying bioelectrical signals as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that is executed to implement the method for classifying bioelectrical signals as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Network abnormal traffic detection method and device, and storage medium

    CN114745155A

  • Electroencephalogram signal classification method

    CN117243566A

  • Electroencephalogram signal emotion recognition method, system and equipment and storage medium

    CN120114059A

  • Electrocardiogram classification system and method fused with multi-scale adaptive attention

    CN120804857A

  • Atrial fibrillation prediction method and system based on local and global feature fusion

    CN120873742A