Difference between revisions of "Projects:2020s2-7451 Analysing Health Data from Wearables"
(→HR and RR Calculation) |
(→HR and RR Calculation) |
||
Line 87: | Line 87: | ||
=== HR and RR Calculation === | === HR and RR Calculation === | ||
+ | [[File:Capture4.png|thumb|HR Estimation]] | ||
For finding the HR from the PPG waveform, the systolic peaks of the PPG waveform were found by "findpeak" MATLAB function. The heart rate is equal to the ratio of the numbers of the detected peaks to the time duration of the PPG signal. For the analysed PPG waveform, the time duration for only good sections was used. This algorithms are proved to provide a good estimation of the heart rate in a noise-free PPG signal and to calculate the accuracy of this algorithms, 47 data which have already been pre-processed are used and the results shows that this algorithms could provide an accuracy of 97.67% in the context of this project. | For finding the HR from the PPG waveform, the systolic peaks of the PPG waveform were found by "findpeak" MATLAB function. The heart rate is equal to the ratio of the numbers of the detected peaks to the time duration of the PPG signal. For the analysed PPG waveform, the time duration for only good sections was used. This algorithms are proved to provide a good estimation of the heart rate in a noise-free PPG signal and to calculate the accuracy of this algorithms, 47 data which have already been pre-processed are used and the results shows that this algorithms could provide an accuracy of 97.67% in the context of this project. | ||
Revision as of 07:16, 8 June 2021
Heart rate (HR) and respiratory rate (RR) are important physiological parameters that could be used to indicate ones health and abnormalities in these parameters could be an indicator of serious illness. Therefore, many different methods have been proposed for automatic monitoring of HR and RR. In this study, we would use photoplethysmogram (PPG) signal to extract HR and RR data through development of algorithms in Matlab. Firstly, digital filtering would be used to detect and distinguish noisy signal and also motion artifact from a raw PPG signal. Then, the filtered signal would be extracted to gain HR and RR data.
Project team
Project students
- Amirahtul Nazihah Amir
- Bin Dai
- Jiaping Wang
Supervisors
- Associate Professor Mathias Baumert
- Associate Professor Brian Ng
Introduction
PPG is a simple optical technique used to detect the volumetric changes in the blood. It is a low cost and non-invasive method that makes a measurement on the surface of the skin. Different from electrocardiogram (ECG), PPG does not focus on the electrical pulses that cause the heart to beat, but rather on the effect that the beating has on blood vessels. With every beat of the heart, blood would be pumped out of the heart into blood vessels putting pressure on the vessel wall and causing them to dilate. These blood vessel would relax again between two heartbeats. In this study, a camera-based PPG is used as it enables remote vital signal monitoring by using cameras. This would be cost-efficient since cameras are available in an everyday item such as a smartphone. By lighting fingertip for 60 seconds with the flashlight of a smartphone camera, minuscule changes in the amount of blood that flows through the dilating and relaxing capillaries would be measured based on the amount of light that is reflected back to the camera. When the capillaries are dilated, meaning it contains a lot of blood, a lot of the light would be absorbed by the blood and therefore just a little would be reflected. Vice versa, when the capillaries are in relax condition, not much of the light would be absorbed and hence there would be more light reflected back to the camera.
Objectives
The overall objective of this project is to design a software system to analyse the health data from noisy photoplethysmography (PPG). The software system has the following specific goals:
- to detect and remove the artifacts in the original PPG signals;
- to monitor the subjects’ health parameters such as the heart rate (HR) and the respiration rate (RR) from the PPG waveforms;
Additionally, this project is aimed to develop a graphical user interface (GUI) system. This GUI design is aimed to display both original and noisy PPG waveforms. In addition, it shall allow users to choose which ranges of signals they consider as artifacts. The calculated HR and RR analysed from the PPG waveforms are displayed to them as well.
Motivation and Significance
Nowadays, one of the significant causes of death worldwide is a disease according to [1]. For the poor nations such as Liberia and Zimbabwe, there are not sufficient diagnosis equipment and treatment instrument. Consequently, it could cause large numbers of patients’ death. Even for some developed and developing nations, there are some impoverished areas that do not have enough medical equipment or hard to move to the medical centre due to mobility problems as stated in [2].
One of the main functions of PPG is to diagnose human fitness and illness via HR and RR calculation [3]. HR and RR are two of the vital human signs which are effective for diagnosing. PPG could be not only detected by specific instrument but also by some wearable device such as smartphones and smartwatch as stated in Section 2.1 below. Therefore, the diagnosis via wearable device PPG is convenient and inexpensive for the needed personals.
Overall, the main significance of this project is to help the patients with mobility issues or who live in some area which does not have sufficient diagnosis equipment. Therefore, they could know if they have any fitness disease as early as possible and receive treatment as early as possible.
Background
Basic Principles of PPG
Photoplethysmography is an elementary, economically efficient and non-invasive optical technique that is used to detect blood volumetric changes [4]. The low-intensity infrared light is low for PPG; and it is absorbed by bone, skin and blood when it passes through biological tissues. A complete PPG signal consists of volumetric changes in arterial blood and variations in venous blood volume. There are two components in the PPG waveform which are an alternating current (AC) component and a direct current (DC) component [5]. The AC component is used for monitoring heart rate, and the DC component is used for calculating respiration rate.
Typically, the PPG detect system uses a light source which could be IR, red or green LEDs; and a photodetector to detect PPG signals through the skin. The figure above shows the general processes of camera-based PPG via a smartphone [6]. As shown in that image, the smartphone has used the camera to detect the PPG signal from the fingers. The LED flashlight from phones is used to detect minor changes in skin colours that are caused by the blood flow. The phone camera is also used to receive the PPG signal from fingers skins via the wide-bandwidth pixel-enabling RGB colours detection.
The limitation of camera-based PPG is the motion artifact which is usually caused by the movement of subjects. Furthermore, the environmental noise could affect the PPG signal acquisition so that the estimation accuracy of HR could be affected [7].
Monitoring Respiration Rate by PPG
In paper reviewed for monitoring respiration rate by PPG signal which is written by [8], a team proposed a method for extracting the instantaneous respiratory rate (IRR) from the PPG. There are two data sets used for analysing. One is the Capnobase data which contains 8 minutes of recording from 29 children and 12 adults, and all subjects received anaesthesia during the experiment. Another is the sleep data from the 20 minutes recording from 43 children for overnight standard polysomnography.
The figure above shows the entire process on how to calculate IRR for the original noisy PPG signals. The method has the following three steps:
- To separate the respiratory-induced intensity, amplitude, and frequency variation signals from original PPG signals by the first synchrosqueezing transform (SST).
- To estimate the corresponding IRR for each separated respiratory-induced variation signal by another SST.
- To calculate final IRR from combined IRR estimates via peak-conditioned fusion method which combines all IRR estimations from three respiratory-induced variations.
The results of this method were compared to the calculated IRR from the simple fusion and single respiratory-induced variation estimations. As a result, the designed method has the best performance. The advantage of this method is that the calculated IRR is more accurate than a single fusion. However, the project team shall do more research on how to write codes for SST and peak-conditioned fusion via MATLAB as the method is required to design a complex software algorithm.
Support Vector Machine
The research review - “Automatic EEG Artifact Removal: A Weighted Support Vector Machine Approach With Error Correction” – which written by [9] . was used to understand the processes of using an SVM for detecting artifacts.
The figure above shows the basic structure of the automatic artifact removal system designed for electroencephalogram (EEG) in the review. Firstly, the artifacts were removed by the independent component analysis (ICA). Then, the feature extractor generated a set of feature vectors for the IC classifier such as normalized skewness and Kullback–Leibler distance. There were two submodules in the IC classifier - a modified probabilistic multiclass SVM to address the unbalanced nature of the data, and an error correction to deal with the unique structural information of the data. The SVM used in the review was a standard SVM system for EEG signal provided. In the end, the EEG was reconstructed to form an artifact-free EEG. According to the testing results, approximate 98% of artifacts were removed in the artifact-free EEG. There were only 2% of artifact which were not detected and removed. Hence, the performance was significantly reduced if the training data was not accurate enough.
To sum up, this review explained the basic structure of SVM design. However, the SVM design in the review used has already been improved by professionals and it was only appropriate for ECG. During the project, the team were required to design their own SVM for PPG and the performance of SVM design could be not as accurate as of the performance for SVM used in this review. The reason was the accuracy of the SVM design would be reduced if the training data was not selected appropriately.
Method
The programming language chose for analysing PPG signals is MATLAB. There are lots of programming language such as Python, which could be used to analyse PPG signals. One of the advantages is that it is easier to use to designing codes compared to other languages, and it is helpful to seek some assistance from the MathWorks website. Additionally, there are some useful add-ons and toolbox include in MATLAB. For instance, "Signal Analyser", is effective to analyse the PPG signals such as power spectrum. Also, "Classification Learner" is helpful to design SVM code for detecting artefacts. Another application used for this project is “APP Designer”, and the team is using it to design the GUI. The integrated codes could be copied into the GUI without redesigning them.
In this project, there are 100 examples of PPG signal provided by the supervisor. Overall, the performances of those signals are different and there is not much noise in the signal as their sampling frequency are low (i.e. fs = 30 Hz). Some signals do not contain any artifact or noise so that they could be used to calculate HR and RR directly. There are some signals which contain both the good region and bad region (artifacts(. Others are not able to be analysed as there is not any good region.
The flowchart above shows how the software design work in this research. They are using for testing the code design. At first, the raw PPG signal is separated into different regions such as 20 regions, and the features for each region are calculated. The features were chosen are the amplitudes difference and the time difference between the closest two peaks, and the HR and RR value. Then, an SVM design is used to detect the performance of each separated region by using those extracted features. Then, the artifacts are removed by codes and the values would be changed to 0 or NaN for calculating RR and HR.
The RR and HR would be calculated for the analysed signal. The HR is calculating by counting the peaks in the analysed signal and divide it by the total time duration of good regions. For RR calculation, the method is to use two synchrosqueezing transforms (SST) to calculate the instantaneous respiratory rate. Another method is to connect the peak points of the PPG signal to get the respiration signal and use the number of peaks in this to calculate RR. The methods using for calculating the HR and RR for analysed signals are also used during the feature extraction.
In the end, a GUI design is used to display the graphs of the original and analysed PPG waveforms; and the RR and HR values calculated by the analysed signal. The users are also able to select which regions are artifact regions by themselves. The reason is that sometimes the machines might not identify the good and bad region correctly. The changes of artifact regions are saved into a new mat file.
Results
Arfifact Detection and Removal
The PPG data used for this project is "PPG.mat" provided by the supervisor. 100 PPG signal data had different performances for analysing.
There were two methods for removing the artifacts. The first method was to detect the peaks for the PPG waveforms. Then to set some conditions for classifying the artifacts section such as the peak to peak differences and the amplitudes of peaks. According to the tests, the accuracy of this method was above 90% for most signal. IF the signals were too bad for analysing, the accuracy of this method would become extremely low.
Another method was to use the SVM design. Firstly, the whole PPG waveform was separated into 20 - 30 sections, and the features of the PPG signal were extracted such as the Peak to peak difference. Then, to select some training data of good and artifact sections for training the SVM. As a result, the SVM would show which sections are artifact and which are good sections. The result of the training showed that the accuracy of the SVM was more than 97%.
The first method has less accuracy than the second method. However, the result would be less accurate if the training data was not selected well.
HR and RR Calculation
For finding the HR from the PPG waveform, the systolic peaks of the PPG waveform were found by "findpeak" MATLAB function. The heart rate is equal to the ratio of the numbers of the detected peaks to the time duration of the PPG signal. For the analysed PPG waveform, the time duration for only good sections was used. This algorithms are proved to provide a good estimation of the heart rate in a noise-free PPG signal and to calculate the accuracy of this algorithms, 47 data which have already been pre-processed are used and the results shows that this algorithms could provide an accuracy of 97.67% in the context of this project.
For RR calculation, the first step was to label all the local maxima and minima in the PPG signals. Then, the corresponding peaks were connected for extracting the restoration signal. The respiration signal represents the waveform for breaths. Similar to the HR calculation, the respiration rate is equal to the ratio of the numbers of the detected peaks to the time duration of the respiration signal.
GUI Design and User Editing Function
The figure above shows the final version of the GUI design, it was designed by using the App Designer. The following paragraph explained the functions for each element in GUI such as buttons and plots. In addition, the User Editing Function was displayed in this GUI under the tabs – “User Editing Function” and “Analysed PPG waveform after user editing”. The integrated code was moved and modified into a code designing panel under App Designer.
The App Designer were mainly two views for design – design view and code view. In the design view, there were some common components provided such as axes and button. Overall, the axes were used to display the waveforms as plotted figures; the text fields were used to show the calculated values of HR and RR, and the buttons were used to execute the commands when pressed.
The users could select which PPG data by pressing the "Changed Pathway" button. If the users do not have any PPG data, the GUI would automatically analyse the sample PPG provided. Before clicking the "Analyse Signal" button, the users are required to enter the set number of PPG data they want to analyse. After licking the "Analyse Signal" button, the original and analysed waveforms would be shown. The red sections are the detected artifacts and the other blue section represented the good signal. Additionally, the HR and RR were calculated and displayed in the GUI.
The user editing function allowed users to modify the artifact sections by themselves. Some artifacts might not be detected and removed, and even some good signals could be mis-detected as artifacts. Each time users pressed the button - "Add Artifact Section" and "Remove Artifact Section", the users are asked to select the start and end points for the section added and removed. After each editing, the HR and RR would be calculated and updated. The users could also reset all the editing by pressing the "Reset" button. The users could also be saved all the PPG data, HR and RR values into a new file.
Conclusion
There were three parts for the Software Design – artifacts and noise removals, HR and RR calculations, and GUI design and User Editing Function.
The first part was just achieved half of the aims. The team did not design the codes for the noise removal due to the lack of time management and team communication. Also, the sample PPG data did not contain too many obvious noises.
The second and third parts had been completed finished worked. However, another method for calculating RR was not finished on time so that the GUI design could not integrate the new RR calculation algorithm. The HR and RR calculations’ aims were achieved.
For GUI and User Editing Function designs, most aims were achieved, and the User Editing Function was put on the GUI. Those tasks were assigned to the author – Bin. In conclusion, all aims were achieved, but some aims were achieved by another method which was more user-friendly. The GUI design was also used to integrate, test and debug other members’ codes.
The GUI developed during this project could be used as a template of the GUI design for PPG as there were not many GUI designs from previous research. The main advantage of the GUI application is that the users could read the health parameters and waveforms directly from the screen by analysing the PPG data collected from wearable device. Due to a lack of programming and application developing experiences, the GUI design was not perfect, and it also requires users to install the MATLAB environment.
The future plan of this project is to study and design an algorithm for removing noises and also test the GUI with other PPG data. Therefore, the GUI application would also be able to remove the noise and be suitable for analysing more types of PPG signal. In addition, the team would research more about artifact removal so that the algorithm would be able to remove artifact more accurate. Furthermore, to learn other programming languages such as Python and design the algorithms by other languages. The GUI application would be designed as an exe file; therefore, it would not require the users to install any programming environment.
References
- ↑ Would Health Organization, “The top 10 causes of death,” 24 May 2018. [Online]. Available: https://www.who.int/news-room/fact-sheets/detail/the-top-10-causes-of-death. [Accessed October 2020].
- ↑ O. Owen, “Access to health care in developing countries: breaking down demand side barriers,” Cadernos de Saúde Pública, vol. 23, no. 12, 2007.
- ↑ R. Laulkar and N. Daimiwal, “Acquisition of PPG signal for diagnosis of parameters related to heart,” 2012 1st International Symposium on Physics and Technology of Sensors (ISPTS-1), pp. 274-277, 2012.
- ↑ I. Van Loon, “How does FibriCheck measure your heart rhythm?,” 24 June 2019. [Online]. Available: https://www.fibricheck.com/how-fibricheck-measures-your-heart-rhythm/. [Accessed September 2020].
- ↑ S. Cheriyedath, “Photoplethysmography (PPG),” News Medical Life Sciences, 2019.
- ↑ T. Vandenberk, J. Stans, C. Mortelmans, R. Van Haelst, G. Van Schelvergem, C. Pelckmans, C. J. Smeets, D. Lanssens, H. De Cannière, V. Storms, I. M. Thijs, B. Vaes and P. M. Vandervoort, “Clinical Validation of Heart Rate Apps: Mixed-Methods Evaluation Study,” JMIR mHealth and uHealth, vol. 5, no. 8, p. e129–e129, 2017.
- ↑ Y. Zhang, B. Liu and Z. Zhang, “Combining ensemble empirical mode decomposition with spectrum subtraction technique for heart rate monitoring using wrist-type photoplethysmography,” Biomedical Signal Processing and Control, vol. 21, pp. 119-125, August 2015.
- ↑ P. Dehkordi, A. Gard, B. Molavi, J. M. Ansermino and G. A. Dumont, “Extracting Instantaneous Respiratory Rate From Multiple Photoplethysmogram Respiratory-Induced Variations,” Frontiers in physiology, vol. 9, July 2018.
- ↑ S.-Y. Shao, K.-Q. Shen, C. J. Ong and E. P. Wilder-Smith, “Automatic EEG Artifact Removal: A Weighted Support Vector Machine Approach With Error Correction,” IEEE transactions on biomedical engineering, vol. 56, no. 2, pp. 336-344, February 2009.