An electrocardiogram data compression method, a terminal device and a storage medium

This method, which uses a convolutional autoencoder model for compression by segmenting and training electrocardiogram (ECG) data, solves the problem of large data storage requirements for ECG data. It achieves efficient data compression and restoration and is suitable for compression and storage of real-time ECG data.

CN113992206BActive Publication Date: 2025-11-07纳龙健康科技股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111254779.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-27
Publication Date
2025-11-07
Estimated Expiration
2041-10-27

AI Technical Summary

Technical Problem

Existing ECG data compression methods are inefficient in lossless compression, and lossy compression does not fully consider the redundancy of ECG QRS pseudo-cycle patterns and diagnostic useless information, resulting in large data storage requirements and high network bandwidth requirements.

Method used

A convolutional autoencoder model is used to segment and train electrocardiogram data to generate compressed data for each segment. The compression process is optimized by using a specific mask and loss function. Data is restored by combining the parameters and latent variables of the decoder and encoder. The compressed data is stored in half-precision floating-point format.

Benefits of technology

It achieves higher data restoration quality and lower bit rate compromise, making it suitable for real-time ECG data compression, with a high compression ratio and data restoration capability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113992206B_ABST
    Figure CN113992206B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of electrocardiogram data compression method, terminal equipment and storage medium, the method includes compression flow and decompression flow.In the compression flow, for each original fragment after electrocardiogram data segmentation, the convolutional autoencoder model is trained, the learnable parameter of decoder in the trained model and the hidden variable generated by encoder are extracted and combined, as the compression data of the original fragment;All compression data are connected and packed as compressed file in sequence.In the decompression flow, according to the learnable parameter and hidden variable extracted from the compressed file, the hidden variable is input into the decoder loaded with learnable parameter, and the decompression fragment is output;The decompression fragment is connected as decompressed electrocardiogram data in sequence.The present application does not depend on the generalization performance of neural network, compared with general convolutional autoencoder, has higher data restoration quality, and the compromise of code rate is limited.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of data compression, and in particular to an electrocardiogram data compression method, a terminal device and a storage medium. BACKGROUND

[0002] Long-range electrocardiogram data acquisition systems such as dynamic and real-time monitoring pose challenges to the local storage of inspection institutions or the network bandwidth of remote collaborative diagnosis. Taking 12-lead dynamic electrocardiogram as an example, the electrocardiogram data of the wearer is recorded for 24 hours, and 350 megabytes are required to save the data when the sampling rate is 200HZ and the sampling accuracy is 12bit. Based on the lossless compression algorithm such as 7z, at most, the data can be compressed to one third of the original size. If lossy compression is used, such as the classic transform and prediction coding-based technology, the QRS pseudo-periodic pattern of electrocardiogram and the redundancy of useless information for diagnosis are not fully considered, and there is still a lot of room for improvement. SUMMARY

[0003] To solve the above problems, the present application provides an electrocardiogram data compression method, a terminal device and a storage medium.

[0004] The specific scheme is as follows:

[0005] An electrocardiogram data compression method, comprising a compression process and a decompression process, wherein:

[0006] The compression process comprises:

[0007] S101: The electrocardiogram data to be compressed is divided into original segments of a rated length;

[0008] S102: A convolutional autoencoder model is constructed, and for each original segment, the convolutional autoencoder model is trained using the original segment to make the loss function of the model meet the requirements, and the learnable parameters of the decoder and the hidden variables generated by the encoder in the trained model are combined to serve as the compressed data of the original segment;

[0009] S103: The compressed data of all original segments is connected and packaged in sequence as a compressed file of the electrocardiogram data to be compressed;

[0010] The decompression process comprises:

[0011] S201: The content of the compressed file is divided into multiple compressed data according to the length of the compressed data corresponding to each original segment;

[0012] S202: The learnable parameters of the decoder and the hidden variables generated by the encoder corresponding to each compressed data are extracted;

[0013] S203: Construct the same convolutional autoencoder model as step S102, load the learnable parameters of the decoder into the decoder of the convolutional autoencoder model, input the hidden variable generated by the encoder into the decoder, and output the decompressed segment corresponding to the compressed data.

[0014] S204: Connect the decompressed segments in sequence to generate the decompressed electrocardiogram data.

