A processing method and device of a heartbeat feature recognition model

CN122208158BActive Publication Date: 2026-10-09SHENZHEN CAREWELL ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610263783.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-03-05
Publication Date
2026-10-09
Estimated Expiration
2046-03-05

AI Technical Summary

Technical Problem

[0003]通过任务实践我们发现这类常规架构存在一些问题:1)级联流程中前置模块的误差会逐级传递放大,导致整体性能受限;2)难以捕捉心电信号的时空依赖关系,例如一个心搏的形态可能受到前几个心搏节律的影响;3)级联流程需要进行逐步处理,无法对R点定位、心搏分类、临床参数进行同步输出,从而导致任务处理效率降低

Benefits of technology

[0020] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for processing a cardiac feature recognition model. As described above, this invention constructs a cardiac feature recognition model based on a Transformer architecture encoding/decoding module, capable of simultaneously recognizing three cardiac features (R-point location, cardiac type, and clinical parameters) of electrocardiogram signals. After model training, it serves as an end-to-end cardiac feature recognition tool for users to handle cardiac feature recognition tasks. The model in this invention achieves multi-task joint learning through a shared encoding/decoding network, effectively avoiding the error accumulation problem in traditional cascaded methods. It utilizes the Transformer's self-attention encoding and cross-attention decoding mechanisms to fully model the long-range temporal dependencies of cardiac signals. Furthermore, it employs a multi-task parallel prediction head to achieve integrated output of localization, classification, and parameter estimation, improving processing efficiency while enhancing feature sharing and collaborative optimization capabilities between different tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122208158B_ABST
    Figure CN122208158B_ABST
Patent Text Reader

Abstract

The embodiment of the application relates to a processing method and device of a heartbeat feature recognition model, the method comprising: constructing a deep learning model for recognizing heartbeat features of an electrocardiosignal, denoted as a heartbeat feature recognition model; constructing a first data set through data acquisition; training the heartbeat feature recognition model based on the first data set; after the model training is completed, inputting an electrocardiosignal X input by a user into the heartbeat feature recognition model to obtain a corresponding heartbeat feature sequence Y out Feedback is fed back to the current user. The application can reduce error accumulation risk, can sufficiently model long-range time dependence of a heartbeat signal, and can improve heartbeat feature recognition efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a processing method and apparatus for a cardiac rhythm feature recognition model. Background Technology

[0002] Identifying the cardiac characteristics of electrocardiogram (ECG) signals is a core task in the intelligent diagnosis of cardiovascular diseases. Conventional cardiac characteristic identification tasks include: R-point localization, cardiac beat classification (such as normal sinus type, atrial fibrillation type, premature ventricular contractions (PVCs), premature atrial contractions (PACs), and junctional premature beats), and measurement of clinical parameters (such as PR interval, QRS width, QT interval, and RR interval). Current mainstream technologies mostly employ a cascaded architecture to handle these cardiac characteristic identification tasks: first, R-points are detected based on U-Net or CNN-RNN; then, the cardiac beat type is identified through an independent classification network; and finally, parameters such as the PR interval are measured using waveform segmentation algorithms.

[0003] Through practical experience, we found that this type of conventional architecture has some problems: 1) Errors in the preceding modules in the cascade process will be amplified step by step, resulting in limited overall performance; 2) It is difficult to capture the spatiotemporal dependencies of ECG signals, for example, the morphology of a heartbeat may be affected by the previous few heartbeat rhythms; 3) The cascade process requires step-by-step processing and cannot output R-point location, heartbeat classification, and clinical parameters synchronously, thus reducing the efficiency of task processing. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies by providing a method, apparatus, electronic device, and computer-readable storage medium for processing a cardiac feature recognition model. This invention constructs a cardiac feature recognition model based on a Transformer architecture encoding / decoding module, capable of simultaneously recognizing three cardiac features (R-point location, cardiac type, and clinical parameters) in electrocardiogram signals. After model training, it serves as an end-to-end cardiac feature recognition tool for users to handle cardiac feature recognition tasks. The model achieves multi-task joint learning through a shared encoding / decoding network, effectively avoiding the error accumulation problem in traditional cascaded methods. It utilizes the Transformer's self-attention encoding and cross-attention decoding mechanisms to fully model the long-range temporal dependencies of cardiac signals. Furthermore, it employs a multi-task parallel prediction head to achieve integrated output of localization, classification, and parameter estimation, improving processing efficiency while enhancing feature sharing and collaborative optimization capabilities between different tasks.

[0005] To achieve the above objectives, a first aspect of the present invention provides a method for processing a cardiac rhythm feature recognition model, the method comprising: A deep learning model, denoted as the heartbeat feature recognition model, is constructed to identify the heartbeat features of electrocardiogram (ECG) signals. This model identifies the R-point location, heartbeat type, clinical parameters, and confidence level of all heartbeat signals from the input ECG signal X and outputs the corresponding heartbeat feature sequence Y. out The types of heartbeats include at least the normal sinus type, atrial fibrillation type, ventricular premature beat type, atrial premature beat type, and junctional premature beat type, and the total number of types is denoted as N. C The clinical parameters must include at least the PR interval, QRS width, QT interval, and RR interval, and the total number of these parameters is denoted as N. P The cardiac rhythm feature recognition model includes a preprocessing layer, an embedding layer, a self-attention encoding network, a cross-attention decoding network, an R-point location prediction head, a cardiac rhythm classification prediction head, a clinical parameter prediction head, a confidence prediction head, and an output layer. The preprocessing layer is used to denoise and segment the input signal and initialize the cardiac rhythm feature vector. The embedding layer performs linear projection embedding encoding on the segmented signal and enhances the embedding features of each segment's projection vector using context-aware position encoding. The self-attention encoding network encodes the input vector's features. The cross-attention decoding network decodes the cardiac rhythm features using the output vector of the encoding network as the key input and the initialized cardiac rhythm feature vector as the initial query input. Each of the four prediction heads predicts the corresponding R-point location, cardiac rhythm type, clinical parameter, or confidence level based on the decoded cardiac rhythm feature vector. The output layer integrates the output vectors of the four prediction heads. The first dataset was constructed through data collection; The heartbeat feature recognition model is trained based on the first dataset; After the model training is completed, the ECG signal X input by the user is sent to the heartbeat feature recognition model to obtain the corresponding heartbeat feature sequence Y. out Provide feedback to the current user.

[0006] Preferably, the electrocardiogram signal X includes L total Signal x at sampling points i L total Let i be the total number of sampling points for the current ECG signal X, where 1 ≤ sampling point index i ≤ L. total The sampling point signal x i Including N Lead A single-lead signal x i,j N Lead Let N be the total number of leads for the current ECG signal X, where 1 ≤ lead index j ≤ N. Lead Each of the single-lead signals x i,j This represents the signal amplitude of the j-th lead at the current i-th sampling point; The heartbeat feature sequence Y outWhen not empty, it consists of one or more cardiac feature data; each cardiac feature data is composed of a set of corresponding R-point index IDs. R Type label A, parameter set M, and confidence level F conf Composition; the R-point index ID R Let i be the index of a sampling point in the electrocardiogram signal X; let A be the type label A, which represents a type of heartbeat; let M be the parameter set N. P Clinical parameter values ​​m v Composition, 1≤index v≤N P ; The input terminal of the heartbeat feature recognition model is used to receive the electrocardiogram signal X, and the output terminal is used to output the heartbeat feature sequence Y. out ; The input of the preprocessing layer is connected to the input of the model; the first output is connected to the input of the embedding layer; and the second output is connected to the second input of the cross-attention decoding network. The output of the embedding layer is connected to the input of the self-attention encoding network. The input of the self-attention encoding network is connected to the first input of the cross-attention decoding network. The output of the cross-attention decoding network is connected to the inputs of the R-point location prediction head, the heart rate classification prediction head, the clinical parameter prediction head, and the confidence prediction head. The outputs of the R-point location prediction head, the heart rate classification prediction head, the clinical parameter prediction head, and the confidence prediction head are respectively connected to the first, second, third, and fourth inputs of the output layer. The output of the output layer is connected to the model output. The self-attention coding network consists of N EN The l1-th encoding module is connected sequentially, N EN The total number of preset encoding modules, 1 ≤ index l1 ≤ N EN The l1st encoding module is implemented based on the self-attention encoding module of the Transformer model framework; The cross-attention decoding network consists of N DE The l2nd decoding module is connected sequentially, N DE The total number of preset decoding modules, 1 ≤ index l2 ≤ N DE The l2nd decoding module is implemented based on the cross-attention decoding module of the Transformer model framework; The R-point location prediction head and the confidence prediction head are each implemented based on a corresponding linear regression calculation network; the heart rate classification prediction head is implemented based on a corresponding linear classification network; and the clinical parameter prediction head is implemented based on an MLP model.

[0007] Preferably, the preprocessing layer is used to perform noise reduction and segmentation on the input signal and initialize the heartbeat feature vector, specifically including: Step 31: Perform signal denoising processing on the ECG signal X based on preset signal denoising rules to obtain the corresponding denoised signal X. ’ ; and according to the preset segment length L win Sliding step size △L step For the noise reduction signal X ’ Perform sliding segmentation to obtain the corresponding N piece Segmented signal If the total number of sampling points in the last segment is less than L, win If the length is insufficient, zero-padding is used, where 1 ≤ segment index k ≤ N. piece ; and from all the obtained segmented signals Form the corresponding segmented signal sequence { }; The signal noise reduction rules include at least the power frequency interference elimination rule, the electromyographic noise elimination rule, and the baseline drift elimination rule; The noise reduction signal X ’ Including L total Each sampling point signal The sampling point signal Including N Lead Single lead signal ; The segment length L win The total number of sampling points in each segment; The sliding step size △L step ΔL is the interval between the starting sampling points of two adjacent segments. step <L win ; N piece This represents the total number of corresponding segments. ceiling() is the floor function; The segmented signal By L win Each sampling point signal Composition, 1 ≤ the index of the sampling point within the segment i * ≤L win ; Signal at each of the sampling points Including N Lead Single lead signal ; The sampling point signal The corresponding sampling point signal The index mapping relationship is as follows: ; Step 32, based on the sampling frequency of the ECG signal X and the total number of sampling points L. total Calculate the corresponding total signal duration T; and based on the total signal duration T and the preset maximum number of heartbeats per unit duration B... uni Estimate the corresponding maximum number of heartbeats B total =T×B uni ; and based on the maximum total number of heartbeats B of the signal total and the preset cardiac feature dimension D heart Set a shape as B total ×D heart The feature vector is used as the initial heart rate feature vector Z ini ; and the heartbeat feature vector Z ini The vector parameters are set randomly; Step 33, and then the segmented signal sequence { The heartbeat feature vector Z is sent to the embedding layer. ini Send to the cross-attention decoding network.

[0008] Preferably, the embedding layer is used to perform linear projection embedding encoding on the segmented signal and to perform embedding feature enhancement processing on the projection vector of each segment using a context-aware position encoding method, specifically including: Step 41, divide the segmented signal sequence { The segmented signals of} As the current segment; and by L of the j-th lead in the current segment win The single-lead signal Form a shape of 1×L win single-lead vector s k,j ; and for the N corresponding to the current segment Lead The single-lead vector s k,j By sequentially piecing them together, we get a shape of 1×(N) Lead ×L win The fragment vector S k ; Step 42, and for each of the said fragment vectors S k Perform linear projection embedding encoding to obtain the corresponding segment projection vector. ; in, ; W emb Let W be the linear projection matrix of the model. emb The shape is (N) Lead ×L win )×D heart The segment projection vector The shape is 1×Dheart ; Step 43, and based on the location encoding function corresponding to the model. Projecting vectors onto each of the aforementioned segments Position encoding vector P k Configure settings; in, ; θ is a function parameter of the position encoding function; the position encoding function Output feature dimension and heartbeat feature dimension D heart Same; the position encoding vector P k The shape is 1×D heart ; Step 44, and based on the preset nearest neighbor radius r, project the vectors of each segment. Set a shape of (2r+1)×D heart Nearest neighbor vectors SN k If the corresponding nearest neighbor segment projection vector does not exist during the setting, it will be insufficient by padding with zeros. Wherein, the nearest neighbor vector SN k From the fragment projection vector arrive composition; Step 45, and perform one-dimensional convolution operation on each of the nearest neighbor vectors SN. k Feature extraction is performed, the extracted features are activated, and the activated features are used as the corresponding context-aware vector C. k ; in, ; ReLU() is the ReLU activation function; Conv1D is the one-dimensional convolution function corresponding to the model, W 1D b 1D The convolution kernel weight vector and bias vector of the current one-dimensional convolution function; the context-aware vector C k The shape is 1×D cxt D cxt This represents the feature dimension output by the current one-dimensional convolution function. Step 46, and according to the gated fusion method, project the vectors of each segment. The corresponding context-aware vector C k and the position encoding vector P k Perform feature fusion and use the fused features as the corresponding fragment enhancement vectors. ; in, ; Sigmoid() is the Sigmoid activation function; G is the gating vector corresponding to the model, with shape D. cxt×1; vector , The shape is D cxt ×D heart ;vector The shape is 1×D heart The fragment enhancement vector The shape is 1×D heart ; Step 47, and by N piece The fragment enhancement vectors Form a shape of N piece ×D heart eigenvector H ini Send to the self-attention coding network.

