An electrocardiogram data compression method and device

Through the deep reinforcement learning network, the most suitable compression scheme is selected and the ECG data is compressed, which solves the problems of insufficient utilization, poor adaptability and low compression rate in the prior art, and achieves more efficient data compression.

CN112863653BActive Publication Date: 2025-06-13WUHAN ZHONGQI BIOLOGICAL MEDICAL ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110224551.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-01
Publication Date
2025-06-13
Estimated Expiration
2041-03-01

AI Technical Summary

Technical Problem

The existing ECG data compression methods have problems such as insufficient characteristics, poor adaptability and low compression rate of ECG data.

Method used

By collecting ECG data samples, establish an alternative compression scheme space, and use a deep reinforcement learning network to select the most suitable compression scheme from it, and compress the compressed ECG data.

Benefits of technology

Improves the adaptability and compression rate of ECG data compression, maintains the characteristics of the data, reduces signal distortion, and generates appropriate compression scheme parameters without labels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112863653B_ABST
    Figure CN112863653B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for electrocardiogram (ECG) data compression, which includes the following steps: collecting ECG data samples to establish an ECG data sample set, and establishing an alternative compression scheme space based on the characteristics of the ECG data; training a deep reinforcement learning network based on the ECG data segment sample set and the alternative compression scheme space to obtain a compression scheme selection model; inputting the ECG data to be compressed into the compression scheme selection model to obtain a matching compression scheme; and compressing the ECG data to be compressed based on the matching compression scheme. The ECG data compression method provided by the present invention fully considers the characteristics of the ECG data, has strong adaptability and a high compression ratio.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electrocardiogram data compression, and particularly to an electrocardiogram data compression method, device and computer storage medium. Background Art

[0002] Electrocardiogram examination has long been one of the routine examination techniques in clinical medicine. Wherever there is medical activity, there is an electrocardiogram. According to the requirements of the American Heart Association (AHA), an electrocardiogram signal must consist of 3 separate leads, the resolution of the ADC is 10 bits, and 500 samples need to be recorded per second. For some special electrocardiogram examinations, such as ambulatory electrocardiogram, 12 leads may be required, the resolution of the ADC is 11 bits, 1000 samples are recorded per second, and the continuous recording duration exceeds 24 hours. If the electrocardiogram signal is converted into a digital format, the computer storage space required for a single electrocardiogram record will exceed 1.32 GB.

[0003] In the United States, for the purpose of comparison and analysis, more than 10 million electrocardiograms need to be recorded every year. In China, it is reported that 35 million people undergo ambulatory electrocardiogram examinations every year. In addition, in recent years, major hospitals have started to equip or have already equipped with remote electrocardiogram monitoring systems. Such a huge demand for electrocardiogram data transmission and storage puts forward higher requirements for effective electrocardiogram data compression methods.

[0004] Currently, the methods for electrocardiogram data compression mainly include: the turning point method and the AZTEC method.

[0005] The turning point method realizes the compression of the original data by analyzing the trend of the sampling points and reducing every two data points in the original signal to one data point in the encoded signal. The "turning point method" also gets its name because it retains all the turning points (points where the positive and negative signs of the signal slope change) in the signal. The turning point method has two main advantages: ① simple and easy to implement; ② it has the same data compression for low-information areas and high-information areas, such as the isoelectric region, low-frequency P waves and T waves in the low-information area. The disadvantages of the turning point method are: ① the algorithm must be used twice to compress the original data. The turning point method can still maintain the resolution of the QRS complex after being applied once, but distortion will occur after the second time; ② due to the unequal time intervals of the saved points, short-term time distortion will be caused.

[0006] AZTEC, whose full name is Amplitude Zone Time Epoch Coding, mainly processes the original electrocardiogram data by converting it into shorter straight lines and oblique lines. The processing process generally includes three parts: generating horizontal lines, generating oblique lines, and curve smoothing, where curve smoothing is achieved based on parabola fitting. The advantages of this method are large data compression ratio, encoding format consistent with the characteristics of the signal interval, and the ability to eliminate baseline noise to a certain extent; the disadvantage is that there is a certain degree of signal distortion, and the waveform after algorithm processing is different from the waveform that doctors are used to seeing. Currently, the AZTEC data compression algorithm has been widely used in the data compression fields of electrocardiogram monitors and databases.

