A P-wave identification method, terminal device and storage medium based on adversarial learning
Through the generative adversarial network method of adversarial learning, a generator and a discriminator are constructed to train electrocardiogram data to identify P waves, which solves the problem of poor P wave recognition in the existing technology and achieves accurate identification of unconventional P waves.
Patent Information
- Application Number
- CN202010818810.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-14
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2040-08-14
AI Technical Summary
The existing technology is ineffective at identifying P waves in electrocardiograms, especially for unconventional P waves such as atrial P waves, retrograde P waves, and non-downloaded P waves. It is difficult to accurately identify, and it is difficult to encode human experience and intuition through machines. .
Adopting the generative adversarial network (GAN) method based on adversarial learning, by building a generator and a discriminator, the electrocardiogram data is trained to realize P wave recognition, the generator is used to generate P wave labeled data, and the recognition is improved through cropping and normalization processing. accuracy.
It effectively improves the recognition accuracy of electrocardiogram P waves, solves the problem of poor recognition effect in the existing technology, and achieves accurate recognition of unconventional P waves.
Smart Images

Figure CN112001481B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electrocardiogram recognition, and in particular to a P wave recognition method based on adversarial learning, a terminal device and a storage medium. Background Art
[0002] The P wave of the electrocardiogram is an atrial depolarization wave, representing the excitation of the left and right atria. The analysis of the P wave is of great significance for the diagnosis and differential diagnosis of arrhythmias. In the automatic analysis of the electrocardiogram, P wave recognition often faces great difficulties. This is because compared with the ventricular wave QRS-T, the P wave has a low amplitude and energy, and often overlaps with other waveforms. Existing P wave recognition methods are often based on bandpass filtering and threshold comparison methods. The recognition success rate of ordinary sinus P waves is acceptable when the artifact interference is relatively small, but for atrial P waves, retrograde P waves, non-downward P waves and other unconventional P waves, the recognition effect is relatively poor. In these cases, the pattern of the P wave is difficult to express with fixed rules, and currently can only be judged by the experience and intuition of human doctors. It is difficult to directly encode human experience and intuition on the machine, however, the problem can be transformed into a conditional distribution model for establishing P waves. In recent years, the generative adversarial network (GAN) developed in the field of deep learning has shown excellent results in learning image data distribution, but due to the particularity of ECG signals relative to natural images, there are currently no such applications. Summary of the invention
[0003] In order to solve the above problems, the present invention proposes a P-wave recognition method, terminal device and storage medium based on adversarial learning.
[0004] The specific plan is as follows:
[0005] A P wave recognition method based on adversarial learning comprises the following steps:
[0006] S1: Collect ECG data and mark the P wave in it, and the ECG data and the corresponding P wave marked data together form a training set;
[0007] S2: Build a generative adversarial network model, set the loss functions of the generator and discriminator, and iteratively train the generator and discriminator through the training set to minimize the loss function of the generator and maximize the loss function of the discriminator;
[0008] S3: Generate P wave labeling data in the electrocardiogram data to be labeled through the trained generator, so as to realize P wave recognition of the electrocardiogram data.
[0009] Furthermore, step S1 also includes cutting the electrocardiogram data and the corresponding P wave marker data, and the cutting method is:
[0010] (1) Set the array input_image to the array corresponding to the ECG data, and the array real_image to the array corresponding to the P wave marker data. Convert input_image and real_image into tensors with a dimension of [1, 1, n, 1], where n represents the sampling length of the original ECG data.
[0011] (2) Stack input_image and real_image in the first dimension, and record the stacked result as stacked_image, whose dimension is [2, 1, n, 1];
[0012] (3) Randomly sample the third dimension of stacked_image, with the sampling range from 0 to ns, where s represents the cropping size. Then, extract the data of s points starting from the sampling point and record it as cropped_image, with a dimension of [2, 1, s, 1].
[0013] (4) Split the cropped_image along the first dimension and assign the split results back to the input_image and real_image as the cropped results.
[0014] Furthermore, step S1 also includes normalizing the electrocardiogram data and the corresponding P wave marker data.
[0015] Furthermore, the generator's loss function total_gen_loss is:
[0016] total_gen_loss=gan_loss+l1_loss
[0017] gan_loss=BinaryCrossentropy(disc_generated_output, ones_like_disc_generated_output)
[0018] l1_loss=reduce_mean(|gen_output-target|)
[0019] Among them, disc_generated_output represents the output tensor of the discriminator, ones_like_disc_generated_output represents a tensor with the same format as disc_generated_output and all values are 1, BinaryCrossentropy represents the calculation of binary cross entropy, gen_output represents the output tensor of the generator, target represents the real P-wave labeled data corresponding to the input of the generator, reduce_mean represents the mean in all dimensions, and gan_loss and l1_loss are both intermediate variables of the loss function.
[0020] Furthermore, the loss function of the discriminator total_disc_loss is:
[0021] total_disc_loss=real_loss+generated_loss
[0022] real_loss=BinaryCrossentropy(disc_real_output,ones_like_disc_real_output)
[0023] generated_loss=BinaryCrossentropy(disc_generated_output, zeros_like_disc_generated_output)
[0024] Among them, disc_real_output is the output obtained after the ECG data and its corresponding P wave labeled data are input into the discriminator, ones_like_disc_real_output is a tensor with the same format as disc_real_output but all values are 1, BinaryCrossentropy means calculating the binary cross entropy, disc_generated_output is the output obtained after the ECG data and the P wave labeled data generated by the generator are input into the discriminator, zeros_like_disc_generated_output is a tensor with the same format as disc_generated_output but all values are 0, real_loss and generated_loss are both intermediate variables of the loss function.
[0025] A P-wave identification terminal device based on adversarial learning includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned method of the embodiment of the present invention are implemented.
[0026] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described above in an embodiment of the present invention are implemented.
[0027] The present invention adopts the above technical solution and realizes the recognition of the P wave of the electrocardiogram by constructing a generative adversarial network, thereby solving the problem of poor P wave recognition effect in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 Shown is a flow chart of Embodiment 1 of the present invention.
[0029] Figure 2 Shown is a schematic diagram of P wave marking in this embodiment.
[0030] Figure 3 Shown is a schematic diagram of the structure of the generator in this embodiment.
[0031] Figure 4 Shown is a schematic diagram of the internal topological structure of an encoding unit instance in this embodiment.
[0032] Figure 5 Shown is a schematic diagram of the internal topology structure of an example of a decoding unit in this embodiment.
[0033] Figure 6 Shown is the topological structure of the generator model in this embodiment and the input and output dimensions of each layer.
[0034] Figure 7 FIG. 4 is a schematic diagram showing the structure of the discriminator in this embodiment.
[0035] Figure 8 Shown is the topological structure of the discriminator model in this embodiment and the input and output dimensions of each layer. DETAILED DESCRIPTION
[0036] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.
[0037] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.
[0038] Embodiment 1:
[0039] The embodiment of the present invention provides a P wave recognition method based on adversarial learning, such as Figure 1 As shown, the following steps are included.
[0040] S1: Collect electrocardiogram data and mark the P wave therein, and the electrocardiogram data and the corresponding P wave marked data together form a training set.
[0041] The electrocardiogram data may be single-lead data or multi-lead data, which is not limited here. In this embodiment, single-lead data is used as an example for description.
[0042] The marks can be manually marked by medical experts and then saved as normalized position masks, such as Figure 2 shown.
[0043] The electrocardiogram data refers to the electrocardiogram voltage data, and the P wave marker data refers to the P wave position mask. In this embodiment, the electrocardiogram data is read into the memory and arranged as an array recorded as input_image, and the signal is resampled at a sampling rate of 360HZ. The P wave marker file is read into the memory. Usually, the P wave marker information is a 1-dimensional numerical sequence, and the numerical value is the offset position of the sampling point. Here, it needs to be converted into a continuous P wave position mask. That is, first construct an array real_image with the same length as input_image but all values are 0, and then traverse the P wave marker sequence. For each P wave position point, within the sampling range of 0.055 seconds on its left side to 0.055 seconds on the right side, the value of the array real_image is set to 1. Then the array input_image corresponds to the electrocardiogram, and the array real_image corresponds to the P wave marker file.
[0044] Since the tensor dimension of the input image received by the network model is [1, 2048], and the data length of the electrocardiogram is generally much longer than 2048 points, it is necessary to crop the image used for training. The purpose of adding random cropping in this embodiment is to increase the robustness of the system, especially the diversification of cropping boundary conditions. The cropping process is as follows:
[0045] (1) Convert input_image and real_image into tensors with a dimension of [1, 1, n, 1], where n represents the sampling length of the original ECG data.
[0046] (2) Stack input_image and real_image in the first dimension, and record the stacked result as stacked_image, whose dimension is [2, 1, n, 1].
[0047] (3) Randomly sample the third dimension of stacked_image, with the sampling range from 0 to n-2048. Then, extract the data of 2048 points starting from the sampling point and record it as cropped_image, with the dimension of [2, 1, 2048, 1].
[0048] (4) Split the cropped_image along the first dimension and assign the split results back to the input_image and real_image as the cropped results.
[0049] In order to ensure the uniformity of the data input to the model, this embodiment also includes normalizing the electrocardiogram data. The specific method adopted is: unifying the input_image unit (to millivolts) and subtracting the mean value in the third dimension to obtain normalized data.
[0050] S2: Build a generative adversarial network model, set the loss functions of the generator and discriminator, and train the generator and discriminator through the training set so that the loss function of the generator is minimized and the loss function of the discriminator is maximized.
[0051] Generative adversarial networks consist of a generator and a discriminator.
[0052] S21: Build the generator.
[0053] The generator is a deep neural network consisting of an encoding unit and a decoding unit. The results are as follows Figure 3 As shown. It can map the input signal x (ECG data) to a probability sequence y, which represents the probability of the P wave appearing at each position, i.e., the P wave position mask. In this embodiment, the encoding unit adopts a structure similar to U-Net, which is characterized by not losing detail information during the decoding process, which is particularly important for small-scale signals such as P waves. The P wave signal can be obtained by performing a dot product between the P wave position mask and the original ECG.
[0054] S211: Define coding unit.
[0055] The encoding unit is a deep neural network layer that downsamples and extracts features from the ECG. Its construction method is defined as downsample(filters, size). The internal topology of an encoding unit instance is as follows: Figure 4 shown.
[0056] Figure 4The input received is a 4-dimensional tensor; Conv2D is a 2D convolution layer, the filters parameter indicates the number of convolution kernels, the size parameter indicates the size of the convolution kernel, and strides is the stride; BatchNormalization is a batch normalization layer; LeakyReLU is an activation function layer. The above layers are supported by the deep learning framework software, and their implementation details are not expanded.
[0057] S212: Define a decoding unit.
[0058] The decoding unit performs upsampling and image transformation on the encoded data. Its construction method is defined as upsample(filters,size). The internal topology of a decoding unit instance is as follows: Figure 5 shown.
[0059] Figure 5 In the figure, Conv2DTranspose is the transposed convolution and Dropout is the randomization layer used to regularize the network.
[0060] S213: Construct a generator.
[0061] The input of the generator is a 4-dimensional tensor in the format of [batch_size, 1, 2048, 1]. The input tensor is encoded by the encoding unit stack, decoded by the decoding unit stack, and finally converted into a probability value through sigmoid activation.
[0062] The encoding unit stack is configured as follows:
[0063] down_stack = [
[0064] downsample(64,4),
[0065] downsample(128,4),
[0066] downsample(256,4),
[0067] downsample(512,4),
[0068] downsample(512,4),
[0069] downsample(512,4),
[0070] downsample(512,4),
[0071] downsample(512,4), ]
[0073] The decoding unit stack is configured as follows:
[0074] up_stack = [
[0075] upsample(512,4),
[0076] upsample(512,4),
[0077] upsample(512,4),
[0078] upsample(512,4),
[0079] upsample(256,4),
[0080] upsample(128,4),
[0081] upsample(64,4), ]
[0083] The connection topology between the decoding unit and the encoding unit is as follows:
[0084] (1) The last layer of the encoding unit is connected to the first layer of the decoding unit:
[0085] down_stack[7]->up_stack[0]
[0086] (2) The last dimension of the tensor of the 7-i layer of the encoding unit and the i-1 layer of the decoding unit is concatenated and sent to the i-th layer of the decoding unit: [down_stack[7-i], up_stack[i-1]]->up_stack[i], for i in 1...7.
[0087] This type of connection is called a skip connection.
[0088] The output of the last layer of the decoding unit is upsampled in sequence and activated with sigmoid to map its value to the range of 0-1 to achieve probability regression.
[0089] The complete model topology of the entire generator and the input and output dimensions of each layer are as follows Figure 6 shown.
[0090] S22: Construct a discriminator.
[0091] The discriminator consists of a multi-layer convolutional neural network and a fully connected structure, such as Figure 7As shown, its input is a pair of signals X and Y, where X is electrocardiogram data and Y is P wave marker data, and the output is a probability value indicating the probability that Y is the "real" (artificially labeled) P wave marker data given X.
[0092] The input of the discriminator is two four-dimensional tensors in the format of [batch_size, 1, 2048, 1], corresponding to the electrocardiogram data and the P wave marker data respectively. The P wave signal is obtained by multiplying these two tensors.
[0093] The P wave marker data and the last dimension of the ECG data are concatenated and fused into a tensor. A series of feature extraction and downsampling operations are performed on the tensor to obtain an encoding vector. Finally, a convolution layer with a convolution kernel of 1 is used for regression to obtain a probability value for determining whether the P wave is true.
[0094] The topological structure of the discriminator model and the input and output dimensions of each layer are as follows Figure 8 shown.
[0095] S23: Construct loss function.
[0096] (1) The generator’s loss function total_gen_loss is obtained by adding Gan_loss and l1_loss.
[0097] gan_loss is the loss caused by the discriminator not classifying the P-wave labeled data generated by the generator as 1 (true), so the calculation formula is as follows:
[0098] The output tensor of the discriminator is recorded as disc_generated_output, and the format is [batch_size, 1, 254, 1]. A tensor with all 1s is constructed, and the format is the same as that of disc_generated_output, recorded as ones_like_disc_generated_output, then: gan_loss = BinaryCrossentropy(disc_generated_output, ones_like_disc_generated_output). BinaryCrossentropy means calculating the binary cross entropy.
[0099] l1_loss is the absolute value error of the 1-norm between the P-wave labeled data output by the generator and the real P-wave labeled data. The calculation formula is as follows:
[0100] The output tensor of the generator is denoted as gen_output, and the real P-wave labeled data is denoted as target, then l1_loss = reduce_mean(|gen_output-target|), where reduce_mean means finding the mean over all dimensions.
[0101] Generator loss function total_gen_loss = gan_loss + l1_loss
[0102] An L1 regularization term is added to make the P waves generated by the generator similar to the real P waves in the image and to accelerate the training convergence process.
[0103] (2) The discriminator loss function total_disc_loss is obtained by adding real_loss and generated_loss.
[0104] real_loss is the loss of the combination of real P-wave marker data and ECG data being treated as fake, calculated as follows:
[0105] real_loss=BinaryCrossentropy(disc_real_output,ones_like_disc_real_output), where disc_real_output is the output obtained after the electrocardiogram data and its corresponding P wave marker data are input into the discriminator, and ones_like_disc_real_output is a tensor with the same format as disc_real_output but all values are 1.
[0106] Generated_loss is the loss of the combination of P-wave marker data and electrocardiogram data generated by the generator being treated as true, calculated as follows:
[0107] generated_loss=BinaryCrossentropy(disc_generated_output,zeros_like_disc_generated_output), where disc_generated_output is the output obtained after the electrocardiogram data and the P-wave marker data generated by the generator are input into the discriminator, and zeros_like_disc_generated_output is a tensor with the same format as disc_generated_output but all values are 0.
[0108] The total loss of the discriminator is total_disc_loss=real_loss+generated_loss.
[0109] S24: Iteratively train the generator and discriminator of the generative adversarial network model through the training set so that the loss function of the generator is minimized and the loss function of the discriminator is maximized.
[0110] The optimization goal of the generator is to minimize the loss function on the training set, that is, by continuously improving the parameters of the generator, the discriminator believes that the P wave generated by the generator is real; the optimization goal of the discriminator is to maximize the loss function, that is, to continuously improve the discriminator parameters so that it can judge that the P wave of the artificial mark is real, while the one generated by the generator is fake.
[0111] The training process continuously iterates and optimizes the generator and the discriminator. Although their optimization goals are completely opposite, a Nash equilibrium will eventually be achieved, making it impossible to further optimize the generator and the discriminator, even if the discriminator cannot distinguish between the P waves generated by the generator and the real P waves.
[0112] Each iteration performs the following operations:
[0113] Set the tensor corresponding to the electrocardiogram data in the training set as input_image and the tensor corresponding to the P wave marker data as target.
[0114] Input_image is input into the generator to generate image gen_output.
[0115] Input_image and target are input to the discriminator to generate disc_real_output.
[0116] Input_image and gen_output are input to the discriminator to generate disc_generated_output.
[0117] The generator loss gen_total_loss is calculated by disc_generated_output, gen_output and target.
[0118] The discriminator loss disc_total_loss is calculated by disc_real_output and disc_generated_output.
[0119] Calculate the gradient of gen_total_loss with respect to the generator parameters and perform gradient descent on the generator.
[0120] Calculate the gradient of disc_total_loss to the discriminator parameters and perform gradient descent on the discriminator.
[0121] During iteration, record the loss curves of the generator and discriminator. When both no longer show a significant decrease, stop iteration and the network model training is complete. The generator model can be serialized, saved and loaded in h5 or json format.
[0122] S3: Generate P wave labeling data in the electrocardiogram data to be labeled through the trained generator, so as to realize P wave recognition of the electrocardiogram data.
[0123] The first embodiment of the present invention realizes the recognition of the P wave of the electrocardiogram by constructing a generative adversarial network, thereby solving the problem that the prior art has poor recognition effect on the P wave.
[0124] Embodiment 2:
[0125] The present invention also provides a P-wave identification terminal device based on adversarial learning, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned method embodiment of embodiment one of the present invention when executing the computer program.
[0126] Further, as an executable solution, the P-wave identification terminal device based on adversarial learning can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The P-wave identification terminal device based on adversarial learning may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the composition structure of the above-mentioned P-wave identification terminal device based on adversarial learning is only an example of a P-wave identification terminal device based on adversarial learning, and does not constitute a limitation on the P-wave identification terminal device based on adversarial learning. It may include more or less components than the above-mentioned, or a combination of certain components, or different components. For example, the P-wave identification terminal device based on adversarial learning may also include input and output devices, network access devices, buses, etc., and the embodiments of the present invention do not limit this.
[0127] Further, as an executable solution, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the P-wave identification terminal device based on adversarial learning, and uses various interfaces and lines to connect the various parts of the entire P-wave identification terminal device based on adversarial learning.
[0128] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the P-wave identification terminal device based on adversarial learning by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and an application required for at least one function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0129] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiment of the present invention are implemented.
[0130] If the module / unit integrated in the P-wave identification terminal device based on adversarial learning is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, 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, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) and software distribution medium, etc.
[0131] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.
Claims
1. A P-wave recognition method based on adversarial learning, characterized in that: The following steps are involved: S1: Collecting electrocardiogram data and marking the P wave therein, and the electrocardiogram data and the corresponding P wave marking data together form a training set; step S1 also includes cutting the electrocardiogram data and the corresponding P wave marking data, and the cutting method is: (1) Set the array input_image as the array corresponding to the ECG data, and the array real_image as the array corresponding to the P wave marker data. The construction method of the array real_image is as follows: first construct an array real_image with the same length as input_image but all values are 0, then traverse the P wave marker sequence, and for each P wave position point, set the value of the array real_image to 1 within the sampling range on its left and right sides; convert input_image and real_image into tensors with a tensor dimension of [1, 1, n, 1], where n represents the sampling length of the original ECG data; (2) Stack input_image and real_image in the first dimension, and record the stacked result as stacked_image, whose dimension is [2, 1, n, 1]; (3) Randomly sample the third dimension of stacked_image, with the sampling range from 0 to ns, where s represents the cropping size. Then, extract the data of s points starting from the sampling point and record it as cropped_image, with a dimension of [2, 1, s, 1]. (4) Split the cropped_image in the first dimension and reassign the split results to input_image and real_image as the cropped results; S2: Build a generative adversarial network model, set the loss functions of the generator and discriminator, and iteratively train the generator and discriminator through the training set to minimize the loss function of the generator and maximize the loss function of the discriminator; S3: Generate P wave labeling data in the electrocardiogram data to be labeled through the trained generator, so as to realize P wave recognition of the electrocardiogram data.
2. The P wave recognition method based on adversarial learning according to claim 1, characterized in that: Step S1 also includes normalizing the electrocardiogram data and the corresponding P wave marker data.
3. The P wave recognition method based on adversarial learning according to claim 1, characterized in that: The loss function of the generator, total_gen_loss, is: total_gen_loss=gan_loss+l1_loss gan_loss=BinaryCrossentropy(disc_generated_output, ones_like_disc_generated_output) l1_loss=reduce_mean(|gen_output-target|) Among them, disc_generated_output represents the output tensor of the discriminator, ones_like_disc_generated_output represents a tensor with the same format as disc_generated_output and all values are 1, BinaryCrossentropy represents the calculation of binary cross entropy, gen_output represents the output tensor of the generator, target represents the real P-wave labeled data corresponding to the input of the generator, reduce_mean represents the mean in all dimensions, and gan_loss and l1_loss are both intermediate variables of the loss function.
4. The P wave recognition method based on adversarial learning according to claim 1, characterized in that: The loss function of the discriminator, total_disc_loss, is: total_disc_loss=real_loss+generated_loss real_loss=BinaryCrossentropy(disc_real_output,ones_like_disc_real_output) generated_loss=BinaryCrossentropy(disc_generated_output, zeros_like_disc_generated_output) Among them, disc_real_output is the output obtained after the ECG data and its corresponding P wave labeled data are input into the discriminator, ones_like_disc_real_output is a tensor with the same format as disc_real_output but all values are 1, BinaryCrossentropy means calculating the binary cross entropy, disc_generated_output is the output obtained after the ECG data and the P wave labeled data generated by the generator are input into the discriminator, zeros_like_disc_generated_output is a tensor with the same format as disc_generated_output but all values are 0, real_loss and generated_loss are both intermediate variables of the loss function.
5. A P-wave recognition terminal device based on adversarial learning, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 4 when executing the computer program.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Method and system for identifying P waves in electrocardiosignal
CN109864737A
Generative adversarial network electrocardiogram abnormity detection method based on single target and multiple targets
CN110558971A
