Disclosure of Invention
In view of this, embodiments of the present application provide an atrial fibrillation detection method, apparatus, and device to solve the problem in the prior art that the accuracy is usually hard to meet the requirement due to the limitation of the information amount of the method of heart rate variability.
A first aspect of an embodiment of the present application provides an atrial fibrillation detection method, including:
extracting heartbeat waveforms related to RR intervals;
performing continuous wavelet transformation on the heartbeat waveform, and reconstructing a time-frequency spectrum tensor of the heartbeat waveform;
and (3) performing feature learning and classification on the time-frequency spectrum system structure of the heartbeat waveform through the trained deep convolution neural network to obtain the detection result of the heartbeat waveform.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the step of extracting a heartbeat waveform related to an RR interval includes:
detecting an R wave crest in the electrocardiosignals by a Panthompus Pan-Tompkins algorithm;
and intercepting a heartbeat waveform list according to the wave peak position of the R wave.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, in the step of truncating the heartbeat waveform list according to the R-wave peak position, for the first aspecti heartbeats, the start position of the waveform (S)i) And a termination position (E)i) The calculation formula of (a) is as follows:
ri represents the position (sampling point) of the ith R wave crest detected in the signal, the value range of i is 2-N-1, and N is the total number of the detected R wave crests.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the step of performing continuous wavelet transform on the heartbeat waveform and reconstructing a time-frequency spectrum tensor of the heartbeat waveform includes:
using the formula of continuous wavelet transform
Obtaining a two-dimensional time frequency spectrum of each heartbeat waveform, wherein a and b are a scale factor and a translation factor respectively, f (t) is an output signal, and psi is a wavelet basis function;
scaling the obtained time-frequency spectrum to a uniform size;
and sequentially superposing time frequency spectrums of a plurality of continuous heartbeat waveforms into a three-dimensional tensor, wherein three dimensions of the three-dimensional tensor are frequency, time and heartbeat sequences in sequence.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, before the step of extracting a heartbeat waveform related to an RR interval, the method further includes:
smoothing the signals by using a moving average method to remove baseline drift signals in the electrocardiosignals;
and removing noise in the electrocardiosignals by using a soft threshold wavelet denoising method.
A second aspect of the embodiments of the present application provides an atrial fibrillation detection apparatus, which includes:
a heartbeat waveform extracting unit, which is used for extracting heartbeat waveforms related to RR intervals;
the time-frequency spectrum tensor reconstruction unit is used for carrying out continuous wavelet transformation on the heartbeat waveform and reconstructing the time-frequency spectrum tensor of the heartbeat waveform;
and the learning classification unit is used for performing characteristic learning and classification on the time-frequency spectrum system structure of the heartbeat waveform through the trained deep convolution neural network to obtain the detection result of the heartbeat waveform.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the heartbeat waveform extracting unit includes:
the peak detection subunit is used for detecting an R wave peak in the electrocardiosignals through a Panthompus Pan-Tompkins algorithm;
and the waveform list intercepting unit is used for intercepting the heartbeat waveform list according to the wave peak position of the R wave.
With reference to the second aspect, in a second possible implementation manner of the second aspect, the time-frequency spectrum tensor reconstructing unit includes:
a transformation subunit for utilizing a continuous wavelet transformation formula
Obtaining a two-dimensional time frequency spectrum of each heartbeat waveform, wherein a and b are a scale factor and a translation factor respectively, f (t) is an output signal, and psi is a wavelet basis function;
the scaling subunit is used for scaling the obtained time-frequency spectrum to a uniform size;
and the superposition subunit is used for superposing the time frequency spectrums of the continuous multiple heartbeat waveforms into a three-dimensional tensor in sequence, and the three dimensions of the three-dimensional tensor are frequency, time and heartbeat sequences in sequence.
A third aspect of embodiments of the present application provides an atrial fibrillation detection apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the atrial fibrillation detection method according to any one of the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the atrial fibrillation detection method according to any one of the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: the heartbeat waveforms related to the adjacent RR intervals are utilized, so that the intercepted heartbeat waveforms can not only reflect the morphological characteristics of an electrocardiogram, but also reflect the change rule of the RR intervals, and therefore, the related characteristics of the activities of atria and ventricles can be reflected at the same time; the time-frequency spectrum tensor is obtained by processing the heartbeat waveform through continuous wavelet transformation, and compared with a one-dimensional electrocardiosignal, the signal characteristics can be more obviously represented; the deep convolutional neural network is adopted to carry out feature learning and classification on the frequency spectrum tensor during the heartbeat waveform, so that the workload and one-sidedness of the traditional method during feature extraction are avoided, and the method has stronger adaptability to a new type of training sample, and is favorable for improving the classification precision.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Fig. 1 is a schematic flow chart of an implementation of the atrial fibrillation detection method according to the embodiment of the present application, which is detailed as follows:
in step S101, a heartbeat waveform related to an RR interval is extracted;
specifically, the step of extracting the heartbeat waveform related to the RR interval may include:
1011, the R wave peak in the signal can be detected using the pantographic Pan-Tompkins algorithm. If there is a large spike in the signal header that is significantly higher than the peak of the normal R wave, this will result in the following peak not being detected. To solve this problem, the number of R wave peaks detected may be compared with a predetermined threshold, and if greater than or equal to this threshold, the detection is successful; if the detected number of the R wave peaks is less than the threshold, the head peak interference is indicated, the detection starting point is delayed backwards for a certain distance, and the detection and the judgment are repeated until the number of the detected R wave peaks reaches the threshold, or the detection starting point is delayed to the end of the signal.
1012, intercepting a heartbeat waveform list according to the wave peak position of the R wave. For the ith heartbeat detected in a signal, its waveform start position (S)i) And a termination position (E)i) The calculation formula of (a) is as follows:
ri represents the position (sampling point) of the ith R wave crest detected in the signal, the value range of i is 2-N-1, and N is the total number of the detected R wave crests.
It follows that the range of the heartbeat waveform is determined by the values of the two RR intervals adjacent thereto. If the previous RR interval is less than the next RR interval, then the R-wave peak in the heartbeat waveform will be located in the portion 1/3 before it; otherwise, the peak of the R wave will be located at a portion 1/3 behind it. If the two RR intervals are equal in magnitude, then the R-wave peak is at the first 1/3 division point in the heartbeat waveform. Therefore, the heartbeat waveform intercepting method can reflect the variation information of the RR interval in the signal. The effect of the heartbeat waveform truncation is shown in figure 2.
Of course, in a preferred embodiment of the present application, before the step of extracting the heartbeat waveform related to the RR interval, a step of filtering the cardiac electrical signal may be further included, specifically including:
1001, smoothing the signals by using a moving average method, and removing baseline drift signals in the electrocardiosignals;
and 1002, removing noise in the electrocardiosignals by using a soft threshold wavelet denoising method.
Wherein, in removing the baseline drift signal in the electrocardiosignal by using the moving average method, the signal can be smoothed by using the moving average method with a floating window of 0.5 second. Then, the smoothed signal is subtracted from the original signal to obtain a signal from which the baseline wander is removed.
The noise in the electrocardiosignal can be removed by using a soft threshold wavelet denoising method, the wavelet basis function used can be sym8 (wavelet family wavelet with the serial number of 8), and the number of layers of decomposition is 5.
The smooth electrocardiosignal can be obtained by removing the baseline drift in the electrocardiosignal and removing the noise in the electrocardiosignal by using a wavelet denoising method.
In step S102, performing continuous wavelet transform on the heartbeat waveform to reconstruct a time-frequency spectrum tensor of the heartbeat waveform;
specifically, the two-dimensional time spectrum of each small-jump waveform can be obtained by using a continuous wavelet transform formula, which is as follows:
where a and b are scale factor and translation factor, respectively, f (t) is the output signal, and Ψ is the wavelet basis function. The two-dimensional time spectrum may better reflect signal characteristics than a 1-dimensional signal. The effect diagram of the heartbeat waveform and continuous wavelet transform is shown in fig. 3.
To reduce the time-frequency spectrum size to reduce the computation and memory footprint of the model training process, the obtained time-frequency spectrum may be scaled to a uniform size, e.g., 64 × 64.
In addition, the time frequency spectrums of a plurality of continuous heartbeat waveforms can be sequentially superposed into a three-dimensional tensor, for example, the time frequency spectrums of 5 continuous heartbeat waveforms can be sequentially superposed into a three-dimensional tensor. Which in turn may be frequency, time and heartbeat sequence. By taking such a tensor as the input of the subsequent classifier, whether atrial fibrillation occurs in the time interval corresponding to the tensor can be detected.
In step S103, feature learning and classification are performed on the time-frequency spectrum system structure of the heartbeat waveform through the trained deep convolutional neural network, so as to obtain a detection result of the heartbeat waveform.
Specifically, the deep neural network provided in the embodiment of the present application, as shown in fig. 4, may include a feature extraction portion composed of 4 layers of convolutional neural networks and a feature classification portion composed of 2 layers of fully-connected layers, and the network structure may be as shown in fig. 4. Each convolutional layer may contain 32 convolutional kernels, the convolutional kernels of the first two convolutional layers may be 10 × 10 in size, the convolutional kernels of the third convolutional layer may be 8 × 8 in size, and the convolutional kernels of the fourth convolutional layer may be 4 × 4 in size; the 2 nd and 3 rd convolution layers, the 4 th convolution layer and the 1 st full-connection layer respectively comprise a maximum pooling layer (the pooling reduction multiple is 2 multiplied by 2) and a Dropout layer (the discarding rate is 0.2); the 1 st fully-connected layer contains 256 neurons and the second fully-connected layer contains 1 neuron. The activation function of each convolution layer adopts a ReLu function, and the activation function of the second full-connection layer is a sigmoid function (S-shaped growth curve). The target function of model training is a cross entropy function, and the formula is as follows:
wherein m is the number of samples in the training set, x is the input data of the samples, y is the sample mark, and theta is the model parameter. The model training can adopt a Stochastic Gradient Descent optimization method, the learning rate can be 0.001, the impulse can be 0.8, and the Weight Decay rate can be 10-6. The neural network model was implemented and trained using a Keras based on a tensorial flow engine.
The training and testing data may be from the MIT-BIH atrial fibrillation dataset. The data set is specially used for verifying the performance of an atrial fibrillation detection algorithm and comprises 25 pieces of electrocardio data which are mainly collected from patients with atrial fibrillation and normal people for about 10 hours, and the sampling rate is 250 Hz. Of these, "00735" and "03665" pieces of data are not used because they lack the original electrocardiogram data, and "04936" and "05091" pieces of data are not used because there is an error in labeling. Each of the remaining electrocardiographic records contains data collected from two leads, of which only the data from the first lead is used in the practice of the present invention. The spectrum tensors of the electrocardiographic waveforms used in the training set and the testing set are obtained from different electrocardiographic records, so that the phenomenon that the model generates overfitting aiming at a few cases is avoided. The performance of the method was evaluated by its sensitivity (Se) and specificity (Sp) for atrial fibrillation detection on the test set, as calculated by the formula:
wherein TP represents the number of samples for positive detection of atrial fibrillation, TN represents the number of samples for positive detection of non-atrial fibrillation, FP represents the number of samples for false detection of atrial fibrillation, and FN represents the number of samples for false detection of non-atrial fibrillation. Test results show that the sensitivity of the atrial fibrillation detection method is 99.41%, and the specificity is 98.91%.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 5 is a schematic structural diagram of an atrial fibrillation detection apparatus provided in the embodiment of the present application, which is detailed as follows:
atrial fibrillation detection apparatus includes:
a heartbeat waveform extracting unit 501, configured to extract a heartbeat waveform related to an RR interval;
a time-frequency spectrum tensor reconstruction unit 502, configured to perform continuous wavelet transform on the heartbeat waveform, and reconstruct a time-frequency spectrum tensor of the heartbeat waveform;
and the learning classification unit 503 is configured to perform feature learning and classification on the time-frequency spectrum system structure of the heartbeat waveform through the trained deep convolutional neural network, so as to obtain a detection result of the heartbeat waveform.
Preferably, the heartbeat waveform extracting unit includes:
the peak detection subunit is used for detecting an R wave peak in the electrocardiosignals through a Panthompus Pan-Tompkins algorithm;
and the waveform list intercepting unit is used for intercepting the heartbeat waveform list according to the wave peak position of the R wave.
Preferably, the temporal spectrum tensor reconstruction unit includes:
a transformation subunit for utilizing a continuous wavelet transformation formula
Obtaining a two-dimensional time frequency spectrum of each heartbeat waveform, wherein a and b are a scale factor and a translation factor respectively, f (t) is an output signal, and psi is a wavelet basis function;
the scaling subunit is used for scaling the obtained time-frequency spectrum to a uniform size;
and the superposition subunit is used for superposing the time frequency spectrums of the continuous multiple heartbeat waveforms into a three-dimensional tensor in sequence, and the three dimensions of the three-dimensional tensor are frequency, time and heartbeat sequences in sequence.
The atrial fibrillation detection apparatus shown in fig. 5 corresponds to the atrial fibrillation detection method shown in fig. 1.
Fig. 6 is a schematic diagram of an atrial fibrillation detection apparatus according to an embodiment of the present application. As shown in fig. 6, the atrial fibrillation detection apparatus 6 of this embodiment includes: a processor 60, a memory 61 and a computer program 62, such as an atrial fibrillation detection program, stored in said memory 61 and executable on said processor 60. The processor 60, when executing the computer program 62, implements the steps in the various atrial fibrillation detection method embodiments described above, such as steps 101-103 shown in fig. 1. Alternatively, the processor 60, when executing the computer program 62, implements the functions of each module/unit in the above-mentioned device embodiments, for example, the functions of the modules 501 to 503 shown in fig. 5.
Illustratively, the computer program 62 may be partitioned into one or more modules/units that are stored in the memory 61 and executed by the processor 60 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 62 in the atrial fibrillation detection apparatus 6. For example, the computer program 62 may be divided into a heartbeat waveform extraction unit, a time-frequency spectrum tensor reconstruction unit, and a learning classification unit, and each unit has the following specific functions:
a heartbeat waveform extracting unit, which is used for extracting heartbeat waveforms related to RR intervals;
the time-frequency spectrum tensor reconstruction unit is used for carrying out continuous wavelet transformation on the heartbeat waveform and reconstructing the time-frequency spectrum tensor of the heartbeat waveform;
and the learning classification unit is used for performing characteristic learning and classification on the time-frequency spectrum system structure of the heartbeat waveform through the trained deep convolution neural network to obtain the detection result of the heartbeat waveform.
The atrial fibrillation detection device 6 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing device. The atrial fibrillation detection apparatus may include, but is not limited to, a processor 60, a memory 61. It will be appreciated by those skilled in the art that fig. 6 is merely an example of an atrial fibrillation detection device 6, and does not constitute a limitation of atrial fibrillation detection device 6, and may include more or fewer components than shown, or some components in combination, or different components, e.g., it may also include input-output devices, network access devices, buses, etc.
The Processor 60 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may be an internal storage unit of the atrial fibrillation detection apparatus 6, such as a hard disk or a memory of the atrial fibrillation detection apparatus 6. The memory 61 may also be an external storage device of the atrial fibrillation detection apparatus 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the atrial fibrillation detection apparatus 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the atrial fibrillation detection apparatus 6. The memory 61 is used for storing the computer program and other programs and data required by the atrial fibrillation detection apparatus. The memory 61 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. . Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.