[0007] In addition, general data compression methods, such as static Huffman coding, adaptive or dynamic Huffman coding, etc., are also directly applied to electrocardiogram data compression.

[0008] Generally speaking, general-purpose data compression methods, whether static or adaptive, have the following deficiencies: ① On the one hand, there are defects in the error-proneness of data compression; ② On the other hand, due to the lack of full utilization of the unique characteristics of electrocardiogram data, it is difficult to improve the compression ratio. As for the turning point method and the AZTEC method, there are problems of signal distortion. Summary of the Invention

[0009] In view of this, it is necessary to provide an electrocardiogram data compression method, device, and computer storage medium to solve the problems of insufficient utilization of electrocardiogram data characteristics, poor adaptability, and low compression ratio existing in the current electrocardiogram data compression scheme.

[0010] The present invention provides an electrocardiogram data compression method, including the following steps:

[0011] Collect electrocardiogram data samples to establish an electrocardiogram data sample set, and establish an alternative compression scheme space based on electrocardiogram data characteristics;

[0012] Based on the electrocardiogram data sample set and the alternative compression scheme space, conduct deep reinforcement learning network training to obtain a compression scheme selection model;

[0013] Input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme;

[0014] Based on the matching compression scheme, perform data compression on the electrocardiogram data to be compressed.

[0015] Further, collecting electrocardiogram data segment samples to establish an electrocardiogram data segment sample set is specifically:

[0016] Collect multiple segments of electrocardiogram (ECG) data samples with different lengths, and copy each of the ECG data samples multiple times to obtain the ECG data sample set.

[0017] Further, establish an alternative compression scheme space based on ECG data characteristics, specifically:

[0018] Establish different main compression scheme sets based on different local characteristics of the ECG data. Each main compression scheme set contains multiple sub-compression schemes for compressing data points. Combine multiple main compression scheme sets to obtain the alternative compression scheme space.

[0019] Further, based on the ECG data sample set and the alternative compression scheme space, perform deep reinforcement learning network training to obtain a compression scheme selection model, specifically:

[0020] Input the ECG data segment samples into the deep reinforcement learning network to obtain multiple alternative compression schemes;

[0021] Use a normalization function to calculate the probabilities of the optional values of each control parameter in each alternative compression scheme, and sample the optional values of each control parameter according to the probabilities to obtain the actual values of each control parameter;

[0022] Determine the output compression scheme based on the actual values of each control parameter;

[0023] Use the output compression scheme to actually compress the ECG data segment samples, and calculate the loss value of the compression by the output compression scheme;

[0024] Correct the deep reinforcement learning network according to the loss value;

[0025] Judge whether the termination condition is satisfied. If so, output the current deep reinforcement learning network model as the compression scheme selection model; otherwise, use the next ECG data segment sample to train the deep reinforcement learning network.

[0026] Further, the deep reinforcement learning network includes a spatial pyramid layer and a fully connected layer.

[0027] Further, input the ECG data to be compressed into the compression scheme selection model to obtain a matching compression scheme, specifically:

[0028] Divide the ECG data to be compressed into multiple segments, and input them into the compression scheme selection model to obtain the probabilities of the control parameters of each data segment. Select the control parameter with the largest probability value among all data segments as the final control parameter of the ECG data to be compressed, and determine the matching compression scheme based on the final control parameter.

[0029] Further, before inputting the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme, the following steps are also included:

[0030] Perform delta encoding on the electrocardiogram data to be compressed to obtain the difference between adjacent two data points, and determine whether all the differences are equal. If so, model and compress the electrocardiogram data to be compressed using an arithmetic progression; otherwise, input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme.

[0031] Further, based on the matching compression scheme, perform data compression on the electrocardiogram data to be compressed. Specifically:

[0032] The electrocardiogram data to be compressed includes voltage value data and timestamp data;

[0033] Set a fixed compression scheme for the timestamp data according to the characteristics of the timestamp data;

[0034] Perform data compression on the timestamp data using the fixed compression scheme;

[0035] Perform data compression on the voltage value data based on the matching compression scheme.

[0036] The present invention also provides an electrocardiogram data compression device, including a processor and a memory. A computer program is stored on the memory, and when the computer program is executed by the processor, the electrocardiogram data compression method is implemented.

[0037] The present invention also provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the electrocardiogram data compression method is implemented.

