Anesthesia-related abnormal electrocardiosignal detection method based on deep learning
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WENZHOU MEDICAL UNIV
- Filing Date
- 2026-04-24
- Publication Date
- 2026-07-21
Smart Images

Figure CN122096726B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of medical data processing technology, and in particular to a method for detecting anesthesia-related abnormal electrocardiogram signals based on deep learning. Background Technology
[0002] During general anesthesia, a patient's electrocardiographic activity is influenced by a combination of factors, including anesthetic drugs, surgical stimuli, and changes in their physiological state. This makes monitoring for electrocardiographic abnormalities during anesthesia a highly challenging clinical task. Commonly used anesthetic drugs such as propofol and remifentanil directly affect myocardial cell ion channels and the autonomic nervous system, potentially inducing various arrhythmias, such as premature ventricular contractions, atrial fibrillation, and even life-threatening ventricular tachycardia. Simultaneously, the stimulation from the surgical procedure, the patient's underlying medical conditions, and the dynamic changes in the depth of anesthesia all contribute to significant time-varying and non-stationary characteristics of electrocardiographic signals. Therefore, real-time and accurate monitoring of electrocardiographic abnormalities during anesthesia is crucial for ensuring patient safety in the perioperative period. Summary of the Invention
[0003] This application provides a deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals, which can focus on the time-frequency characteristics most relevant to the patient's current physiological state, adapt to the influence of changes in anesthesia state on the representation of abnormal electrocardiograms, and enhance the model's on-site adaptability.
[0004] The first aspect of this application provides a method for detecting anesthesia-related abnormal electrocardiogram signals based on deep learning, the method comprising:
[0005] Acquire training samples from the training set, which include the preprocessed ECG denoised signal obtained during the patient's anesthesia and surgery, the multi-channel time-frequency feature map extracted from the ECG denoised signal, the anesthesia depth index synchronized with the ECG denoised signal, and the corresponding labeled heart rhythm type.
[0006] Training samples are input into the neural network model group for training. The multi-channel time-frequency feature map is adaptively weighted based on the anesthesia depth index. After fusing the morphological feature map of the ECG denoised signal with the weighted multi-channel time-frequency feature map to obtain a compact feature vector, the model is input into the classification head to output the predicted heart rhythm type, thus constructing an anesthesia-related abnormal ECG detection model.
[0007] In some embodiments, the multi-channel time-frequency feature map is adaptively weighted based on the anesthesia depth index, and the morphological feature map of the denoised ECG signal is fused with the weighted multi-channel time-frequency feature map to obtain a compact feature vector, including:
[0008] After mapping the anesthesia depth index to a modal weight vector using a multilayer perceptron, the multi-channel time-frequency feature map is adaptively weighted according to the diagonal matrix of the modal weight vector to obtain the weighted multi-channel time-frequency feature map.
[0009] The morphological features of the ECG denoised signal are extracted by a projection convolutional network and then externally multiplied and broadcast to form a morphological feature map.
[0010] After the weighted multi-channel time-frequency feature map and the morphological feature map are combined to form an enhanced feature matrix, multi-scale spatiotemporal feature extraction and global context encoding are performed to obtain a compact feature vector.
[0011] In some embodiments, performing multi-scale spatiotemporal feature extraction and global context encoding to obtain a compact feature vector includes:
[0012] Multiple parallel dilated convolutions are applied to the enhanced feature matrix along the time axis to extract local patterns in different receptive fields, resulting in different local feature maps.
[0013] Different local feature maps are concatenated along the channel dimension, fed into a bidirectional gated recurrent unit to learn long-range dependencies, and then subjected to global average pooling and linear mapping to obtain a compact feature vector.
[0014] In some embodiments, the method further includes:
[0015] The loss function, including class weights and focusing parameters, is dynamically adjusted based on the anesthesia depth index and applied to the neural network model group.
[0016] For each category of the labeled heart rhythm type, the complement value of the predicted heart rhythm type output by the neural network model group is calculated. The focusing parameter is used as the target number, the complement value is raised to the target number, and the natural logarithm of the predicted heart rhythm type is calculated. The category weight, the result of the exponentiation operation, and the natural logarithm are multiplied together and then multiplied by the labeled heart rhythm type to obtain the single-class loss for each category.
[0017] The single-class losses of all categories are summed, and the negative of the sum is taken to obtain the adaptive weighted focus loss value. The trainable parameters of the neural network model group are optimized based on the adaptive weighted focus loss value.
[0018] In some embodiments, dynamically adjusting the class weights and focusing parameters of the loss function applied to the neural network model group based on the anesthesia depth index includes:
[0019] For each category of the labeled heart rhythm type, the category weight is calculated by combining the first absolute difference between the preset abnormal anesthesia depth reference value and the anesthesia depth index, the reciprocal of the training sample frequency corresponding to the category, and a preset decay factor; and
[0020] Calculate the second absolute difference between the preset reference anesthesia depth and the anesthesia depth index. After normalizing the second absolute difference, multiply it by the preset adjustment range. Add the result of the multiplication to the preset basic focusing parameters to obtain the focusing parameters.
[0021] In some embodiments, before obtaining training samples from the training set, the method further includes:
[0022] Obtain the patient's raw electrocardiogram signals and the anesthesia depth index synchronized with the time during the anesthesia procedure;
[0023] Invalid segments of the original electrocardiogram (ECG) signal are removed, and non-overlapping segments are performed using a preset time window to obtain a set of ECG signal segments.
[0024] For each ECG signal segment in the ECG signal segment set, adaptive morphological filtering and energy adaptive wavelet thresholding are combined to denoise the ECG signal, and multi-channel time-frequency feature maps are extracted from the ECG signal.
[0025] The heart rhythm type was labeled by the feature groups formed by the denoised ECG signal, multi-channel time-frequency feature map and anesthesia depth index to obtain the dataset, and the training set was divided.
[0026] In some embodiments, for each ECG signal segment in the ECG signal segment set, adaptive morphological filtering and energy-adaptive wavelet thresholding are jointly performed to obtain a denoised ECG signal, including:
[0027] For each ECG signal segment in the ECG signal segment set, extract the sample sequence of the ECG signal segment;
[0028] The local slope at each discrete-time index in the sample sequence is approximated using the central difference method. The local slope is then normalized, and the adaptive structuring element length of the sample sequence is determined based on the normalized local slope.
[0029] Based on the adaptive structuring element length, morphological opening and closing operations are performed on the sample sequence to obtain the morphological opening and closing operation results respectively. The average value of the opening and closing operation results is taken as the morphological filtering output signal.
[0030] Perform morphological filtering on the output signal Layer-level stationary wavelet decomposition yields approximation coefficients and detail coefficients for each layer.
[0031] The noise standard deviation of each layer is estimated based on the detail coefficients of each layer, and the energy proportion of each layer detail coefficient is calculated. The threshold of each layer is adaptively calculated based on the energy proportion and the noise standard deviation of each layer. The detail coefficients of each layer are shrunk by combining the thresholds of each layer and using a soft thresholding function. The ECG denoised signal is reconstructed by combining the shrunk detail coefficients of each layer and the approximation coefficients through inverse stationary wavelet transform.
[0032] In some embodiments, extracting multi-channel time-frequency feature maps from the denoised ECG signal includes:
[0033] Variational mode decomposition combined with adaptive parameter optimization is used to decompose the ECG denoised signal into multimodal ECG components;
[0034] The multimodal instantaneous amplitude values of the multimodal electrocardiogram components are extracted by Hilbert transform, and the multimodal instantaneous amplitude values are arranged in rows to form a multi-channel time-frequency feature map.
[0035] In some embodiments, variational mode decomposition combined with adaptive parameter optimization is used to decompose the ECG denoised signal into multimodal ECG components, including:
[0036] With the goal of minimizing the difference between the sum of multimodal ECG components and the ECG denoised signal, as well as the weighted sum of the number of modes, a grid search is performed within a preset range of the number of modes and a preset range of bandwidth penalty factors to find the optimal number of modes and bandwidth penalty factor that meet the objectives, and these are determined as the target number of modes and the target bandwidth penalty factor.
[0037] By substituting the ECG denoised signal, the number of target modes, and the penalty factor for the target bandwidth into the constrained variational problem formula of variational mode decomposition, and solving iteratively using the alternating direction multiplier method, the multimodal ECG components are obtained.
[0038] In some embodiments, the labeled heart rhythm type includes normal sinus rhythm, premature ventricular contractions, atrial fibrillation, ventricular tachycardia, and other abnormalities.
[0039] Understandably, in related technologies, the detection of ECG abnormalities during anesthesia needs to consider both the time-frequency characteristics of the ECG signal and the patient's physiological state. Conventional methods are based solely on ECG waveforms and do not utilize clinical parameters such as anesthesia depth, making it difficult to adapt to the impact of changes in anesthesia state on the representation of ECG abnormalities. This application provides a deep learning-based method for detecting anesthesia-related abnormal ECG signals. It uses the anesthesia depth index as one of the sample features and adaptively weights the multi-channel time-frequency feature maps extracted from the denoised ECG signal. This allows the abnormal ECG detection model to focus more on the time-frequency characteristics most relevant to the patient's current physiological state when fusing them into a compact feature vector for the input classification head, thus adapting to the impact of changes in anesthesia state on the representation of ECG abnormalities and enhancing the model's real-world adaptability. Attached Figure Description
[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0041] Figure 1A flowchart illustrating a deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals, as provided in an embodiment of this application.
[0042] Figure 2 A schematic diagram of experimental results for a deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals provided in an embodiment of this application;
[0043] Figure 3 Another flowchart illustrating the deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals provided in this application embodiment;
[0044] Figure 4 A schematic diagram of another experimental result for the deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals provided in this application embodiment;
[0045] Figure 5 This is a schematic diagram of another experimental result of the deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals provided in the embodiments of this application.
[0046] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0047] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0048] The terms “first”, “second”, etc. used in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0049] The limitations of the relevant technology are further detailed below:
[0050] 1. Most related methods rely solely on ECG waveforms for abnormal detection, failing to fully utilize key intraoperative clinical parameters such as anesthesia depth. Since anesthetic drugs affect cardiac electrophysiological characteristics, the same ECG waveform may have different clinical significance at different anesthesia depths. Models that ignore this information struggle to adapt to the impact of changes in anesthetic status on the representation of ECG abnormalities.
[0051] 2. Conventional ECG signal denoising methods have limitations when processing non-stationary signals during anesthesia. Filters with fixed parameters cannot adapt to local slope changes in ECG waveforms, and are prone to morphological distortion at steep points in the QRS complex; while traditional wavelet thresholding uses a globally fixed threshold, without considering the differences in energy distribution across different frequency bands of the signal, which can easily lead to over-suppression of high-frequency details or incomplete denoising.
[0052] 3. Traditional time-frequency analysis methods are ineffective in characterizing the complex features of anesthesia ECGs. Fourier transform lacks time-frequency localization capabilities, wavelet transform requires pre-defined basis functions and a fixed decomposition scale, making it difficult to adaptively match the non-stationary characteristics of anesthesia ECG signals. Variational mode decomposition with fixed parameters is prone to mode aliasing or information redundancy, failing to extract time-frequency representations with clear physiological significance.
[0053] 4. Existing deep learning models neglect class imbalance and differences in clinical risk in anesthesia ECG detection. Conventional cross-entropy loss treats all samples equally, while abnormal samples are scarce during anesthesia, and the clinical urgency of the same abnormality varies at different depths of anesthesia. The lack of a risk-aware loss function makes it difficult for the model to focus on high-risk, hard-to-classify samples, affecting the clinical applicability of the detection.
[0054] The technical solution of this application and how the technical solution of this application solves the technical problem are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0055] Please see Figure 1 , Figure 1 A flowchart illustrating the deep learning-based method for detecting anesthesia-related abnormal electrocardiogram signals provided in this application is shown below. Figure 1 As shown, the detection method may include the following steps:
[0056] Step S210: Obtain training samples from the training set. The training samples include the preprocessed ECG denoised signal obtained during the patient's anesthesia and surgery, the multi-channel time-frequency feature map extracted from the ECG denoised signal, the anesthesia depth index synchronized with the ECG denoised signal, and the corresponding labeled heart rhythm type.
[0057] In this embodiment, the training process employs supervised learning and the Adam optimizer algorithm. This optimizer can adaptively adjust the learning rate, resulting in fast convergence and good stability in most cases. The initial learning rate is set to 0.001, and a cosine annealing strategy is used to gradually decay the learning rate during training, helping the model to more precisely approximate the optimal solution in later stages. The batch size is set to 64 based on the hardware memory capacity, meaning that 64 samples are processed simultaneously in each iteration to calculate the average loss and backpropagate to update the parameters. The training set samples are randomly shuffled before each iteration to enhance the model's generalization ability.
[0058] Step S220: Input the training samples into the neural network model group for training, adaptively weight the multi-channel time-frequency feature map based on the anesthesia depth index, fuse the morphological feature map of the ECG denoised signal with the weighted multi-channel time-frequency feature map to obtain a compact feature vector, input it into the classification head to output the predicted heart rhythm type, and construct an anesthesia-related abnormal ECG detection model.
[0059] In this embodiment, the neural network model group is the neural network component corresponding to the formula involved in step S220. The calculation process of the compact feature vector includes: mapping the anesthesia depth index to a modal weight vector through a multilayer perceptron; adaptively weighting the multi-channel time-frequency feature map according to the diagonal matrix of the modal weight vector to obtain a weighted multi-channel time-frequency feature map; then, extracting the morphological features of the ECG denoised signal through a projection convolutional network and outer productting and broadcasting them to form a morphological feature map. Finally, after adding the weighted multi-channel time-frequency feature map and the morphological feature map to form an enhanced feature matrix, multi-scale spatiotemporal feature extraction and global context encoding are performed to obtain the compact feature vector.
[0060] The formula for calculating the enhanced feature matrix is as follows:
[0061]
[0062] in, This represents the enhanced feature matrix, with dimension . This is understandable; it enhances the feature matrix by fusing the anesthesia depth index with the denoised ECG signal. Its morphological characteristics. This represents a diagonal matrix operator with diagonal elements of the input vector; Represents the time-frequency characteristic map of multiple channels; The modal weight vector is obtained by mapping the anesthesia depth index using a multilayer perceptron, and has a dimension of [missing information]. Each element corresponds to a modality weight, which is used to adjust the importance of that modality in the fusion. The multilayer perceptron contains a hidden layer with 16 hidden units, and the output layer uses the Sigmoid activation function to constrain the weights between 0 and 1. The diagonal matrix representing the modal weight vector; This represents the element-wise addition operator; This represents a one-dimensional convolutional projection network, consisting of two convolutional layers with a kernel size of 3 and a stride of 1, and an output channel of 1, used to denoise ECG signals. (length is) Mapped to morphological features of the same length The output shape is ; This represents the outer product operator, which multiplies the left-hand vector by the right-hand vector to obtain a matrix; Indicates length is A column vector of all 1s, used to broadcast and copy the projection result as... The matrix, i.e. This is a morphological feature diagram.
[0063] It is understandable that the ability of each intrinsic mode function (i.e., each modal ECG component) to represent abnormalities varies at different depths of anesthesia. In this embodiment, after mapping the anesthesia depth index to a modal weight vector using a multilayer perceptron, the multichannel time-frequency feature map is adaptively weighted according to the diagonal matrix of the modal weight vector to obtain a weighted multichannel time-frequency feature map, which can improve the ability to represent abnormalities.
[0064] In this embodiment, the method for performing multi-scale spatiotemporal feature extraction and global context encoding to obtain a compact feature vector includes: applying multiple parallel dilated convolutions along the time axis to the enhanced feature matrix to extract local patterns in different receptive fields, resulting in different local feature maps. Then, the different local feature maps are concatenated along the channel dimension, fed into a bidirectional gated recurrent unit to learn long-range dependencies, and finally subjected to global average pooling and linear mapping to obtain a compact feature vector.
[0065] Specifically, the formula for calculating the compact feature vector is as follows:
[0066]
[0067] in, Represents a compact feature vector with dimension . Compact feature vectors are used to integrate multi-scale time-frequency patterns and global temporal dependencies; This represents a bidirectional gated cyclic cell network with the number of hidden units being... Output the forward and backward hidden states at each time step, and take the concatenation result of the last time step to obtain... dimensional vector; This represents concatenating the outputs of each dilated convolution along the channel dimension; Represents the set of void ratios, with values ranging from 1 to 2. This is used to achieve multi-scale receptive fields; Indicates the void ratio A one-dimensional convolution operation with a kernel size of 3 and padding of 1. To ensure the duration remains constant, the number of output channels is [number missing]. Each dilated convolution independently extracts local patterns. Representing different local feature maps; This represents the enhanced feature matrix, with dimension . ; Represents a set The number of elements, with a value of 3; This indicates the number of output channels for dilated convolutions, with an example value of 32; bidirectional gated recurrent unit network. Number of hidden units The example value is 64, then This represents the weight matrix of the linear layer, with dimension 1. Mapping the output of a bidirectional gated recurrent unit network to the feature dimension ; This represents the bias vector of the linear layer, with dimension . ; This represents the dimension of the compact feature vector, with an example value of 128. This indicates taking the hidden state at the last time step.
[0068] In this embodiment, the specific method by which the input classification head (which includes a fully connected linear layer and a Softmax function) outputs a predicted heart rhythm type is as follows:
[0069] First, compact feature vectors After passing through a fully connected linear layer, this layer contains a dimension of Trainable classification layer weight matrix and dimension are Trainable classification layer bias vectors ,in This represents the total number of heart rhythm categories, with a value of 5. After linear transformation, the category score vector is obtained. , dimension ;
[0070] Then, the category score vector Apply the Softmax function element by element, i.e. , class score vector Convert to category probability values, ensuring the sum of all category probabilities is 1. Each category probability value indicates the corresponding predicted heart rhythm type, such as... At that time, the five category probability values indicate normal sinus rhythm, premature ventricular contractions, atrial fibrillation, ventricular tachycardia, and other abnormalities, respectively. Category probability values The neural network model group predicts that the training sample belongs to the first... The confidence level of the class, where, This represents the summation index across all categories. This represents the category score vector of the j-th class; that is, the formula indicates that the currently calculated category score vector... After obtaining the natural index, divide the natural index by the sum of the natural indices of all C category score vectors.
[0071] Understandably, steps S210 to S220 are repeated until the early termination mechanism is met, at which point the neural network model group completes training and constructs an anesthesia-related abnormal electrocardiogram detection model.
[0072] The early stopping mechanism works as follows: 1. A patience value of 10 is set. If the validation set loss function value does not decrease to its historical lowest level within 10 consecutive epochs (each epoch executing steps S210 to S220), the model is considered to have converged or begun to overfit. Training is immediately stopped, and the model parameters are rolled back to the state corresponding to the epoch with the lowest validation set loss. 2. The maximum number of training epochs is set to 100. This prevents indefinite waiting due to validation set fluctuations. The early stopping mechanism effectively saves computational resources and ensures the model has good generalization performance.
[0073] After each training cycle, the neural network model is evaluated using a validation set, and the loss function value and classification accuracy on the validation set are calculated. The validation set is not involved in parameter updates; it is only used to monitor whether the model is overfitting. An early stopping mechanism can be used to determine when to stop training.
[0074] Understandably, in related technologies, the detection of ECG abnormalities during anesthesia needs to consider both the time-frequency characteristics of the ECG signal and the patient's physiological state. Conventional methods are based solely on ECG waveforms and do not utilize clinical parameters such as anesthesia depth, making it difficult to adapt to the impact of changes in anesthesia state on the representation of ECG abnormalities. The technical solution provided in this application uses the anesthesia depth index as one of the sample features and adaptively weights the multi-channel time-frequency feature maps extracted from the denoised ECG signal. This allows the abnormal ECG detection model to focus more on the time-frequency characteristics most relevant to the patient's current physiological state when fusing them into a compact feature vector for the input classification head, thus adapting to the impact of changes in anesthesia state on the representation of ECG abnormalities and enhancing the model's on-site adaptability.
[0075] In some embodiments, the detection method further includes the following steps:
[0076] Step S310: Dynamically adjust the class weights and focusing parameters of the loss function applied to the neural network model group based on the anesthesia depth index.
[0077] In this embodiment, the calculation process of category weight is as follows: for each category of the labeled heart rhythm type, the category weight is calculated by combining the first absolute difference between the preset abnormal anesthesia depth reference value and the anesthesia depth index, the reciprocal of the training sample frequency corresponding to the category, and the preset decay factor.
[0078] Specifically, the formula for calculating category weights is as follows:
[0079]
[0080] in, This represents the class weights that depend on the depth of anesthesia, used to adjust the contribution of different classes to the loss. Represents the base class weight, based on the weight of the training set. The reciprocal of the training sample frequency is set to alleviate class imbalance; The anesthesia depth index is obtained in real time by a bispectral EEG monitor, and the value ranges from 0 to 100. The smaller the value, the deeper the anesthesia. This represents the attenuation factor, which controls the degree to which the depth of anesthesia deviates from the reference value. An example value is 0.1. Indicates the first The reference values for the depth of anesthesia most commonly associated with abnormalities are predefined by clinical statistics or expert knowledge. For example, the reference value for the normal class is 70, and the reference value for premature ventricular contractions is 40.
[0081] In this embodiment, the calculation process of the focusing parameters is as follows: for each category of the labeled heart rhythm type, the second absolute difference between the preset reference anesthesia depth and the anesthesia depth index is calculated, the second absolute difference is normalized and multiplied by the preset adjustment amplitude, and the multiplication result is added to the preset basic focusing parameters to obtain the focusing parameters.
[0082] Specifically, the formula for calculating the focusing parameter is as follows:
[0083]
[0084] in, This represents a focusing parameter that depends on the depth of anesthesia and is used to adjust the model's attention to training samples of varying difficulty. This represents the basic focusing parameter, with a preferred value of 2. This indicates the adjustment range, controlling the intensity of the change in the focusing parameter with the depth of anesthesia. An example value is 1. This represents the Sigmoid function, which maps the input to a range of 0 to 1. This represents the reference depth of anesthesia, a threshold used to distinguish between deep and superficial anesthesia; an example value is 60.
[0085] S320: For each category of the labeled heart rhythm type, calculate the complement value of the predicted heart rhythm type output by the neural network model group, take the focus parameter as the target number, perform a power operation on the complement value of the target number, and calculate the natural logarithm of the predicted heart rhythm type. Multiply the category weight, the result of the power operation, and the natural logarithm, and then multiply it with the labeled heart rhythm type to obtain the single-class loss for each category.
[0086] S330: Summate the single-class losses of all categories, take the negative of the sum to obtain the adaptive weighted focus loss value, and optimize the trainable parameters of the neural network model group based on the adaptive weighted focus loss value.
[0087] Specifically, the formula for calculating the adaptive weighted focus loss value (i.e., the loss function) is as follows:
[0088]
[0089] In the formula, The loss function is an adaptive weighted focus loss value for anesthesia state perception, used to optimize the trainable parameters of the model and improve attention to high-risk and hard-to-classify samples. This represents the total number of abnormal categories, including normal and various arrhythmias. An example value is 5. This represents the category index, with a value range of 100. ; The first character representing the true label (i.e., the labeled heart rate type) If the training sample belongs to the first category If the class is a given type, the value is 1; otherwise, it is 0. The output of the neural network model group represents the first... The probability value (i.e. the predicted heart rhythm type) is obtained from the Softmax layer.
[0090] Understandably, abnormal ECG samples during anesthesia are scarce and closely related to the depth of anesthesia. Conventional cross-entropy loss is insufficient to handle class imbalance and ignores the differences in clinical risk of abnormalities under different anesthesia states. This embodiment proposes a weighted focus loss function for anesthesia depth perception, which dynamically adjusts the class weights and focus parameters based on the anesthesia depth index of the training samples, enabling the model to focus on high-risk and difficult-to-classify samples.
[0091] Understandably, in this embodiment, based on the denoised ECG signal and multi-channel feature map, an anesthesia depth index is introduced to design a multimodal deep learning model (i.e., an anesthesia-related abnormal ECG detection model). Modal information is fused through an attention mechanism, and global dependencies are extracted using spatiotemporal convolution and recurrent neural networks. An adaptive loss function for anesthesia state perception is also adopted to improve the accuracy and clinical relevance of abnormal detection.
[0092] like Figure 2 As shown, Figure 2 The diagram illustrates the results of applying steps S220 and S310 to S330. Step S220 maps the anesthesia depth index to a modal weight vector using a multilayer perceptron. The multi-channel time-frequency feature map is adaptively weighted based on the diagonal matrix of the modal weight vector, resulting in a weighted multi-channel time-frequency feature map (i.e., using an anesthesia depth-modulated modal attention mechanism). Steps S310 to S330 dynamically adjust the class weights and focusing parameters of the abnormal ECG detection model's loss function using the anesthesia depth index. The diagram shows the weight changes of the eight modalities as the anesthesia depth index changes from 0 to 100. It can be seen that the peak values of the modal weight vectors for different modalities appear in different anesthesia depth index ranges. The distribution of the modal weight vectors demonstrates that the anesthesia depth-modulated modal attention mechanism can dynamically adjust the importance of each modality according to the real-time anesthesia depth, enabling the model to focus more on the frequency band information most relevant to the current physiological state when fusing features. The changes in the weight curves visually verify the effective modulation effect of the anesthesia depth index on modality selection, reflecting the innovation of this application in enhancing the clinical adaptability of the model using multimodal data. The horizontal axis in the figure represents the anesthesia depth index, which ranges from 0 to 100. The smaller the value, the deeper the anesthesia. The vertical axis represents the weight values of the modal weight vector, which are dimensionless. The sum of the weights of each modality at the same anesthesia depth is 1.
[0093] Please see Figure 3 In some embodiments, before obtaining training samples from the training set, the method further includes:
[0094] S110: Acquire raw electrocardiogram signals and anesthesia depth index synchronized with the patient's anesthesia during the surgical procedure.
[0095] Specifically, data acquisition took place in the operating rooms of multiple collaborating hospitals. All participating patients were elective surgeries undergoing general anesthesia, and all had signed informed consent forms before surgery. The research protocol was approved by the ethics committees of each hospital. The acquisition equipment used a medical-grade single-lead ECG acquisition module, which continuously records raw ECG signals at a sampling frequency of 500 Hz, accurately capturing high-frequency details in the ECG waveform. Simultaneously, the patient's anesthesia depth index was recorded using a bispectral EEG monitor. This index is a commonly used clinical quantitative indicator of anesthesia depth, ranging from 0 to 100, with lower values indicating deeper anesthesia. The raw ECG signals and the anesthesia depth index were synchronized using the same time reference, ensuring that each raw ECG corresponds to a real-time anesthesia depth index, providing a foundation for subsequent multimodal fusion.
[0096] During the surgery, raw electrocardiogram (ECG) signals were recorded from the moment the patient entered the operating room until they left, covering different stages such as anesthesia induction, maintenance, and recovery. Anesthesiologists used propofol, remifentanil, and other drugs to maintain anesthesia according to clinical practice, adjusting the administration rate based on the intensity of surgical stimulation and the patient's vital signs. This ensured that the collected data naturally encompassed ECG changes at different depths of anesthesia.
[0097] S120: Remove invalid segments from the original ECG signal, perform non-overlapping segmentation using a preset time window, and obtain a set of ECG signal segments.
[0098] Specifically, the raw electrocardiogram (ECG) signal is first preprocessed for quality control to remove invalid segments caused by electrode detachment, equipment interference, etc. Then, it is segmented into non-overlapping segments with a preset window length of 2.5 seconds. Each window contains 1250 sampling points to obtain a set of ECG signal segments. The reason for choosing a 2.5-second window is that this duration usually contains 2 to 3 complete heartbeats, which can reflect the typical characteristics of arrhythmia without introducing too many non-stationary changes due to an excessively long window, while also taking into account the delay requirements of real-time detection.
[0099] Step S130: For each ECG signal segment in the ECG signal segment set, perform adaptive morphological filtering and energy adaptive wavelet thresholding to obtain a denoised ECG signal, and extract multi-channel time-frequency feature maps from the denoised ECG signal.
[0100] Understandably, raw ECG signals acquired during anesthesia often contain baseline drift, power line interference, and electromyographic noise. Furthermore, due to the influence of anesthetic drugs, the signals exhibit non-stationarity and morphological diversity. Conventional bandpass filters struggle to effectively remove noise overlapping with the QRS complex spectrum, while wavelet threshold denoising, with its fixed threshold setting, can easily lead to over-smoothing or insufficient denoising. In this embodiment, adaptive morphological filtering is used to eliminate baseline drift and impulse noise, and then energy-adaptive stationary wavelet threshold denoising is used to suppress high-frequency noise, maximizing the signal-to-noise ratio while preserving the waveform morphology.
[0101] In this embodiment, the method of obtaining a denoised ECG signal by performing adaptive morphological filtering and energy-adaptive wavelet thresholding combined for each ECG signal segment in the ECG signal segment set includes the following steps S131 to S135:
[0102] Step S131: For each ECG signal segment in the ECG signal segment set, extract the sample sequence of the ECG signal segment.
[0103] Step S132: The local slope at each discrete-time index in the sample sequence is approximated using the central difference method. The local slope is normalized, and the adaptive structuring element length of the sample sequence is determined based on the normalized local slope.
[0104] Specifically, the central difference method is used for approximate calculation, for ,have , This represents the discrete-time index, with units of sampling point numbers, and a value range of [value range missing]. , The total number of sampling points for each sample is 1250; for the boundary... Using forward difference ,for Backward difference is used ; Indicates the index in discrete time The local slope at a given point reflects the degree of drastic change in the sample sequence at that moment. Indicates the discrete-time index of the sample sequence The amplitude at that point; Represents the local slope at all times. Find the minimum value, and iterate through all local slopes. Sure; Represents the local slope at all times. The maximum value, traversing all local slopes Sure.
[0105] Next, through The local slope is normalized to obtain the normalized local slope. , that is Indicates the index in discrete time The normalized local slope at point , with a range of values of This maps the local slope to a uniform scale.
[0106] Finally, through Calculate the index in discrete time Adaptive structuring element length at the location The unit is the number of sampling points, which is dynamically adjusted based on the normalized local slope; among which, This indicates the minimum structuring element length, used to preserve details where the signal is steep; an example value is 3. This represents the maximum length of the structuring element, used to smooth the baseline in flat segments; an example value is 11. This represents the floor operation, ensuring that the length of the structure element is an integer.
[0107] As is understandable, morphological filtering smooths signals by combining erosion and dilation operations on structuring elements. Conventional methods use fixed-length structuring elements, which cannot adapt to local slope changes in ECG waveforms and are prone to morphological distortion at steep QRS complexes. In this embodiment, the length of the adaptive structuring element is dynamically adjusted based on the local slope. This ensures that the length is small when the local slope is large and large when the local slope is small, thus achieving adaptive filtering.
[0108] Step S133: Perform morphological opening and closing operations on the sample sequence based on the adaptive structuring element length, and obtain the morphological opening and closing operation results respectively. Take the average value of the opening and closing operation results as the morphological filtering output signal.
[0109] Specifically, firstly, based on the adaptive structuring element length Determine the index in discrete time Flat structural elements used at the location flat structural elements The shape is based on the current time. The straight line segment centered at the center has a length of All elements have a value of 0 and are used to define the neighborhood range in morphological operations. This represents the discrete-time index, with units of sampling point numbers, and a value range of [value range missing]. ,in The total number of sampling points for each sample is 1250.
[0110] Next, through Perform morphological opening operations to calculate the discrete-time index. Morphological opening operation result at the location , Represents a sample sequence with a length of The data were acquired by an ECG acquisition device at a sampling frequency of 500Hz, with each sample containing 1250 sampling points, covering 2.5 seconds of ECG signal. This means the sample sequence... First perform erosion calculation, then perform dilation calculation, and then... The value at that location.
[0111] pass Perform morphological closing operations to calculate the discrete-time index. Morphological closing operation result at the location .
[0112] It is understandable that the above morphological opening and closing operations are based on the general erosion formula. , This represents the morphological erosion operator. For input signal, As a structural element, The offset within the structuring element is used to calculate the minimum signal value within the neighborhood covered by the structuring element. The general expansion formula is as follows: , This represents the morphological dilation operator, whose result is constructed by taking the maximum value of the signal within the neighborhood covered by the structuring element.
[0113] Finally, through The average value of the opening and closing operations is used to calculate the morphological filter output signal. Where, in the formula, Indicates the index in discrete time The morphological filter output value at that point is the signal amplitude after adaptive morphological filtering, which has removed baseline drift and some electromyographic noise.
[0114] Step S134: Perform morphological filtering on the output signal Layer-level stationary wavelet decomposition yields approximation coefficients and detail coefficients for each layer.
[0115] Step S135: Estimate the noise standard deviation of each layer based on the detail coefficients of each layer, and calculate the energy proportion of each layer detail coefficient. Adaptively calculate the threshold of each layer based on the energy proportion and the noise standard deviation of each layer. Combine the thresholds of each layer and use a soft thresholding function to shrink the detail coefficients of each layer. Combine the shrunken detail coefficients of each layer with the approximate coefficients and reconstruct the ECG denoised signal through inverse stationary wavelet transform.
[0116] It is understandable that conventional wavelet thresholding denoising uses a universal threshold, which is based only on the noise variance and does not consider the energy distribution of each frequency band of the signal, easily leading to excessive suppression of high-frequency details. In this embodiment, a stationary wavelet transform is used to decompose the signal, and the threshold is adaptively adjusted according to the energy proportion of the detail coefficients at each level.
[0117] Understandably, the method of combining adaptive morphological filtering and energy-adaptive wavelet thresholding for denoising dynamically adjusts the length of the morphological filtering structuring element based on the local signal slope, preserving the steep shape of the QRS wave while smoothing the baseline. At the same time, the threshold is adaptively calculated based on the energy proportion of the wavelet coefficients at each layer, avoiding excessive suppression of high-frequency details.
[0118] Specifically, through The morphological filtering output signal is transformed and reconstructed to obtain the ECG denoised signal.
[0119] in, This represents the denoised ECG signal, with a length of [length missing]. The output is the result after energy adaptive stationary wavelet threshold denoising.
[0120] This represents the inverse stationary wavelet transform operator, which reconstructs the wavelet coefficients into a time-domain signal;
[0121] Indicates the first The layer approximation coefficients are obtained from stationary wavelet decomposition, with a length N of 1250.
[0122] This indicates the wavelet decomposition level, with a value of 5.
[0123] Indicates the first The detail factor of the layer after soft thresholding .
[0124] In practical implementation, Indicates the first The detail coefficients of the layer after soft thresholding, for the th Layers, original detail coefficients The thresholding process is as follows, obtained through stationary wavelet decomposition:
[0125] a) First estimate the first Layer noise standard deviation The calculation method is expressed as ,in For the first The set of all detail coefficients of a layer. For absolute values, It is a median function. is the proportionality constant between the standard deviation and the median of the Gaussian distribution;
[0126] b) Then calculate the first Energy percentage of layer detail factor The calculation method is expressed as ,in For coefficient index, For the first Layer Detail coefficients;
[0127] c) Adaptive calculation of the first based on energy proportion Layer threshold The calculation method is expressed as ,in For the first The number of layer detail coefficients in stationary wavelet transform The value is 1250. This is an energy regulation factor that controls the sensitivity of the threshold to the energy ratio; an empirical value of 5 is used.
[0128] d) The detail coefficients are shrunk using a soft thresholding function to obtain... ,in This is a sign function that returns the sign of the coefficient. This indicates taking the maximum value;
[0129] Among them, the approximation coefficient The process remains unchanged, and the stationary wavelet transform uses the sym4 wavelet basis, with a decomposition level of [number missing]. .
[0130] like Figure 4 As shown, this experiment verifies the preprocessing effect of a combined adaptive morphological filtering and energy-adaptive wavelet thresholding method on anesthesia ECG signals. The experiment used simulated noisy ECG signals, sampled at 500 Hz for two and a half seconds, containing typical interference components such as baseline drift, power line interference, and electromyographic noise. The figure shows, from top to bottom, the original noisy signal, the signal after adaptive morphological filtering, and the signal after energy-adaptive wavelet thresholding (i.e., the denoised ECG signal). The original signal waveform is chaotic, and the QRS complex is difficult to identify due to noise. Adaptive morphological filtering effectively removes baseline drift and some impulse noise by dynamically adjusting the length of the structuring element, allowing the QRS morphology to initially appear, but high-frequency electromyographic noise still exists. Finally, after energy-adaptive wavelet thresholding, the signal becomes smooth and clear, and characteristic waveforms such as the P wave, QRS wave, and T wave are completely preserved without significant distortion. The horizontal axis in the figure represents time in seconds, covering the entire analysis window; the vertical axis represents amplitude in millivolts, reflecting the voltage intensity of the ECG signal.
[0131] In this embodiment, the specific method for extracting multi-channel time-frequency feature maps from the ECG denoised signal includes the following steps S136 and S137.
[0132] Step S136: Use variational mode decomposition combined with adaptive parameter optimization to decompose the ECG denoised signal into multimodal ECG components.
[0133] Understandably, anesthesia-induced ECG abnormalities often manifest as waveform changes in specific frequency bands. For example, premature ventricular contractions (PVCs) present as low-frequency, wide QRS waves, and atrial fibrillation presents as baseline oscillations and RR interval irregularities. Conventional Fourier transforms lack time-frequency localization capabilities, and wavelet transforms require preset basis functions and have fixed decomposition scales. In contrast, this embodiment employs variational mode decomposition combined with adaptive parameter optimization to decompose the denoised ECG signal into multimodal ECG components. This eliminates the need for preset basis functions, and the decomposition scale adapts to change automatically.
[0134] Specifically, with the goal of minimizing the difference between the sum of multimodal ECG components and the ECG denoised signal, as well as the weighted sum of the number of modes, a grid search is performed within a preset range of the number of modes and a preset range of bandwidth penalty factors to find the optimal number of modes and bandwidth penalty factor that meet the objectives, and these are determined as the target number of modes and the target bandwidth penalty factor.
[0135] For example, the expression for the objective (i.e., the objective function) is:
[0136] ,in, Indicates time, This represents the ECG noise-reduced signal. Indicates the number of modes, and the range of the number of modes. , Indicates the first The eigenmode function, i.e. the th intrinsic mode function The modal ECG components are the modal components to be solved. This represents the bandwidth penalty factor, and the range of the bandwidth penalty factor. , The penalty coefficient, balancing decomposition accuracy and the number of modes, is empirically set to 0.01. When the objective is minimized, the number of objective modes is obtained. Penalty factor for target bandwidth .
[0137] Next, the ECG denoised signal, the number of target modes, and the penalty factor for the target bandwidth are substituted into the constrained variational problem formula of variational mode decomposition, and the multimodal ECG components are obtained by iterative solution using the alternating direction multiplier method.
[0138] For example, the constrained variational problem formula for variational mode decomposition is as follows:
[0139]
[0140] in, This represents all possible multimodal ECG components. and its center frequency ( Indicates the first Find the minimum value at the center frequencies of each mode, such that the objective function is minimized while satisfying the constraints. That is, the sum of all modal ECG components equals the ECG denoised signal; Indicates time Find the partial derivative. Represents the Dirac function, Represents the imaginary unit. This represents the convolution operator; The Hilbert transform kernel is constructed for analytic signals; This is a frequency shift factor used to shift the modal spectrum of the electrocardiogram component to the baseband. express The square of the norm.
[0141] The variational problem above is solved iteratively using the alternating direction multiplier method to obtain the ECG components of each mode. and the corresponding center frequency To unify the input dimensions of subsequent networks, the maximum number of modes is fixed. ,like Then, zeros are padded to the missing modal ECG components, resulting in a dimension of The multimodal ECG components are matrices. The format is such that each row corresponds to a modal ECG component sequence. This represents the total number of sampling points for each multimodal ECG component, with a value of 1250.
[0142] Furthermore, the spectrum can be obtained by first performing a Fourier transform on the denoised ECG signal. The number of main frequency components in the spectrum can be detected by peak detection. The number of frequency components can be used as the initial value of the number of modes. This initial value is the starting value for grid search, so as to further narrow the search range within the range of the number of modes.
[0143] Step S137: Extract the multimodal instantaneous amplitude of the multimodal ECG component through Hilbert transform, arrange the multimodal instantaneous amplitude in rows to form a multi-channel time-frequency feature map.
[0144] Specifically, based on each modal electrocardiogram component Hilbert transform kernel in For each modal electrocardiogram component Perform the Hilbert transform to obtain the analytic signal. Then, the modulus of the analytic signal is taken to obtain the instantaneous amplitude of each modulus. In step S220, the weighting object of the diagonal matrix of the modal weight vector is specifically the instantaneous amplitude of each mode. Then, the instantaneous amplitude of each mode is calculated. As features, they constitute a multi-channel time-frequency feature map.
[0145] In the formula, This represents a multi-channel time-frequency feature map, which is of size [missing information]. The matrix, with each row corresponding to the instantaneous amplitude sequence of a mode, represents the time-frequency characteristics of the fused signal and can effectively distinguish the frequency band patterns of different arrhythmias.
[0146] This represents the modal index, with a value range of 100. ;
[0147] This represents a discrete-time index, with a value range of [value range missing]. ;
[0148] Indicates the first The modality at time... The instantaneous amplitude sequence reflects the energy intensity of this mode, and is calculated as follows: ;
[0149] Indicates the first An analytic signal with one modality is in complex form and is defined as follows: ;
[0150] The Hilbert transform is defined as follows: ,in The integral variable is used to construct the analytic signal, based on the Hilbert transform kernel. imaginary part It is constructed.
[0151] Please see Figure 5 , Figure 5 This diagram illustrates the results of the multi-channel time-frequency feature extraction method applied in this embodiment. The figure shows the time-varying curves of the instantaneous amplitude sequences of the first four modes. Mode 1 exhibits slow and low-frequency changes in its instantaneous amplitude sequence, primarily corresponding to baseline or respiratory-related components. Mode 2 displays periodic peaks with large amplitudes, and its frequency matches the dominant frequency of the QRS complex, highlighting the ventricular depolarization process. Mode 3 has smaller amplitudes and higher frequencies, potentially containing detailed information about P or T waves. Mode 4 exhibits random fluctuations, representing residual noise. These instantaneous amplitude sequences from different frequency bands characterize the time-varying properties of the ECG denoised signal, providing rich discriminative information for distinguishing abnormal types such as normal sinus rhythm, premature ventricular contractions, and atrial fibrillation. The results show that adaptive variational mode decomposition can automatically optimize the number of modes and bandwidth based on the signal spectral characteristics, avoiding mode aliasing or information redundancy caused by a fixed decomposition scale, thereby extracting a time-frequency representation with clear physiological significance. The horizontal axis in the graph represents time, in seconds; the vertical axis represents instantaneous amplitude, in millivolts. The amplitude of each mode reflects the energy strength of the component in that frequency band.
[0152] Step S140: Label the heart rhythm type of the feature group formed by the ECG denoised signal, multi-channel time-frequency feature map and anesthesia depth index to obtain the dataset, and divide it into training sets.
[0153] Specifically, at least two clinical experts with more than five years of experience in interpreting electrocardiograms were invited to independently label the heart rhythm type for each feature group to form a dataset. The categories were set into five classes based on common and clinically significant labeled heart rhythm types during anesthesia. :The first category is normal sinus rhythm, characterized by normal waveform morphology, regular rhythm, and a heart rate between 60 and 100 beats per minute. The second category is premature ventricular contractions (PVCs), characterized by premature, wide, and abnormal QRS complexes, often exceeding 120 milliseconds in duration, usually followed by a complete compensatory pause. The third category is atrial fibrillation, characterized by the disappearance of P waves replaced by irregular fibrillation waves, with absolutely irregular RR intervals. The fourth category is ventricular tachycardia, referring to three or more consecutive PVCs, with a ventricular rate typically exceeding 100 beats per minute. The fifth category is other abnormalities, including but not limited to atrial PVCs, supraventricular tachycardia, sinus bradycardia, sinus tachycardia, atrioventricular block, and other uncommon or difficult-to-classify abnormal waveforms. For samples with inconsistent labeling by two experts, a third, higher-level expert arbitrates to reach a consensus. During the annotation process, experts can refer to the anesthesia depth index and patient clinical information recorded simultaneously, but the final judgment is based solely on the electrocardiogram waveform to ensure the objectivity and repeatability of the annotation.
[0154] After obtaining the dataset, it was divided according to the patient dimension to ensure that all samples from the same patient appeared in only one subset of the training, validation, or test sets, avoiding data leakage that could lead to inflated performance. The dataset was allocated in an approximately 8:1:1 ratio, ensuring the training set contained enough samples to learn rich features, the validation set was used for model hyperparameter tuning and early arrest detection, and the test set was reserved for final performance evaluation. The final training dataset contained tens of thousands to hundreds of thousands of labeled samples, covering different depths of anesthesia, different ages, different genders, and various types of arrhythmias.
[0155] In some embodiments, the detection method further includes: acquiring the current ECG denoised signal, the current multi-channel time-frequency feature map, and the current anesthesia depth index; inputting the probability value of the patient's current heart rhythm type into the output of the abnormal ECG detection model; and determining the category with the highest probability value as the patient's current heart rhythm type.
[0156] Specifically, the preprocessing of the raw data corresponding to the input data of the abnormal ECG detection model is described in steps S110 to S130, and will not be repeated here. The prediction process of the abnormal ECG detection model is consistent with the forward propagation of the model training process (i.e., the relevant steps in step S220), and will not be repeated here.
[0157] Decision-making based on the output probability values includes selecting the category with the highest probability value as the prediction result for the current sample. To reduce false alarms, a threshold can be set; for example, only when the maximum probability of a category exceeds 0.8 is it considered abnormal and an alarm triggered; otherwise, it is considered normal or suspicious, and only the probability value is recorded for later review. The detection results are displayed on the monitoring screen in real time. Once high-risk abnormalities such as ventricular tachycardia are detected, the system immediately issues an audible and visual alarm to remind the anesthesiologist to intervene in a timely manner. At the same time, the system automatically saves the time, type, related waveforms, and the anesthesia depth index at that time to the database for postoperative review and analysis. Through this continuous and real-time monitoring method, this application can efficiently identify various electrocardiographic abnormalities during anesthesia, providing strong protection for patient safety.
[0158] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0159] Finally, it should be noted that the above 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 or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting anesthesia-related abnormal electrocardiogram signals based on deep learning, characterized in that the method... include: Acquire training samples from the training set, which include the preprocessed denoised ECG signal obtained during the patient's anesthesia procedure, the multi-channel time-frequency feature map extracted from the denoised ECG signal, the anesthesia depth index synchronized with the time of the denoised ECG signal, and the corresponding labeled heart rhythm type. The training samples are input into the neural network model group for training. The multi-channel time-frequency feature map is adaptively weighted based on the anesthesia depth index. After fusing the morphological feature map of the ECG denoised signal with the weighted multi-channel time-frequency feature map to obtain a compact feature vector, it is input into the classification head to output the predicted heart rhythm type. The compact feature vector is used to integrate multi-scale time-frequency patterns and global temporal dependencies. The class weights and focusing parameters of the loss function applied to the neural network model group are dynamically adjusted based on the anesthesia depth index. For each category of the labeled heart rhythm type, the complement value of the predicted heart rhythm type output by the neural network model group is calculated. The focusing parameter is used as the target number, the complement value is raised to the power of the target number, and the natural logarithm of the predicted heart rhythm type is calculated. The category weight, the result of the power operation, and the natural logarithm are multiplied together and then multiplied by the labeled heart rhythm type to obtain the single-class loss for each category. The single-class losses of all categories are summed, and the negative of the sum is taken to obtain the adaptive weighted focus loss value. Based on the adaptive weighted focus loss value, the trainable parameters of the neural network model group are optimized to construct an anesthesia-related abnormal electrocardiogram detection model.
2. The method according to claim 1, characterized in that, The adaptive weighting of multi-channel time-frequency feature maps based on the anesthesia depth index, and the fusion of the morphological feature map of the denoised ECG signal with the weighted multi-channel time-frequency feature map, yields a compact feature vector, including: After mapping the anesthesia depth index to a modal weight vector using a multilayer perceptron, the multi-channel time-frequency feature map is adaptively weighted according to the diagonal matrix of the modal weight vector to obtain the weighted multi-channel time-frequency feature map. The morphological features of the ECG denoised signal are extracted by a projection convolutional network and then externally multiplied and broadcast to form a morphological feature map. After the weighted multi-channel time-frequency feature map and the morphological feature map are combined to form an enhanced feature matrix, multi-scale spatiotemporal feature extraction and global context encoding are performed to obtain a compact feature vector.
3. The method according to claim 2, characterized in that, The process of performing multi-scale spatiotemporal feature extraction and global context encoding to obtain a compact feature vector includes: Multiple parallel dilated convolutions are applied to the enhanced feature matrix along the time axis to extract local patterns in different receptive fields, resulting in different local feature maps. Different local feature maps are concatenated along the channel dimension, fed into a bidirectional gated recurrent unit to learn long-range dependencies, and then subjected to global average pooling and linear mapping to obtain a compact feature vector.
4. The method according to claim 1, characterized in that, The dynamic adjustment of the class weights and focusing parameters of the loss function applied to the neural network model group based on the anesthesia depth index includes: For each category of the labeled heart rhythm type, the category weight is calculated by combining the first absolute difference between the preset abnormal anesthesia depth reference value and the anesthesia depth index, the reciprocal of the training sample frequency corresponding to the category, and a preset decay factor; and Calculate the second absolute difference between the preset reference anesthesia depth and the anesthesia depth index. After normalizing the second absolute difference, multiply it by the preset adjustment range. Add the result of the multiplication to the preset basic focusing parameters to obtain the focusing parameters.
5. The method according to claim 1, characterized in that, Before obtaining the training samples in the training set, the method further includes: Obtain the patient's raw electrocardiogram signals and the anesthesia depth index synchronized with the time during the anesthesia procedure; Invalid segments of the original electrocardiogram (ECG) signal are removed, and non-overlapping segments are performed using a preset time window to obtain a set of ECG signal segments. For each ECG signal segment in the ECG signal segment set, adaptive morphological filtering and energy adaptive wavelet thresholding are combined to denoise the ECG signal, and multi-channel time-frequency feature maps are extracted from the ECG signal. The heart rhythm type is labeled by the feature group formed by the denoised ECG signal, multi-channel time-frequency feature map and anesthesia depth index to obtain the dataset, and the training set is divided.
6. The method according to claim 5, characterized in that, The process of performing adaptive morphological filtering and energy-adaptive wavelet thresholding combined to denoise each ECG signal segment in the ECG signal segment set to obtain a denoised ECG signal includes: For each ECG signal segment in the ECG signal segment set, extract the sample sequence of the ECG signal segment; The local slope at each discrete-time index in the sample sequence is approximated using the central difference method. The local slope is then normalized, and the adaptive structuring element length of the sample sequence is determined based on the normalized local slope. Based on the adaptive structuring element length, morphological opening and closing operations are performed on the sample sequence to obtain the morphological opening and closing operation results respectively. The average value of the opening and closing operation results is taken as the morphological filtering output signal. Perform morphological filtering on the output signal Layer-level stationary wavelet decomposition yields approximation coefficients and detail coefficients for each layer. The noise standard deviation of each layer is estimated based on the detail coefficients of each layer, and the energy proportion of each layer detail coefficient is calculated. The threshold of each layer is adaptively calculated based on the energy proportion and the noise standard deviation of each layer. The detail coefficients of each layer are shrunk by combining the thresholds of each layer and using a soft thresholding function. The ECG denoised signal is reconstructed by combining the shrunk detail coefficients of each layer and the approximation coefficients through inverse stationary wavelet transform.
7. The method according to claim 5, characterized in that, The extraction of multi-channel time-frequency feature maps from the ECG denoised signal includes: Variational mode decomposition combined with adaptive parameter optimization is used to decompose the ECG denoised signal into multimodal ECG components; The multimodal instantaneous amplitude values of the multimodal electrocardiogram components are extracted by Hilbert transform, and the multimodal instantaneous amplitude values are arranged in rows to form a multi-channel time-frequency feature map.
8. The method according to claim 7, characterized in that, The method employs variational mode decomposition combined with adaptive parameter optimization to decompose the ECG denoised signal into multimodal ECG components, including: With the goal of minimizing the difference between the sum of multimodal ECG components and the ECG denoised signal, as well as the weighted sum of the number of modes, a grid search is performed within a preset range of the number of modes and a preset range of bandwidth penalty factors to find the optimal number of modes and bandwidth penalty factor that satisfy the goal, and these are determined as the target number of modes and the target bandwidth penalty factor. By substituting the ECG denoised signal, the number of target modes, and the penalty factor for the target bandwidth into the constrained variational problem formula of variational mode decomposition, and solving iteratively using the alternating direction multiplier method, the multimodal ECG components are obtained.
9. The method according to claim 1, characterized in that, The labeled heart rhythm types include normal sinus rhythm, premature ventricular contractions, atrial fibrillation, ventricular tachycardia, and other abnormalities.