Edge Impulse logo
Blog Post

Getting the Pulse: Technical Insights Into Edge Impulse's New HR and HRV Blocks

Machine LearningExplore Edge Impulse's insights into heart rate and heart rate variability in digital health, including applications and tools.

Louis Moreau

October 6, 2023

In digital health engineering, few metrics are as vital as heart rate (HR) and heart rate variability (HRV). These offer profound insights into health, and at Edge Impulse, we have made substantial strides in simplifying the measurement of HR and HRV for resource-constrained devices. In this exploration tailored for engineers in the digital health industry we'll dive deep into the technical aspects of Edge Impulse's HR and HRV features. This article will help you gain a comprehensive understanding of PPG heart rate estimates, HRV feature generation, embedded code for on-device inference, and more.

Read the Demystifying HR and HRV sectionDemystifying HR and HRV

Before we delve into the intricacies of Edge Impulse's offerings, let's establish a foundational understanding of HR and HRV.

Heart rate (HR) interbeat intervals
The measurement and analysis of heart rate interbeat intervals (IBIs) are fundamental in the study of cardiovascular physiology and health. IBIs, also known as RR intervals, represent the time intervals between successive heartbeats, specifically the time elapsed between the R-peaks of consecutive QRS complexes on an electrocardiogram (ECG) waveform.

Heart rate variability (HRV) is a measure of the variation in time between successive heartbeats. It goes beyond the measurement of the heart rate itself. 

These variations offer insights into the balance between the sympathetic and parasympathetic branches of the autonomic nervous system of the autonomic nervous system, providing insights into various aspects of our health, including autonomic nervous system balance, cardiovascular health, stress levels, and fitness and recovery.

“A healthy heart is not a metronome”[1] — it exhibits complex patterns best described by mathematical chaos.

Read the Real-world applications using HR/HRV features sectionReal-world applications using HR/HRV features

Read the Atrial fibrillation classification sectionAtrial fibrillation classification

Atrial fibrillation, a common cardiac arrhythmia affecting millions, can be detected using our HRV features extracted from PPG signals [2]. This approach offers diagnostic accuracy comparable to ECG-based methods, enhancing diagnostic accessibility for a broader population.

Atrial Fibrillation Graphs - Edge Impulse Studio

Read the Stress detection sectionStress detection

Psychological stress, affecting sympathovagal balance, is closely reflected in HRV metrics. This demonstrates that HRV can serve as an informative marker of the physiological effects of psychological stressors in healthy adult populations.

Edge Impulse Stress Detection project trained with HRV extracted features from 40k data samples

Read the Sleep staging sectionSleep staging

Recent studies[3] have explored the use of HRV as a parameter for sleep staging. It offers a convenient, non-invasive, and cost-effective approach to monitoring sleep stages. While these results are obtained from HRV features alone, combining them with actigraphy and respiratory features can further enhance accuracy.

Read the Empowering progress in digital health sectionEmpowering progress in digital health

Read the Reduce R&D costs sectionReduce R&D costs

Edge Impulse HR/HRV solutions leverage cutting-edge algorithms, eliminating the need for prolonged algorithm refinement. This streamlined approach significantly reduces research and development (R&D) investment, enabling accelerated product development.

Read the Reliability sectionReliability

We deliver precise and dependable Interbeat Interval (IBI) measurements for HRV analysis, catering to a wide range of customer applications. This ensures that your digital health device consistently provides reliable results.

Read the Large-scale clinical studies sectionLarge-scale clinical studies

Edge Impulse offers a robust infrastructure for expanding centralized and decentralized clinical studies to encompass small and large cohorts of subjects. This scalability is vital for rigorous testing and validation, ensuring that your dataset is diverse and minimizes model biases.

Read the Solution expertise sectionSolution expertise

Our solution engineers possess extensive expertise in applying HRV data to edge AI projects in the digital health domain. You can tap into this wealth of knowledge to save time and gain insights from industry experts.

Read the Hardware-optimized ML models sectionHardware-optimized ML models

Our models are meticulously crafted to operate efficiently on resource-constrained edge devices. This guarantees that your digital health product remains cost-effective.