[0038] Beneficial effects: The present invention first establishes an alternative compression scheme space based on the characteristics of electrocardiogram data, and then, based on the method of deep reinforcement learning, selects the most suitable compression scheme for each data point from the alternative compression scheme space. Compared with traditional data compression based on manually constructing features with prior knowledge, since this method automatically mines the internal characteristics of electrocardiogram data to establish an alternative compression scheme space and then selects the most suitable compression scheme, its adaptability is stronger; this method converts the problem of selecting a compression scheme into a multi-label classification problem, uses deep learning, and with the help of the data mining and reconstruction capabilities of deep learning, can better preserve the characteristics of electrocardiogram data, ensure the encoding effect, and at the same time obtain a high data compression ratio. At the same time, due to the introduction of deep reinforcement learning technology, the appropriate compression scheme parameters of the input electrocardiogram data can be generated without labels. Description of the Drawings

[0039] Figure 1Flowchart of the first embodiment of the electrocardiogram data compression method provided by the present invention;

[0040] Figure 2a Schematic diagram of electrocardiogram data containing multiple data distribution patterns;

[0041] Figure 2b Schematic diagram of the characteristics of different data distribution patterns of electrocardiogram data;

[0042] Figure 3 Schematic diagram of the division of the compression scheme selection stage in the first embodiment of the electrocardiogram data compression method provided by the present invention;

[0043] Figure 4 Schematic diagram of the training of the deep reinforcement learning network in the first embodiment of the electrocardiogram data compression method provided by the present invention. Detailed implementation manners

[0044] The following will specifically describe the preferred embodiments of the present invention with reference to the accompanying drawings. The accompanying drawings form a part of this application and are used together with the embodiments of the present invention to explain the principles of the present invention, rather than to limit the scope of the present invention.

[0045] Embodiment 1

[0046] As Figure 1 shown, Embodiment 1 of the present invention provides an electrocardiogram data compression method, hereinafter referred to as this method, including the following steps:

[0047] S1. Collect electrocardiogram data samples to establish an electrocardiogram data sample set, and establish an alternative compression scheme space based on electrocardiogram data characteristics;

[0048] S2. Based on the electrocardiogram data sample set and the alternative compression scheme space, perform deep reinforcement learning network training to obtain a compression scheme selection model;

[0049] S3. Input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme;

[0050] S4. Perform data compression on the electrocardiogram data to be compressed based on the matching compression scheme.

[0051] In this embodiment, an alternative compression scheme space is first established based on the characteristics of electrocardiogram data, and then, based on the method of deep reinforcement learning, the most suitable compression scheme is selected for each data point from the alternative compression scheme space. Compared with traditional data compression that manually constructs features based on prior knowledge, since this method automatically mines the internal characteristics of electrocardiogram data to establish the alternative compression scheme space and then selects the most suitable compression scheme, its adaptability is stronger. This method converts the problem of selecting a compression scheme into a multi-label classification problem, uses deep learning, and with the data mining and reconstruction capabilities of deep learning, it can better preserve the characteristics of electrocardiogram data, ensure the encoding effect, and at the same time obtain a high data compression ratio. At the same time, due to the introduction of deep reinforcement learning technology, the appropriate compression scheme parameters of the input electrocardiogram data can be generated without labels.

[0052] Preferably, electrocardiogram data segment samples are collected to establish an electrocardiogram data segment sample set, specifically:

[0053] Collect multiple electrocardiogram data samples with different lengths, and copy each of the electrocardiogram data samples multiple times to obtain the electrocardiogram data sample set.

[0054] Collect electrocardiogram data samples, which do not necessarily have the same length, and copy each electrocardiogram data sample times to construct an electrocardiogram data sample set.

[0055] Preferably, an alternative compression scheme space is established based on the characteristics of electrocardiogram data, specifically:

[0056] Based on different local characteristics of electrocardiogram data, different main compression scheme sets are established. Each main compression scheme set contains multiple sub-compression schemes for compressing data points, and the alternative compression scheme space is obtained by combining multiple main compression scheme sets.

[0057] The compression algorithm actually refers to two algorithms:

[0058] Compression algorithm: The input data is generated into a representation that requires fewer binary digits ;

[0059] Reconstruction algorithm: Perform operations on the compressed data representation to generate a reconstruction result .

[0060] If the reconstruction result is the same as the input data , it is lossless compression. If the reconstruction result y is the same as the input data If they are different, it is lossy compression. By convention, the compression algorithm and the reconstruction algorithm are usually combined and called the compression algorithm.