[0015] Further, before the segmentation in step S101, the method further comprises: resampling the to-be-compressed electrocardiogram data at a fixed sampling rate.

[0016] Further, the sampling rate of the resampling is 200HZ.

[0017] Further, before step S102, the method further comprises: identifying the waveform type corresponding to each original segment, and setting different masks for the original segments according to different waveform types; and setting the condition for stopping training of the convolutional autoencoder model as the loss function being less than the product of the loss function threshold and the mask.

[0018] Further, the loss function of the convolutional autoencoder model adopts L1 loss.

[0019] Further, the learnable parameters of the decoder and the hidden variable generated by the encoder are in half-precision floating-point format.

[0020] Further, the waveform type corresponding to the original segment includes: P wave, QRS wave, artifact and poor acquisition quality.

[0021] Further, the method for setting the mask comprises: setting 0.5 at 30 milliseconds before and after the P wave and 60 milliseconds before and after the QRS wave, setting 5 at the positions of the artifact and the poor acquisition quality, and setting 1 at the remaining positions.

[0022] An electrocardiogram data compression terminal device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described above when executing the computer program.

[0023] A computer-readable storage medium stores a computer program, wherein the computer program is executed by a processor to implement the steps of the method described above.

[0024] The technical scheme adopted in the present application does not rely on the generalization performance of the neural network, and has higher data restoration quality and limited compromise of code rate compared with the general convolutional autoencoder. BRIEF DESCRIPTION OF DRAWINGS

[0025] Figure 1 The flowchart shown is an embodiment of the present application. DETAILED DESCRIPTION

[0026] To further illustrate the embodiments, the present application provides accompanying drawings. These drawings are part of the disclosure of the present application, mainly used to illustrate the embodiments, and can be used to explain the operating principle of the embodiments in conjunction with the related description of the specification. With reference to these contents, those skilled in the art should understand other possible implementations and advantages of the present application.

[0027] The present application will be further described in conjunction with the accompanying drawings and specific embodiments.

[0028] Embodiment one:

[0029] The present application provides an electrocardiogram data compression method, as shown in the following figure, the method comprises a compression process and a decompression process. Figure 1

[0030] (1) Compression process

[0031] S101: The to-be-compressed electrocardiogram data is divided into original segments of a rated length.

[0032] In order to ensure that the lengths of all original segments of the to-be-compressed electrocardiogram data are consistent, it is preferred to set the to-be-compressed electrocardiogram data to be resampled at a fixed sampling rate in this embodiment, and the sampling rate of resampling is set to 200HZ, that is, if the sampling rate of the to-be-compressed electrocardiogram data itself is not 200HZ, then 200HZ is used for resampling.

[0033] The rated length can be set in advance by those skilled in the art according to the needs, which is not limited here. In this embodiment, the to-be-compressed electrocardiogram data is sequentially divided into a sequence of original segments with a length of 60 seconds (12000 points).

[0034] S102: A convolutional autoencoder model is constructed, and for each original segment, the original segment is used to train the convolutional autoencoder model, so that the loss function of the model meets the requirements, and the learnable parameters of the decoder in the trained model and the hidden variables generated by the encoder are combined to serve as the compressed data of the original segment.

[0035] ​The network architecture of the convolutional autoencoder (AE) model includes an encoder and a decoder. The encoder uses a convolutional neural network to extract and combine features of an image to generate a hidden variable with a much lower dimension than the original image. This process can be described as f(x)→z, where x represents the original image, f represents the encoder, and z represents the hidden variable. The decoder restores the hidden variable to an image through a deconvolution operation. This process can be described as g(z)→x', where g represents the decoder, and x' represents the restored image. The convolution and deconvolution operations are controlled by the hyperparameters and learnable parameters of the neural network structure, where the hyperparameters are fixed, and the learnable parameters can be learned through training.

[0036] In the traditional algorithm, the learnable parameters of the convolutional autoencoder are fixed after training on large data, and it is expected that after encoding and decoding operations on the unseen original image x using the fixed learnable parameters, the restored image x' will be very close to the original image x. The advantage is that only the hidden variable is used to transmit information, and the compression rate is very high. However, the generalization performance has high requirements for the training process of the network, especially the size of the training data, which should cover the overall distribution of the samples. This is unrealistic in the field of electrocardiogram.