[0009] Preferably, the self-attention coding network is used to perform feature encoding on the input vector, specifically including: With the feature vector H ini This is the input to the first encoding module, and is passed through N. EN The l1-th encoding module performs one round of sequential self-attention encoding to obtain a corresponding feature vector H. out Send to the cross-attention decoding network; The input and output vectors of the l1st encoding module are denoted as the corresponding vectors. , ; Each of the l1-th encoding modules is used for the input vector The query, key, and value vectors are transformed, and then feature-encoded according to the encoding rules of the self-attention encoding module of the Transformer model framework to obtain the corresponding output vector. ; Input vector of the first encoding module ; The output vector of the l1st encoding module is used as the input vector of the l1+1th encoding module; The feature vector H out For the Nth EN Output vector of the encoding module ; The feature vector H out The shape is N piece ×D heart .

[0010] Preferably, the cross-attention decoding network is used to decode the heartbeat features using the output vector of the encoding network as the key input and the initialized heartbeat feature vector as the initial query input, specifically including: With the feature vector H outAs the key-value input vector of each of the l2nd decoding modules, the heartbeat feature vector Z ini As the query input vector of the first decoding module, and through N DE The l2nd decoding module performs a round of sequential cross-attention decoding to obtain a corresponding heart rate feature vector Z. out Send to the R-point location prediction head, the heart rate classification prediction head, the clinical parameter prediction head, and the confidence prediction head; Among them, the key-value input vector of each of the l2nd decoding modules is H. out The query input vector is denoted as the corresponding The decoded output vector is denoted as the corresponding... ; Each of the 12th decoding modules is used to process the feature vector H out Perform key-value vector conversion and process the query input vector. The query vector is transformed, and then feature decoding is performed on the obtained query, key, and value vectors according to the decoding rules of the cross-attention decoding module of the Transformer model framework to obtain the corresponding decoded output vector. ; The query input vector of the first decoding module ; The decoding output vector of the l2nd decoding module is used as the query input vector of the l2+1th decoding module; The heartbeat feature vector Z out For the Nth DE Output vector of the decoding module ; The heartbeat feature vector Z out The shape is B total ×D heart By B total The shape is 1×D heart eigenvectors Composition; 1 ≤ index o ≤ B total .

[0011] Preferably, each of the four prediction heads is used to predict the corresponding R-point location, heartbeat type, clinical parameters, or confidence level based on the decoded heartbeat feature vector, specifically including: The R-point location prediction head is used to predict the heartbeat feature vector Z. out Predict the corresponding position prediction vector Y1, and send the position prediction vector Y1 to the output layer; in, ; W R The weight matrix corresponding to the prediction head for the R point location has a shape of 1×D.heart The shape of the position prediction vector Y1 is B. total ×1, from B total Predicted locations Composition; the predicted location It is a normalized scalar with a value between [0,1], used to express the relative position of the current R point in the current electrocardiogram signal; The heartbeat classification prediction head is used to predict heartbeat features based on the heartbeat feature vector Z. out Each of the aforementioned feature vectors Heartbeat classification prediction yields a 1×N shape C Prediction vector ; and from the obtained B total The predicted vectors Composition shape B total ×N C The type prediction vector Y2 is sent to the output layer; in, ; Softmax() is the Softmax function; W C b C Here are the weight matrix and bias vector corresponding to the heart rate classification prediction head; the weight matrix W C The shape is N C ×D heart Bias vector b C The shape is 1×N C The prediction vector By N C Type probability Composition, 1≤index u≤N C The probability of each of the aforementioned types Corresponds to a type of heartbeat; The clinical parameter prediction head is used to use an MLP network based on the heartbeat feature vector Z. out Clinical parameter prediction yields a shape of B total ×N P The parameter prediction vector Y3 is sent to the output layer; in, ; β represents the model parameters of the MLP network; the parameter prediction vector Y3 is determined by B. total prediction vectors Composition; the prediction vector The shape is 1×N P , by N P Prediction parameters Composition, each of the prediction parameters Corresponding to a class of clinical parameters; each of the predicted parameters All are based on a single z-score standard value; The confidence prediction head is used to predict the heart rate feature vector Z. out Predict the corresponding confidence prediction vector Y4, and send the confidence prediction vector Y4 to the output layer; in, ; W conf The weight matrix corresponding to the confidence prediction head has a shape of 1×D. heart The confidence prediction vector Y4 has a shape of B. total ×1, from B total Each prediction confidence level Composition; the prediction confidence level It is a scalar whose value is between [0,1].

[0012] Preferably, the output layer is used to integrate the output vectors of the four prediction heads, specifically including: Step 81, the output layer selects the predicted positions with the same index o from the position prediction vector Y1, the type prediction vector Y2, the parameter prediction vector Y3, and the confidence prediction vector Y4. The prediction vector The prediction vector The prediction confidence level Extract the data to form a corresponding heart rate array; and then use the predicted confidence level... The heartbeat arrays that are greater than or equal to a preset confidence threshold are selected as candidate heartbeat arrays; Step 82, and take each of the candidate heartbeat arrays as the current array; and based on the predicted position of the current array... Calculate the corresponding R-point index ID R ; and based on the prediction vector of the current array Set the corresponding type marker A; and based on the N corresponding to the type marker A... P Group standard deviation and mean, and the prediction vector of the current array. Calculate the corresponding parameter set M; and set the prediction confidence of the current array. The corresponding confidence level F conf ; Wherein, the R point index ID R The calculation method is as follows: ; round() is the rounding function; The type label A is the prediction vector. The type with the highest probability value Corresponding heart rate type; The standard deviation and mean of each clinical parameter for each type of cardiac rhythm are denoted as the corresponding... , ;wherein, N corresponds to the current type marker A. P The group standard deviation and mean are denoted as the corresponding , ; The clinical parameter values ​​m of the parameter set M v The calculation method is as follows: ; Step 83, using the R-point index ID corresponding to each of the candidate heartbeat arrays. R The type label A, the parameter set M, and the confidence level F conf A corresponding cardiac feature data is formed; all the obtained cardiac feature data are combined to form the corresponding cardiac feature sequence Y. out And output it.

[0013] Preferably, the first dataset includes N TR The first data record; N TR The first dataset contains the total number of records; the first data records include the training signal X. TR Location label vector Type label vector Parameter label vector ; The training signal X TR The data format is consistent with the ECG signal X; the training signal X TR The corresponding actual total number of heartbeats is recorded as the corresponding total number of heartbeats. ; The location label vector By the corresponding Each tag position composition, The label location Let be a normalized scalar with values ​​between [0,1], specifically the o-th scalar. ’ The relative duration T between the R-point position of a heartbeat signal and the current signal's initial sampling point position. off Total duration T of the current signal total The ratio T off / T total ; The type label vector By the corresponding label vectors Composition; the label vector Including N C Probability of each label The label vector In the above, there is one and only one label probability that corresponds to the current true heartbeat type. 1 for all, N for the rest C -1 probability of the label All are 0; The parameter label vector By the corresponding label vectors Composition; the label vector Including N P Each tag parameter Each of the aforementioned tag parameters It is the z-score standard value of the vth clinical parameter type under the uth type of cardiac rhythm.

[0014] Preferably, the construction of the first dataset through data collection specifically includes: Multiple raw electrocardiogram (ECG) signals are collected from a set of pre-defined public databases, including at least the MIT-BIH database, SVDB database, CPSC 2018 dataset, and CCDD database. The original ECG signals are resampled according to the sampling frequency of the ECG signal X, and the resampled signals are then converted into training signals according to the ECG signal X to obtain the corresponding training signal X. TR ; and for the training signal X TR The total number of records N is obtained by counting the total number of records. TR ; and each of the training signals X TR This serves as the current signal; and all heartbeat signals on the current signal are labeled using a preset manual or machine labeling method; and the total number of labeled heartbeat signals on the current signal is counted to obtain the corresponding total number of heartbeats. The process iterates through all heartbeat signals marked on the current signal; during this iteration, the currently iterated heartbeat signal is taken as the current heartbeat; the R-point position of the current heartbeat is marked, and the relative duration T between the marked position and the start and end points of the current signal is calculated. off Perform calculations and assign the total duration T of the current signal to it. total Perform identification and calculate the corresponding tag position. The heartbeat type of the current heartbeat is labeled, and the label probability corresponding to the labeled heartbeat type of the current heartbeat is assigned. Set it to 1, and set the remainder N to 1.C -1 corresponding label probability All are set to 0, and the N corresponding to the current heartbeat is... C The probability of the label Form a corresponding label vector ; and for the N of the current heartbeat P True values ​​of clinical-like parameters Mark the data; and at the end of this traversal, assign the current signal to the corresponding data. The label positions The corresponding location label vector is formed. The current signal corresponding to The label vectors Form the corresponding type label vector ; And classify all the training signals X according to heart rate type. TR All true parameter values ​​of all heartbeat signals Clustering yields the corresponding N C A first parameter set; and all the true parameter values ​​of each first parameter set according to clinical parameter type. Clustering yields the corresponding N P A second parameter set is defined; and a corresponding set of standard deviations is obtained by calculating the standard deviation and mean of each second parameter set. ,average value ; all the true parameter values ​​in each of the first parameter sets They all belong to the same type of heartbeat; all the true parameter values ​​in each of the second parameter sets They all belong to the same type of cardiac rhythm and the same type of clinical parameter; and each of the training signals X TR As the current signal; and perform a round of traversal on all heartbeat signals marked on the current signal; and during this round of traversal, take the currently traversed heartbeat signal as the current heartbeat; and take the heartbeat type corresponding to the current heartbeat as the current type u. * ; and the true parameter values ​​of the current heartbeat. As the current parameter value m * and the current parameter value m * The corresponding clinical parameter type is used as the current type v * and the current type u * and the current type v * The corresponding standard deviation and the average value As the current standard deviation and current average and the current parameter value m * The corresponding tag parameters Perform calculations. ; and N corresponding to the current heartbeat P The label parameters The corresponding label vector is formed. ; and at the end of this round of traversal, the signal corresponding to the current signal is... The label vectors The corresponding parameter label vector is formed. ; And by each of the training signals X TR and its corresponding set of location label vectors The type label vector and the parameter label vector Form a corresponding first data record; And by N TR The first data records constitute the corresponding first dataset.