[0061] Generally, the development of a compression algorithm for specific data is divided into two stages: the modeling stage and the encoding stage.

[0062] Modeling stage: By analyzing the internal characteristics of the data, mainly the redundancy of the data, and describing it with a model. For example, differential encoding methods (delta, delta-of-delta) can be used to model sequence data where adjacent values are relatively close.

[0063] Encoding stage: Describe the model in an encoding way, as well as the difference between the data and the model, that is, the residual, usually using a binary symbol system.

[0064] After the above two-stage processing, we only need to transmit and store the parameters of the model and the residual sequence to achieve compression.

[0065] For electrocardiogram data, through actual observation, we find that it has the following important characteristics:

[0066] 1. Temporal correlation and similarity of measured values.

[0067] Electrocardiogram data is often collected at relatively fixed time intervals, which is also called the sampling interval. This way will result in:

[0068] a. In the recorded data, the timestamps increase steadily with a relatively fixed value;

[0069] b. The measured values obtained at consecutive timestamps are relatively close.

[0070] Table 1 shows a partial electrocardiogram signal record with record number 801 in the MIT-BIH supraventricular arrhythmia dataset, abbreviated as the SVDB dataset.

[0071] Table 1. Partial signal record values of record number 801 in the SVDB dataset

[0072]

[0073] As can be seen from Table 1, the timestamps of this electrocardiogram increase at a fixed interval of approximately 8 ms (some are 7 ms), and the electrocardiogram signal values recorded from 00:00:31.320 to 00:00:31.375 are relatively close.

[0074] 2. Diversity of data distribution patterns.

[0075] Figure 2aAs an electrocardiogram (ECG) data actually collected, it can be seen from the figure that this ECG shows at least four different local data distribution patterns, namely: Pattern A, Pattern B, Pattern C, and Pattern D. Such situations are also very common in actual ECGs.

[0076] 3. Diversity of data sub-segment preference schemes.

[0077] As Figure 2b shown, Figure 2b the figure shows data sub-segments of three different data distribution patterns, namely: Region A, Region B, and Region C. For the measured values in Region A and Region B, it is more suitable to model them through first-order or second-order differences, which can retain the relationship between adjacent two sampling points or the dynamic relationship between adjacent three sampling points. For the C-point region, since it is a peak / valley point region, the data on both sides of this point are sometimes symmetric and relatively close in some cases. The data can be compressed through exclusive OR operation to remove redundant data and only leave different data.

[0078] The above features are crucial for guiding how to design or select effective data compression algorithms in actual work.

[0079] According to the structural type (redundancy) characteristics in the ECG voltage value data, here we define 4 methods suitable for modeling such redundancy, as shown in Table 2.

[0080] Table 2. Four data redundancy modeling methods

[0081]

[0082] In Table 2, is the voltage value at the sampling moment, is the voltage value at the sampling moment, is the voltage value at the sampling moment, is the previous sampling moment of is the previous sampling moment of

[0083] The methods suitable for encoding the differences between the above modeling models and the original ECG input data are shown in Table 3.

[0084] Table 3. Three model and residual coding methods

[0085]

[0086] Next, the construction of the alternative compression method space S is carried out. In theory, if we randomly select a modeling method from Table 2 and combine it with an encoding method from Table 3, we can obtain a compression scheme. Different combinations of all methods in the two tables constitute the alternative compression method space S. However, the drawback of this operation is that it is necessary to add control information bits for mode selection (5 bits) and corresponding parameters (2 bits) to the encoding result. As shown in Table 4, it is easy to calculate that the ratio of the control information bits to the number of bits required for encoding the original data is close to 50%.

[0087] Table 4. Parametric Representation of the Compression Scheme Space S

[0088]

[0089] The six types of encoding methods in Table 3 specifically refer to: two types of offset encoding, three types of bitmask encoding, and one type of trailing zero encoding. The two types of offset encoding correspond to two output formats. The three types of bitmask encoding correspond to two output formats. In the "1 value" output mode, there are at most 2 bitmasks, so there are two cases: 1-bitmask encoding and 2-bitmask encoding; in the "2 values" case, only 2 bitmasks are used; therefore, the two output formats of bitmask encoding are a total of three types. There are three types of bitmask encoding, two types of offset encoding, and one type of trailing zero encoding. In total, 2 + 3 + 1 = 6 types.

