A dual-branch fusion adaptive filtering method for electrocardiogram signals
By using a dual-branch fusion adaptive filtering method for ECG signals, the fusion ratio of the filtering results is determined by adjusting the amplitude domain scale and characterization quantity of the filtering branch within the local amplitude range. This solves the problem of noise suppression and waveform preservation in ECG signal display and improves the clarity and stability of ECG waveforms.
Patent Information
- Application Number
- CN202611594635.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-15
- Publication Date
- 2026-11-17
AI Technical Summary
Existing ECG signal display filtering methods struggle to simultaneously achieve noise suppression and waveform preservation, and the compensation process is prone to display distortion and fluctuations.
An adaptive filtering method for ECG signal fusion using a dual-branch approach is adopted. By combining the first and second bilateral filtering branches, the amplitude domain scale is adjusted using the local amplitude range. The fusion ratio of the filtering results is determined based on the amplitude representation, rapidly changing representation, and slowly changing representation, and smoothing and compensation control are then performed.
It improves the clarity and stability of ECG waveforms, and reduces display fluctuations caused by excessive smoothing of rapidly changing waveforms and sudden removal of compensation.
Smart Images

Figure CN123122502A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital signal processing and waveform display technology, specifically to a dual-branch fusion adaptive filtering method for electrocardiogram signals. Background Technology
[0002] Continuously acquired electrocardiogram (ECG) signals are susceptible to interference from factors such as power frequency interference, baseline drift, electromyographic interference, and impulse interference during display. To obtain a clear and stable display waveform, it is usually necessary to filter and smooth the continuously acquired ECG signals.
[0003] Stronger smoothing reduces noise and local fluctuations in flat regions, but can over-smooth rapidly changing waveforms. Weaker smoothing preserves more of the rapidly changing waveform, but is less effective at suppressing noise in flat regions. Therefore, using a single, fixed smoothing strength makes it difficult to simultaneously achieve both noise suppression and waveform shape preservation.
[0004] Furthermore, when the displayed waveform is further compensated using the processing results at different time scales after the pre-stage filtering, the compensation process may also change the waveform shape that has already been formed in the pre-stage. When the compensation amplitude or the compensation change between adjacent sampling points is large, local fluctuations are also likely to form in the displayed waveform. Summary of the Invention
[0005] This invention provides a dual-branch fusion adaptive filtering method for electrocardiogram (ECG) signals, which has the beneficial effect of improving the clarity and stability of continuous ECG waveform display. It solves the problems mentioned in the background art, such as the difficulty in balancing noise suppression and waveform preservation in existing display filtering methods, and the easy occurrence of display distortion and fluctuations caused by the compensation process.
[0006] This invention provides the following technical solution: a dual-branch fusion adaptive filtering method for electrocardiogram (ECG) signals, which preprocesses continuously sampled ECG signals to obtain a preprocessed sequence, and determines the local amplitude range and local amplitude scale by the local amplitude distribution;
[0007] The same preprocessed sequence is input into a first bilateral filter branch and a second bilateral filter branch using the same spatial domain scale. The first branch uses a fixed amplitude domain scale, and the second branch adjusts the amplitude domain scale according to the local amplitude range.
[0008] The amplitude representation, rapid change representation, and slow change representation are determined by the preprocessing sequence. The fusion ratio of the two filtering results is determined based on the three, and the fusion result is obtained. A rapid change hold-up state is established when the rapid change representation meets the triggering condition.
[0009] The difference between the short smoothing scale processing result and the long smoothing scale processing result is used as the slow-varying residual. When the fast-changing state is invalid, the slow-varying residual is subjected to the first amplitude constraint. The compensation gain is determined according to the ratio of the absolute value of the slow-varying residual before constraint to the local amplitude scale. The compensation gain is allowed to decrease as the ratio increases within a preset ratio range. The target compensation amount is formed according to the slow-varying residual after constraint and the compensation gain, and the second amplitude constraint is performed.
[0010] When the state remains valid during rapid changes, the current compensation target is set to zero; when it is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target.
[0011] The actual compensation amount is updated based on the difference between the current compensation target and the actual compensation amount at the previous sampling point, and the variation range of the actual compensation amount at adjacent sampling points is limited.
[0012] The actual compensation amount is added to the fusion result to obtain the displayed ECG waveform.
[0013] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram (ECG) signals described in this invention, the continuously sampled ECG signals are sequentially subjected to power frequency interference suppression, bandpass filtering, morphological baseline removal, and impulse interference suppression to obtain a preprocessed sequence. Morphological baseline removal includes performing opening and closing operations on the bandpass-filtered ECG sequence, determining the baseline estimate based on the opening and closing operation results, and subtracting the baseline estimate from the bandpass-filtered ECG sequence.
[0014] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, a local window is established with the sampling point to be output as the center, the local amplitude range is determined according to the difference between the upper quantile value and the lower quantile value of the preprocessed sequence within the local window, and the maximum value between the local amplitude range and the preset lower limit of amplitude is taken as the local amplitude scale.
[0015] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, the first bilateral filtering branch and the second bilateral filtering branch both take the same preset number of sampling points before and after the sampling point to be output as the filtering neighborhood; the two branches adopt the same spatial domain scale.
[0016] The first branch uses a fixed amplitude range scale, and the second branch determines the amplitude range scale according to a preset proportion of the local amplitude range, and limits the amplitude range scale between a preset lower limit and a preset upper limit; the fixed amplitude range scale of the first branch is greater than the preset upper limit of the amplitude range scale of the second branch.
[0017] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, the amplitude characterization quantity is determined according to the absolute value of the current preprocessed sample value, and the rapid change characterization quantity is determined according to the square of the difference between the current preprocessed sample value and the previous preprocessed sample value.
[0018] The preprocessed sequence is smoothed according to both short and long smoothing scales. The absolute value of the difference between the short and long smoothing scales is used as the slow-varying characteristic, and the positive and negative directions of the difference are retained as the slow-varying residuals.
[0019] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, the following steps are taken: historical data of amplitude representation, rapidly changing representation, and slowly changing representation are stored respectively; the corresponding representation is normalized according to the upper and lower historical quantile values of each type of historical data; when the amount of historical data does not reach the preset minimum amount of historical data, or when the numerical difference between the upper and lower historical quantile values is not greater than the minimum span threshold of the corresponding representation, the corresponding normalization result is set to zero.
[0020] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, the lower limit of the original fusion weight of the second bilateral filtering result is determined based on the normalized amplitude representation and the rapidly changing representation.
[0021] According to the weighting coefficient that decreases as the normalized rapidly changing characteristic increases, the normalized slowly changing characteristic is weighted, and the weighted slowly changing characteristic is smoothed to obtain the slowly changing state quantity.
[0022] The maximum value between the lower limit of the original fusion weight and the slowly changing state variable is taken as the original fusion weight of the second bilateral filtering result. The original fusion weight is smoothed over time to obtain the fusion weight of the second bilateral filtering result. The value obtained by subtracting the fusion weight is taken as the fusion weight of the first bilateral filtering result. The two bilateral filtering results are then fused.
[0023] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, the following steps are taken: when the normalized rapid change representation meets the preset triggering condition, a rapid change holding state is established, and the rapid change holding state is maintained at a predetermined number of sampling points; when the preset triggering condition is met again during the holding period, the holding is restarted; during the effective period of the rapid change holding state, the current compensation target is set to zero.
[0024] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, the first amplitude constraint scale is determined according to the local amplitude range, and the slow-varying residual is subjected to the first amplitude constraint.
[0025] The compensation gain is determined based on the ratio of the absolute value of the slow-varying residual before the first amplitude constraint to the local amplitude scale, and the compensation gain is allowed to decrease as the ratio increases within a preset ratio range.
[0026] The target compensation amount is formed based on the slowly varying residual and compensation gain after the first amplitude constraint.
[0027] As an optional scheme of the dual-branch fusion adaptive filtering method for electrocardiogram signals described in this invention, wherein: when the rapidly changing hold state is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target;
[0028] Compare the difference between the current compensation target and the actual compensation amount at the previous sampling point; when the absolute value of the difference is greater than the preset maximum change amount at a single point, the actual compensation amount is updated towards the current compensation target, and the update range is the preset maximum change amount at a single point; when the absolute value of the difference is not greater than the preset maximum change amount at a single point, the current actual compensation amount is the current compensation target.
[0029] The present invention has the following beneficial effects:
[0030] 1. This method of dual-branch fusion adaptive filtering for electrocardiogram (ECG) signals involves feeding the same preprocessed ECG sequence into two bilateral filtering branches using the same spatial domain scale. The first branch uses a fixed amplitude domain scale, while the second branch adjusts the amplitude domain scale according to the current local amplitude range. The fusion ratio of the two filtering results is determined based on amplitude representation, rapidly changing representation, and slowly changing state variables. This enhances the suppression of fine noise and local fluctuations in smooth regions and increases the participation of the second branch in rapidly changing regions, reducing over-smoothing of rapidly changing waveforms and thus improving the clarity and stability of continuous ECG waveform display.
[0031] 2. This ECG signal dual-branch fusion adaptive filtering method utilizes a normalized rapidly changing characteristic quantity to adjust the preceding dual-branch fusion, and this characteristic quantity triggers a rapidly changing hold state for subsequent compensation control. When the rapidly changing signal intensifies, the weighting relationship between the original fusion weights and the slowly changing characteristic quantity changes accordingly, allowing the preceding fusion to adapt to the rapidly changing waveform in a timely manner. When the rapidly changing hold state is effective, the current compensation target of the subsequent stage is set to zero, and no new non-zero compensation target is formed. The existing actual compensation quantity is not instantaneously cleared to zero, but continues to be gradually adjusted under the limit of the maximum change at a single point. Thus, the rapidly changing information on which the preceding fusion is based can continue to trigger the subsequent compensation protection process, reducing the display fluctuations caused by the subsequent compensation reapplying to the rapidly changing waveform and the sudden removal of the compensation quantity. Attached Figure Description
[0032] Figure 1This is a flowchart of the method of the present invention.
[0033] Figure 2 This is a flowchart of the dual-branch fusion method of the present invention. Detailed Implementation
[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0035] Please see Figure 1 and Figure 2 An adaptive filtering method for dual-branch fusion of electrocardiogram signals.
[0036] First, the continuously sampled electrocardiogram signals are preprocessed to form a preprocessed sequence, and the local amplitude range and local amplitude scale are determined based on the amplitude distribution of the preprocessed sequence near the sampling point to be output.
[0037] The same preprocessed sequence is fed into the first bilateral filtering branch and the second bilateral filtering branch, respectively. Both branches use the same spatial domain scale. The first bilateral filtering branch uses a fixed amplitude domain scale; the second bilateral filtering branch adjusts the amplitude domain scale according to the current local amplitude range.
[0038] The amplitude and rapid change characteristics are determined based on the preprocessed sequence, and then processed according to short and long smoothing scales respectively. The difference between the short-smoothing scale result and the long-smoothing scale result is taken as the slow-varying residual, and the slow-varying characteristic is determined based on the absolute value of the slow-varying residual.
[0039] The amplitude, rapidly changing, and slowly changing characteristics are each historically normalized. The lower bound of the original fusion weights for the second bilateral filtering result is determined based on the amplitude and rapidly changing characteristics. Weighting coefficients for the slowly changing characteristics are determined based on the rapidly changing characteristics, decreasing as the rapidly changing characteristics increase. The slowly changing characteristics are then weighted using these weighting coefficients, and the weighted slowly changing characteristics are state-smoothed. The original fusion weights for the second bilateral filtering result are determined based on the obtained slowly changing state variables and the lower bound of the original fusion weights. After time smoothing, the weights used for fusing the two bilateral filtering results are obtained.
[0040] The normalized rapid change representation mentioned above is also used to trigger a rapid change hold-up state. When the representation meets the triggering condition, a rapid change hold-up state is established; during the validity period of this state, the current compensation target is set to zero, but the existing actual compensation amount is not directly set to zero.
[0041] The slowly varying residuals are continuously formed according to the relationship between the result of short smoothing scale processing and the result of long smoothing scale processing. When the rapidly changing state is invalid, the slowly varying residuals are subjected to the first amplitude constraint. The compensation gain is determined based on the ratio of the absolute value of the slowly varying residuals before the first amplitude constraint to the local amplitude scale, and the compensation gain is allowed to decrease as the ratio increases within a preset ratio range. The target compensation amount is formed using the slowly varying residuals after the first amplitude constraint and the compensation gain.
[0042] A second amplitude constraint is applied to the target compensation amount. When the rapid change hold state is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target; when the rapid change hold state is valid, the current compensation target is zero. The actual compensation amount approaches the current compensation target point by point according to the preset maximum change amount at a single point. Finally, the actual compensation amount is added to the dual-branch fusion result to obtain the ECG waveform for display.
[0043] The continuously sampled ECG signals are sequentially subjected to power frequency interference suppression, bandpass filtering, morphological baseline removal, and impulse interference suppression to obtain a preprocessed sequence. Morphological baseline removal includes performing opening and closing operations on the bandpass-filtered ECG sequence, determining the baseline estimate based on the opening and closing operation results, and subtracting the baseline estimate from the bandpass-filtered ECG sequence.
[0044] A local window is established with the sampling point to be output as the center. The local amplitude range is determined based on the difference between the upper quantile and lower quantile values of the preprocessed sequence within the local window. The maximum value between the local amplitude range and the preset lower amplitude limit is taken as the local amplitude scale.
[0045] Both the first and second bilateral filtering branches take the same preset number of sampling points before and after the sampling point to be output as the filtering neighborhood; the two branches use the same spatial domain scale.
[0046] The first branch uses a fixed amplitude range scale, and the second branch determines the amplitude range scale according to a preset proportion of the local amplitude range, and limits the amplitude range scale between a preset lower limit and a preset upper limit; the fixed amplitude range scale of the first branch is greater than the preset upper limit of the amplitude range scale of the second branch.
[0047] The magnitude characterization is determined based on the absolute value of the current preprocessed sample value, and the rapid change characterization is determined based on the square of the difference between the current preprocessed sample value and the previous preprocessed sample value.
[0048] The preprocessed sequence was smoothed according to both short and long smoothing scales. The absolute value of the difference between the short and long smoothing scales was used as the slow-varying characteristic, and the positive and negative directions of the difference were retained as the slow-varying residuals.
[0049] Historical data for amplitude representation, rapid change representation, and slow change representation are stored separately. The corresponding representation is normalized based on the upper and lower historical quantiles of each type of historical data. When the amount of historical data does not reach the preset minimum amount of historical data, or when the difference between the upper and lower historical quantiles is not greater than the minimum span threshold of the corresponding representation, the corresponding normalization result is set to zero.
[0050] The lower bound of the original fusion weights of the second bilateral filtering result is determined based on the normalized amplitude representation and the rapidly changing representation.
[0051] According to the weighting coefficient that decreases as the normalized rapidly changing characteristic increases, the normalized slowly changing characteristic is weighted, and the weighted slowly changing characteristic is smoothed to obtain the slowly changing state quantity.
[0052] The maximum value between the lower limit of the original fusion weight and the slowly changing state variable is taken as the original fusion weight of the second bilateral filtering result. The original fusion weight is smoothed over time to obtain the fusion weight of the second bilateral filtering result. The value obtained by subtracting the fusion weight is taken as the fusion weight of the first bilateral filtering result. The two bilateral filtering results are then fused.
[0053] When the normalized rapid change representation meets the preset trigger condition, a rapid change hold state is established, and the rapid change hold state is maintained at a predetermined number of sampling points; if the preset trigger condition is met again during the hold period, the hold is restarted; during the effective period of the rapid change hold state, the current compensation target is set to zero.
[0054] The first amplitude constraint scale is determined based on the local amplitude range, and the first amplitude constraint is applied to the slowly varying residuals.
[0055] The compensation gain is determined by the ratio of the absolute value of the slow-varying residual before the first amplitude constraint to the local amplitude scale, and the compensation gain is allowed to decrease as the ratio increases within a preset ratio range.
[0056] The target compensation amount is formed based on the slowly varying residual and compensation gain after the first amplitude constraint.
[0057] When the rapidly changing state is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target.
[0058] Compare the difference between the current compensation target and the actual compensation amount at the previous sampling point; when the absolute value of the difference is greater than the preset maximum change amount at a single point, the actual compensation amount is updated towards the current compensation target, and the update magnitude is the preset maximum change amount at a single point; when the absolute value of the difference is not greater than the preset maximum change amount at a single point, the current actual compensation amount is the current compensation target.
[0059] Example 1
[0060] ECG signal preprocessing:
[0061] ECG sampling data is continuously received at a sampling frequency of 500Hz. The ADC count value output by the acquisition device is converted into an ECG amplitude value expressed in μV according to the fixed gain and quantization relationship of the acquisition channel.
[0062] The continuously sampled ECG signals were sequentially subjected to 50Hz power frequency interference suppression, 0.5–18 Hz bandpass filtering, morphological baseline removal, and median impulse interference suppression. The 0.5–18 Hz bandpass filtering was formed by four second-order digital filter sections connected in series, and the coefficients of each digital filter section were predetermined based on the 500 Hz sampling frequency and the target frequency range.
[0063] Morphological baseline removal uses a flat structuring element with a length of 61 sampling points. Opening and closing operations are performed on the bandpass-filtered ECG sequence, with the opening operation involving erosion followed by dilation, and the closing operation involving dilation followed by erosion. The average of the opening and closing operation results at corresponding sampling positions is taken as the baseline estimate, and this baseline estimate is subtracted from the bandpass-filtered ECG sequence.
[0064] Five-point median filtering was used to suppress impulse interference in the baseline-removed ECG sequence, resulting in a preprocessed sequence. Subsequent parameters involving local amplitude range, local amplitude scale, bilateral filter amplitude domain scale, slow-varying residual, amplitude constraint scale, target compensation amount, and actual compensation amount all used μV as the amplitude unit.
[0065] Local amplitude range and local amplitude scale:
[0066] A 451-point centered window is established with the point to be output as the center, containing 225 preprocessed sampling points before and after the point to be output. The 98th and 2nd percentile values of the preprocessed sequence within this local window are determined, and the current local amplitude range is determined by the following formula:
[0067]
[0068] Take the current local amplitude range and the preset amplitude lower limit The maximum value in the range is used as the current local magnitude scale:
[0069]
[0070] In this embodiment Take 1μV. The local amplitude range is used to determine the amplitude domain scale, the first amplitude constraint scale, and the second amplitude constraint scale of the second bilateral filter branch; the local amplitude scale is used to evaluate the degree of change of the slowly varying residual relative to the current local waveform amplitude.
[0071] Two bilateral filter branches:
[0072] Both the first and second bilateral filtering branches use a preset number of sampling points before and after the output sampling point as the filtering neighborhood. The bilateral filter determines corresponding weights based on the positional distance and amplitude difference between the neighboring sampling points and the output sampling point, and then uses these weights to weight the sampled values in the filtering neighborhood. Both the spatial domain scale and the amplitude domain scale are positive values.
[0073] Both branches use the same spatial domain scale. The first bilateral filter branch uses a fixed amplitude domain scale; the second bilateral filter branch determines its amplitude domain scale according to a preset proportion of the current local amplitude range, and restricts the resulting amplitude domain scale between a preset lower limit and a preset upper limit. The fixed amplitude domain scale of the first bilateral filter branch is greater than the preset upper limit of the amplitude domain scale of the second bilateral filter branch.
[0074] In this embodiment, the filtering neighborhood of both branches is taken as 100 sampling points before and after the sampling point to be output, and the spatial domain scale parameter is taken as 30 sampling points. The amplitude domain scale of the first bilateral filtering branch is 140μV. The amplitude domain scale of the second bilateral filtering branch is determined according to 20% of the current local amplitude range, and the amplitude domain scale is limited to 18-110μV.
[0075] Under the above relationship, the amplitude domain scale of the first bilateral filter branch is always larger than that of the second bilateral filter branch. Therefore, the first filter result has a relatively strong smoothing effect, while the second filter result is more conducive to preserving local amplitude changes.
[0076] Three types of characterizations and slowly varying residuals:
[0077] The amplitude characterization quantity is determined based on the absolute value of the current preprocessed sample value.
[0078] The rapid change characterization is determined by the square of the difference between the current preprocessed sample value and the previous preprocessed sample value. The rapid change characterization represents the degree of rapid amplitude change between adjacent sample points, and its unit is [unit missing]. .
[0079] Gaussian smoothing was applied to the preprocessed sequence using both short and long smoothing scales. Normalized Gaussian weights were used for Gaussian smoothing, with the weights within each smoothing scale summing to 1. In this embodiment, the short smoothing scale parameter used 35 sampling points, and the long smoothing scale parameter used 100 sampling points, yielding the results for both short and long smoothing scales.
[0080] The difference between the result of short-smoothing processing and the result of long-smoothing processing is used as the slow-varying residual:
[0081]
[0082] in For slow-varying residuals, This is the result of short-smooth scale processing. This is the result of long-scale smoothing processing.
[0083] The direction of the subtraction remains unchanged throughout the processing. The absolute value of the slowly varying residual is taken as the slowly varying characteristic. The slowly varying characteristic is used to represent the degree of difference between the two smooth scales; the slowly varying residuals in both positive and negative directions are retained for subsequent compensation.
[0084] Characteristic history normalization:
[0085] The amplitude, rapid change, and slow change metrics maintain independent historical data, and the original values are not directly compared among the three types of metrics. Each type of metric stores a maximum of 15,000 historical data points. After accumulating the first 200 historical data points, the corresponding lower and upper historical quantiles are calculated; thereafter, the historical quantiles are updated every 50 new data points, and the remaining sampling points use the historical quantiles obtained from the most recent update.
[0086] In this embodiment, the lower historical quantile is the 55th percentile, and the upper historical quantile is the 96th percentile, with the upper historical quantile not lower than the lower historical quantile. When calculating historical quantiles, the data currently in the historical sequence are sorted in ascending order of value. For a quantile ratio p, the smallest integer not less than the product of p and the number of data points participating in the statistical data is used as the sorting index, and the data corresponding to that index is taken as the quantile value; no interpolation is performed.
[0087] The current sampling point is normalized using the most recently determined historical quantile value. After processing the current sampling point, the current original representation is written into the corresponding historical sequence. When the historical quantile value update condition is met, a new historical quantile value is calculated and used starting from the next sampling point.
[0088] When there are fewer than 200 historical data points, or when the difference between the upper and lower historical quantiles is not greater than the minimum span threshold of the corresponding representation, the corresponding normalization result is set to 0. When the historical quantile span is greater than the corresponding minimum span threshold, if the current representation is not higher than the lower historical quantile, the normalization result is set to 0; if it is not lower than the upper historical quantile, the normalization result is set to 1; if it is between two historical quantiles, linear normalization is performed based on its relative position between the two historical quantiles.
[0089] Thus, the normalized amplitude characterization, normalized rapid change characterization, and normalized slow change characterization are obtained, all of which range from 0 to 1. The units for the amplitude characterization and the slow change characterization are μV, and the unit for the rapid change characterization is [missing value]. Therefore, corresponding minimum span thresholds are set for each. In this embodiment, the minimum span thresholds for both the amplitude representation and the slowly varying representation are set to... The minimum span threshold for rapidly changing representation quantities is taken as .
[0090] Dual-branch fusion control:
[0091] The lower bound of the original fusion weights of the second bilateral filter result is determined based on the normalized amplitude representation and the normalized rapid change representation:
[0092]
[0093] in, This is the lower bound of the original fusion weights of the second bilateral filtering result. The coefficients corresponding to the amplitude characterization quantities. For the coefficients corresponding to rapidly changing characterization quantities, This is the normalized amplitude representation of the current sampling point. This is a normalized representation of rapid changes at the current sampling point.
[0094] Both coefficients are greater than 0 and not greater than 1. In this embodiment, the coefficient corresponding to the amplitude representation is 0.85, and the coefficient corresponding to the rapid change representation is 0.55. Therefore, the lower limit of the original fusion weight of the second bilateral filtering result is in the range of 0 to 1.
[0095] The weighting coefficients acting on the normalized slowly varying characteristics are determined based on the normalized rapidly changing characteristics. This embodiment uses:
[0096]
[0097] in, This is the weighted, slowly varying characteristic quantity. To normalize the slowly varying characterization quantity, These are weighting coefficients;
[0098] The weighting coefficients mentioned above decrease as the normalized rapidly changing characterization increases, while the resulting weighted slowly changing characterization remains within the range of 0 to 1.
[0099] The weighted, slowly varying representation is smoothed to obtain the slowly varying state quantity. The initial value of the slowly varying state quantity is 0. When the weighted, slowly varying representation is not lower than the slowly varying state quantity of the previous sampling point, the update coefficient is 0.05; when the weighted, slowly varying representation is lower than the slowly varying state quantity of the previous sampling point, the update coefficient is 0.015. The current slowly varying state quantity is equal to the linear update result between the previous slowly varying state quantity and the current weighted, slowly varying representation according to the update coefficient.
[0100] Both of the above update coefficients are between 0 and 1. Therefore, under the condition that the initial slow-varying state quantity is 0 and the weighted slow-varying characterization quantity is between 0 and 1, the slow-varying state quantity remains within the range of 0 to 1.
[0101] The maximum value between the lower bound of the original fusion weights of the second bilateral filtering result and the slowly varying state variable is taken as the original fusion weights of the second bilateral filtering result. Causal exponential smoothing is then applied to these original fusion weights. In this embodiment, the smoothing coefficient of the current original fusion weights is 0.0645, and the coefficient of the fusion weight of the previous sampling point is 0.9355; the first valid sampling point to be output directly uses the current original fusion weights. Since both the original fusion weights and the previous fusion weights are within the range of 0 to 1, the smoothed fusion weights are also within the range of 0 to 1.
[0102] The smoothed fusion weights are used as the weights of the second filtering result in the final fusion result, and the value obtained by subtracting the fusion weights from one is used as the weight of the first filtering result. The two filtering results are then weighted and fused. The larger the fusion weight, the higher the proportion of the second filtering result in the final fusion result. The aforementioned lower limit of the original fusion weights only constrains the original fusion weights before time smoothing and is not used as the instantaneous lower limit of the final fusion weights at the current sampling point.
[0103] Maintaining state amidst rapid changes:
[0104] When the normalized rapid change representation exceeds 0.20, a rapid change hold state is established. In this embodiment, the hold length is 35 sampling points, and the trigger sampling point is the first sampling point in the hold interval; thereafter, the hold count decreases accordingly for each sampling point processed, and the rapid change hold state is invalidated after the count ends.
[0105] If the normalized rapid change characterization value exceeds 0.20 again during the hold period, the hold count is restarted with 35 sampling points.
[0106] The normalized rapidly changing characteristic quantity participates in the front-end dual-branch fusion control and is used to trigger the rapidly changing hold state; the rapidly changing hold state is used for the subsequent compensation control. During the validity period of this state, the current compensation target is set to 0. This state only changes the target value that the actual compensation quantity needs to approach at the current sampling point, and does not directly set the existing actual compensation quantity to 0.
[0107] First amplitude constraint and gain compensation:
[0108] The slowly varying residuals are continuously formed according to the relationship between the short smoothing scale processing result and the long smoothing scale processing result. When the rapidly changing state is invalid, the first amplitude constraint scale is determined based on the current local amplitude range. In this embodiment, the maximum value between 12% and 1μV of the current local amplitude range is taken as the first amplitude constraint scale.
[0109] The first amplitude constraint is applied to the slowly varying residuals using the hyperbolic tangent function:
[0110]
[0111] in, The slowly varying residuals after the first amplitude constraint. This is the first amplitude constraint scale for the current sampling point. The slow-varying residual after the first amplitude constraint maintains the same sign as the slow-varying residual before the constraint, and is gradually compressed as the absolute value of the slow-varying residual increases.
[0112] Determine its proportion relative to the current local amplitude scale based on the slowly varying residual before the first amplitude constraint:
[0113]
[0114] When the above proportion is not greater than 2.5%, the compensation gain is 4.5; when the above proportion is not less than 7.5%, the compensation gain is 1.5.
[0115] When the above ratio is between 2.5% and 7.5%, let t equal the ratio minus 0.025 and then divided by 0.05, and use the following formula to continuously reduce the compensation gain from 4.5 to 1.5:
[0116]
[0117] exist Within the range, The gain increases monotonically, therefore the compensation gain decreases continuously and connects seamlessly with the constant gain segments of 4.5 and 1.5 at both ends of the proportional range. The slowly varying residual before the first amplitude constraint is used to determine the compensation gain; the slowly varying residual after the first amplitude constraint is used to form the target compensation amount.
[0118] Target compensation amount and second amplitude constraint:
[0119] The target compensation amount is formed based on the compensation gain and the slowly varying residual after the first magnitude constraint:
[0120]
[0121] The second amplitude constraint scale is determined based on the current local amplitude range. In this embodiment, the maximum value between 8% and 1μV of the current local amplitude range is taken as the second amplitude constraint scale.
[0122] A second amplitude constraint is applied to the target compensation amount using the hyperbolic tangent function:
[0123]
[0124] in, This is the target compensation amount after the second amplitude constraint. This is the second amplitude constraint scale for the current sampling point. This represents the target compensation amount before the second amplitude constraint. The second amplitude constraint is used to limit the target compensation amount after compensation gain adjustment. The decreasing relationship of the compensation gain is used to change the compensation response before entering the second amplitude constraint, which further constrains the target compensation amount.
[0125] Current compensation targets and actual compensation amounts:
[0126] The target value that the actual compensation amount needs to approach at the current sampling point is called the current compensation target. When the rapidly changing state is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target; when the rapidly changing state is valid, 0 is used as the current compensation target.
[0127] Compare the difference between the current compensation target and the actual compensation amount at the previous sampling point. When the absolute value of the difference is greater than the preset maximum change at a single point, the actual compensation amount at the current sampling point changes only towards the current compensation target according to the maximum change at a single point; when the absolute value of the difference is not greater than the preset maximum change at a single point, the actual compensation amount at the current sampling point is directly taken as the current compensation target.
[0128] In this embodiment, the maximum single-point change is set to 1 μV, and the initial value of the actual compensation is set to 0. Therefore, regardless of whether the rapid change maintains the state establishment or failure, the actual compensation uses the same single-point change limit, and there is no situation where the value jumps directly from the current value to 0 due to state switching.
[0129] Display waveform formation and startup processing:
[0130] The actual compensation amount is added to the dual-branch fusion result to obtain the ECG waveform for display. For display devices using integer data interfaces, the obtained ECG waveform can be adjusted for display scaling, rounded, and its data range limited according to the display interface requirements. In this embodiment, the display gain is set to 3.0, and the rounded display data is limited to a 16-bit signed integer representation.
[0131] During the first 1050 input sampling points after startup or reset, no valid display output processed by this method is generated. During the startup waiting period, preprocessing that can be completed based on the acquired data continues to be performed; once the data window required for the corresponding calculation is complete, local amplitude statistics, characterization calculations, and historical data accumulation continue, but no valid display output is generated temporarily.
[0132] After the startup wait is complete, only the output sampling points that have obtained complete local window data of 225 sampling points before and after the input sampling point are displayed effectively. Therefore, there is a waiting time for the display output relative to the corresponding input sampling point, which is determined by the length of the centered window. The corresponding historical quantile value can be established after the historical representation reaches 200 sampling points, and it is not required that the historical window of 15,000 sampling points be completely filled before the normalization process begins.
[0133] Example 2
[0134] When the local amplitude range is 50μV, the second bilateral filter branch obtains 10μV, which is less than 18μV, based on 20% of the local amplitude range. Therefore, the amplitude range scale is 18μV; the first amplitude constraint scale is 6μV; and the second amplitude constraint scale is 4μV.
[0135] When the local amplitude range is 300μV, the amplitude range scale of the second bilateral filter branch is 60μV, the first amplitude constraint scale is 36μV, and the second amplitude constraint scale is 24μV.
[0136] When the local amplitude range is 600μV, 20% of the local amplitude range is 120μV, which exceeds 110μV. Therefore, the amplitude range scale of the second bilateral filter branch is 110μV; the first amplitude constraint scale is 72μV, and the second amplitude constraint scale is 48μV.
[0137] When the local amplitude range is 800μV, the amplitude domain scale of the second bilateral filter branch is still 110μV, the first amplitude constraint scale is 96μV, and the second amplitude constraint scale is 64μV.
[0138] Example 3
[0139] If the local amplitude range is set to 300 μV, then the local amplitude scale is 300 μV, the first amplitude constraint scale is 36 μV, and the second amplitude constraint scale is 24 μV.
[0140] When the slow-varying residual is 3 μV, the ratio of the absolute value of the slow-varying residual to the local amplitude scale is 1%, and the compensation gain is 4.5. The slow-varying residual after the first amplitude constraint is approximately 2.993 μV, and the target compensation amount is approximately 13.469 μV. The target compensation amount after the second amplitude constraint is approximately 12.213 μV.
[0141] When the slow-varying residual is 30 μV, the ratio of the absolute value of the slow-varying residual to the local amplitude scale is 10%, and the compensation gain is 1.5. The slow-varying residual after the first amplitude constraint is approximately 24.561 μV, and the target compensation amount is approximately 36.842 μV. The target compensation amount after the second amplitude constraint is approximately 21.871 μV.
[0142] The above values are used to illustrate the calculation relationship between the first amplitude constraint, the compensation gain, and the second amplitude constraint.
[0143] Example 4
[0144] Before the rapid change hold-up state is established, the actual compensation value of the previous sampling point is 8 μV. After the rapid change hold-up state is established, the current compensation target switches to 0. Since the maximum change value at a single point is 1 μV, the subsequent actual compensation values change towards 0 in the directions of 7 μV, 6 μV, and 5 μV, instead of directly changing from 8 μV to 0.
[0145] When the actual compensation value is 60 μV before the state is established, during the hold period of 35 sampling points, the actual compensation value changes towards 0 with a variation of no more than 1 μV per sampling point. At the end of the hold period, the actual compensation value may still be greater than 0.
[0146] After the rapid change holding state fails, the target compensation amount after the second amplitude constraint is used as the current compensation target again, and the actual compensation amount continues to be updated according to the same single-point maximum change limit.
[0147] Other implementation methods:
[0148] The above implementation provides a set of specific parameters and their processing relationships that can be directly executed. Bilateral filtering, Gaussian smoothing, historical quantile statistics, and rounding are performed using calculation methods commonly used in this field.
[0149] The first and second amplitude constraints adopt the aforementioned hyperbolic tangent relationship. Under other parameter combinations, the first amplitude constraint should apply to the slowly varying residual, and the second amplitude constraint should apply to the target compensation amount. The processing relationship should also be maintained so that the slowly varying residual before the first amplitude constraint is used to determine the compensation gain, and the slowly varying residual after the first amplitude constraint is used to form the target compensation amount.
[0150] Meanwhile, the normalized rapid change representation quantity should be included in the front-end dual-branch fusion control, and the rapid change hold state should be triggered by this representation quantity. The rapid change hold state is used for the current compensation target control in the subsequent stage, and the actual compensation quantity continues to be limited by the maximum change quantity at a single point during the state switching process.
[0151] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0152] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A dual-branch fusion adaptive filtering method for electrocardiogram signals, characterized in that: The continuously sampled electrocardiogram signals are preprocessed to obtain a preprocessed sequence, and the local amplitude range and local amplitude scale are determined by the local amplitude distribution. The same preprocessed sequence is input into a first bilateral filter branch and a second bilateral filter branch using the same spatial domain scale. The first branch uses a fixed amplitude domain scale, and the second branch adjusts the amplitude domain scale according to the local amplitude range. The amplitude representation, rapid change representation, and slow change representation are determined by the preprocessing sequence. The fusion ratio of the two filtering results is determined based on the three, and the fusion result is obtained. A rapid change hold-up state is established when the rapid change representation meets the triggering condition. The difference between the short smoothing scale processing result and the long smoothing scale processing result is used as the slow-varying residual. When the fast-changing state is invalid, the slow-varying residual is subjected to the first amplitude constraint. The compensation gain is determined according to the ratio of the absolute value of the slow-varying residual before constraint to the local amplitude scale. The compensation gain is allowed to decrease as the ratio increases within a preset ratio range. The target compensation amount is formed according to the slow-varying residual after constraint and the compensation gain, and the second amplitude constraint is performed. When the state remains valid during rapid changes, the current compensation target is set to zero; when it is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target. The actual compensation amount is updated based on the difference between the current compensation target and the actual compensation amount at the previous sampling point, and the variation range of the actual compensation amount at adjacent sampling points is limited. The actual compensation amount is added to the fusion result to obtain the displayed ECG waveform.
2. The ECG signal dual-branch fusion adaptive filtering method according to claim 1, characterized in that: The continuously sampled electrocardiogram (ECG) signals are sequentially subjected to power frequency interference suppression, bandpass filtering, morphological baseline removal, and impulse interference suppression to obtain a preprocessed sequence. Morphological baseline removal includes performing opening and closing operations on the bandpass-filtered ECG sequence, determining the baseline estimate based on the opening and closing operation results, and subtracting the baseline estimate from the bandpass-filtered ECG sequence.
3. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 1, characterized in that: A local window is established with the sampling point to be output as the center. The local amplitude range is determined based on the difference between the upper quantile and lower quantile values of the preprocessed sequence within the local window. The maximum value between the local amplitude range and the preset lower amplitude limit is taken as the local amplitude scale.
4. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 3, characterized in that: Both the first and second bilateral filtering branches take the same preset number of sampling points before and after the sampling point to be output as the filtering neighborhood; the two branches use the same spatial domain scale. The first branch uses a fixed amplitude range scale, and the second branch determines the amplitude range scale according to a preset proportion of the local amplitude range, and limits the amplitude range scale between a preset lower limit and a preset upper limit. The fixed amplitude range scale of the first branch is larger than the preset upper limit of the amplitude range scale of the second branch.
5. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 1, characterized in that: The magnitude characterization is determined based on the absolute value of the current preprocessed sample value, and the rapid change characterization is determined based on the square of the difference between the current preprocessed sample value and the previous preprocessed sample value. The preprocessed sequence is smoothed according to both short and long smoothing scales. The absolute value of the difference between the short and long smoothing scales is used as the slow-varying characteristic, and the positive and negative directions of the difference are retained as the slow-varying residuals.
6. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 5, characterized in that: Historical data for amplitude representation, rapid change representation, and slow change representation are stored separately. The corresponding representation is normalized based on the upper and lower historical quantiles of each type of historical data. When the amount of historical data does not reach the preset minimum amount of historical data, or when the difference between the upper and lower historical quantiles is not greater than the minimum span threshold of the corresponding representation, the corresponding normalization result is set to zero.
7. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 6, characterized in that: The lower bound of the original fusion weights of the second bilateral filtering result is determined based on the normalized amplitude representation and the rapidly changing representation. According to the weighting coefficient that decreases as the normalized rapidly changing characteristic increases, the normalized slowly changing characteristic is weighted, and the weighted slowly changing characteristic is smoothed to obtain the slowly changing state quantity. The maximum value between the lower limit of the original fusion weight and the slowly changing state variable is taken as the original fusion weight of the second bilateral filtering result. The original fusion weight is smoothed over time to obtain the fusion weight of the second bilateral filtering result. The value obtained by subtracting the fusion weight is taken as the fusion weight of the first bilateral filtering result. The two bilateral filtering results are then fused.
8. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 7, characterized in that: When the normalized rapid change representation meets the preset trigger condition, a rapid change holding state is established, and the rapid change holding state is maintained at a predetermined number of sampling points; if the preset trigger condition is met again during the holding period, the holding is restarted; during the effective period of the rapid change holding state, the current compensation target is set to zero.
9. The dual-branch fusion adaptive filtering method for electrocardiogram signals according to claim 3, characterized in that: The first amplitude constraint scale is determined based on the local amplitude range, and the first amplitude constraint is applied to the slowly varying residuals. The compensation gain is determined based on the ratio of the absolute value of the slow-varying residual before the first amplitude constraint to the local amplitude scale, and the compensation gain is allowed to decrease as the ratio increases within a preset ratio range. The target compensation amount is formed based on the slowly varying residual and compensation gain after the first amplitude constraint.
10. The adaptive filtering method for dual-branch fusion of electrocardiogram signals according to claim 9, characterized in that: When the rapidly changing state is invalid, the target compensation amount after the second amplitude constraint is used as the current compensation target. Compare the difference between the current compensation target and the actual compensation amount at the previous sampling point; when the absolute value of the difference is greater than the preset maximum change amount at a single point, the actual compensation amount is updated in the direction of the current compensation target, and the update range is the preset maximum change amount at a single point; When the absolute value of the difference is not greater than the preset maximum change at a single point, the current actual compensation amount is taken as the current compensation target.