[0015] Preferably, training the heartbeat feature recognition model based on the first dataset specifically includes: Step 11-1: Initialize the first counter to the total number of records N in the first dataset. TR ; Step 11-2: Take the first data record of the first dataset as the current training record; Step 11-3, record the training signal X from the current training session. TR The corresponding electrocardiogram signal X is input into the heartbeat feature recognition model for processing to obtain four corresponding prediction vectors; The four prediction vectors include the location prediction vector Y1, the type prediction vector Y2, the parameter prediction vector Y3, and the confidence prediction vector Y4; the location prediction vector Y1 includes the corresponding B total The predicted locations The type prediction vector Y2 includes the corresponding B total The predicted vectors The prediction vector Including N C The probability of the type The parameter prediction vector Y3 includes the corresponding B total The predicted vectors The prediction vector Including N P The prediction parameters The confidence prediction vector Y4 includes the corresponding B total The prediction confidence level ; Steps 11-4: Construct corresponding prediction target sets based on the four prediction vectors; and based on the location label vector of the current training record. The type label vector The parameter label vector Construct the corresponding target set of tags; Wherein, the prediction target set is composed of the corresponding B total One prediction target S o Composition; each of the predicted targets S o A set of corresponding predicted positions The prediction vector The prediction vector The prediction confidence level composition; The label target set consists of the corresponding individual tag targets Composition; each of the stated label targets A set of corresponding label positions The label vector The label vector composition; Steps 11-5: Using the shortest R-point spacing as the matching condition, identify the predicted-label pairs matched in the predicted target set and the labeled target set to obtain the corresponding matching set G. P ; Wherein, the matching set G P When not empty, it includes one or more prediction-label pairs (o,o) ’ ); each of the predicted-label pairs (o,o) ’ ) is a set of matched predicted targets S o and the label target index o, o ’ Composition; the predicted target S of each matching pair o and the label target The R-point spacing = | All of them are less than the preset point spacing threshold τ, and the R-point spacing of the current prediction-label pair is the minimum value among all R-point spacings between all predicted targets and the current label target; the matching set G P Any two of the predicted-label pairs (o,o) ’ The index o or o) ’ They have no connection whatsoever; Steps 11-6 involve identifying targets in the predicted target set that do not appear in the matching set G. PThe index o in the middle forms the corresponding pseudo-target set G. F ; and those tags in the target set that do not appear in the matching set G P index o in ’ Form the corresponding missed detection target set G M ; Steps 11-7: Construct the location loss function L based on the smoothed L1 loss function. pos : , ; |G P |For the matching set G P The total number of predicted label pairs; The first smoothing L1 loss function, The smoothing coefficients of the first smoothed L1 loss function; Steps 11-8: Construct a classification loss function L based on the multi-class cross-entropy loss function. cls : , , , , , ; |G F |For the pseudo-target set G F The total number of indexes; , These are the corresponding matching set classification loss function and pseudo-target set classification loss function, respectively. , These are the corresponding matching set classification loss weight coefficients and pseudo-target set classification loss weight coefficients, respectively. , These are the corresponding cross-entropy loss functions for the matching set and the pseudo-target set, respectively. Steps 11-9: Construct the parametric loss function L based on the smooth L1 loss function. para : , ; The second smoothing L1 loss function, The smoothing coefficients of the second smoothing L1 loss function; Steps 11-10, based on the matching set G P and the pseudo-target set G FFor each of the predicted confidence levels of the predicted confidence vector Y4 Set a corresponding label confidence level. : ; Steps 11-11: Construct the confidence loss function L based on the binary cross-entropy loss function. conf : ; Steps 11-12, based on the missed detection target set G M and the pseudo-target set G F For each missed target, the distance between the R-points and each pseudo-target is calculated, and the shortest distance is taken as the corresponding shortest missed-target-pseudo-target distance. : ; Steps 11-13, based on all the aforementioned shortest missed detection-false target spacing Set the loss function for missed detection penalty L miss : ; |G M |For the set of missed detection targets G M The total number of indexes; η is the preset penalty intensity coefficient; Steps 11-14, based on the location loss function L pos The classification loss function L cls The parameter loss function L para The confidence loss function L conf The missed detection penalty loss function L miss Construct the corresponding overall loss function L all : , ; , , , , These are the preset weighting coefficients for location loss, classification loss, parameter loss, confidence loss, and missed detection penalty loss. Steps 11-15, for the overall loss function L allThe loss value is calculated to obtain the corresponding first loss value; and it is identified whether the first loss value meets the preset first loss value range; if it does, proceed to steps 11-16; if it does not, the first counter is decremented by 1 when the first counter is greater than 0, and the overall loss function L is optimized based on the preset first model optimizer. all The model parameters of the heartbeat feature recognition model are modulated once in the direction that reaches the minimum value, and the process returns to step 11-3 when the modulation ends. The first model optimizer includes the Adam optimizer; Steps 11-16: Identify whether the current training record is the last first data record in the first dataset; if the current training record is not the last first data record, then take the next first data record in the first dataset as the new current training record and return to steps 11-3; if the current training record is the last first data record, then calculate the current pass rate = first counter / N. TR The system identifies whether the current pass rate is less than a preset pass rate threshold. If so, it returns to step 11-1; otherwise, it stops training and confirms that the training of the heartbeat feature recognition model has ended.

[0016] Furthermore, the matching set G is obtained by identifying the predicted-label pairs matched between the predicted target set and the label target set using the shortest R-point spacing as the matching condition. P Specifically, it includes: For each of the tag targets in the tag target set Perform one round of traversal; and during this round of traversal, change the currently traversed tag target. The corresponding target is used as the current label target; and the current label target and each of the predicted targets S in the predicted target set are compared. o The corresponding point spacing is obtained by calculating the R-point spacing. ; and at the end of this round of traversal, the result obtained from this round of traversal ×B total The spacing between the points Form a shape as ×B total The matrix D; the matrix D is composed of ×B total The spacing between the points Composition, each row corresponds to one of the stated label targets. Each column corresponds to one of the predicted targets S. o ; And the B of the matrix D totalAll columns are initially marked as unused columns; and a row-by-row traversal is performed on the matrix D; during this traversal, the current traversed row is taken as the current row; and the B of the current row is... total The spacing between the points The minimum value is taken as the current minimum spacing; and the column corresponding to the current minimum spacing is taken as the current column; and when the current minimum spacing is less than the point spacing threshold τ and the current column is an unused column, a set of indices o corresponding to the current row and the current column is used. ’ A corresponding prediction-label pair (o, o) is formed by o and o. ’ ), and modify the unused column flag of the current column to the used flag; and at the end of this round of traversal, use all the obtained prediction-label pairs (o,o) ’ The corresponding matching set G is formed. P .

[0017] A second aspect of the present invention provides an apparatus for implementing the processing method of the cardiac feature recognition model described in the first aspect above, the apparatus comprising: a model construction module, a data acquisition module, a model training module, and a model application module; The model building module is used to construct a deep learning model for recognizing the heartbeat features of electrocardiogram (ECG) signals, denoted as the heartbeat feature recognition model. The heartbeat feature recognition model is used to identify the R-point position, heartbeat type, clinical parameters, and confidence level of all heartbeat signals in the input ECG signal X, and output the corresponding heartbeat feature sequence Y. out The types of heartbeats include at least the normal sinus type, atrial fibrillation type, ventricular premature beat type, atrial premature beat type, and junctional premature beat type, and the total number of types is denoted as N. C The clinical parameters must include at least the PR interval, QRS width, QT interval, and RR interval, and the total number of these parameters is denoted as N. P The cardiac rhythm feature recognition model includes a preprocessing layer, an embedding layer, a self-attention encoding network, a cross-attention decoding network, an R-point location prediction head, a cardiac rhythm classification prediction head, a clinical parameter prediction head, a confidence prediction head, and an output layer. The preprocessing layer is used to denoise and segment the input signal and initialize the cardiac rhythm feature vector. The embedding layer performs linear projection embedding encoding on the segmented signal and enhances the embedding features of each segment's projection vector using context-aware position encoding. The self-attention encoding network encodes the input vector's features. The cross-attention decoding network decodes the cardiac rhythm features using the output vector of the encoding network as the key input and the initialized cardiac rhythm feature vector as the initial query input. Each of the four prediction heads predicts the corresponding R-point location, cardiac rhythm type, clinical parameter, or confidence level based on the decoded cardiac rhythm feature vector. The output layer integrates the output vectors of the four prediction heads. The data acquisition module is used to construct a first dataset through data acquisition; The model training module trains the heartbeat feature recognition model based on the first dataset; The model application module is used to input the user-input electrocardiogram signal X into the heartbeat feature recognition model after the model training is completed to obtain the corresponding heartbeat feature sequence Y. out Provide feedback to the current user.

[0018] A third aspect of the present invention provides an electronic device, including: a memory, a processor, and a transceiver; The processor is used to couple with the memory, read and execute instructions in the memory to implement the steps of the method described in the first aspect above; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0019] A fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions that, when executed by a computer, cause the computer to perform the instructions described in the first aspect.

[0020] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for processing a cardiac feature recognition model. As described above, this invention constructs a cardiac feature recognition model based on a Transformer architecture encoding / decoding module, capable of simultaneously recognizing three cardiac features (R-point location, cardiac type, and clinical parameters) of electrocardiogram signals. After model training, it serves as an end-to-end cardiac feature recognition tool for users to handle cardiac feature recognition tasks. The model in this invention achieves multi-task joint learning through a shared encoding / decoding network, effectively avoiding the error accumulation problem in traditional cascaded methods. It utilizes the Transformer's self-attention encoding and cross-attention decoding mechanisms to fully model the long-range temporal dependencies of cardiac signals. Furthermore, it employs a multi-task parallel prediction head to achieve integrated output of localization, classification, and parameter estimation, improving processing efficiency while enhancing feature sharing and collaborative optimization capabilities between different tasks. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of a processing method for a cardiac rhythm feature recognition model provided in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the cardiac rhythm feature recognition model provided in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the structure of the self-attention coding network and the cross-attention decoding network provided in Embodiment 1 of the present invention; Figure 4 This is a module structure diagram of a processing device for a cardiac rhythm feature recognition model provided in Embodiment 2 of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0023] Embodiment 1 of the present invention provides a processing method for a cardiac rhythm feature recognition model, such as... Figure 1 The schematic diagram shows a processing method for a heartbeat feature recognition model provided in Embodiment 1 of the present invention. The method mainly includes the following steps: Step 1: Construct a deep learning model for recognizing the heartbeat features of electrocardiogram signals, denoted as the heartbeat feature recognition model.

[0024] Here, the cardiac feature recognition model of this invention is used to identify the R-point position, cardiac type, clinical parameters, and confidence level of all cardiac signals of the input electrocardiogram signal X, and output the corresponding cardiac feature sequence Y. out .

[0025] ECG signal X includes L total Signal x at sampling points i L total Let L be the total number of sampling points for the current ECG signal X, where 1 ≤ sampling point index i ≤ L. total ; Sampling point signal x i Including N Lead A single-lead signal x i,j N Lead Let N be the total number of leads for the current ECG signal X, where 1 ≤ lead index j ≤ N. Lead Each single-lead signal x i,j It represents the signal amplitude of the j-th lead at the current i-th sampling point.

[0026] Heartbeat feature sequence Y out When not empty, it consists of one or more heartbeat feature data; each heartbeat feature data consists of a set of corresponding R-point index IDs. R Type label A, parameter set M, and confidence level F conf Composition; R-point index ID RLet i be the index of a sampling point in the electrocardiogram signal X; let A be the type label for a type of heartbeat; let M be the parameter set consisting of N P Clinical parameter values ​​m v Composition, 1≤index v≤N P .

[0027] The cardiac beat feature recognition model can identify at least the following types of cardiac beats: normal sinus type, atrial fibrillation type, premature ventricular contraction type, premature atrial contraction type, and junctional premature beat type. The total number of types is denoted as N. C The cardiac rhythm feature recognition model can identify at least the PR interval, QRS width, QT interval, and RR interval, with the total number of such parameters denoted as N. P .

[0028] like Figure 2 As shown in the schematic diagram of the cardiac rhythm feature recognition model provided in Embodiment 1 of the present invention, the model input terminal of the cardiac rhythm feature recognition model is used to receive the electrocardiogram signal X, and the model output terminal is used to output the cardiac rhythm feature sequence Y. out .

[0029] like Figure 2 As shown, the model components of the heartbeat feature recognition model include: a preprocessing layer, an embedding layer, a self-attention encoding network, a cross-attention decoding network, an R-point location prediction head, a heartbeat classification prediction head, a clinical parameter prediction head, a confidence prediction head, and an output layer.

[0030] like Figure 2 As shown, the connection relationships of the model components in the heartbeat feature recognition model are as follows: the input of the preprocessing layer is connected to the model input; the first output is connected to the input of the embedding layer; the second output is connected to the second input of the cross-attention decoding network; the output of the embedding layer is connected to the input of the self-attention encoding network; the input of the self-attention encoding network is connected to the first input of the cross-attention decoding network; the output of the cross-attention decoding network is connected to the inputs of the R-point location prediction head, the heartbeat classification prediction head, the clinical parameter prediction head, and the confidence prediction head; the outputs of the R-point location prediction head, the heartbeat classification prediction head, the clinical parameter prediction head, and the confidence prediction head are connected to the first, second, third, and fourth inputs of the output layer, respectively; and the output of the output layer is connected to the model output.

[0031] The functionalities of the model components in the beat feature recognition model are shown below.