[0037] In this embodiment, the generalization performance of the convolutional autoencoder is not used, but for each input original segment image, a corresponding convolutional autoencoder model is trained and over-fitted. Specifically, the data x is trained by gradient descent at the compression end. When the output x' of the convolutional autoencoder model is close to x within a target range (i.e., the loss function meets the requirements), the compression process is completed. Then, the learnable parameters p of the decoder g and the hidden variable z generated by the encoder f in the convolutional autoencoder model are combined together as the compression data z' corresponding to the original segment. The compression data z' is transmitted to the decompression end, which is a model with the same structure as the convolutional autoencoder model constructed in the compression process, i.e., the hyperparameters are the same, but the learnable parameters of the encoder f and the decoder g are to be filled. The decompression end separates the compression data z' into the learnable parameters p and the hidden variable z, then loads the learnable parameters p into the decoder g, and takes the hidden variable z as the input of the decoder, to obtain the output decompression segment x'.

[0038] Since different wave types of electrocardiogram data correspond to different compression loss requirements, in order to make the wave type with high requirement have less compression loss, and the wave type with low requirement have relatively high compression loss, the embodiment further includes, before step S102: identifying the wave type corresponding to each original segment, and setting different masks for the original segment according to different wave types, and setting the condition for stopping training of the convolutional autoencoder model as the loss function being less than the product of the loss function threshold and the mask. In the embodiment, the loss function is set to L1 loss, and the loss function threshold is 0.01.

[0039] Since the morphology and position of the p wave are crucial for long-term electrocardiogram diagnosis, the wave types identified in the embodiment include p wave, QRS wave, artifact and poor acquisition quality, and the masks corresponding to these wave types are set as follows: 0.5 is set at 30 milliseconds before and after the P wave and 60 milliseconds before and after the QRS wave, 5 is set at the position of the artifact and poor acquisition quality, and 1 is set at the remaining positions. The smaller the mask, the higher the accuracy requirement for training and the less the compression loss.

[0040] S103: connecting and packing the compression data of all original segments in sequence as a compression file of the to-be-compressed electrocardiogram data.

[0041] In the embodiment, the learnable parameters of the decoder and the hidden variables generated by the encoder are both in half-precision floating-point format, and the packed compression file is a binary file.

[0042] (2) Decompression process

[0043] S201: dividing the content of the compression file into multiple compression data according to the length of the compression data corresponding to each original segment.

[0044] The length of the compression data corresponding to each original segment should be the total length of the learnable parameters of the decoder and the hidden variables generated by the encoder, which is 20384 bytes in the embodiment.

[0045] S202: extracting the learnable parameters of the decoder and the hidden variables generated by the encoder corresponding to each compression data.

[0046] In the embodiment, the compression data is restored to 10192 floating-point values in single-precision floating-point format, the first 2386 floating-point values are extracted as hidden variables, the last 7824 floating-point values are extracted as autoencoder parameters, the first 2386 floating-point values are extracted as hidden variables H, and the last 7824 floating-point values are extracted as autoencoder parameters.

[0047] S203: constructing the same convolutional autoencoder model as in step S102, loading the learnable parameters of the decoder into the decoder of the convolutional autoencoder model, inputting the hidden variables generated by the encoder into the decoder, and outputting the decompression segment corresponding to the compression data.

[0048] The convolutional autoencoder model same as step S102, that is, the hyperparameters of the model are same.

[0049] S204: connecting each decompressed segment in sequence to generate decompressed electrocardiogram data.

[0050] The method of the embodiment has the advantages of not relying on the generalization performance of the neural network, higher data restoration quality compared with the general convolutional autoencoder, and limited compromise of the code rate. By calculating the compression ratio (taking the parameters in the specific implementation as an example): the length of the compressed data is: 2386 (hidden variables) + 7824 = 10192 floating points, if represented by half-precision floating points, the occupied size is 20384 bytes, the original data is 12000*8 (leads) = 96000 short integers, occupying 192000 bytes, and the compression ratio is about 9.5. The method has a high requirement for computing power, but if there is the assistance of GPU hardware, the acceptable quasi-real-time performance can also be obtained through parallel computing acceleration.

[0051] Embodiment two:

[0052] The application further provides an electrocardiogram data compression terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps in the above method embodiments of the first embodiment of the application when executing the computer program.

