Artifact removal is probably the most important and (unfortunately) most overlooked step of the signal processing pipeline required to compute HRV features
While all beat to beat data should go through artifact removal (even when collected with ECG or chest straps, as ectopic beats would still be present under these circumstances, see an example here), the issue becomes particularly important for PPG measurements, as they are more prone to noise (which means that it’s easier to mess up the signal, just by moving)
The issue of artifact removal is particularly important for HRV analysis. In particular, even a single artifact over a 5 minutes window, can have very large consequences in terms of the derived HRV features (we’ll see an example in a minute). Camera-based apps, watches, rings, wristbands, are all affected by these issues as soon as you move
去除伪影的问题对于HRV分析尤其重要。 特别是，即使在5分钟的窗口内只有一个工件，也可能在派生的HRV功能方面产生非常大的后果(我们将在稍后看到一个示例)。 一旦您移动，基于相机的应用程序，手表，戒指，腕带都会受到这些问题的影响
Thus, if our goal is to correctly compute HRV features in healthy individuals (i.e. individuals without cardiac issues), we need to do our best to clean the beat to beat intervals from any artifacts, regardless of their origin (actual ectopic beats, or issues because the user was moving)
问题有多严重？ (How bad is the problem?)
This is why 99% of smartwatches on the market do not even bother with HRV analysis and target only heart rate estimation, which still doesn’t really work consistently when exercising (if you are serious about your exercise heart rate, please get a chest strap)
The few devices that do go through the trouble of doing HRV analysis, normally do so while you sleep (e.g. an Oura ring or Fitbit), or using a specific sensing modality (e.g. the Scosche Rhythm24 HRV mode or the Apple Watch using the Breathe app). This choice makes a lot of sense as if you are sleeping or doing a breathing exercise, you are not moving that much.
很少有遇到HRV分析麻烦的设备，通常会在您睡觉时(例如，Oura环或Fitbit)或使用特定的感应方式(例如，Scosche Rhythm24 HRV模式或使用“呼吸”应用程序的Apple Watch)进行)。 这种选择很有意义，就好像您正在睡觉或进行呼吸运动时，您并没有动那么多。
Additionally, given the limited utility of HRV analysis during exercise, as long as you are able to collect high-quality data at rest or during the night, you are good to go (you can learn more about heart rate variability and when to measure, in our guide here).
For phone or camera-based measurements, similar to the ones we use in HRV4Training or HRV4Biofeedback, issues are typically caused by finger movement, as the apps are used while at rest, and therefore there is no body movement
Let’s look at one example:
Above we have one minute of PPG data, including detected peaks. In general, the data shown here is good quality, however, there are some clear artifacts (e.g. in the second row, causing a spike and abnormal gap between beats)
During this test ECG data was collected simultaneously, used to extract reference RR intervals, and compute rMSSD, which was 163ms. If we use the PPG data and detected peaks we have here to compute rMSSD, we get 229ms (which is a large difference for this metric, repeated measures are in the 5–15ms difference range).
在此测试期间，同时收集ECG数据，用于提取参考RR间隔并计算163ms的rMSSD。 如果我们使用PPG数据和检测到的峰值来计算rMSSD ，我们将获得229ms (对于该指标而言，这是一个很大的差异，重复测量的差异在5-15ms范围内)。
The few artifacts present have a large effect on our output metric, and therefore we need to address the issue or the data collected will be rather useless. Note that this problem normally does not affect resting heart rate (60 beats over a minute are still 60 beats even if a couple of them are out of place, hence this is key only in the context of HRV analysis normally)
三个步骤中的基本工件清除 (Basic artifact removal in three steps)
There are many different methods that can be used to remove artifacts. Something that I found to be effective when looking at data over a broad range of HRV values and PPG-related issues, is the following:
Remove extreme values (range filter, typically anything that does not result in an instantaneous heart rate between 20 and 200+ bpm, depending on the application, e.g. resting physiology or exercise)
Remove beat to beat abnormalities. This means removing beat to beat differences that for example are more than X%, which is not physiologically possible. X should change based on the actual baseline HRV of the person, as the common thresholds (20–25%) can overcorrect. Overcorrection tends to be a minor problem for nonathletes but should be accounted for in a population with particularly high HRV values
删除拍子以消除拍子异常。 这意味着去除拍子之间的拍子差异，例如大于X％，这在生理上是不可能的。 X应该根据人的实际基线HRV进行更改，因为常见阈值(20–25％)可能会过高。 对于非运动员，过度矫正往往是一个小问题，但应在HRV值特别高的人群中解决
Remove remaining outliers. After the previous steps, we could still have some outliers, especially if we are less strict with the abnormalities filter (say we use 50–70% for athletes, then there will be more artifact that we actually need to remove). For this filter, I found (empirically) the following thresholds to work well: 0.10–0.25 * 25th and 75th percentiles of the clean data.
删除剩余的异常值。 在前面的步骤之后，我们仍然可能有一些异常值，特别是如果我们对异常过滤器的要求不严格(例如，我们对运动员使用50％到70％的数据，那么实际上我们将需要删除更多的假象)。 对于此过滤器，我发现(凭经验)以下阈值可以正常工作： 0.10–0.25 *原始数据的25％和75％ 。
In our apps, we use these methods plus a few extra steps that can be feature-dependent, or person-dependent, as well as optimized thresholds based on the person’s historical data and group-level parameters. However, in almost all cases, what is reported above is already sufficient, as we will see in the validation below
Let’s first look at our example, we can see here in yellow the valid peaks after artifact removal:
Lets now look at the PP (and RR) intervals. PP intervals are the beat to beat differences computed after detecting individual beats in our PPG (or ECG, called RR intervals in this case) data. When we visualize PP intervals over time, normally we can spot easily any artifacts (spikes) as well as any other issues, since the time series should look very similar between sensing modalities (phone camera, chest strap, or ECG).
现在让我们看一下PP(和RR)间隔。 PP间隔是在我们的PPG (或ECG，在此情况下称为RR间隔)数据中检测到单个拍后计算出的拍差。 当我们可视化随时间变化的PP间隔时，通常我们可以轻松发现任何伪像(尖峰)以及任何其他问题，因为时间序列在传感方式(手机摄像头，胸带或ECG)之间看起来非常相似。
In the figure below, we have in the top plot our camera-based PP intervals (in dark blue before artifact correction, while in light blue after artifact correction), as well as RR intervals reported by a Polar chest strap (second row) and computed from reference ECG data (third row). We can also see the participant’s breathing pattern (about 10 oscillations per minute)
As previously discussed, rMSSD for artifacted data in this example was 229m. On the other hand, after artifact removal rMSSD for the camera-based algorithm is 166ms (hence very close to the 163ms of our reference, ECG). Again, differences in consecutive measurements, even using ECG, are in the 5–15ms range, hence our difference here is negligible and we were able to effectively remove all artifacts and estimate HRV correctly (you can find more information on repeated measures for PPG, chest strap and ECG data, here).
如前所述，此示例中用于伪造数据的rMSSD为229m 。 另一方面，去除伪影后，基于相机的算法的rMSSD为166ms (因此与我们的参考ECG的163ms非常接近)。 同样，即使使用ECG，连续测量的差异也在5–15ms范围内，因此我们的差异可以忽略不计，并且我们能够有效去除所有伪像并正确估计HRV (您可以找到有关重复测量PPG的更多信息，胸带和ECG数据，在此)。
组级别验证 (Group level validation)
It is of course key to develop a method that works over a broad range of HRV values (and not only for the person shown in the figures above). Typical values we see for rMSSD in healthy individuals are between 10 and 250ms
Let’s look at the results of the method described above for about 100 recordings. In the figure, I also report the correlation and root mean square error between rMSSD computed from ECG and PPG. We want the correlation to be very high (close to 1) and rmse to be very low (realistically, below 10ms)
让我们看一下上述方法对大约100条记录的结果。 在图中，我还报告了从ECG和PPG计算出的rMSSD之间的相关性和均方根误差。 我们希望相关性非常高(接近1)，而rmse非常低(实际上，低于10ms)
First, let’s look at the results without any artifact removal:
We can see quite clearly that for many recordings, artifacts are a big problem. We still have quite a few recordings on the identity line, hence this is probably very high-quality data, but rMSSD without artifact removal is highly overestimated in many cases, leading to poor correlation and large error
The three-steps method I described above is similar to the one we have previously published in Plews, D. J., Scott, B., Altini, M., Wood, M., Kilding, A. E., & Laursen, P. B. (2017). Comparison of heart-rate-variability recording with smartphone photoplethysmography, Polar H7 chest strap, and electrocardiography. International journal of sports physiology and performance — let’s look at the results when we apply it for artifact removal:
我上面描述的三步法类似于我们之前在Plews，DJ，Scott，B.，Altini，M.，Wood，M.，Kilding，AE和Laursen，PB(2017)中发表的方法。 智能手机光体积描记法，Polar H7胸带和心电图对心率变异性记录的比较。 国际运动生理学和性能杂志-让我们看看将其应用于去除伪影的结果：
Much better. We now have an almost perfect correlation between ECG-derived rMSSD and camera-based rMSSD, after applying these simple filters. We can see how we do not have all those highly overestimated rMSSD values anymore
好多了。 在应用了这些简单的过滤器之后，我们现在在源自ECG的rMSSD和基于相机的rMSSD之间具有几乎完美的相关性。 我们可以看到我们不再拥有所有那些被高估的rMSSD值了
Any optical measure (phone-based, wristband, ring, etc.) — can benefit from this approach in order to provide high-quality HRV data
信号质量估计(Signal quality estimation)
Based on the artifact removal method just covered, we can also determine signal quality. A simple method I’ve developed to determine noise level is to rely on the ratio between the number of removed beats (according to the various filters) and the number of beats originally detected
Intuitively, if we remove zero or a few artifacts, we will have high quality data, while if we remove many artifacts, we will tend to have poor quality data. While it is possible that all artifacts are removed correctly even if there are many, in general this is rare. The reason is that detecting many artifacts in PPG data is typically associated with movement and therefore large disruptions in signal quality (more than actual ectopic beats), which cannot be easily recovered
直观地，如果我们删除零个或几个假象，我们将获得高质量的数据，而如果我们删除许多假象，则我们将倾向于获得质量较差的数据。 尽管即使有很多伪影也可能会被正确删除，但通常这很少见。 原因是，检测PPG数据中的许多伪影通常与运动相关联，因此信号质量的重大破坏(超过实际异位搏动)，无法轻易恢复
Below are two screenshots taken during a measurement in which I intentionally moved the finger a lot while recording. You can see how the app is able to detect the issue and report back the problem to the user. While hardly any system out there reports quality (your smartwatch most likely will keep providing random heart rate data while you exercise, regardless of the fact that they might be able to detect the issue), I think this is a key feature that can help to gain confidence in the tools we use
以下是在测量过程中拍摄的两个屏幕截图，在录制过程中，我故意将手指移动了很多。 您可以查看应用程序如何检测到问题并将问题报告给用户。 尽管目前几乎没有任何系统能够报告质量(您的智能手表很可能会在运动时继续提供随机的心率数据，而不管他们是否能够检测到问题)，但我认为这是一项关键功能，可以帮助您对我们使用的工具充满信心
In my view, it is quite pointless to pretend that a sensor will always provide high-quality data (no matter how much you pay for it), especially when it comes to optical sensors (watches, wristbands, etc.). Motion will always be an issue, and sometimes data might need to be discarded.
Implementing effective artifact removal methods, as well as being transparent about any potential issues, should make it easier to make effective use of these technologies, which can be extremely helpful in tracking individual responses to physical and psychological forms of stress (check out a few examples here)
That’s a wrap for this article, I hope you’ve found it useful
Marco holds a PhD cum laude in applied machine learning, a M.Sc. cum laude in computer science engineering, and a M.Sc. cum laude in human movement sciences and high-performance coaching.
Marco拥有应用机器学习博士学位，并以优异的成绩获得硕士学位。 以优异的成绩获得计算机科学工程学位，并获得硕士学位。 以优异的成绩获得人体运动科学和高性能教练的指导。
He has published more than 50 papers and patents at the intersection between physiology, health, technology and human performance.