[0032] 1) Preprocessing layer: The preprocessing layer in this embodiment of the invention is used to perform noise reduction and segmentation on the input signal and initialize the heartbeat feature vector.

[0033] Specifically, it includes: Step A1, where the preprocessing layer performs signal denoising processing on the electrocardiogram signal X based on preset signal denoising rules to obtain the corresponding denoised signal X. ’ ; and according to the preset segment length L win Sliding step size △L step For the noise-reduced signal X ’ Perform sliding segmentation to obtain the corresponding N piece Segmented signal If the total number of sampling points in the last segment is less than L, win If the length is insufficient, zero-padding is used, where 1 ≤ segment index k ≤ N. piece ; and from all the segmented signals obtained Form the corresponding segmented signal sequence { }

[0034] Here, the signal noise reduction rules in this embodiment of the invention include at least power frequency interference elimination rules, electromyographic noise elimination rules, and baseline drift elimination rules.

[0035] The noise reduction signal X in this embodiment of the invention ’ Including L total Each sampling point signal Sampling point signal Including N Lead Single lead signal .

[0036] The segment length L in this embodiment of the invention win Total number of sampling points in each segment; sliding step size ΔL step ΔL is the interval between the starting sampling points of two adjacent segments. step <L win .

[0037] N in the embodiments of the present invention piece The total number of corresponding segments is calculated as follows: ; Here, ceiling() is the floor function.

[0038] Segmented signals in embodiments of the present invention By L win Each sampling point signal Composition, 1 ≤ the index of the sampling point within the segment i * ≤L win Signal at each sampling point Including N Lead Single lead signal The sampling point signal of this embodiment of the invention. Its corresponding sampling point signal The index mapping relationship is as follows: .

[0039] Step A2, based on the sampling frequency and the total number of sampling points L of the ECG signal X. total Calculate the corresponding total signal duration T; and based on the total signal duration T and the preset maximum number of heartbeats per unit duration B... uni Estimate the corresponding maximum number of heartbeats B total =T×B uni ; and based on the maximum total number of heartbeats B from the signal total and the preset cardiac feature dimension D heart Set a shape as B total ×D heart The feature vector is used as the initial heart rate feature vector Z ini ; and the heart rate feature vector Z ini The vector parameters are set randomly.

[0040] Here, in this embodiment of the invention, the maximum total number of heartbeats per unit time B uni Heartbeat feature dimension D heart These are two pre-set positive integer values.

[0041] Step A3, and divide the segmented signal sequence { Send the heartbeat feature vector Z to the embedding layer. ini Send to the cross-attention decoding network.

[0042] 2) Embedding layer: The embedding layer in this embodiment of the invention is used to perform linear projection embedding encoding on segmented signals and to perform embedding feature enhancement processing on the projection vector of each segment using a context-aware position encoding method.

[0043] Specifically, this includes: Step B1, the embedding layer segments the signal sequence { The segmented signals of} As the current segment; and by L of the j-th lead in the current segment win Single lead signal Form a shape of 1×L win single-lead vector s k,j ; and for the N corresponding to the current segment Lead One single-lead vector s k,j By sequentially piecing them together, we get a shape of 1×(N) Lead ×L win The fragment vector S k .

[0044] Step B2, and for each segment vector S k Perform linear projection embedding encoding to obtain the corresponding segment projection vector. .

[0045] Here, the fragment projection vector of the embodiment of the present invention The calculation method is as follows: ; Among them, W emb W is the linear projection matrix of the model; emb The shape is (N) Lead ×L win )×D heart Fragment projection vector The shape is 1×D heart .

[0046] Step B3, and based on the location encoding function corresponding to the model. Projecting vectors onto each segment Position encoding vector P k Configure the settings.

[0047] Here, the position encoding vector P in this embodiment of the invention k The calculation method is as follows: ; Where θ is the position encoding function Function parameters; position encoding function Output feature dimension and heartbeat feature dimension D heart Same; position encoding vector P k The shape is 1×D heart .

[0048] Step B4, and based on the preset nearest neighbor radius r, project the vectors for each segment. Set a shape of (2r+1)×D heart Nearest neighbor vectors SN k If the corresponding nearest neighbor segment projection vector does not exist during the setting, it will be insufficient by padding with zeros.

[0049] Here, in this embodiment of the invention, the nearest neighbor radius r is a preset positive integer. The nearest neighbor vector SN in this embodiment of the invention... k Depend on arrive The projection vectors of (2r+1) segments are composed of: { }

[0050] Step B5, and perform one-dimensional convolution operation on each nearest neighbor vector SN. k Feature extraction is performed, the extracted features are activated, and the activated features are used as the corresponding context-aware vector C. k .

[0051] Here, the context-aware vector C in this embodiment of the invention k The calculation method is as follows: ; Where ReLU() is the ReLU activation function; Conv1D is the one-dimensional convolution function corresponding to the model, and W 1D b 1D The convolution kernel weight vector and bias vector of the current one-dimensional convolution function; context-aware vector C. k The shape is 1×D cxt D cxt This represents the feature dimension output by the current one-dimensional convolution function.

[0052] Step B6, and according to the gated fusion method, project the vectors of each segment. The corresponding context-aware vector C k and position encoding vector P k Perform feature fusion and use the fused features as the corresponding fragment enhancement vectors. ; Here, the fragment enhancement vector of the embodiment of the present invention The calculation method is as follows: ; Where Sigmoid() is the Sigmoid activation function; G is the gating vector corresponding to the model, with shape D. cxt ×1; vector , The shape is D cxt ×D heart ;vector The shape is 1×D heart Fragment enhancement vector The shape is 1×D heart .

[0053] Step B7, and by N piece Fragment enhancement vectors Form a shape of N piece ×D heart eigenvector H ini Send to the self-attention coding network.

[0054] 3) Self-attention encoding network: The self-attention coding network of this embodiment consists of N EN The l1-th encoding module is connected sequentially, N EN The total number of preset encoding modules, 1 ≤ index l1 ≤ N EN The l1 encoding module is implemented based on the self-attention encoding module of the Transformer model framework. For example... Figure 3The diagram shows the structure of the self-attention coding network and the cross-attention decoding network provided in Embodiment 1 of the present invention.

[0055] Self-attention coding networks are used to encode features from input vectors.

[0056] Specifically, this includes: using the feature vector H ini This is the input to the first encoding module, and is passed through N. EN The l1-th encoding module performs one round of sequential self-attention encoding to obtain a corresponding feature vector H. out Send to the cross-attention decoding network.

[0057] Here, the input and output vectors of the l1 encoding module in this embodiment of the invention are denoted as the corresponding... , Each of the l1st encoding modules in this embodiment of the invention is used to encode the input vector. The query, key, and value vectors are transformed, and then feature-encoded according to the encoding rules of the self-attention encoding module of the Transformer model framework to obtain the corresponding output vector. .

[0058] Input vector of the first encoding module The output vector of the l1st encoding module serves as the input vector of the l1+1th encoding module. The feature vector H output by the self-attention encoding network... out For the Nth EN Output vector of the encoding module .

[0059] Feature vector H in this embodiment of the invention out The shape is N piece ×D heart .

[0060] 4) Cross-attention decoding network: The cross-attention decoding network of this invention consists of N DE The l2nd decoding module is connected sequentially, N DE The total number of preset decoding modules, 1 ≤ index l2 ≤ N DE The l2 decoding module is implemented based on the cross-attention decoding module of the Transformer model framework.

[0061] The cross-attention decoding network is used to decode cardiac features by taking the output vector of the encoding network as the key input and the initialized cardiac feature vector as the initial query input.

[0062] Specifically, this includes: using the feature vector H out As the key-value input vector for each of the l2nd decoding modules, the heartbeat feature vector Zini As the query input vector of the first decoding module, and through N DE The l2nd decoding module performs a round of sequential cross-attention decoding to obtain a corresponding heart rate feature vector Z. out Send to the R-point location prediction head, heart rate classification prediction head, clinical parameter prediction head, and confidence prediction head.

[0063] Here, the key-value input vector of each of the l2nd decoding modules in this embodiment of the invention is H. out The query input vector is denoted as the corresponding The decoded output vector is denoted as the corresponding... Each of the l2 decoding modules is used to process the feature vector H. out Perform key-value vector conversion and process the query input vector. The query vector is transformed, and then feature decoding is performed on the obtained query, key, and value vectors according to the decoding rules of the cross-attention decoding module of the Transformer model framework to obtain the corresponding decoded output vector. .

[0064] The query input vector of the first decoding module The decoding output vector of the l2nd decoding module serves as the query input vector for the l2+1th decoding module. The heart rate feature vector Z output by the cross-attention decoding network... out For the Nth DE Output vector of the decoding module .

[0065] The cardiac feature vector Z in this embodiment of the invention out The shape is B total ×D heart By B total The shape is 1×D heart eigenvectors Composition; 1 ≤ index o ≤ B total .

[0066] 5) Four prediction heads: The four prediction heads in this embodiment of the invention (R-point location prediction head, heartbeat classification prediction head, clinical parameter prediction head, and confidence prediction head) are each used to predict the corresponding R-point location, heartbeat type, clinical parameter, or confidence level based on the decoded heartbeat feature vector. Specifically, the R-point location prediction head and the confidence prediction head are each implemented based on a corresponding linear regression calculation network; the heartbeat classification prediction head is implemented based on a corresponding linear classification network; and the clinical parameter prediction head is implemented based on an MLP model.

[0067] a) Prediction of point R location: The R-point location prediction head of this invention is used based on the heartbeat feature vector Z.out Predict the corresponding position prediction vector Y1 and send the position prediction vector Y1 to the output layer.

[0068] Here, the reasoning method for the location prediction vector Y1 in this embodiment of the invention is as follows: ; Among them, W R The weight matrix corresponding to the prediction head at point R has a shape of 1×D. heart The shape of the location prediction vector Y1 is B. total ×1, from B total Predicted locations Composition. Predicted location. It is a normalized scalar with a value between [0,1], used to express the relative position of the current R point in the current electrocardiogram signal.

[0069] b) Cardiac classification prediction head: The heartbeat classification prediction head of this embodiment of the invention is used to predict heartbeats based on the heartbeat feature vector Z. out Each feature vector Heartbeat classification prediction yields a 1×N shape C Prediction vector ; and from the obtained B total prediction vectors Composition shape B total ×N C The type prediction vector Y2 is sent to the output layer.

[0070] Here, each prediction vector of the type prediction vector Y2 in this embodiment of the invention... The reasoning method is as follows: ; Where Softmax() is the Softmax function; W C b C This refers to the weight matrix and bias vector corresponding to the heartbeat classification prediction head. Weight matrix W C The shape is N C ×D heart Bias vector b C The shape is 1×N C Prediction vector By N C Type probability Composition, 1≤index u≤N C Probability of each type This corresponds to a type of heartbeat.

[0071] c) Clinical parameter prediction head: The clinical parameter prediction head of this invention is used to predict heart rate features based on the heart rate feature vector Z using an MLP network. out Clinical parameter prediction yields a shape of B total ×N P The parameter prediction vector Y3 is sent to the output layer.

[0072] Here, the reasoning method for the parameter prediction vector Y3 in this embodiment of the invention is as follows: ; Where β represents the model parameters of the MLP network; the parameter prediction vector Y3 is derived from B. total prediction vectors Composition. Prediction vector The shape is 1×N P , by N P Prediction parameters Composition, each prediction parameter Each predictive parameter corresponds to a class of clinical parameters. All of them are based on a single z-score standard value.

[0073] d) Confidence prediction head: The confidence prediction head of this embodiment of the invention is used to predict the heart rate based on the heartbeat feature vector Z. out Predict the corresponding confidence prediction vector Y4 and send the confidence prediction vector Y4 to the output layer.

[0074] Here, the reasoning method for the confidence prediction vector Y4 in this embodiment of the invention is as follows: ; Among them, W conf The weight matrix corresponding to the confidence prediction head has a shape of 1×D. heart The confidence prediction vector Y4 has a shape of B. total ×1, from B total Each prediction confidence level Composition. Prediction confidence level It is a scalar whose value is between [0,1].

[0075] 6) Output layer: The output layer in this embodiment of the invention is used to integrate the output vectors of the four prediction heads.

[0076] Specifically, this includes: Step C1, where the output layer selects the predicted positions with the same index o from the position prediction vector Y1, type prediction vector Y2, parameter prediction vector Y3, and confidence prediction vector Y4. Prediction vector Prediction vector Prediction confidence Extract the data to form a corresponding heart rate array; and use the prediction confidence scores from it. Heartbeat arrays that are greater than or equal to a preset confidence threshold are used as candidate heartbeat arrays.