[0090] To address the above problems, we divide the selection of the compression scheme for each data point into two stages: converting the problem of selecting the most suitable scheme from a large number of alternative compression schemes into a two-stage selection problem with a primary and a secondary stage: first, select the primary scheme suitable for the data segment containing the data point; for the specific data point, traverse the sub-schemes to select the optimal compression scheme. Specifically, as Figure 3 shown:

[0091] In the first stage, global features are extracted for the ECG data segment, and a suitable primary compression scheme is selected based on the global features. The primary compression schemes in this embodiment are divided according to the encoding method, including schemes mainly based on mask encoding, schemes mainly based on offset encoding, and hybrid encoding schemes that combine mask encoding and offset encoding, as shown in Table 5. Then, select the data redundancy modeling method from Table 2. It may be necessary to perform multiple redundant modelings on the data. For example, first perform a first-order encoding operation on the data, then continue to perform an exclusive OR operation on the obtained data, and then perform a first-order difference operation, etc., until the redundancy in the data is reduced to a very low level. To reduce the computational complexity, here we perform at most four redundant modelings, namely, redundant modeling method 1, redundant modeling method 2, redundant modeling method 3, redundant modeling method 4, plus two parameters, offByteShift and maskByteShift, which together constitute the parameter space of the alternative compression scheme;

[0092] In the second stage, each data point in the ECG data segment is processed, and all sub-compression schemes under the corresponding main compression scheme are traversed, and the best sub-compression scheme is selected from them for compression.

[0093] After the above processing, only 2 bits are required for the control information bit.

[0094] Specifically, the three types of main compression schemes suitable for ECG data selected in this embodiment are shown in Table 5.

[0095] Table 5, Three Types of Main Compression Schemes

[0096]

[0097] The parametric representation of the compression scheme space S is further refined as shown in Table 6.

[0098] Table 6, Parametric Compression Scheme Space

[0099]

[0100] Among them, the compression scheme is the basic unit for compressing a single data point and can be represented as a quadruple , where is the value of the data point to be compressed as input, is the representation of the compressed data point, and are respectively and corresponding parameters. The compression scheme space refers to the set composed of a series of compression schemes, denoted by . Each data point has a single compression scheme space suitable for it, and will be compressed and stored through a specific compression scheme in this scheme space.

[0101] Preferably, the deep reinforcement learning network includes a spatial pyramid layer and a fully connected layer.

[0102] Considering that the spatial pyramid pooling network structure can exhibit the redundant structure of the structural type information, that is, the minimum data segment lengths required for the structural type information are different, so in this embodiment, the spatial pyramid pooling network structure, that is, the spatial pyramid layer, is added to the deep reinforcement learning network.

[0103] Specifically, as Figure 4 shown, the neural network model constructed in this embodiment includes a spatial pyramid layer, a fully connected layer 1, a fully connected layer 2, and a fully connected layer 3.

[0104] Preferably, based on the electrocardiogram data sample set and the alternative compression scheme space, a deep reinforcement learning network is trained to obtain a compression scheme selection model, specifically as follows:

[0105] Input the electrocardiogram data segment sample into the deep reinforcement learning network to obtain multiple alternative compression schemes;

[0106] Use a normalization function to calculate the probability of the optional values of each control parameter in each alternative compression scheme, and sample the optional values of each control parameter according to the probability to obtain the actual values of each control parameter;

[0107] Determine the output compression scheme based on the actual values of each control parameter;

[0108] Use the output compression scheme to actually compress the electrocardiogram data segment sample, and calculate the loss value of the compression by the output compression scheme;

[0109] Correct the deep reinforcement learning network according to the loss value;

[0110] Judge whether the termination condition is satisfied. If so, output the current deep reinforcement learning network model as the compression scheme selection model. Otherwise, use the next electrocardiogram data segment sample to train the deep reinforcement learning network.

[0111] After dividing the matching of the compression scheme into two stages, the compression scheme selection problem in the first stage can be regarded as a multi-label classification problem, and the labels are the optional values of all control parameters. In this embodiment, there are 23 control parameters in total, that is, the 23 values in the "value range" in Table 6. Since there are no labeled training samples, reinforcement learning is used to train and obtain the above several control parameters.

[0112] As Figure 4 shown, the specific training process is as follows:

[0113] Randomly select electrocardiogram data segment samples (not necessarily of the same length), and copy each electrocardiogram data segment sample times, input it into the spatial pyramid layer, and then input it into a fully connected network with 3 hidden layers. The three hidden layers are the fully connected layer 1, the fully connected layer 2, and the fully connected layer 3 in Figure 4. After the electrocardiogram data segment sample passes through the deep reinforcement learning network, it will obtain control parameters of alternative compression schemes , alternative compression schemes correspond to electrocardiogram data segment samples; use the normalization function region softmax to calculate each alternative compression scheme The probability of the optional value of each control parameter, and then sample and select the actual parameter value of the corresponding control parameter according to this probability, and calculate to obtain After the actual parameter value of each control parameter in Input it into the underlying compression algorithm for actual compression and obtain the compression ratio And calculate the loss value, and update the parameters of the deep reinforcement learning network and backpropagate accordingly to realize the training of the deep reinforcement learning network.

[0114] Train each electrocardiogram data sample in sequence according to the above steps until the termination condition is reached, such as reaching the maximum number of times, then stop training, output the deep reinforcement learning network model, and obtain the compression scheme selection model.

[0115] Preferably, calculate the loss value of compressing with the alternative compression scheme, specifically:

[0116] ;

[0117] Among them, is the loss value; is the number of electrocardiogram data segment samples with different lengths collected, is the number of copies of the electrocardiogram data segment sample; is the reward function, that is, under the condition of selecting the alternative compression scheme the compression ratio of the electrocardiogram data segment sample; is the normalized reward function, which judges whether the compression ratio of the electrocardiogram data segment sample under the alternative compression scheme is higher than the average compression ratio of copies of electrocardiogram data segment samples (N different samplings of the same data segment). If so, it is positive feedback, otherwise it is negative feedback. The normalized reward function is used to describe the compression effect of the electrocardiogram data segment sample; is the reward function value of the th electrocardiogram data segment sample, that is, the compression ratio value; is the total cross entropy of the th electrocardiogram data segment sample; is the regularization constant, takes the value of 0.01 or 0.001; is the average entropy of all alternative compression schemes used for entropy regularization, which is used to prevent the network from falling into local optimum; is the set of control parameters of the alternative compression scheme, is the value of the th control parameter of the alternative compression scheme, represents the set of control parameters of the th electrocardiogram data segment sample.

[0118] Preferably, input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme. Specifically:

[0119] Divide the electrocardiogram data to be compressed into multiple segments, and input them into the compression scheme selection model to obtain the probabilities of the control parameters for each data segment. Select the control parameter with the largest probability value among all data segments as the final control parameter for the electrocardiogram data to be compressed, and determine the matching compression scheme based on the final control parameter.

[0120] When matching the compression scheme, the entire electrocardiogram data to be compressed or a local data segment of the electrocardiogram data to be compressed can be input into the compression scheme selection model to obtain the probabilities of the control parameters for each data segment, and select the one with the largest probability value among all data segments as the final control parameter for the input data.

[0121] Preferably, before inputting the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme, it further includes:

[0122] Perform delta coding on the electrocardiogram data to be compressed to obtain the difference between adjacent two data points, and judge whether all the differences are equal. If so, use an arithmetic sequence to model and compress the electrocardiogram data to be compressed; otherwise, input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme.

[0123] In this embodiment, when performing compression coding on the electrocardiogram data to be compressed, first judge whether the electrocardiogram data to be compressed is an arithmetic sequence with equal differences. If so, directly use the arithmetic sequence for modeling and data compression, and there is no need to match the compression scheme anymore, because for electrocardiogram data with equal differences, using an arithmetic sequence for modeling is a suitable method.

[0124] Specifically, the process of compressing and coding the voltage value data in the electrocardiogram data to be compressed in this embodiment is as follows:

[0125] Perform delta coding on the voltage value. The first value remains unchanged, and starting from the second value, calculate its value, that is .

[0126] If all are equal, an arithmetic sequence can be used to model the voltage value data, and only record the first value, value, and the quantity. The first value is the initial value of the arithmetic sequence, value is the common difference of the arithmetic sequence, and the quantity is the data length of the arithmetic sequence;

[0127] If values are not all equal, then: use the zig-zag method to convert the signed values into unsigned values ; Then for each value, the compression scheme selection model traverses all available alternative compression schemes in the space of available alternative compression schemes, compresses and stores the data , and calculates the corresponding compression ratio; finally, the scheme with the largest compression ratio is selected for numerical compression.