[0053] Further, as an executable scheme, the electrocardiogram data compression terminal device can be a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The electrocardiogram data compression terminal device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the above-mentioned composition structure of the electrocardiogram data compression terminal device is only an example of the electrocardiogram data compression terminal device, and does not constitute a limitation on the electrocardiogram data compression terminal device, and can include more or fewer components than the above, or combine certain components, or different components, for example, the electrocardiogram data compression terminal device can also include an input / output device, a network access device, a bus and the like, and the embodiments of the application do not limit this.

[0054] Further, as an executable solution, the processor can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor or the like, which is a control center of the electrocardiogram data compression terminal device and connects various parts of the electrocardiogram data compression terminal device through various interfaces and lines.

[0055] The memory can be used to store the computer program and / or modules, and the processor realizes various functions of the electrocardiogram data compression terminal device by running or executing the computer program and / or modules 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 at least one application program required by a function; and 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 nonvolatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state memory device.

[0056] The application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the method provided in the embodiments of the application.

[0057] The modules / units integrated in the electrocardiogram data compression terminal device, if realized in the form of software function units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware. The computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be realized. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM) and software distribution medium, etc.

[0058] Although the present application is specifically shown and described in conjunction with the preferred embodiments, it should be understood that various changes in form and details can be made therein without departing from the spirit and scope of the application as defined in the appended claims.

Claims

1. A method for electrocardiogram data compression, comprising a compression procedure and a decompression procedure, characterized in that, Wherein: Compression process: S101: The ECG data to be compressed is divided into original segments of a rated length; S102: A convolutional autoencoder model is constructed, and for each original segment, the convolutional autoencoder model is trained using the original segment, so that the loss function of the model meets the requirements, and the learnable parameters of the decoder and the hidden variables generated by the encoder in the trained model are combined and taken as the compressed data of the original segment; S103: The compressed data of all original segments is connected and packaged in sequence as a compressed file of the ECG data to be compressed; Decompression process: S201: The content of the compressed file is divided into multiple compressed data according to the length of the compressed data corresponding to each original segment; S202: The learnable parameters of the decoder and the hidden variables generated by the encoder corresponding to each compressed data are extracted; S203: A convolutional autoencoder model identical to that in step S102 is constructed, the learnable parameters of the decoder are loaded into the decoder of the convolutional autoencoder model, and then the hidden variables generated by the encoder are input into the decoder, and the decompressed segment corresponding to the compressed data is output; S204: The decompressed segments are connected in sequence to generate decompressed ECG data.

2. The electrocardiogram data compression method of claim 1, wherein: Before the division in step S101, there is also a step of: resampling the ECG data to be compressed at a fixed sampling rate.

3. The electrocardiogram data compression method of claim 2, wherein: The sampling rate of the resampling is 200 HZ.

4. The electrocardiogram data compression method of claim 1, wherein: Before step S102, there is also a step of: identifying the waveform type corresponding to each original segment, and setting different masks for the original segments according to different waveform types; and setting the condition for stopping training of the convolutional autoencoder model as the loss function being less than the product of the loss function threshold and the mask.

5. The electrocardiogram data compression method of claim 1, wherein: The loss function of the convolutional autoencoder model adopts L1 loss.

6. The electrocardiogram data compression method of claim 1, wherein: The learnable parameters of the decoder and the hidden variables generated by the encoder are both in half-precision floating-point format.

7. The electrocardiogram data compression method of claim 1, wherein: The waveform types corresponding to the original segments include: P wave, QRS wave, artifact, and poor acquisition quality.

8. The electrocardiogram data compression method of claim 7, wherein: The method of setting the mask includes: setting 0.5 at 30 milliseconds before and after the P wave and 60 milliseconds before and after the QRS wave, setting 5 at the positions of the artifact and poor acquisition quality, and setting 1 at the remaining positions.

9. An electrocardiogram data compression terminal device, characterized by: 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 of any one of claims 1-8 when executing the computer program.

10. A computer readable storage medium storing a computer program, characterized in that: The computer program is executed by the processor to implement the steps of the method of any one of claims 1-8.

Citation Information

Patent Citations

  • Image compression processing method and device, computer equipment and storage medium

    CN113313777A

  • Systems and methods for compressing data

    US20180063538A1