[0077] Here, the confidence threshold in this embodiment of the invention is a pre-set threshold parameter.

[0078] Step C2, and use each candidate heartbeat array as the current array; and based on the predicted position of the current array... Calculate the corresponding R-point index ID R And based on the prediction vector of the current array. Set the corresponding type tag A; and based on the N corresponding to type tag A... P Group standard deviation and mean, and the prediction vector of the current array. Calculate the corresponding parameter set M; and calculate the prediction confidence of the current array. As the corresponding confidence level F conf .

[0079] Here, in the embodiment of the present invention, the R-point index ID R The calculation method is as follows: ; The round() function is used for rounding.

[0080] In this embodiment of the invention, type label A is the prediction vector. The type probability with the highest probability value The corresponding heart rate type.

[0081] The standard deviation and mean of each clinical parameter for each type of cardiac rhythm in this embodiment of the invention are denoted as the corresponding... , ; where N corresponds to the current type tag A P The group standard deviation and mean are denoted as the corresponding , .

[0082] The clinical parameter values ​​m of the parameter set M in this embodiment of the invention v The calculation method is as follows: .

[0083] Step C3 involves using the R-point index ID corresponding to each candidate heartbeat array. R Type label A, parameter set M, and confidence level F conf This forms a corresponding cardiac feature data set; all the obtained cardiac feature data sets are combined to form a corresponding cardiac feature sequence Y. out And output it.

[0084] Step 2: Construct the first dataset through data collection.

[0085] Here, the first dataset in this embodiment of the invention includes N TR The first data record; N TR This represents the total number of records in the first dataset.

[0086] The first data record in this embodiment of the invention includes the training signal X. TR Location label vector Type label vector Parameter label vector .

[0087] Training signal X in this embodiment of the invention TR The data format is consistent with the electrocardiogram signal X. The training signal X in this embodiment of the invention... TR The corresponding actual total number of heartbeats is recorded as the corresponding total number of heartbeats. .

[0088] Location label vector of the present invention By the corresponding Each tag position composition, ; tag position Let be a normalized scalar with values ​​between [0,1], specifically the o-th scalar. ’ The relative duration T between the R-point position of a heartbeat signal and the current signal's initial sampling point position. off Total duration T of the current signal total The ratio T off / T total .

[0089] Type label vector of this invention By the corresponding label vectors Composition; label vector Including N C Probability of each label ; tag vector In the middle, there is one and only one label probability that corresponds to the current true heartbeat type. 1 for all, N for the rest C -1 label probability All are 0.

[0090] Parameter label vector of the present invention By the corresponding label vectors Composition; label vector Including N P Each tag parameter ; Each tag parameter It is the z-score standard value of the vth clinical parameter type under the uth type of cardiac rhythm.

[0091] The current step 2 specifically includes: Step 21: Collect multiple raw electrocardiogram signals from a pre-set multi-type public database.

[0092] Here, the various publicly available databases successfully used in this invention include at least the MIT-BIH database, the SVDB database, the CPSC2018 dataset, and the CCDD database.

[0093] Step 22: Resample each original ECG signal according to the sampling frequency of ECG signal X, and perform training signal conversion on the obtained resampled signals according to ECG signal X to obtain the corresponding training signal X. TR ; and for the training signal X TR The total number of records N is obtained by counting the total number of records. TR .

[0094] Step 23, and then process each training signal X TR This serves as the current signal; and all heartbeat signals on the current signal are labeled using a preset manual or machine labeling method; the total number of labeled heartbeat signals on the current signal is then counted to obtain the corresponding total number of heartbeats. The system iterates through all heartbeat signals marked on the current signal; during this iteration, the heartbeat signal currently being iterated is taken as the current heartbeat; the R-point position of the current heartbeat is marked, and the relative duration T between the marked position and the start and end points of the current signal is calculated. off Perform the calculation and set the total signal duration T of the current signal. total Perform identification and calculate the corresponding label position. It also labels the heartbeat type of the current heartbeat and assigns the label probability corresponding to the currently labeled heartbeat type. Set it to 1, and set the remainder N to 1. C -1 corresponding label probability All are set to 0, and N is determined by the current heartbeat. C Probability of each label Form a corresponding label vector ; and the N of the current heartbeat P True values ​​of clinical-like parameters Mark the symbols; and at the end of this round of traversal, assign the symbol to the current signal. Each tag position Form the corresponding position label vector The current signal corresponds to label vectors Form the corresponding type label vector .

[0095] Step 24, and classify all training signals X according to heartbeat type. TR All true parameter values ​​of all heartbeat signals Clustering yields the corresponding N C Each first parameter set; and all true parameter values ​​for each first parameter set according to clinical parameter type. Clustering yields the corresponding N P A second parameter set is defined; and the standard deviation and mean of each second parameter set are calculated to obtain a corresponding set of standard deviations. ,average value .

[0096] Here, all the actual parameter values ​​in each first parameter set of the embodiments of the present invention. They all belong to the same type of heartbeat; all true parameter values ​​in each second parameter set They all belong to the same type of heartbeat and the same type of clinical parameter.

[0097] Step 25, and then process each training signal X TR As the current signal; and iterate through all heartbeat signals marked on the current signal; during this iteration, the heartbeat signal currently iterated is taken as the current heartbeat; and the heartbeat type corresponding to the current heartbeat is taken as the current type u. * ; and the current true parameter values ​​of the heartbeat As the current parameter value m * and set the current parameter value m * The corresponding clinical parameter type is used as the current type v * and the current type u * and current type v * corresponding standard deviation and average As the current standard deviation and current average and for the current parameter value m * Corresponding tag parameters Perform calculations. ; and N corresponding to the current heartbeat P Each tag parameter Form the corresponding label vector And at the end of this round of traversal, the signal corresponding to the current signal is... label vectors Form the corresponding parameter label vector .

[0098] Step 26, and from each training signal XTR and its corresponding set of location label vectors Type label vector and parameter label vector This forms a corresponding first data record.

[0099] Step 27, and by N TR The first data record constitutes the corresponding first dataset.

[0100] Step 3: Train a heartbeat feature recognition model based on the first dataset.

[0101] Specifically, this includes: Step 3-1, initializing the first counter to the total number of records N in the first dataset. TR .

[0102] Step 3-2: Take the first data record of the first dataset as the current training record.

[0103] Step 3-3, record the training signal X in the current training session. TR The corresponding electrocardiogram signal X is input into the heartbeat feature recognition model and processed to obtain four corresponding prediction vectors.

[0104] The four prediction vectors include location prediction vector Y1, type prediction vector Y2, parameter prediction vector Y3, and confidence prediction vector Y4; location prediction vector Y1 includes the corresponding B total Predicted locations The type prediction vector Y2 includes the corresponding B. total prediction vectors Prediction vector Including N C Type probability The parameter prediction vector Y3 includes the corresponding B. total prediction vectors Prediction vector Including N P Prediction parameters The confidence prediction vector Y4 includes the corresponding B total Each prediction confidence level .

[0105] Steps 3-4: Construct the corresponding prediction target set based on the four prediction vectors; and based on the position label vector of the current training record. Type label vector Parameter label vector Construct the corresponding target set of tags.

[0106] Wherein, the prediction target set is composed of the corresponding B total One prediction target S oComposition; each predicted target S o From a set of corresponding predicted positions Prediction vector Prediction vector Prediction confidence Composition. The target set of tags consists of the corresponding individual tag targets Composition; each tag target A set of corresponding label positions Label vectors Label vectors composition.

[0107] Steps 3-5: Using the shortest R-point distance as the matching condition, identify the predicted-label pairs matched in the predicted target set and the label target set to obtain the corresponding matching set G. P .

[0108] Here, the matching set G of this embodiment of the invention P When not empty, it includes one or more prediction-label pairs (o,o) ’ ); Each prediction-label pair (o,o ’ ) is a set of matched prediction targets S o and tag target index o, o ’ Composition; prediction target S for each matching pair o and tag target The R-point spacing = | All of these values ​​are less than the preset point spacing threshold τ, and the R-point spacing of the current prediction-label pair is the minimum value among all R-point spacings between all predicted targets and the current label target; Matching set G P Any two prediction-label pairs (o,o) ’ The index o or o) ’ There is no overlap. Here, the point spacing threshold τ in this embodiment of the invention is a pre-set threshold parameter.

[0109] The current steps 3-5 specifically include: Step 3-5-1, for each tag target in the tag target set Perform one iteration; and during this iteration, change the currently traversed label target. The corresponding target is used as the current label target; and the current label target and each predicted target S in the predicted target set are compared. o The corresponding point spacing is obtained by calculating the R-point spacing. ; and at the end of this round of traversal, the result obtained from this round of traversal ×B total Spacing between points Form a shape as ×B total The matrix D.

[0110] Here, the matrix D in this embodiment of the invention is derived from... ×B total Spacing between points Composition, each line corresponds to a tag target. Each column corresponds to a prediction target S. o .

[0111] Step 3-5-2, and then B of matrix D total All columns are initially marked as unused columns; a row-by-row traversal is performed on matrix D; during this traversal, the current traversed row is taken as the current row; and the B column of the current row is set as the current row. total Spacing between points The minimum value is used as the current minimum spacing; the column corresponding to the current minimum spacing is used as the current column; and when the current minimum spacing is less than the point spacing threshold τ and the current column is an unused column, the index o corresponding to the current row and the current column is used. ’ A prediction-label pair (o, o) is formed by combining o and o. ’ ), and change the unused column flag of the current column to the used flag; and at the end of this round of traversal, use all the obtained prediction-label pairs (o,o) ’ ) form the corresponding matching set G P .

[0112] Steps 3-6 involve predicting targets that do not appear in the matching set G. P The index o in the middle forms the corresponding pseudo-target set G. F ; and those tags in the target set that do not appear in the matching set G P index o in ’ Form the corresponding missed detection target set G M .

[0113] Steps 3-7: Construct the location loss function L based on the smoothed L1 loss function. pos .

[0114] Here, the position loss function L in this embodiment of the invention pos for: , .

[0115] Among them, |G P |For matching set G P The total number of predicted label pairs; This is the first smoothing L1 loss function; is the smoothing coefficient of the first smoothing L1 loss function.

[0116] Steps 3-8: Construct the classification loss function L based on the multi-class cross-entropy loss function. cls .

[0117] Here, the classification loss function L in this embodiment of the invention cls for: , , , , , .

[0118] Among them, |G F |For the pseudo-target set G F The total number of indexes; , These are the corresponding matching set classification loss function and pseudo-target set classification loss function, respectively. , These are the corresponding matching set classification loss weight coefficients and pseudo-target set classification loss weight coefficients, respectively. , These are the corresponding cross-entropy loss functions for the matching set and the pseudo-target set, respectively.

[0119] Steps 3-9: Construct the parametric loss function L based on the smoothed L1 loss function. para .

[0120] Here, the parameter loss function L in this embodiment of the invention para for: , .

[0121] in, This is the second smoothing L1 loss function; is the smoothing coefficient of the second smoothing L1 loss function.

[0122] Steps 3-10, based on the matching set G P and pseudo-target set G F For each prediction confidence level of the confidence prediction vector Y4 Set a corresponding label confidence level. .

[0123] Here, the label confidence level of the embodiments of the present invention. The setup method is as follows: .

[0124] Step 3-11: Construct the confidence loss function L based on the binary cross-entropy loss function. conf .

[0125] Here, the confidence loss function L in this embodiment of the invention conf for: .

[0126] Step 3-12, based on the missed detection target set G M and pseudo-target set G F For each missed target, the distance between the R-points and each pseudo-target is calculated, and the shortest distance is taken as the corresponding shortest missed-target-pseudo-target distance. .

[0127] Here, the shortest missed detection-false target spacing in this embodiment of the invention. The identification method is as follows: .

[0128] Step 3-13, based on all shortest missed detection-false target spacing Set the loss function for missed detection penalty L miss .

[0129] Here, the missed detection penalty loss function L in this embodiment of the invention. miss for: .

[0130] Among them, |G M |For the set of missed detections G M The total number of indexes; η is a preset penalty intensity coefficient.

[0131] Step 3-14, based on the location loss function L pos Classification loss function L cls , parameter loss function L para Confidence loss function L conf 1. Loss function for missed detection penalty miss Construct the corresponding overall loss function L all .

[0132] Here, the overall loss function L in this embodiment of the invention all for: , .

[0133] in, , , , , These are the preset weighting coefficients for location loss, classification loss, parameter loss, confidence loss, and missed detection penalty.

[0134] Step 3-15, for the overall loss function L all The loss value is calculated to obtain the corresponding first loss value; and it is identified whether the first loss value meets the preset first loss value range; if it does, proceed to step 3-16; if it does not, when the first counter is greater than 0, the first counter is decremented by 1, and the overall loss function L is optimized based on the preset first model optimizer. all The direction that reaches the minimum value modulates the model parameters of the heartbeat feature recognition model in one round, and returns to step 3-3 when the modulation ends.

[0135] Here, the first loss value range in this embodiment of the invention is a pre-set numerical range; the first model optimizer includes at least the Adam optimizer.

[0136] Step 3-16: Identify whether the current training record is the last first data record in the first dataset; if the current training record is not the last first data record, take the next first data record in the first dataset as the new current training record and return to step 3-3; if the current training record is the last first data record, calculate the current pass rate = first counter / N. TR It then identifies whether the current pass rate is less than the preset pass rate threshold. If so, it returns to step 3-1; otherwise, it stops training and confirms that the training of the heartbeat feature recognition model has ended.

[0137] Here, the pass rate threshold in this embodiment of the invention is a pre-set threshold parameter.

[0138] Step 4: After model training is complete, the user-inputted electrocardiogram signal X is fed into the heartbeat feature recognition model to obtain the corresponding heartbeat feature sequence Y. out Provide feedback to the current user.

[0139] Figure 4 This is a module structure diagram of a processing device for a heartbeat feature recognition model provided in Embodiment 2 of the present invention. This device can be a terminal device or server implementing the aforementioned method embodiment, or it can be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 4As shown, the device includes: a model building module 201, a data acquisition module 202, a model training module 203, and a model application module 204.

[0140] Model building module 201 is used to build a deep learning model for recognizing the heartbeat features of electrocardiogram (ECG) signals, denoted as the heartbeat feature recognition model. The heartbeat feature recognition model is used to identify the R-point position, heartbeat type, clinical parameters, and confidence level of all heartbeat signals of the ECG signal X input to the model, and output the corresponding heartbeat feature sequence Y. out The types of heartbeats include at least the normal sinus type, atrial fibrillation type, ventricular premature beat type, atrial premature beat type, and junctional premature beat type, and the total number of types is denoted as N. C The clinical parameters must include at least the PR interval, QRS width, QT interval, and RR interval, and the total number of these parameters is denoted as N. P The cardiac rhythm feature recognition model includes a preprocessing layer, an embedding layer, a self-attention encoding network, a cross-attention decoding network, an R-point location prediction head, a cardiac rhythm classification prediction head, a clinical parameter prediction head, a confidence prediction head, and an output layer. The preprocessing layer is used to denoise and segment the input signal and initialize the cardiac rhythm feature vector. The embedding layer is used to perform linear projection embedding encoding on the segmented signal and to perform embedding feature enhancement processing on the projection vector of each segment using a context-aware position encoding method. The self-attention encoding network is used to encode the input vector. The cross-attention decoding network is used to decode the cardiac rhythm features using the output vector of the encoding network as the key value input and the initialized cardiac rhythm feature vector as the initial query input. The four prediction heads are each used to predict the corresponding R-point location, cardiac rhythm type, clinical parameter, or confidence based on the decoded cardiac rhythm feature vector. The output layer is used to integrate the output vectors of the four prediction heads.

[0141] The data acquisition module 202 is used to construct the first dataset through data acquisition.

[0142] The model training module 203 trains a heartbeat feature recognition model based on the first dataset.

[0143] The model application module 204 is used to input the user-input electrocardiogram signal X into the heartbeat feature recognition model to obtain the corresponding heartbeat feature sequence Y after the model training is completed. out Provide feedback to the current user.

[0144] The processing device for a cardiac feature recognition model provided in this embodiment of the invention can execute the method steps in the above method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.

[0145] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing elements; they can be fully implemented in hardware; or some modules can be implemented by processing elements calling software, while others are implemented in hardware. For example, the model building module can be a separate processing element, or it can be integrated into a chip in the above device. Alternatively, it can be stored as program code in the memory of the above device, and its functions can be called and executed by a processing element. The implementation of other modules is similar. Moreover, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.

[0146] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more Digital Signal Processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). As another example, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a System-on-a-Chip (SOC).

[0147] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the foregoing method embodiments are generated. The computer described above can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The aforementioned computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the aforementioned computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, Bluetooth, microwave, etc.) means. The aforementioned computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).

[0148] Figure 5 This is a schematic diagram of an electronic device provided in Embodiment 3 of the present invention. This electronic device can be a terminal device or server implementing the methods of the aforementioned embodiments, or it can be a terminal device or server connected to the aforementioned terminal device or server implementing the methods of the aforementioned embodiments. Figure 5 As shown, the electronic device may include: a processor 301 (e.g., CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transmission and reception operations of the transceiver 303. The memory 302 may store various instructions for performing various processing functions and implementing the processing steps described in the foregoing embodiments. Preferably, the electronic device involved in the embodiments of the present invention further includes: a power supply 304, a system bus 305, and a communication port 306. The system bus 305 is used to realize communication connections between components. The communication port 306 is used for communication between the electronic device and other peripherals.

[0149] exist Figure 5The system bus 305 mentioned can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, it is represented by only one thick line in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write libraries, and read-only libraries). Memory may include Random Access Memory (RAM) and may also include Non-Volatile Memory, such as at least one disk storage device.

[0150] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), graphics processing units (GPUs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0151] It should be noted that the embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when run on a computer, cause the computer to perform the methods and processes provided in the above embodiments.

[0152] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for processing a cardiac feature recognition model. As described above, this invention constructs a cardiac feature recognition model based on a Transformer architecture encoding / decoding module, capable of simultaneously recognizing three cardiac features (R-point location, cardiac type, and clinical parameters) of electrocardiogram signals. After model training, it serves as an end-to-end cardiac feature recognition tool for users to handle cardiac feature recognition tasks. The model in this invention achieves multi-task joint learning through a shared encoding / decoding network, effectively avoiding the error accumulation problem in traditional cascaded methods. It utilizes the Transformer's self-attention encoding and cross-attention decoding mechanisms to fully model the long-range temporal dependencies of cardiac signals. Furthermore, it employs a multi-task parallel prediction head to achieve integrated output of localization, classification, and parameter estimation, improving processing efficiency while enhancing feature sharing and collaborative optimization capabilities between different tasks.

[0153] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0154] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for processing a cardiac rhythm feature recognition model, characterized in that, The method includes: A deep learning model, denoted as the heartbeat feature recognition model, is constructed to identify the heartbeat features of electrocardiogram (ECG) signals. This model identifies the R-point location, heartbeat type, clinical parameters, and confidence level of all heartbeat signals from the input ECG signal X and outputs the corresponding heartbeat feature sequence Y. out The types of heartbeats include at least the normal sinus type, atrial fibrillation type, ventricular premature beat type, atrial premature beat type, and junctional premature beat type, and the total number of types is denoted as N. C The clinical parameters must include at least the PR interval, QRS width, QT interval, and RR interval, and the total number of these parameters is denoted as N. P The cardiac rhythm feature recognition model includes a preprocessing layer, an embedding layer, a self-attention encoding network, a cross-attention decoding network, an R-point location prediction head, a cardiac rhythm classification prediction head, a clinical parameter prediction head, a confidence prediction head, and an output layer. The preprocessing layer is used to denoise and segment the input signal and initialize the cardiac rhythm feature vector. The embedding layer performs linear projection embedding encoding on the segmented signal and enhances the embedding features of each segment's projection vector using context-aware position encoding. The self-attention encoding network encodes the input vector's features. The cross-attention decoding network decodes the cardiac rhythm features using the output vector of the encoding network as the key input and the initialized cardiac rhythm feature vector as the initial query input. Each of the four prediction heads predicts the corresponding R-point location, cardiac rhythm type, clinical parameter, or confidence level based on the decoded cardiac rhythm feature vector. The output layer integrates the output vectors of the four prediction heads. The first dataset was constructed through data collection; The heartbeat feature recognition model is trained based on the first dataset; After the model training is completed, the ECG signal X input by the user is sent to the heartbeat feature recognition model to obtain the corresponding heartbeat feature sequence Y. out Provide feedback to the current user; The embedding layer is used to perform linear projection embedding encoding on the segmented signal and to perform embedding feature enhancement processing on the projection vector of each segment using a context-aware position encoding method, specifically including: Step 41, divide the segmented signal sequence { The segmented signals of} As the current segment; and by L of the j-th lead in the current segment win Single lead signal Form a shape of 1×L win single-lead vector s k,j ; and for the N corresponding to the current segment Lead The single-lead vector s k,j By sequentially piecing them together, we get a shape of 1×(N) Lead ×L win The fragment vector S k ; Where 1 ≤ segment index k ≤ N piece N piece The total number of segments; 1 ≤ the index of the sampling point within the segment i * ≤L win L win The segment length is 1 ≤ lead index j ≤ N Lead N Lead The total number of leads for the electrocardiogram signal X; Step 42, and for each of the said fragment vectors S k Perform linear projection embedding encoding to obtain the corresponding segment projection vector. ; in, ; W emb Let W be the linear projection matrix of the model. emb The shape is (N) Lead ×L win )×D heart The segment projection vector The shape is 1×D heart ;D heart For cardiac rhythm characteristics; Step 43, and based on the location encoding function corresponding to the model. Projecting vectors onto each of the aforementioned segments Position encoding vector P k Configure settings; in, ; θ is a function parameter of the position encoding function; the position encoding function Output feature dimension and heartbeat feature dimension D heart Same; the position encoding vector P k The shape is 1×D heart ; Step 44, and based on the preset nearest neighbor radius r, project the vectors of each segment. Set a shape of (2r+1)×D heart Nearest neighbor vectors SN k If the corresponding nearest neighbor segment projection vector does not exist during the setting, it will be padded with zeros. Wherein, the nearest neighbor vector SN k From the fragment projection vector arrive composition; Step 45, and perform one-dimensional convolution operation on each of the nearest neighbor vectors SN. k Feature extraction is performed, the extracted features are activated, and the activated features are used as the corresponding context-aware vector C. k ; in, ; ReLU() is the ReLU activation function; Conv1D is the one-dimensional convolution function corresponding to the model, W 1D b 1D The convolution kernel weight vector and bias vector of the current one-dimensional convolution function; the context-aware vector C k The shape is 1×D cxt D cxt This represents the feature dimension output by the current one-dimensional convolution function. Step 46, and according to the gated fusion method, project the vectors of each segment. The corresponding context-aware vector C k and the position encoding vector P k Perform feature fusion and use the fused features as the corresponding fragment enhancement vectors. ; in, ; Sigmoid() is the Sigmoid activation function; G is the gating vector corresponding to the model, with shape D. cxt ×1; vector , The shape is D cxt ×D heart ;vector The shape is 1×D heart The fragment enhancement vector The shape is 1×D heart ; Step 47, and by N piece The fragment enhancement vectors Form a shape of N piece ×D heart eigenvector H ini Send to the self-attention coding network; When training the heartbeat feature recognition model based on the first dataset, the overall loss function L is constructed. all for: , ; , , , , These are the preset weighting coefficients for location loss, classification loss, parameter loss, confidence loss, and missed detection penalty loss. For the location loss function constructed based on the smooth L1 loss function, For the classification loss function constructed based on the multi-class cross-entropy loss function, Parametric loss function constructed based on smooth L1 loss function, For the confidence loss function constructed based on the binary cross-entropy loss function, The loss function is the penalty function for missed detections; Missed detection penalty loss function Specifically: ; G M The set of missed detection targets, which is indexed by one or more heartbeats when it is not empty. Composition; |G M | represents the total number of indexes in the missed target set; η represents the preset penalty intensity coefficient; τ represents the point spacing threshold; The shortest missed-detection-pseudo-target distance is defined for each missed-detection target in the missed-detection target set. During model training, after obtaining the predicted target set and the label target set corresponding to a training signal, the predicted-label pairs matched in the predicted target set and the label target set are identified using the shortest R-point distance as the matching condition to obtain the corresponding matching set. The corresponding missed-detection target set is composed of the heartbeat indices in the label target set that do not appear in the matching set, and the corresponding pseudo-target set is composed of the heartbeat indices in the predicted target set that do not appear in the matching set. The shortest missed-detection-pseudo-target distance is defined for each missed-detection target in the missed-detection target set. It is the shortest distance between the currently missed target and all pseudo-targets in the pseudo-target set.

2. The processing method of the cardiac rhythm feature recognition model according to claim 1, characterized in that, The electrocardiogram signal X includes L total Signal x at sampling points i L total Let i be the total number of sampling points for the current ECG signal X, where 1 ≤ sampling point index i ≤ L. total The sampling point signal x i Including N Lead A single-lead signal x i,j N Lead Let N be the total number of leads for the current ECG signal X, where 1 ≤ lead index j ≤ N. Lead Each of the single-lead signals x i,j This represents the signal amplitude of the j-th lead at the current i-th sampling point; The heartbeat feature sequence Y out When not empty, it consists of one or more cardiac feature data; each cardiac feature data is composed of a set of corresponding R-point index IDs. R Type label A, parameter set M, and confidence level F conf Composition; the R-point index ID R Let i be the index of a sampling point in the electrocardiogram signal X; let A be the type label A, which represents a type of heartbeat; let M be the parameter set N. P Clinical parameter values ​​m v Composition, 1≤index v≤N P ; The input terminal of the heartbeat feature recognition model is used to receive the electrocardiogram signal X, and the output terminal is used to output the heartbeat feature sequence Y. out ; The input of the preprocessing layer is connected to the input of the model; the first output is connected to the input of the embedding layer; and the second output is connected to the second input of the cross-attention decoding network. The output of the embedding layer is connected to the input of the self-attention encoding network. The input of the self-attention encoding network is connected to the first input of the cross-attention decoding network. The output of the cross-attention decoding network is connected to the inputs of the R-point location prediction head, the heart rate classification prediction head, the clinical parameter prediction head, and the confidence prediction head. The outputs of the R-point location prediction head, the heart rate classification prediction head, the clinical parameter prediction head, and the confidence prediction head are respectively connected to the first, second, third, and fourth inputs of the output layer. The output of the output layer is connected to the model output. The self-attention coding network consists of N EN The l1-th encoding module is connected sequentially, N EN The total number of preset encoding modules, 1 ≤ index l1 ≤ N EN The l1st encoding module is implemented based on the self-attention encoding module of the Transformer model framework; The cross-attention decoding network consists of N DE The l2nd decoding module is connected sequentially, N DE The total number of preset decoding modules, 1 ≤ index l2 ≤ N DE The l2nd decoding module is implemented based on the cross-attention decoding module of the Transformer model framework; The R-point location prediction head and the confidence prediction head are each implemented based on a corresponding linear regression calculation network; the heart rate classification prediction head is implemented based on a corresponding linear classification network; and the clinical parameter prediction head is implemented based on an MLP model.

3. The processing method of the cardiac rhythm feature recognition model according to claim 2, characterized in that, The preprocessing layer is used to perform noise reduction and segmentation on the input signal and initialize the heartbeat feature vector, specifically including: Step 31: Perform signal denoising processing on the ECG signal X based on preset signal denoising rules to obtain the corresponding denoised signal X. ’ ; and according to the preset segment length L win Sliding step size △L step For the noise reduction signal X ’ Perform sliding segmentation to obtain the corresponding N piece Segmented signal If the total number of sampling points in the last segment is less than L, win The length is then padded with zeros, where 1 ≤ segment index k ≤ N. piece ; and from all the obtained segmented signals Form the corresponding segmented signal sequence { }; The signal noise reduction rules include at least the power frequency interference elimination rule, the electromyographic noise elimination rule, and the baseline drift elimination rule; The noise reduction signal X ’ Including L total Each sampling point signal The sampling point signal Including N Lead Single lead signal ; The segment length L win The total number of sampling points in each segment; The sliding step size △L step ΔL is the interval between the starting sampling points of two adjacent segments. step <L win ; N piece This represents the total number of corresponding segments. ceiling() is the floor function; The segmented signal By L win Each sampling point signal Composition, 1 ≤ the index of the sampling point within the segment i * ≤L win ; Signal at each of the sampling points Including N Lead Single lead signal ; The sampling point signal The corresponding sampling point signal The index mapping relationship is as follows: ; Step 32, based on the sampling frequency of the ECG signal X and the total number of sampling points L. total Calculate the corresponding total signal duration T; and based on the total signal duration T and the preset maximum number of heartbeats per unit duration B... uni Estimate the corresponding maximum number of heartbeats B total =T×B uni ; and based on the maximum total number of heartbeats B of the signal total and the preset cardiac feature dimension D heart Set a shape as B total ×D heart The feature vector is used as the initial heart rate feature vector Z ini ; and the heartbeat feature vector Z ini The vector parameters are set randomly; Step 33, and then the segmented signal sequence { The heartbeat feature vector Z is sent to the embedding layer. ini Send to the cross-attention decoding network.

4. The processing method of the cardiac rhythm feature recognition model according to claim 3, characterized in that, The self-attention coding network is used to encode features of the input vector, specifically including: With the feature vector H ini This is the input to the first encoding module, and is passed through N. EN The l1-th encoding module performs one round of sequential self-attention encoding to obtain a corresponding feature vector H. out Send to the cross-attention decoding network; The input and output vectors of the l1st encoding module are denoted as the corresponding vectors. , ; Each of the l1-th encoding modules is used for the input vector The query, key, and value vectors are transformed, and then feature-encoded according to the encoding rules of the self-attention encoding module of the Transformer model framework to obtain the corresponding output vector. ; Input vector of the first encoding module ; The output vector of the l1st encoding module is used as the input vector of the l1+1th encoding module; The feature vector H out For the Nth EN Output vector of the encoding module ; The feature vector H out The shape is N piece ×D heart .

5. The processing method of the cardiac rhythm feature recognition model according to claim 4, characterized in that, The cross-attention decoding network is used to decode heartbeat features using the output vector of the encoding network as the key input and the initialized heartbeat feature vector as the initial query input. Specifically, it includes: With the feature vector H out As the key-value input vector of each of the l2nd decoding modules, the heartbeat feature vector Z ini As the query input vector of the first decoding module, and through N DE The l2nd decoding module performs a round of sequential cross-attention decoding to obtain a corresponding heart rate feature vector Z. out Send to the R-point location prediction head, the heart rate classification prediction head, the clinical parameter prediction head, and the confidence prediction head; Among them, the key-value input vector of each of the l2nd decoding modules is H. out The query input vector is denoted as the corresponding The decoded output vector is denoted as the corresponding... ; Each of the 12th decoding modules is used to process the feature vector H out Perform key-value vector conversion and process the query input vector. The query vector is transformed, and then feature decoding is performed on the obtained query, key, and value vectors according to the decoding rules of the cross-attention decoding module of the Transformer model framework to obtain the corresponding decoded output vector. ; The query input vector of the first decoding module ; The decoding output vector of the l2nd decoding module is used as the query input vector of the l2+1th decoding module; The heartbeat feature vector Z out For the Nth DE Output vector of the decoding module ; The heartbeat feature vector Z out The shape is B total ×D heart By B total The shape is 1×D heart eigenvectors Composition; 1 ≤ index o ≤ B total .

6. The processing method of the cardiac rhythm feature recognition model according to claim 5, characterized in that, The four prediction heads are each used to predict the corresponding R-point location, heartbeat type, clinical parameters, or confidence level based on the decoded heartbeat feature vector, specifically including: The R-point location prediction head is used to predict the heartbeat feature vector Z. out Predict the corresponding position prediction vector Y1, and send the position prediction vector Y1 to the output layer; in, ; W R The weight matrix corresponding to the prediction head for the R point location has a shape of 1×D. heart The shape of the position prediction vector Y1 is B. total ×1, from B total Predicted locations Composition; the predicted location It is a normalized scalar with a value between [0,1], used to express the relative position of the current R point in the current electrocardiogram signal; The heartbeat classification prediction head is used to predict heartbeat features based on the heartbeat feature vector Z. out Each of the aforementioned feature vectors Heartbeat classification prediction yields a 1×N shape C Prediction vector ; and from the obtained B total The predicted vectors Composition shape B total ×N C The type prediction vector Y2 is sent to the output layer; in, ; Softmax() is the Softmax function; W C b C Here are the weight matrix and bias vector corresponding to the heart rate classification prediction head; the weight matrix W C The shape is N C ×D heart Bias vector b C The shape is 1×N C The prediction vector By N C Type probability Composition, 1≤index u≤N C The probability of each of the aforementioned types Corresponds to a type of heartbeat; The clinical parameter prediction head is used to use an MLP network based on the heartbeat feature vector Z. out Clinical parameter prediction yields a shape of B total ×N P The parameter prediction vector Y3 is sent to the output layer; in, ; β represents the model parameters of the MLP network; the parameter prediction vector Y3 is determined by B. total prediction vectors Composition; the prediction vector The shape is 1×N P , by N P Prediction parameters Composition, each of the prediction parameters Corresponding to a class of clinical parameters; each of the predicted parameters All are based on a single z-score standard value; The confidence prediction head is used to predict the heart rate feature vector Z. out Predict the corresponding confidence prediction vector Y4, and send the confidence prediction vector Y4 to the output layer; in, ; W conf The weight matrix corresponding to the confidence prediction head has a shape of 1×D. heart The confidence prediction vector Y4 has a shape of B. total ×1, from B total Each prediction confidence level Composition; the prediction confidence level It is a scalar whose value is between [0,1].

7. The processing method of the cardiac rhythm feature recognition model according to claim 6, characterized in that, The output layer is used to integrate the output vectors of the four prediction heads, specifically including: Step 81, the output layer selects the predicted positions with the same index o from the position prediction vector Y1, the type prediction vector Y2, the parameter prediction vector Y3, and the confidence prediction vector Y4. The prediction vector The prediction vector The prediction confidence level Extract the data to form a corresponding heart rate array; and then use the predicted confidence level... The heartbeat arrays that are greater than or equal to a preset confidence threshold are selected as candidate heartbeat arrays; Step 82, and take each of the candidate heartbeat arrays as the current array; and based on the predicted position of the current array... Calculate the corresponding R-point index ID R ; and based on the prediction vector of the current array Set the corresponding type marker A; and based on the N corresponding to the type marker A... P Group standard deviation and mean, and the prediction vector of the current array. Calculate the corresponding parameter set M; and set the prediction confidence of the current array. The corresponding confidence level F conf ; Wherein, the R point index ID R The calculation method is as follows: ; round() is the rounding function; The type label A is the prediction vector. The type with the highest probability value Corresponding heart rate type; The standard deviation and mean of each clinical parameter for each type of cardiac rhythm are denoted as the corresponding... , ;wherein, N corresponds to the current type marker A. P The group standard deviation and mean are denoted as the corresponding , ; The clinical parameter values ​​m of the parameter set M v The calculation method is as follows: ; Step 83, using the R-point index ID corresponding to each of the candidate heartbeat arrays. R The type label A, the parameter set M, and the confidence level F conf A corresponding cardiac feature data is formed; all the obtained cardiac feature data are combined to form the corresponding cardiac feature sequence Y. out And output it.

8. The processing method of the cardiac rhythm feature recognition model according to claim 6, characterized in that, The first dataset includes N TR The first data record; N TR The first dataset contains the total number of records; the first data records include the training signal X. TR Location label vector Type label vector Parameter label vector ; The training signal X TR The data format is consistent with the ECG signal X; the training signal X TR The corresponding actual total number of heartbeats is recorded as the corresponding total number of heartbeats. ; The location label vector By the corresponding Each tag position composition, The label location Let be a normalized scalar with values ​​between [0,1], specifically the o-th scalar. ’ The relative duration T between the R-point position of a heartbeat signal and the current signal's initial sampling point position. off Total duration T of the current signal total The ratio T off / T total ; The type label vector By the corresponding label vectors Composition; the label vector Including N C Probability of each label The label vector In the above, there is one and only one label probability that corresponds to the current true heartbeat type. 1 for all, N for the rest C -1 probability of the label All are 0; The parameter label vector By the corresponding label vectors Composition; the label vector Including N P Each tag parameter Each of the aforementioned tag parameters It is the z-score standard value of the vth clinical parameter type under the uth type of cardiac rhythm.

9. The processing method of the cardiac rhythm feature recognition model according to claim 8, characterized in that, The construction of the first dataset through data collection specifically includes: Multiple raw electrocardiogram (ECG) signals are collected from a set of pre-defined public databases, including at least the MIT-BIH database, SVDB database, CPSC 2018 dataset, and CCDD database. The original ECG signals are resampled according to the sampling frequency of the ECG signal X, and the resampled signals are then converted into training signals according to the ECG signal X to obtain the corresponding training signal X. TR ; and for the training signal X TR The total number of records N is obtained by counting the total number of records. TR ; and each of the training signals X TR This serves as the current signal; and all heartbeat signals on the current signal are labeled using a preset manual or machine labeling method; and the total number of labeled heartbeat signals on the current signal is counted to obtain the corresponding total number of heartbeats. The process iterates through all heartbeat signals marked on the current signal; during this iteration, the currently iterated heartbeat signal is taken as the current heartbeat; the R-point position of the current heartbeat is marked, and the relative duration T between the marked position and the start and end points of the current signal is calculated. off Perform calculations and assign the total duration T of the current signal to it. total Perform identification and calculate the corresponding tag position. The heartbeat type of the current heartbeat is labeled, and the label probability corresponding to the labeled heartbeat type of the current heartbeat is assigned. Set it to 1, and set the remainder N to 1. C -1 corresponding label probability All are set to 0, and the N corresponding to the current heartbeat is... C The probability of the label Form a corresponding label vector ; and for the N of the current heartbeat P True values ​​of clinical-like parameters Mark the data; and at the end of this traversal, assign the current signal to the corresponding data. The label positions The corresponding location label vector is formed. The current signal corresponding to The label vectors Form the corresponding type label vector ; And classify all the training signals X according to heart rate type. TR All true parameter values ​​of all heartbeat signals Clustering yields the corresponding N C A first parameter set; and all the true parameter values ​​of each first parameter set according to clinical parameter type. Clustering yields the corresponding N P A second parameter set is defined; and a corresponding set of standard deviations is obtained by calculating the standard deviation and mean of each second parameter set. ,average value ; all the true parameter values ​​in each of the first parameter sets They all belong to the same type of heartbeat; all the true parameter values ​​in each of the second parameter sets They all belong to the same type of cardiac rhythm and the same type of clinical parameter; and each of the training signals X TR As the current signal; and perform a round of traversal on all heartbeat signals marked on the current signal; and during this round of traversal, take the currently traversed heartbeat signal as the current heartbeat; and take the heartbeat type corresponding to the current heartbeat as the current type u. * ; and the true parameter values ​​of the current heartbeat. As the current parameter value m * and the current parameter value m * The corresponding clinical parameter type is used as the current type v * and the current type u * and the current type v * The corresponding standard deviation and the average value As the current standard deviation and current average and the current parameter value m * The corresponding tag parameters Perform calculations. ; and N corresponding to the current heartbeat P The label parameters The corresponding label vector is formed. ; and at the end of this round of traversal, the signal corresponding to the current signal is... The label vectors The corresponding parameter label vector is formed. ; And by each of the training signals X TR and its corresponding set of location label vectors The type label vector and the parameter label vector Form a corresponding first data record; And by N TR The first data records constitute the corresponding first dataset.

10. The processing method of the cardiac rhythm feature recognition model according to claim 8, characterized in that, The process of training the heartbeat feature recognition model based on the first dataset specifically includes: Step 11-1: Initialize the first counter to the total number of records N in the first dataset. TR ; Step 11-2: Take the first data record of the first dataset as the current training record; Step 11-3, record the training signal X from the current training session. TR The corresponding electrocardiogram signal X is input into the heartbeat feature recognition model for processing to obtain four corresponding prediction vectors; The four prediction vectors include the location prediction vector Y1, the type prediction vector Y2, the parameter prediction vector Y3, and the confidence prediction vector Y4; the location prediction vector Y1 includes the corresponding B total The predicted locations The type prediction vector Y2 includes the corresponding B total The predicted vectors The prediction vector Including N C The probability of the type The parameter prediction vector Y3 includes the corresponding B total The predicted vectors The prediction vector Including N P The prediction parameters The confidence prediction vector Y4 includes the corresponding B total The prediction confidence level ; Steps 11-4: Construct corresponding prediction target sets based on the four prediction vectors; and based on the location label vector of the current training record. The type label vector The parameter label vector Construct the corresponding target set of tags; Wherein, the prediction target set is composed of the corresponding B total One prediction target S o Composition; each of the predicted targets S o A set of corresponding predicted positions The prediction vector The prediction vector The prediction confidence level composition; The label target set consists of the corresponding individual tag targets Composition; each of the stated label targets A set of corresponding label positions The label vector The label vector composition; Steps 11-5: Using the shortest R-point spacing as the matching condition, identify the predicted-label pairs matched in the predicted target set and the labeled target set to obtain the corresponding matching set G. P ; Wherein, the matching set G P When not empty, it includes one or more prediction-label pairs (o,o) ’ ); each of the predicted-label pairs (o,o) ’ ) is a set of matched predicted targets S o and the label target index o, o ’ Composition; the predicted target S of each matching pair o and the label target The R-point spacing = | All of them are less than the preset point spacing threshold τ, and the R-point spacing of the current prediction-label pair is the minimum value among all R-point spacings between all predicted targets and the current label target; the matching set G P Any two of the predicted-label pairs (o,o) ’ The index o or o) ’ They have no connection whatsoever; Steps 11-6 involve identifying targets in the predicted target set that do not appear in the matching set G. P The index o in the middle forms the corresponding pseudo-target set G. F ; and those tags in the target set that do not appear in the matching set G P index o in ’ Form the corresponding missed detection target set G M ; Steps 11-7: Construct the location loss function L based on the smoothed L1 loss function. pos : , ; |G P |For the matching set G P The total number of predicted label pairs; The first smoothing L1 loss function, The smoothing coefficients of the first smoothed L1 loss function; Steps 11-8: Construct a classification loss function L based on the multi-class cross-entropy loss function. cls : , , , , , ; |G F |For the pseudo-target set G F The total number of indexes; , These are the corresponding matching set classification loss function and pseudo-target set classification loss function, respectively. , These are the corresponding matching set classification loss weight coefficients and pseudo-target set classification loss weight coefficients, respectively. , These are the corresponding cross-entropy loss functions for the matching set and the pseudo-target set, respectively. Steps 11-9: Construct the parametric loss function L based on the smooth L1 loss function. para : , ; The second smoothing L1 loss function, The smoothing coefficients of the second smoothing L1 loss function; Steps 11-10, based on the matching set G P and the pseudo-target set G F For each of the predicted confidence levels of the predicted confidence vector Y4 Set a corresponding label confidence level. : ; Steps 11-11: Construct the confidence loss function L based on the binary cross-entropy loss function. conf : ; Steps 11-12, based on the missed detection target set G M and the pseudo-target set G F For each missed target, the distance between the R-points and each pseudo-target is calculated, and the shortest distance is taken as the corresponding shortest missed-target-pseudo-target distance. : ; Steps 11-13, based on all the aforementioned shortest missed detection-false target spacing Set the loss function for missed detection penalty L miss : ; |G M |For the set of missed detection targets G M The total number of indexes; η is the preset penalty intensity coefficient; Steps 11-14, based on the location loss function L pos The classification loss function L cls The parameter loss function L para The confidence loss function L conf The missed detection penalty loss function L miss Construct the corresponding overall loss function L all : , ; , , , , These are the preset weighting coefficients for location loss, classification loss, parameter loss, confidence loss, and missed detection penalty loss. Steps 11-15, for the overall loss function L all The loss value is calculated to obtain the corresponding first loss value; and it is identified whether the first loss value meets the preset first loss value range; if it does, proceed to steps 11-16; if it does not, the first counter is decremented by 1 when the first counter is greater than 0, and the overall loss function L is optimized based on the preset first model optimizer. all The model parameters of the heartbeat feature recognition model are modulated once in the direction that reaches the minimum value, and the process returns to step 11-3 when the modulation ends. The first model optimizer includes the Adam optimizer; Steps 11-16: Identify whether the current training record is the last first data record in the first dataset; if the current training record is not the last first data record, then take the next first data record in the first dataset as the new current training record and return to steps 11-3; if the current training record is the last first data record, then calculate the current pass rate = first counter / N. TR The system identifies whether the current pass rate is less than a preset pass rate threshold. If so, it returns to step 11-1; otherwise, it stops training and confirms that the training of the heartbeat feature recognition model has ended.