To discover how Edge Impulse HR/HRV can enhance your digital health project, please visit our website or reach out to our team. We are here to support your innovation and provide impactful health solutions that truly matter. 

Read the Edge Impulse's technical arsenal for HR and HRV sectionEdge Impulse's technical arsenal for HR and HRV

The suite of modules we provide for HR and HRV analysis encompasses feature generation libraries, on-device capabilities, a reference design, and strong expertise from our teams to leverage.

Read the Edge Impulse HR/HRV features sectionEdge Impulse HR/HRV features

For enterprise users, Edge Impulse offers libraries for HR and HRV feature generation, accessible both within the Edge Impulse Studio and on-device. Additionally, we provide blocks that facilitate training with raw PPG/ECG data within the Studio. 

Read the PPG/ECG to IBI Library sectionPPG/ECG to IBI Library

The first library we provide is called PPG-HR. It can efficiently and accurately detect heartbeats from either PPG or ECG signals, and then calculate the HR interbeat intervals (IBIs).

[4] - Illustration of deriving HRV data from ECG and PPG signals, (a) RR intervals in the ECG signal, and (b) PP intervals in the PPG signal. N.U.: Normalised units.

Read the HRV feature extraction library sectionHRV feature extraction library

The output of the PPG-HR block is typically used as an input to the HRV extraction block. For situations where IBI data is already available, the HRV library can be run standalone, directly with IBI input. 

In the time domain, you can extract metrics like AVNN, SDNN, rMMSD, pNN50, Mean HR, HR percentiles, IQR, HR slope, and rMMSD slope. 

In the frequency domain, you can extract VLF/LF/HF values, energies, ratios and peaks, and boundary adaptation metrics. 

The library also supports more advanced metrics like Sample Entropy, DFA, SD1, SD2, SD2/SD1 ratio, and circadian features.

See the appendix section to understand these features.

Read the Extensive resources sectionExtensive resources

In addition, we also provide multiple Studio project examples and a full reference design to help our customers facilitate the understanding and the replication of advanced workflows.

Edge Impulse's algorithms can handle either PPG or ECG inputs, optionally integrating accelerometer data for enhanced accuracy. We demonstrated how to apply crucial filtering mechanisms to clean the signal and excel in precise IBI and HR estimation. Finally, to improve the detection of HR peaks, we can add feedback and tracking mechanisms. Remarkably, all of this is achieved with minimal RAM usage, consuming just 1.6K of memory.

Our commitment to simplifying heart rate variability (HRV) measurement aligns with our dedication to granting access to expert knowledge and advanced algorithms. By utilizing Edge Impulse HR/HRV solutions, you can streamline your development process, benefiting from the expertise of industry leaders in the digital health sector.

Read the Appendix sectionAppendix

[5] - Table 1: Selected time domain HRV indexes
[5] - Table 2: Selected frequency domain HRV indexes
[5] - Table 3: Selected nonlinear HRV indexes

Read the References sectionReferences

[1] - Shaffer, F., McCraty, R., & Zerr, C. L. (2014). "A healthy heart is not a metronome: An integrative review of the heart's anatomy and heart rate variability". Frontiers in Psychology, 5, 1040. 

[2] - Maxime Voisin*, Yichen Shen*, Alireza Aliamiri, Anand Avati, Awni Hannun, and Andrew Ng. Ambulatory Atrial Fibrillation Monitoring Using Wearable Photoplethysmography with Deep Learning

[3] - Radha, M., Fonseca, P., Moreau, A. et al. Sleep stage classification from heart-rate variability using long short-term memory neural networks. Sci Rep 9, 14149 (2019).

[4] - Lu, Lei & Zhu, Tingting & Morelli, Davide & Creagh, Andrew & Liu, Zhangdaihong & Yang, Jenny & Liu, Fenglin & Zhang, Yuan-Ting & Clifton, David. (2023). Uncertainties in the Analysis of Heart Rate Variability: A Systematic Review. IEEE reviews in biomedical engineering. PP. 10.1109/RBME.2023.3271595. 

[5] - Rajendra Acharya, U et al. “Heart rate variability: a review.” Medical & biological engineering & computing vol. 44,12 (2006): 1031-51. doi:10.1007/s11517-006-0119-0


Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter