Training of waveform recognition model, electrocardiogram waveform recognition method, device and equipment
By augmenting the data of the electrocardiogram waveform signal, multiple training samples are generated and inputted into the waveform recognition model, the problem of insufficient existing data is solved and the recognition accuracy of the waveform recognition model is improved.
Patent Information
- Application Number
- CN202110902579.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-06
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-08-06
AI Technical Summary
The existing data set with complete labels is not enough to support the waveform recognition model with high accuracy, resulting in the waveform recognition accuracy being insufficient.
By obtaining the electrocardiogram waveform signal, calculating the number of samples based on its length and preset length, a random number is generated as the starting point of the intercepted sample, thereby generating multiple training samples, inputting them into the waveform recognition model for training, enhancing the data volume and increasing the amount of data Identification accuracy.
Through the data augmentation method, the number and quality of training samples are increased, and the recognition accuracy of the waveform recognition model is improved.
Smart Images

Figure CN113647908B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and specifically to the training of waveform recognition models, and electrocardiogram waveform recognition methods, devices and equipment. Background Art
[0002] The ECG waveform signal is a waveform signal that represents the patient's heart beating condition and is generated by monitoring the patient's heart beating process. By identifying the waveform of the ECG waveform signal based on the waveform recognition model, the waveform in the ECG waveform signal can be determined. Based on the waveform in the identified ECG waveform signal, it is convenient for doctors to analyze the patient's cardiovascular health condition.
[0003] At present, the requirements for the recognition accuracy of waveform recognition models are getting higher and higher. However, in order to train a waveform recognition model with high accuracy, a large amount of training data is required. The amount of data in the existing fully annotated data sets is not enough to support the training of a waveform recognition model with high accuracy. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a waveform recognition model training, ECG waveform recognition method, device and equipment for increasing the sample data volume and improving the recognition accuracy of the waveform recognition model.
[0005] To solve the above problems, the technical solutions provided in the embodiments of the present application are as follows:
[0006] A training method for a waveform recognition model, the method comprising:
[0007] Acquire an ECG waveform signal, wherein each sampling point of the ECG waveform signal corresponds to a label of a waveform classification result;
[0008] Calculating the number of sample divisions according to the length of the ECG waveform signal and a preset length, wherein the number of sample divisions is greater than the ratio of the length of the ECG waveform signal to the preset length;
[0009] Generate n random numbers within the length interval of the electrocardiogram waveform signal, where n is a positive integer and n is the number of sample divisions;
[0010] Taking the n random numbers as first time points respectively, and intercepting the waveform signal between the first time point and a second time point with a preset length away from the first time point from the electrocardiogram waveform signal as a training sample waveform signal;
[0011] Inputting the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, wherein the waveform recognition model includes a feature extraction sub-model and a classification sub-model;
[0012] The waveform recognition model is trained according to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal to obtain a trained waveform recognition model.
[0013] In a possible implementation, the calculating the number of sample divisions according to the length of the electrocardiogram waveform signal and a preset length includes:
[0014] Calculating the difference between the length of the electrocardiogram waveform signal and a preset length to obtain a first value;
[0015] Calculate the quotient of the first value and the random sampling step length to obtain a second value;
[0016] The second value is rounded to an integer to obtain the number of sample divisions.
[0017] In a possible implementation, the method further includes:
[0018] If the first value is less than zero, the ECG waveform signal is acquired again.
[0019] In a possible implementation, the method further includes:
[0020] If the first value is equal to zero, the ECG waveform signal is determined as a training sample waveform signal.
[0021] In a possible implementation, the feature extraction sub-model is a Unet network structure, and the classification sub-model is a conditional random field CRF model;
[0022] The step of inputting the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model comprises:
[0023] Inputting the training sample waveform signal into a feature extraction sub-model to obtain a feature vector of each sampling point of the training sample waveform signal output by the feature extraction sub-model;
[0024] The feature vector of each sampling point of the training sample waveform signal is input into the classification sub-model to obtain the predicted classification result of each sampling point of the training sample waveform signal output by the classification sub-model.
[0025] In a possible implementation, after acquiring the ECG waveform signal, the method further includes:
[0026] The electrocardiogram waveform signal is subjected to wavelet transformation and standardization processing to obtain the electrocardiogram waveform signal again.
[0027] A method for recognizing an electrocardiogram waveform, the method comprising:
[0028] Acquire an electrocardiogram signal to be identified, and extract at least one input waveform signal of a preset length from the electrocardiogram signal to be identified;
[0029] The input waveform signal is input into a waveform recognition model to obtain a waveform classification result of each sampling point in the input waveform signal output by the waveform recognition model, wherein the waveform recognition model is trained according to the above-mentioned training method of the ECG waveform recognition model.
[0030] A training device for a waveform recognition model, the device comprising:
[0031] A first acquisition unit is used to acquire an ECG waveform signal, wherein each sampling point of the ECG waveform signal corresponds to a label of a waveform classification result;
[0032] A calculation unit, configured to calculate a number of sample divisions according to a length of the ECG waveform signal and a preset length, wherein the number of sample divisions is greater than a ratio of the length of the ECG waveform signal to the preset length;
[0033] A generating unit, configured to generate n random numbers within the length interval of the electrocardiogram waveform signal, wherein n is a positive integer and n is the number of sample divisions;
[0034] An interception unit, configured to use the n random numbers as first time points respectively, and intercept a waveform signal between the first time point and a second time point with a preset length away from the first time point from the electrocardiogram waveform signal as a training sample waveform signal;
[0035] An input unit, used to input the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, wherein the waveform recognition model includes a feature extraction sub-model and a classification sub-model;
[0036] The training unit is used to train the waveform recognition model according to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal to obtain a trained waveform recognition model.
[0037] An electrocardiogram waveform recognition device, comprising:
[0038] The acquisition unit is used to acquire the electrocardiogram signal to be identified and to intercept at least one input waveform signal of a preset length from the electrocardiogram signal to be identified.
[0039] An input unit is used to input the input waveform signal into a waveform recognition model to obtain a waveform classification result of each sampling point in the input waveform signal output by the waveform recognition model, wherein the waveform recognition model is trained according to the above-mentioned training method of the ECG waveform recognition model.
[0040] A waveform recognition model training device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the waveform recognition model training method as described above is implemented.
[0041] An electrocardiogram waveform recognition device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electrocardiogram waveform recognition method as described above is implemented.
[0042] A computer-readable storage medium stores instructions, which, when executed on a terminal device, enable the terminal device to execute the training method of the waveform recognition model as described above, or to execute the electrocardiogram waveform recognition method as described above.
[0043] It can be seen that the embodiments of the present application have the following beneficial effects:
[0044] The embodiment of the present application provides a method, device and equipment for training a waveform recognition model and recognizing an ECG waveform. After obtaining an ECG waveform signal with a waveform classification result label at each sampling point, data enhancement is performed on the ECG waveform signal. Specifically, the number of sample divisions n is determined according to the length of the ECG waveform signal and a preset length. Among them, the preset length is the input signal length of the waveform recognition model. N random numbers are generated within the length interval of the ECG waveform signal, and the first time points corresponding to the n random numbers are respectively used as the starting time points of the n training sample waveform signals. The waveform signal between the first time point and the second time point with a preset length from the first time point is intercepted from the ECG waveform signal as the training sample waveform signal. Further, each training sample waveform signal is input into the waveform recognition model to obtain the predicted classification results of each sampling point of the training sample waveform signal output by the waveform recognition model. Among them, the waveform recognition model includes a feature extraction sub-model and a classification sub-model. According to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal, the waveform recognition model is trained to obtain a trained waveform recognition model. Since the training sample waveform signals input into the waveform recognition model are n training sample waveform signals obtained by data enhancement, compared with the existing labeled data set, the amount of training sample data generated by this method increases, which helps to improve the recognition accuracy of the waveform recognition model after training. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic diagram of a scenario example provided in an embodiment of the present application;
[0046] Figure 2 A flowchart of a method for training a waveform recognition model provided in an embodiment of the present application;
[0047] Figure 3 A structural diagram of a waveform recognition model provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of the Unet network structure provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of a conditional random field (CRF) model structure provided in an embodiment of the present application;
[0050] Figure 6 A flowchart of obtaining a training sample waveform signal provided in an embodiment of the present application;
[0051] Figure 7 A flowchart of an electrocardiogram waveform recognition method provided in an embodiment of the present application;
[0052] Figure 8 A schematic diagram of the structure of a waveform recognition model training device provided in an embodiment of the present application;
[0053] Fig. 9 A schematic diagram of the structure of an electrocardiogram waveform recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0055] To facilitate understanding of the technical solution provided by this application, the background technology involved in this application will be described below.
[0056] The ECG waveform signal is a waveform signal that represents the patient's heart beating condition and is generated by monitoring the patient's heart beating process. Since the waveform based on the ECG waveform signal can be used to analyze the patient's health status, it is very important to accurately identify the waveform in the ECG waveform signal. If you want to train a waveform recognition model with high accuracy to identify the waveform in the ECG waveform signal, a large amount of training sample data is required. However, the amount of training sample data in the currently known fully annotated data set is very small, which is not enough to support the training of a waveform recognition model with high accuracy.
[0057] Based on this, the present application embodiment provides a waveform recognition model training, ECG waveform recognition method, device and equipment. In order to facilitate understanding of the waveform recognition model training method provided in the present application embodiment, the following is combined with Figure 1 See the example scenario shown in the figure. Figure 1 , which is a framework diagram of an exemplary application scenario provided in an embodiment of the present application.
[0058] Obtain the ECG waveform signal with the waveform classification result label corresponding to each sampling point. Calculate the number of sample divisions n according to the length of the ECG waveform signal and the preset length. The preset length is the input signal length of the waveform recognition model. The number of sample divisions n is the number of training sample waveform signals that need to be obtained.
[0059] After determining the number of sample divisions n, n random numbers are generated within the length interval of the ECG waveform signal. The time points corresponding to the n random numbers are all first time points. The n first time points are respectively used as the starting time of n training sample waveform signals. Based on the first time point, the waveform signal between the first time point and the second time point with a preset length from the first time point is intercepted from the ECG waveform signal as the training sample waveform signal. Thus, n training sample waveform signals are obtained.
[0060] The acquired n training sample waveform signals are respectively input into the waveform recognition model, and the prediction classification results of each sampling point in the training sample waveform signal are output.
[0061] In addition, since each sampling point in the ECG waveform signal corresponds to a label of the waveform classification result, after determining the training sample waveform signal, the label of the waveform classification result corresponding to each sampling point in the training sample waveform signal can be obtained. Based on the predicted classification results of each sampling point in the training sample waveform signal output by the waveform recognition model and the label of the waveform classification result corresponding to each sampling point in the training sample waveform signal, the waveform recognition model is trained to obtain a trained waveform recognition model.
[0062] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.
[0063] Based on the above description, the training method of the waveform recognition model provided in the present application will be described in detail below in conjunction with the accompanying drawings.
[0064] See also Figure 2 , Figure 2 A flowchart of a waveform recognition model training method provided in an embodiment of the present application. The waveform recognition model training method can be executed by a terminal device. Figure 2As shown, the waveform recognition method includes S201-S206:
[0065] S201: Acquire an ECG waveform signal, wherein each sampling point of the ECG waveform signal corresponds to a label of a waveform classification result.
[0066] The ECG waveform signal is a waveform signal containing information related to the heartbeat obtained by monitoring the heartbeat. Each patient has his or her own ECG waveform signal, and the ECG waveform signals corresponding to several patients can form an ECG waveform signal set.
[0067] Each ECG waveform signal is labeled to determine the label of the waveform classification result corresponding to each sampling point of the ECG waveform signal. The label of the waveform classification result is used in the subsequent training process of the waveform recognition model.
[0068] After obtaining the ECG waveform signal, the ECG waveform signal corresponding to each sampling point with the waveform classification result label can be subjected to wavelet transformation and standardization processing to obtain the ECG waveform signal again. It can be understood that the recovered ECG waveform signal is the ECG waveform signal after wavelet transformation and standardization processing.
[0069] As an example, the wavelet transform adopts the Daubechies wavelet transform algorithm; and the normalization process adopts the z-score normalization.
[0070] In the specific implementation, the Daubechies wavelet transform algorithm is first used to perform wavelet decomposition and wavelet reconstruction on the ECG waveform signal to achieve filtering and denoising of the ECG waveform signal to obtain a low-noise ECG waveform signal. Secondly, the z-score standardization is used to standardize the low-noise ECG waveform signal to obtain the ECG waveform signal again.
[0071] Among them, since there are a large number of signal spikes and mutation signals in the ECG waveform signal, for example, the Q point, R point, and S point in the ECG waveform signal are all signal spikes, and wide QRS and ST segment depression are mutation signals. Signal spikes and mutation signals are helpful for waveform recognition. Therefore, Daubechies wavelet transform is used to filter and denoise the ECG waveform signal to obtain a low-noise ECG waveform signal, thereby protecting the effective signal spikes and mutation signals in the ECG waveform signal.
[0072] In addition, z-score standardization (also known as normalization) is a standardization based on the mean and standard deviation of low-noise ECG waveform signals. Due to different sampling frequencies, each heartbeat in the ECG waveform signal has hundreds to thousands of data points. For an ECG waveform signal containing thousands of heartbeats, the total number of data points will be hundreds of thousands to millions. Considering the calculation speed of the standardization algorithm, the embodiment of the present application selects the z-score algorithm to standardize the ECG waveform signal to increase the speed of standardization and re-acquire the ECG waveform signal.
[0073] S202: Calculate the number of sample divisions according to the length of the ECG waveform signal and a preset length.
[0074] After obtaining the ECG waveform signal with the waveform classification result label corresponding to each sampling point, the number of sample divisions is calculated according to the length of the ECG waveform signal and the preset length. Among them, the preset length is the input signal length of the waveform recognition model. The number of sample divisions is the number of training sample waveform signals, and the training sample waveform signals are used to train the waveform recognition model. After determining the number of sample divisions, the ECG waveform signal can be divided into training sample waveform signals of the number of sample divisions and the preset length.
[0075] It should be noted that the ordinary method determines the amount of training samples of the ECG waveform signal as the ratio of the length of the ECG waveform signal to the preset length. The length of the ECG waveform signal can be understood as the number of sampling points corresponding to the ECG waveform signal. The number of sample divisions in the embodiment of the present application needs to be greater than the ordinary ECG waveform signal training sample amount, that is, the number of sample divisions needs to be greater than the ratio of the length of the ECG waveform signal to the preset length, so as to determine that the total data volume of the training samples has been enhanced, which helps to improve the recognition accuracy of the waveform recognition model after the training is completed.
[0076] In a possible implementation, the embodiment of the present application provides a specific implementation of calculating the number of sample divisions according to the length of the ECG waveform signal and a preset length, including:
[0077] Calculating the difference between the length of the ECG waveform signal and a preset length to obtain a first value;
[0078] Calculate the quotient of the first value and the random sampling step length to obtain a second value;
[0079] The second value is rounded to obtain the number of sample divisions.
[0080] It is understandable that the smaller the random sampling step size, the larger the second value, the larger the number of sample divisions, and the greater the similarity of adjacent training sample waveform signals. Therefore, it is necessary to select a suitable random sampling step size to achieve total data enhancement of the training samples and the similarity of adjacent training sample waveform signals should not be too large. As an example, the random sampling step size can be determined according to the sampling frequency of the ECG waveform signal. For example, the random sampling step size is one twentieth of the sampling frequency. As another example, the random sampling step size can be determined based on experience.
[0081] It should be noted that whether the ECG waveform signal can be divided into samples of the ECG waveform signal can be determined based on the size of the first numerical value. When the first numerical value is greater than zero, the length of the ECG waveform signal is greater than the preset length (i.e., the input signal length of the waveform recognition model), it is determined that the ECG waveform signal can be divided into samples, and the number of sample divisions is greater than or equal to 1. If the first numerical value is equal to zero, that is, the length of the ECG waveform signal is equal to the preset length, the ECG waveform signal is determined to be a training sample waveform signal, and the number of sample divisions is 1. That is, the premise for obtaining the number of sample divisions mentioned above requires that the first numerical value is greater than or equal to zero.
[0082] If the first value is less than zero, the length of the ECG waveform signal is less than the preset length, the ECG waveform signal is reacquired, that is, the labeled ECG waveform signal of another patient is reacquired, and S202 is re-executed to obtain a training sample waveform signal that meets the sample division condition.
[0083] In addition, the embodiment of the present application provides a proof process for the above-mentioned specific implementation method of calculating the number of sample divisions based on the length of the ECG waveform signal and the preset length, so as to prove that the specific implementation method can achieve data enhancement of training samples. Please see below for the specific proof process.
[0084] S203: Generate n random numbers within the length interval of the ECG waveform signal, where n is a positive integer and n is the number of sample divisions.
[0085] After determining the number of sample divisions, n random numbers are generated within the length interval of the ECG waveform signal, where n is a positive integer and n is the number of sample divisions.
[0086] The time point corresponding to each random number can be used as the starting time point of a training sample waveform signal.
[0087] As an example, the length of the ECG waveform signal minus a preset length is taken as the target length, and n random numbers are generated in the interval from zero to the target length.
[0088] S204: Taking n random numbers as first time points respectively, and intercepting waveform signals between the first time point and a second time point with a preset length away from the first time point from the ECG waveform signal as training sample waveform signals.
[0089] The time points corresponding to the n random numbers are all taken as the first time points. Each first time point is the starting time point of each training sample waveform signal. The waveform signal between the first time point and the second time point with a preset length from the first time point is intercepted from the ECG waveform signal as the training sample waveform signal. The training sample waveform signal meets the input signal length of the waveform recognition model.
[0090] Due to the randomness of the random numbers, the acquired n training sample waveform signals can more objectively represent the entire ECG waveform signal.
[0091] S205: Input the training sample waveform signal into the waveform recognition model to obtain the prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, wherein the waveform recognition model includes a feature extraction sub-model and a classification sub-model.
[0092] Input n training sample waveform signals into the waveform recognition model in sequence to train the waveform recognition model. Take a training sample waveform signal as an example, input the training sample waveform signal into the waveform recognition model, and obtain the prediction classification results of each sampling point of the training sample waveform signal output by the waveform recognition model.
[0093] In specific implementation, the waveform recognition model includes a feature extraction sub-model and a classification sub-model. The feature extraction sub-model is used to extract features from the input training sample waveform signal, and after obtaining the extracted result features, the result features are input into the classification sub-model to classify each sampling point in the training sample waveform signal to obtain the predicted classification results of each sampling point of the training sample waveform signal.
[0094] In a possible implementation, the embodiment of the present application provides a specific implementation of inputting a training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, including:
[0095] Inputting the training sample waveform signal into the feature extraction sub-model to obtain the feature vector of each sampling point of the training sample waveform signal output by the feature extraction sub-model;
[0096] The feature vector of each sampling point of the training sample waveform signal is input into the classification sub-model to obtain the predicted classification result of each sampling point of the training sample waveform signal output by the classification sub-model.
[0097] It can be understood that the result features output by the feature extraction sub-model are represented by feature vectors.
[0098] In a possible implementation, the feature extraction sub-model is a Unet network structure, and the classification sub-model is a conditional random field CRF model. Figure 3 , Figure 3 This is a structural diagram of the waveform recognition model provided in the embodiment of the present application. Figure 3 As shown in the figure, if the obtained training sample waveform signal is Sample_i, which contains k sampling points {Element_1, Element_2, ..., Element_k}. Input the training sample waveform signal Sample_i into the Unet network structure for feature extraction, and obtain the feature vector {T_1, T_2, ..., T_k}. Each element in the feature vector is the feature vector corresponding to each sampling point. Then input the feature vector into the CRF model for classification, and obtain the prediction classification result {Label_1, Label_2, ..., Label_k} corresponding to each sampling point.
[0099] Specifically, see Figure 4 , Figure 4 This is a schematic diagram of the Unet network structure provided in the embodiment of the present application. Figure 4 As shown, if k is 288. The input of the Unet network structure needs to undergo 4 layers of downsampling first, and the downsampling process is the process of feature extraction. The length of the training sample waveform signal is 288 sampling points, then the input layer size of the Unet network structure is 288×1, and 288 represents 288 sampling points. The input of the Unet network structure will first undergo two convolution processes and rectification linearization of the "conv 32, Relu" modules to extract the input features and obtain the result features. Among them, the conv32 in the "conv 32, Relu" module indicates convolution processing, 32 represents 32 convolution kernels; Relu represents a rectified linear unit, which can also be called an activation function. Afterwards, it is downsampled by the "maxpol 2" module, where "maxpol 2" represents 2 poolings. The above operation is repeated 3 times, that is, after 4 downsamplings, as shown in Figure 4 The left half of the Unet network structure shown is executed.
[0100] The result features obtained from the last downsampling are processed by convolution and rectification linearization of the "up conv 32, Relu" module to obtain the current result features. Among them, up conv 32 means convolution processing. The result features at this time are upsampled 4 times again. In the process of upsampling each layer, the result features obtained by downsampling of the corresponding layer and the current result features need to be input into the "concat" module for feature splicing. Among them, "concat" means feature splicing. Then go through two convolutions and rectification linearization of the "conv 32, Relu" module. After that, go through convolution and rectification linearization of the "upconv 32, Relu" module. In the last upsampling, after two convolutions and rectification linearization of the "conv 32, Relu" module, the extracted feature vector is obtained. Figure 4 The output layer size of the Unet network structure is 288×16, where 288 represents the length of the training sample waveform signal and 16 represents the feature dimension corresponding to the sampling point in the waveform signal. Figure 4 All parameters in the Unet network structure are obtained through experiments.
[0101] See also Figure 5 , Figure 5 A schematic diagram of the conditional random field CRF model structure provided in the embodiment of the present application. After obtaining the feature vector, the feature vector is input into Figure 5 Classification is performed in the CRF model shown in the figure to obtain the predicted classification results {Label_1, Label_2,..., Label_k} corresponding to each sampling point, where k is 288.
[0102] The waveform recognition model composed of the Unet model and the CRF model has the advantages of high accuracy and fast speed of the Unet model, as well as the advantages of fewer input restrictions and strong tolerance of the CRF model. It is an algorithm model with powerful learning ability.
[0103] S206: training the waveform recognition model according to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal to obtain a trained waveform recognition model.
[0104] Since each sampling point in the ECG waveform signal corresponds to a label of the waveform classification result, after determining the training sample waveform signal, the label of the waveform classification result corresponding to each sampling point in the training sample waveform signal can be obtained.
[0105] Based on the predicted classification results of each sampling point in the training sample waveform signal output by the waveform recognition model and the labels of the waveform classification results corresponding to each sampling point in the training sample waveform signal, the waveform recognition model is trained to obtain a trained waveform recognition model.
[0106] As an example, the labels corresponding to the waveform classification results of each sampling point in the ECG waveform signal include eight types: P, PQ, QR, RS, SJ, JT, T, and D. Among them, P, PQ, JT, T, and D represent the P wave, PR segment, ST segment, T wave, and the interval between two adjacent heartbeats, respectively. QR, RS, and SJ collectively represent the QRS complex wave interval. It can be understood that the above labels can be refined or summarized as needed, and the number of label categories is not limited here.
[0107] The embodiment of the present application provides a training method for a waveform recognition model. After obtaining an ECG waveform signal with a waveform classification result label at each sampling point, data enhancement is performed on the ECG waveform signal. Specifically, the number of sample divisions n is determined according to the length of the ECG waveform signal and the preset length. Among them, the preset length is the input signal length of the waveform recognition model. N random numbers are generated within the length interval of the ECG waveform signal, and the first time points corresponding to the n random numbers are respectively used as the starting time points of the n training sample waveform signals. The waveform signal between the first time point and the second time point with a preset length from the first time point is intercepted from the ECG waveform signal as the training sample waveform signal. Further, each training sample waveform signal is input into the waveform recognition model to obtain the predicted classification results of each sampling point of the training sample waveform signal output by the waveform recognition model. Among them, the waveform recognition model includes a feature extraction sub-model and a classification sub-model. According to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal, the waveform recognition model is trained to obtain a trained waveform recognition model. Since the training sample waveform signals input into the waveform recognition model are n training sample waveform signals obtained by data enhancement, the amount of training sample data of the waveform recognition model is increased, which helps to improve the recognition accuracy of the waveform recognition model after training.
[0108] In addition, the embodiment of the present application also provides a proof process for calculating the number of sample divisions based on the length of the ECG waveform signal and the preset length to achieve sample quantity enhancement, as follows:
[0109] Determine an ECG waveform signal as the i-th data segment, its sampling frequency is H Hz, and the data segment length is x i , the preset length is set to l, the random sampling step is s, and the number of sample partitions is represented by n, which is calculated by the following formula:
[0110]
[0111] The brackets represent rounding.
[0112] Correspondingly, the calculation formula for obtaining the sample size n1 of the ECG waveform signal in the ordinary way is:
[0113]
[0114] It can be seen from this that by using the data enhancement method in S202-S204 provided in the embodiment of the present application, the amount of sample increase is n-n1.
[0115] Proof: Due to Assumptions Obviously, x i ≥l,l>s,s>0, and f(x i )>0 is a sufficient condition for n>n1. Therefore, as long as f(x i ) is a monotonically increasing function, we can find a suitable x i , so that
[0116] First, prove that f(x i ) is a monotonically increasing function:
[0117]
[0118] According to the conditions l>s,s>0, we can get That is, f(x i ) is a monotonically increasing function.
[0119] Further, only x is required i ,st.f(x i )=0:
[0120]
[0121] then, That is, only the data segment length is required, that is, the length of the ECG waveform signal satisfies By using the data enhancement method in S202-S204 provided in the present application, the number of sample divisions obtained will be greater than the number n1 of ECG waveform signal training samples obtained in a conventional manner.
[0122] For example, the length of the ECG waveform signal is 2500 sampling points, the sampling frequency is 250HZ, the preset length is 256 sampling points, and the random sampling step is 10. That is, x i =2500, H=250, l=256, s=10.
[0123] but It can be seen from this that using the data enhancement method provided in the embodiment of the present application will increase the number of samples.
[0124] and,
[0125]
[0126] It can be seen that the sample size increased by 224-9=215.
[0127] Based on the above content, it can be known that the method of obtaining training sample waveform signals described in S202-S204 provided in the embodiment of the present application is a data enhancement method, which can increase the amount of sample data and help improve the recognition accuracy of the waveform recognition model.
[0128] In a possible implementation, the present application embodiment provides a specific process for obtaining a training sample waveform signal. Figure 6 , Figure 6 A flowchart for obtaining a training sample waveform signal provided in an embodiment of the present application.
[0129] like Figure 6 As shown, a data set including multiple data segments is obtained, each data segment is an ECG waveform signal, and a preset length is set, which is the input signal length of the waveform recognition model.
[0130] Taking the ith data segment as an example, the difference di between the ith data segment and the preset length is calculated, where di=xi-l.
[0131] Determine whether di satisfies di≥0. If not, the data segment does not meet the input signal length of the waveform recognition model and is discarded, and the i+1th data segment is processed.
[0132] If di≥0 is satisfied, it can be determined that the i-th data segment can be divided. Further, it is determined whether di satisfies di=0. If di=0, the i-th data segment just meets the input signal length of the waveform recognition model, and the i-th data segment can be used as a training sample waveform signal. If not, it is determined that di>0, and the number of sample divisions obtained by division will be greater than or equal to 1. Based on this, the number of sample divisions n to be divided into for the i-th data segment is calculated, n=[di / s], where s is the random sampling step. After determining the number n, generate n random numbers r1,……,rn between [0,di]. Take r1,……rn as the starting sampling points of the n training sample waveform signals, and according to the preset length l, determine the n training sample waveform signals as (r1,r1+l),……,(rn,rn+l).
[0133] Thus, the processing of "obtaining training samples" for the i-th data segment is completed. Traverse all data segments and perform the above operations to form a sample set from all training sample waveform signals obtained from all data segments. Train the waveform recognition model based on the sample set. Based on the above process, it can be seen that the obtained sample set increases the amount of training sample data of the waveform recognition model, which helps to improve the recognition accuracy of the waveform recognition model after training.
[0134] The present application also provides a method for recognizing an electrocardiogram waveform. Figure 7 , Figure 7 A flowchart of an electrocardiogram waveform recognition method provided in an embodiment of the present application. Figure 7 As shown, the electrocardiogram waveform recognition method includes:
[0135] S701: Acquire an electrocardiogram signal to be identified, and extract at least one input waveform signal of a preset length from the electrocardiogram signal to be identified.
[0136] The preset length is the input signal length of the waveform recognition model.
[0137] S702: Input the input waveform signal into a waveform recognition model to obtain a waveform classification result of each sampling point in the input waveform signal output by the waveform recognition model, wherein the waveform recognition model is trained according to the training method of the ECG waveform recognition model as described in any of the above embodiments.
[0138] The waveform classification results of each sampling point in the input waveform signal obtained by inputting the input waveform signal into the waveform recognition model correspond to the label types set during the training process of the waveform recognition model. That is, if the labels include eight types such as P, PQ, QR, RS, SJ, JT, T, and D, the waveform classification results of each sampling point in the input waveform signal obtained by the waveform recognition model are the above eight results.
[0139] It can be understood that based on the waveform recognition model with high recognition accuracy, the waveform classification result of each sampling point in the input waveform signal is more accurate.
[0140] Based on the training method of a waveform recognition model provided by the above method embodiment, the present application embodiment also provides a training device for a waveform recognition model. The training device for the waveform recognition model will be described below in conjunction with the accompanying drawings.
[0141] See also Figure 8 , Figure 8 A schematic diagram of the structure of a waveform recognition model training device provided in an embodiment of the present application. Figure 8 As shown, the training device of the waveform recognition model includes:
[0142] A first acquisition unit 801 is used to acquire an ECG waveform signal, each sampling point of the ECG waveform signal corresponds to a label of a waveform classification result;
[0143] A calculation unit 802, configured to calculate a number of sample divisions according to a length of the ECG waveform signal and a preset length, wherein the number of sample divisions is greater than a ratio of the length of the ECG waveform signal to the preset length;
[0144] A generating unit 803 is used to generate n random numbers within the length interval of the ECG waveform signal, where n is a positive integer and n is the number of sample divisions;
[0145] The interception unit 804 is used to use the n random numbers as first time points respectively, and intercept the waveform signal between the first time point and a second time point with a preset length away from the first time point from the electrocardiogram waveform signal as a training sample waveform signal;
[0146] An input unit 805 is used to input the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, wherein the waveform recognition model includes a feature extraction sub-model and a classification sub-model;
[0147] The training unit 806 is used to train the waveform recognition model according to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal to obtain a trained waveform recognition model.
[0148] In a possible implementation, the calculation unit 802 includes:
[0149] A first calculation subunit, used for calculating the difference between the length of the electrocardiogram waveform signal and a preset length to obtain a first value;
[0150] A second calculation subunit is used to calculate the quotient of the first value and the random sampling step length to obtain a second value;
[0151] The rounding subunit is used to round the second value to obtain the number of sample divisions.
[0152] In a possible implementation manner, the device further includes:
[0153] The second acquisition unit is used to reacquire the ECG waveform signal if the first value is less than zero.
[0154] In a possible implementation manner, the device further includes:
[0155] A determination unit is configured to determine the ECG waveform signal as a training sample waveform signal if the first value is equal to zero.
[0156] In a possible implementation, the feature extraction sub-model is a Unet network structure, and the classification sub-model is a conditional random field CRF model;
[0157] The input unit 805 includes:
[0158] A first input sub-unit, used to input the training sample waveform signal into a feature extraction sub-model, and obtain a feature vector of each sampling point of the training sample waveform signal output by the feature extraction sub-model;
[0159] The second input subunit is used to input the feature vector of each sampling point of the training sample waveform signal into the classification submodel to obtain the predicted classification result of each sampling point of the training sample waveform signal output by the classification submodel.
[0160] In a possible implementation manner, the device further includes:
[0161] The processing unit is used to perform wavelet transform and standardization processing on the ECG waveform signal after acquiring the ECG waveform signal, so as to obtain the ECG waveform signal again.
[0162] In addition, an embodiment of the present application also provides a training device for a waveform recognition model, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the training method for the waveform recognition model described in any of the above embodiments is implemented.
[0163] In addition, an embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal device, the terminal device executes the training method of the waveform recognition model as described in any of the above embodiments.
[0164] The embodiment of the present application provides a training device and equipment for a waveform recognition model. After obtaining an ECG waveform signal with a waveform classification result label at each sampling point, data enhancement is performed on the ECG waveform signal. Specifically, the number of sample divisions n is determined according to the length of the ECG waveform signal and the preset length. Among them, the preset length is the input signal length of the waveform recognition model. Generate n random numbers within the length interval of the ECG waveform signal, and use the first time points corresponding to the n random numbers as the starting time points of the n training sample waveform signals. Intercept the waveform signal between the first time point and the second time point with a preset length from the first time point from the ECG waveform signal as the training sample waveform signal. Further, input each training sample waveform signal into the waveform recognition model to obtain the predicted classification results of each sampling point of the training sample waveform signal output by the waveform recognition model. Among them, the waveform recognition model includes a feature extraction sub-model and a classification sub-model. According to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal, the waveform recognition model is trained to obtain a trained waveform recognition model. Since the training sample waveform signals input into the waveform recognition model are n training sample waveform signals obtained by data enhancement, the amount of training sample data of the waveform recognition model is increased, which helps to improve the recognition accuracy of the waveform recognition model after training.
[0165] Based on the ECG waveform recognition method provided by the above method embodiment, the present application embodiment also provides an ECG waveform recognition device. The ECG waveform recognition device will be described below in conjunction with the accompanying drawings.
[0166] See also Fig. 9 , Fig. 9 A schematic diagram of the structure of an electrocardiogram waveform recognition device provided in an embodiment of the present application. Fig. 9 As shown, the electrocardiogram waveform recognition device comprises:
[0167] The acquisition unit 901 is used to acquire the electrocardiogram signal to be identified, and to intercept at least one input waveform signal of a preset length from the electrocardiogram signal to be identified.
[0168] The input unit 902 is used to input the input waveform signal into a waveform recognition model to obtain a waveform classification result of each sampling point in the input waveform signal output by the waveform recognition model, wherein the waveform recognition model is trained according to the training method of the electrocardiogram waveform recognition model as described in any of the above embodiments.
[0169] In addition, an embodiment of the present application also provides an ECG waveform recognition device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the ECG waveform recognition method described in any of the above embodiments is implemented.
[0170] In addition, an embodiment of the present application further provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes the ECG waveform recognition method as described in any of the above embodiments.
[0171] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0172] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0173] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0174] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0175] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A training method for a waveform recognition model, characterized in that: The method comprises: Acquire an ECG waveform signal, wherein each sampling point of the ECG waveform signal corresponds to a label of a waveform classification result; Calculating the number of sample divisions according to the length of the ECG waveform signal and a preset length, wherein the number of sample divisions is greater than the ratio of the length of the ECG waveform signal to the preset length; Generate n random numbers within the length interval of the electrocardiogram waveform signal, where n is a positive integer and n is the number of sample divisions; Taking the n random numbers as first time points respectively, and intercepting the waveform signal between the first time point and a second time point with a preset length away from the first time point from the electrocardiogram waveform signal as a training sample waveform signal; Inputting the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, wherein the waveform recognition model includes a feature extraction sub-model and a classification sub-model; According to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal, the waveform recognition model is trained to obtain a trained waveform recognition model; The calculating the number of sample divisions according to the length of the electrocardiogram waveform signal and a preset length includes: Calculating the difference between the length of the electrocardiogram waveform signal and a preset length to obtain a first value; Calculate the quotient of the first value and the random sampling step length to obtain a second value; Rounding the second value to obtain the number of sample divisions; The length of the electrocardiogram waveform signal is greater than the square of the preset length divided by a third value, and the third value is a difference between the preset length and the random sampling step length.
2. The method according to claim 1, characterized in that The method further comprises: If the first value is less than zero, the ECG waveform signal is acquired again.
3. The method according to claim 1, characterized in that The method further comprises: If the first value is equal to zero, the ECG waveform signal is determined as a training sample waveform signal.
4. The method according to claim 1, characterized in that The feature extraction sub-model is a Unet network structure, and the classification sub-model is a conditional random field CRF model; The step of inputting the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model comprises: Inputting the training sample waveform signal into a feature extraction sub-model to obtain a feature vector of each sampling point of the training sample waveform signal output by the feature extraction sub-model; The feature vector of each sampling point of the training sample waveform signal is input into the classification sub-model to obtain the predicted classification result of each sampling point of the training sample waveform signal output by the classification sub-model.
5. The method according to claim 1, characterized in that After acquiring the ECG waveform signal, the method further includes: The electrocardiogram waveform signal is subjected to wavelet transformation and standardization processing to obtain the electrocardiogram waveform signal again.
6. A method for recognizing an electrocardiogram waveform, characterized in that: The method comprises: Acquire an electrocardiogram signal to be identified, and extract at least one input waveform signal of a preset length from the electrocardiogram signal to be identified; The input waveform signal is input into a waveform recognition model to obtain a waveform classification result of each sampling point in the input waveform signal output by the waveform recognition model, wherein the waveform recognition model is trained according to the training method for the waveform recognition model according to any one of claims 1-5.
7. A training device for a waveform recognition model, characterized in that: The device comprises: A first acquisition unit is used to acquire an ECG waveform signal, wherein each sampling point of the ECG waveform signal corresponds to a label of a waveform classification result; A calculation unit, configured to calculate a number of sample divisions according to a length of the ECG waveform signal and a preset length, wherein the number of sample divisions is greater than a ratio of the length of the ECG waveform signal to the preset length; A generating unit, configured to generate n random numbers within the length interval of the electrocardiogram waveform signal, wherein n is a positive integer and n is the number of sample divisions; An interception unit, configured to use the n random numbers as first time points respectively, and intercept a waveform signal between the first time point and a second time point with a preset length away from the first time point from the electrocardiogram waveform signal as a training sample waveform signal; An input unit, used to input the training sample waveform signal into a waveform recognition model to obtain a prediction classification result of each sampling point of the training sample waveform signal output by the waveform recognition model, wherein the waveform recognition model includes a feature extraction sub-model and a classification sub-model; A training unit, used to train the waveform recognition model according to the predicted classification results of each sampling point of the training sample waveform signal and the labels of the waveform classification results corresponding to each sampling point of the training sample waveform signal, to obtain a trained waveform recognition model; The computing unit comprises: A first calculation subunit, used for calculating the difference between the length of the electrocardiogram waveform signal and a preset length to obtain a first value; A second calculation subunit is used to calculate the quotient of the first value and the random sampling step length to obtain a second value; a rounding subunit, used for rounding the second value to obtain the number of sample divisions; The length of the electrocardiogram waveform signal is greater than the square of the preset length divided by a third value, and the third value is a difference between the preset length and the random sampling step length.
8. An electrocardiogram waveform recognition device, characterized in that: The device comprises: An acquisition unit, used for acquiring an electrocardiogram signal to be identified, and intercepting at least one input waveform signal of a preset length from the electrocardiogram signal to be identified; An input unit is used to input the input waveform signal into a waveform recognition model to obtain a waveform classification result of each sampling point in the input waveform signal output by the waveform recognition model, wherein the waveform recognition model is trained according to the training method of the waveform recognition model according to any one of claims 1 to 5.
9. A training device for a waveform recognition model, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the training method for the waveform recognition model as described in any one of claims 1 to 5 is implemented.
10. An electrocardiogram waveform recognition device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electrocardiogram waveform recognition method as claimed in claim 6 is implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the training method for a waveform recognition model as described in any one of claims 1 to 5, or executes the electrocardiogram waveform recognition method as described in claim 6.