11. The processing method of the cardiac rhythm feature recognition model according to claim 10, characterized in that, The matching set G is obtained by identifying the predicted-label pairs matched between the predicted target set and the label target set using the shortest R-point distance as the matching condition. P Specifically, it includes: For each of the tag targets in the tag target set Perform one round of traversal; and during this round of traversal, change the currently traversed tag target. The corresponding target is used as the current label target; and the current label target and each of the predicted targets S in the predicted target set are compared. o The corresponding point spacing is obtained by calculating the R-point spacing. ; and at the end of this round of traversal, the result obtained from this round of traversal ×B total The spacing between the points Form a shape as ×B total The matrix D; the matrix D is composed of ×B total The spacing between the points Composition, each row corresponds to one of the stated label targets. Each column corresponds to one of the predicted targets S. o ; And the B of the matrix D total All columns are initially marked as unused columns; and a row-by-row traversal is performed on the matrix D; during this traversal, the current traversed row is taken as the current row; and the B of the current row is... total The spacing between the points The minimum value is taken as the current minimum spacing; and the column corresponding to the current minimum spacing is taken as the current column; and when the current minimum spacing is less than the point spacing threshold τ and the current column is an unused column, a set of indices o corresponding to the current row and the current column is used. ’ A corresponding prediction-label pair (o, o) is formed by o and o. ’ ), and modify the unused column flag of the current column to the used flag; and at the end of this round of traversal, use all the obtained prediction-label pairs (o,o) ’ The corresponding matching set G is formed. P .

12. An apparatus for performing the processing method of the cardiac feature recognition model according to any one of claims 1-11, characterized in that, The device includes: a model building module, a data acquisition module, a model training module, and a model application module; The model building module is used to construct a deep learning model for recognizing the heartbeat features of electrocardiogram (ECG) signals, denoted as the heartbeat feature recognition model. The heartbeat feature recognition model is used to identify the R-point position, heartbeat type, clinical parameters, and confidence level of all heartbeat signals in the input ECG signal X, and output the corresponding heartbeat feature sequence Y. out The types of heartbeats include at least the normal sinus type, atrial fibrillation type, ventricular premature beat type, atrial premature beat type, and junctional premature beat type, and the total number of types is denoted as N. C The clinical parameters must include at least the PR interval, QRS width, QT interval, and RR interval, and the total number of these parameters is denoted as N. P The cardiac rhythm feature recognition model includes a preprocessing layer, an embedding layer, a self-attention encoding network, a cross-attention decoding network, an R-point location prediction head, a cardiac rhythm classification prediction head, a clinical parameter prediction head, a confidence prediction head, and an output layer. The preprocessing layer is used to denoise and segment the input signal and initialize the cardiac rhythm feature vector. The embedding layer performs linear projection embedding encoding on the segmented signal and enhances the embedding features of each segment's projection vector using context-aware position encoding. The self-attention encoding network encodes the input vector's features. The cross-attention decoding network decodes the cardiac rhythm features using the output vector of the encoding network as the key input and the initialized cardiac rhythm feature vector as the initial query input. Each of the four prediction heads predicts the corresponding R-point location, cardiac rhythm type, clinical parameter, or confidence level based on the decoded cardiac rhythm feature vector. The output layer integrates the output vectors of the four prediction heads. The data acquisition module is used to construct a first dataset through data acquisition; The model training module trains the heartbeat feature recognition model based on the first dataset; The model application module is used to input the user-input electrocardiogram signal X into the heartbeat feature recognition model after the model training is completed to obtain the corresponding heartbeat feature sequence Y. out Provide feedback to the current user.

13. An electronic device, characterized in that, include: Memory, processor, and transceiver; The processor is configured to be coupled to the memory, read and execute instructions in the memory to implement the method according to any one of claims 1-11; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a computer, cause the computer to perform the method according to any one of claims 1-11.

Citation Information

Patent Citations

  • An electrocardiogram classification method and system based on a deep residual network

    CN109948647A

  • Method for identifying heart rhythm types based on improved convolutional neural network

    CN110037682A