[0128] Zig-zag coding: Zig-zag is a variable-length coding for signed numbers. It mainly moves the sign bit to the lowest bit, so that numbers with smaller absolute values will occupy fewer coding bits.

[0129] Preferably, the data compression of the electrocardiogram data to be compressed is performed based on the matching compression scheme, specifically:

[0130] The electrocardiogram data to be compressed includes voltage value data and timestamp data;

[0131] A fixed compression scheme for the timestamp data is set according to the characteristics of the timestamp data;

[0132] The fixed compression scheme is used to perform data compression on the timestamp data;

[0133] The voltage value data is compressed based on the matching compression scheme.

[0134] The electrocardiogram data includes the following three main attributes: timestamp, voltage value, and other information. The timestamp is used to record the moment when the data is collected. The voltage value generally does not exceed ±5 mV. Other information includes which lead the data is collected from, ADC value, AD resolution, gain, etc. For the same electrocardiogram data, the other information of each sampling point is the same, and usually a separate file is used for storage. Therefore, there is no redundancy in other information and no modeling is required. The redundancy of electrocardiogram data mainly lies in the timestamp and voltage value, or in other words, the compression of electrocardiogram data is mainly divided into the compression of the timestamp and the compression of the voltage value.

[0135] Since the characteristics of the timestamp data are basically the same, in this embodiment, a fixed compression scheme is directly selected to compress it. The compression scheme selection model is mainly used to select a matching compression scheme for the voltage value data, so as to realize the compression of the voltage value data.

[0136] The fixed compression scheme for compressing the timestamp data selected in this embodiment is specifically described as follows.

[0137] The numerical incrementality shown by the timestamp data makes it very suitable for modeling using differential coding.

[0138] Denote the timestamp data set of the electrocardiogram data as , where, is a subset of and represents the th time block of the timestamp data, where , is the th timestamp on the time block . All timestamp data is represented by 8 bytes. The compression process of the timestamp data is as follows:

[0139] S100: First, perform second-order difference encoding, i.e., delta-of-delta encoding. Keep the first and second data unchanged, and starting from the 3rd data, calculate the differences to obtain the difference set , .

[0140] S200: If all the differences in the difference set are the same, then the timestamp data can be modeled using only an arithmetic progression. The arithmetic progression modeling is as follows: Only record the first value, value, and the quantity. The first value is the initial value of the arithmetic progression, value is the common difference of the arithmetic progression, and the quantity is the data length of the arithmetic progression. In the encoding stage, for the model, just select an appropriate encoding method according to the characteristics of the above three values, such as offset, bitmask, trailing zero, and store it directly after encoding. For the difference between the data and the model, i.e., the residual, since its value is all 0, it can be represented by 1 bit.

[0141] S300: If all the differences in the difference set are not all the same, then encode it in the following way. If , then only store 0 in the header part header of the encoding. If , then store "0b1" in the header part header of the encoding, occupying 1 bit; store the value of in the data part data of the encoding, occupying 3 bits), a total of 4 bits. Finally, return the header, data list.

[0142] Taking the timestamp data in Table 1 as an example, the first six timestamp data are: 00:00:31.320; 00:00:31.328; 00:00:31.335; 00:00:31.343; ​​00:00:31.351; 00:00:31.359;

[0149] After the delta-of-delta operation, the output is shown in Table 7:

[0150] Table 7. Output Encoding of Delta-of-Delta Operation

[0151]

[0152] The initial timestamp is (00:00:31.320, 00:00:31.328). The encoding format is (0x7A59, 0x7A60, ), and the original encoding is (1100 || 0b101 001). The original timestamp requires 6 8 bytes = 48 bytes = 384 bits. After compression, only 2 8 8 + 4 + 6 = 138 bits. This greatly saves storage space. It can be understood that when the quantity of timestamp data is large, the storage space saving effect after compression is more obvious.

[0153] Embodiment 2

[0154] Embodiment 2 of the present invention provides an electrocardiogram data compression device, including a processor and a memory. A computer program is stored on the memory, and when the computer program is executed by the processor, it implements the electrocardiogram data compression method provided in Embodiment 1.

[0155] The electrocardiogram data compression device provided in the embodiment of the present invention is used to implement the electrocardiogram data compression method. Therefore, the technical effects possessed by the electrocardiogram data compression method are also possessed by the electrocardiogram data compression device, which will not be elaborated herein.

[0156] Embodiment 3

[0157] Embodiment 3 of the present invention provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the electrocardiogram data compression method provided in Embodiment 1.

[0158] The computer storage medium provided in the embodiment of the present invention is used to implement the electrocardiogram data compression method. Therefore, the technical effects possessed by the electrocardiogram data compression method are also possessed by the computer storage medium, which will not be elaborated herein.

[0159] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.

Claims

1. An electrocardiogram data compression method, characterized in that, it includes the following steps: Collect electrocardiogram data samples to establish an electrocardiogram data sample set, and establish an alternative compression scheme space based on electrocardiogram data characteristics; Based on the electrocardiogram data sample set and the alternative compression scheme space, perform deep reinforcement learning network training to obtain a compression scheme selection model; Input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme; Compress the electrocardiogram data to be compressed based on the matching compression scheme; Among them, based on the electrocardiogram data sample set and the alternative compression scheme space, perform deep reinforcement learning network training to obtain a compression scheme selection model, specifically: Input the electrocardiogram data segment samples into the deep reinforcement learning network to obtain multiple alternative compression schemes; Use a normalization function to calculate the probability of the optional values of each control parameter in each alternative compression scheme, and sample the optional values of each control parameter according to the probability to obtain the actual values of each control parameter; Determine the output compression scheme based on the actual values of each control parameter; Use the output compression scheme to actually compress the electrocardiogram data segment samples, and calculate the loss value of the compression by the output compression scheme; Correct the deep reinforcement learning network according to the loss value; Judge whether the termination condition is satisfied. If so, output the current deep reinforcement learning network model as the compression scheme selection model. Otherwise, use the next electrocardiogram data segment sample to train the deep reinforcement learning network and establish an alternative compression scheme space based on electrocardiogram data characteristics, specifically: Establish different main compression scheme sets based on different local characteristics of electrocardiogram data. Each main compression scheme set contains multiple sub-compression schemes for compressing data points. Combine multiple main compression scheme sets to obtain the alternative compression scheme space; Compress the electrocardiogram data to be compressed based on the matching compression scheme, specifically: The electrocardiogram data to be compressed includes voltage value data and timestamp data; Set a fixed compression scheme for the timestamp data according to the characteristics of the timestamp data; Use the fixed compression scheme to compress the timestamp data; Compress the voltage value data based on the matching compression scheme.

2. The electrocardiogram data compression method according to claim 1, characterized in that, Collect electrocardiogram data segment samples to establish an electrocardiogram data segment sample set, specifically: Collect multiple segments of electrocardiogram data samples with different lengths, and copy each electrocardiogram data sample multiple times to obtain the electrocardiogram data sample set.

3. The electrocardiogram data compression method according to claim 1, characterized in that, The deep reinforcement learning network includes a spatial pyramid layer and a fully connected layer.

4. The electrocardiogram data compression method according to claim 1, characterized in that, Input the electrocardiogram data to be compressed into the compression scheme selection model to obtain a matching compression scheme, specifically: The electrocardiogram data to be compressed is divided into multiple segments and input into the compression scheme selection model to obtain the probabilities of the control parameters for each data segment. The control parameter with the maximum probability value among all data segments is selected as the final control parameter for the electrocardiogram data to be compressed, and the matching compression scheme is determined based on the final control parameter.

5. The electrocardiogram data compression method according to claim 1, characterized in that, before inputting the electrocardiogram data to be compressed into the compression scheme selection model to obtain the matching compression scheme, it further includes: performing delta coding on the electrocardiogram data to be compressed to obtain the differences between adjacent data points, and determining whether all the differences are equal. If so, an arithmetic progression is used to model and compress the electrocardiogram data to be compressed; otherwise, the electrocardiogram data to be compressed is input into the compression scheme selection model to obtain the matching compression scheme.

6. An electrocardiogram data compression device, characterized in that, it includes a processor and a memory, and a computer program is stored on the memory. When the computer program is executed by the processor, the electrocardiogram data compression method according to any one of claims 1-5 is implemented.

7. A computer storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the electrocardiogram data compression method according to any one of claims 1-5 is implemented.

Citation Information

Patent Citations

  • Physiological signal compressing method and system and medical device

    CN104739509A

  • Picture dynamic adaptive compression method based on reinforcement learning

    CN110210548A