Heart Rate Detection Using SVM Based on Video Imagery

According to the World Health Organization, the death rate of cardiovascular diseases ranks first in the composition of disease deaths. Research shows that the heart rate can be employed as an important physiological parameter to measure the health status of people’s cardiac health. A pressure pulse is formed by the periodic beating and contraction of the heart, so its rate and the pressure pulse signal have a distinct synchronous periodicity. Certain wavelengths of light are known to be absorbed by the capillaries in the human skin, where this absorption fluctuates in accordance with the heartbeat as the capillary blood volume changes. Therefore, the intensity of the reflected light on the skin surface changes periodically, as manifested by a change of skin color. A dynamic target tracking algorithm was used for tracking the region of interest (ROI) in real time, where with this approach multiple targets can be monitored simultaneously. Our approach uses Photoplethysmography (IPPG) imaging technology, in conjunction with an ordinary camera to capture subtle periodic changes of intensity of reflected light from the surface skin. We then use a Support Vector Machine (SVM) algorithm for the video image data. The results of our research show that heart rate information of subjects can be detected quickly and accurately even when monitoring multiple targets.


Introduction
Traditional Chinese medicine methods of heart rate detection include directly sensing the pulse by touch. Using this method can roughly get the heart rate of the subject without any equipment and relies on a skilled practitioner. Manual methods are prone to variations due to the differences in pulse characteristics and the subjective nature of the practitioner's interpretation of the pulse [1]. On the other hand, there are applications of electronic devices for heart rate measurement and monitoring. For example, with the Electrocardiogram (ECG), sensors detect physiological changes related to a heart rate and convert them into electrical signals to obtain the rate. While the accuracy of ECGs is better than manual methods, ECG measurements are limited in many ways. The devices are expensive and cumbersome, and the measurement requires multiple external sensors, which is clearly not appropriate for newborns or patients with extensive burns.
In recent years, there is a growing interest in non-contact medical and health devices, especially in the wake of the COVID-19 outbreak in 2019, so research into non-contact heart rate detection is of practical importance. There are many non-contact methods. For example, Liang et al. [2] proposed a non-contact human physiological signal detection method based on 2.4 GHz WiFi environment in their study. Lee et al. [3] used pulsed radio ultra-wideband (IR-UWB) radar to obtain heartbeat information without contact.
In 1937, Hertzman [4] proposed Photoplethysmography (PPG), which is a non-invasive application that can be used to obtain information about the change of blood volume in human blood vessels, and PPG has been widely used in modern medical industry [5]. Heart rate detection based on video images, namely image-Photoplethysmography (IPPG), is developed on the basis of traditional Photoplethysmography [6]. In this study, we utilized IPPG technology to detect subtle changes of human skin color by using ordinary cameras to determine the heart rate and other signals [7]. The optical properties of skin are mainly caused by the absorption of light by subcutaneous fluid, hemoglobin, and melanin, etc. In comparison, the absorption of light by blood is higher than that by other absorption factors. When the light enters the subcutaneous tissue, the periodic fluctuation of blood will affect the intensity of light reflection, in which the fluctuation of blood causes periodic changes in reflected light, while the light reflected by surrounding tissues and bones hardly shifts [8]. By capturing the light from the imaging equipment, changes in the reflected light signal can be observed [9] and the periodic components of the signal can be analyzed to obtain physiological parameters related to the human body, such as heart rate, blood pressure, etc. [10].
Li et al. [11], Kai [12] and Sanyal et al. [13] used human facial images to study heart rate detection. However, the innovation part lies in we propose a heart rate detection method based on video images of the neck rather than facial images, and this approach has certain advantages. Firstly, facial capillaries are numerous and thin, and it is relatively difficult to detect changes in the light signal reflected by the capillary network. Moreover, facial nerves are prevalent across the face, and even slight changes in human expression causes changes in blood vessel volume. Such changes will have a huge impact on the experimental results. Secondly, during the COVID-19 outbreak, wearing a mask was purported to minimize the risk of contracting or transmitting the novel Coronavirus [14]. With this in mind we must consider the risk of taking off the mask to collect the facial video image data [15]. In addition, facial image data is important personal privacy information, and collecting facial images increases the risk of personal information leaks [16]. Capturing video images of the neck however, avoids these problems. Moreover, the main arteries of the human body are located in the neck, therefore capturing video of the neck region improves the accuracy of the experiment and constitutes the basis of the theoretical research we put forward in this research.
One limitation of using facial images for non-contact heart rate research is that it requires the patient to remain still while capturing the video image in order to avoid motion interference. When using the neck region for similar research, relatively simple and mature edge detection algorithms are able to identify and track the region of interest (ROI), thus avoiding motion interference issue.
The advantages of this study are mainly the combination of IPPG technology and SVM algorithms. By using the dynamic target tracking algorithm, a specific region of the neck was selected as the ROI for the experiment, and corresponding optimization was made to correct for motion interference during data acquisition. Cao et al. [17] analyzed the effect of the Red Green Blue (RGB) video image channel for non-contact heart rate measurement and the study showed that optimizing the RGB channel resulted in higher measurement accuracy. Therefore, in this study, we also employed RGB channel optimization. In order to eliminate the noise in pulse wave signals and improve the accuracy of the experiment, an SVM algorithm was adopted to process the selected RGB channel data. The effects of environment and hardware parameters, such as illumination, camera frame rate and resolution, on the measurement accuracy are also studied. The measurement accuracy of the system was verified by experiments.

IPPG Principles
Lambert-Bill's Law When a monochromatic light with a wavelength of λ, light intensity of I O is irradiated vertically into a medium, the transmitted light intensity through the medium is: where e ð Þ is the absorptivity of the medium under the incident light of wavelength λ. Higher values of e ð Þ indicate higher absorption of a particular wavelength of light. C is the percentage of medium, which is a constant and L is the length of light travels through the medium.
Oxygenated hemoglobin in the blood in human blood vessels absorbs light in some wavelength ranges. As the heart beats periodically, the percentage of oxygenated hemoglobin in the vascular blood changes, which affects the absorption and reflection of light by the blood. Thus, by detecting and characterizing the periodic color changes in the skin the heart rate can be determined.

Data Acquisition and Processing
In IPPG measurement, certain regions of the human body are typically selected as signal acquisition ROI, considering the strength of movement noise generated by muscles in the static or moving state of the human body, vascular distribution, etc.
In 2008, Verkruysse et al. [18] selected the face as the ROI for image-based photoelectric volume tracing. In their study they selected various segments of the facial area to extract the pulse wave signal. The results show that in general the frontal facial area produced a more distinct pulse wave signal with less noise, and that the entire facial area in aggregate was useful to extract additional information such as the breath rate. Their work also concluded that if the ROI area is very small, such as a localized point on the forehead the signal noise tends to be larger.
The experiment uses the camera that comes with the mobile phone, the video size is 640 * 480, and the format is set to 30 frames per second (fps), and video image data was subsequently stored in AVI format. During video image acquisition, the experimental subjects sat approximately 0.5 m from the camera so as to occupy the full video frame, and were advised to avoid large movements as much as possible during the image capture. The actual heart rate was measured synchronously with a fingertip pulse oximeter. In order to test whether the research plan we designed meets the requirements, 10 subjects of different genders and ages were selected. Each participant underwent multiple video capture trials and synchronous heart rate comparison tests.
According to physiological data, skin melanin absorbs light in the 460-560 nm region of the spectrum, and fluid absorbs a lot of ultraviolet and infrared rays. Most of the green light and yellow light pass through the skin and will not be reflected back after entering the blood, the green light changes more obviously after passing through the blood. Therefore, when extracting the signal from the video, it is best to select the pixel green channel value. The experimental results are shown in Figs.1 and 2.
Fast Fourier Transform (FFT) is then performed using the time domain of green channel signal, and the power spectrum is obtained. The position with the highest value in the signal spectrum represents the frequency of the heart rate and respiratory rate we measured.

SVM
In 1995, Zhang et al. [19] presented a supervised learning model, namely a Support Vector Machine (SVM). The SVM is a basic algorithm, and has excellent learning ability and generalization performance. As a result, SVM have always attracted much attention in the field of machine learning, and its related basic concepts are discussed as follows.  Given a set of labeled training samples Once the vector W and the offset B meet the formula (2), then we consider previously obtained data x 1 ; y 1 ð Þ; x 2 ; y 2 ð Þ; …; x n ; y n ð Þ f gas linearly separable. The meaning of the Eq. (2) is as follows, where "Á" means the dot product of the vector. Since all the data in the sample completed before training conforms to the Eq. (2), we combine the conclusions to get a new formula, Suppose an optimal hyperplane can divide x 1 ; y 1 ð Þ; x 2 ; y 2 ð Þ; …; x n ; y n ð Þ f g linearly, then we find a plane with the largest distance denoted as In order to get the best data, we make changes to the Eq. (4), the Lagrange function can be introduced and the optimal classification function can be solved according to the Kuhn-Tucker condition, namely where, a i > 0 is Lagrangian coefficient.
Generally speaking, the general idea of SVM is to obtain an interval maximized hyperplane in the feature space. Therefore, we want to get the corresponding classification function, we must choose the function that meets the Mercer conditions, namely Among them, the Function K x i ; x j À Á is called Kernel Function.
With the continuous deepening of research, various models and methods extended by support vector machines have been obtained [20][21][22][23], and these have been used in many places. We can also use it in our daily work. Of course, this algorithm is used in the core idea of this research.

The Research Methods
A method based on SVM is proposed to track the peak of heart rate spectrum. This method regards the tracking of peak of heart rate spectrum as a pattern classification task, and the statistical characteristics of multi-channel IPPG signals are fully considered in this process. This article uses the method of heart rate signal peak tracking and the method of SVM, namely, peak discovery followed by peak selection.
The detection of spectral peaks is mainly used to locate all spectral peaks in the IPPG signal spectrum. First set the threshold to K according to the conditions, namely where, z refers to the IPPG signal spectrum of each channel after noise reduction; n is a parameter that controls the size of the threshold; max Á f g is the maximum value in the obtained formula, here is what we want to get is the crest factor of the three-channel signal spectrum.
The threshold is then used to form a candidate spectrum peak set, such that, when the detected peak value of the spectrum is higher than the initially set threshold, this value will be saved for the next step of comparison. If it is lower than the threshold, this value will be excluded.
The ultimate goal of using this method is to select the most accurate heart rate signal spectral peak from a set of spectral peaks that meet the threshold. The heartbeat is periodic, and there is only one spectral peak corresponding to the true heart rate in a time period. In order to distinguish the correct heart rate peak from the wrong heart rate peak, we need to find the particularity of the correct heart rate peak, and then perform statistical analysis.
1. After comparing the detected correct heart rate peaks, we found that most of the heart rate peaks have the largest peak coefficient among the peaks detected in the corresponding time period. 2. Among the detected correct heart rate peaks, the distance between most of the heart rate peaks and the correct heart rate peak in the previous time period is the smallest.
According to some of the characteristics of the correct heart rate spectral peak mentioned above, the detected spectral peak can be distinguished according to the crest factor and the peak-to-peak value of the adjacent time period. Assuming that there are L spectrum peaks in the detected spectrum peaks that meet the initial threshold size, then the coefficient of the spectrum peaks that meet the threshold can be expressed as follows: where coe i is the coefficient i of the candidate spectral peak, and coe max represents the maximum coefficient in the set of candidate spectral peaks.
The distance of spectral peaks that meet the initial threshold in adjacent time periods can be expressed as: where f i is the frequency i of the first candidate spectral peak and f prev represents the estimated heart rate frequency in the previous window.
SVM has good robustness and accuracy in signal processing, and can be used in this research to deal with the problem of spectral peak classification. In addition, because of the specific properties of the SVM decision surface, we can extend it to more applications. In this paper, the coefficient ratio and distance between candidate peaks are extracted from the set of candidate peaks. Secondly, perform the labeling operation, and mark the correct peak of the heart rate spectrum as "1" and the wrong peak as "0". Then start learning according to the characteristics of the correct spectral peaks to find the support vector. Finally, the optimal hyperplane is determined according to the above support vectors.
In the testing stage, the coefficient ratio and the distance between the candidate spectral peaks should be selected first, and the feature vectors should be constructed. Then we can use the trained classifier to detect the correct peak of the heart rate spectrum, which corresponds to the true heart rate value. The position of the spectral peak corresponding to the true heart rate value in its time period can be divided into three categories, namely Case 1: If only one heart rate peak is filtered out by the SVM detector, then this peak is the heart rate peak corresponding to the current time period, and the corresponding frequency is recorded as f HR .
Case 2: If multiple heart rate spectrum peaks are detected by the SVM detector, the spectrum peak closest to the last heart rate spectrum peak of the adjacent time period is selected from the spectrum peaks of the corresponding period, and the corresponding frequency is recorded as f HR .
Case 3: If the correct heart rate peak is not obtained through the SVM detector, then we believe that the signal extracted in the corresponding time period contains interference noise such as motion. Cannot get the correct frequency corresponding to the peak of the spectrum.
Based on the above-mentioned various situations, we have proposed a prediction mechanism that can accurately locate the peak of the heart rate spectrum. The corresponding frequency is recorded as f HR .
This mechanism can be expressed as, where f predict represents the frequency corresponding to the predicted heart rate spectrum peak of the current time window and f prev predict represents the frequency corresponding to the predicted heart rate spectrum peak of the previous window. The values for f predict and f prev predict are obtained by using a smoothing algorithm, which uses the frequencies corresponding to the estimated heart rate spectrum peaks from the previous 10-time windows.
If the correct heart rate peak is obtained, the frequency f HR corresponding to the peak of the spectrum can be obtained. According to the calculation rules of the heart rate, the heart rate BPM est in the current time period can be expressed as.
BPM est ¼ f HR Ã 60 (11) where BPM est is the number of heart beats per minute.

Result Analysis
For evaluating the performance of the SVM based algorithm, we chose our own data set to test the effectiveness of the algorithm. In this dataset there are 15 sets of data. During the experiment the subjects sat 1 meter from the camera, and remained still so as to avoid large movements. The signals were collected from healthy men age 18-35 years old with light skin, and IPPG signal was collected from the tester's wrist by a pulse oximeters with green light LED (515 nm) distributed at different locations. The subjects also wore a finger clip oximeter which recorded the heart rate during the video image acquisition. The synchronous motion acceleration signal was collected from the wrist using a triaxial accelerometer, and ECG signals were collected from the tester's chest using ECG electrodes and the ECG readings were considered as the actual heart rate. All the collected signals were sent wirelessly to nearby mobile devices which included computers and mobile phones.
In the simulation experiment, the input data is divided into a continuous series of overlapping time windows each with a descrete 8-s time interval and a 2-s time incement step-size between adjacent windows. In the same time period, estimate the current heart rate value through the obtained IPPG signal and motion acceleration signal, and the continuous heart rate is obtained by aggregating the heart rates from the sliding time windows.
The Least Mean Square Adaptive Filter (LMS-ANC) is used to eliminate some motion noise in multichannel IPPG signal, whose filtering order is 25 and optimized value l ¼ 0:005. In the objective function of sparse signal reconstruction model, its weight coefficient s ¼ 1. An M-FOCUSS algorithm using a ¼ 10 À10 regularization parameter was used to determine the optimal solution. The parameters of the spectral peak selection method based on SVM are as follows: 1. the parameters of the formula f ¼ 0:7 2. the order of the smoothing algorithm is 2 3. the smoothing parameter is 20 In addition, this study selected 5 training data sets (training datasets) and 5 test data sets (test datasets) for training the classifier. All training data sets are then used to evaluate the overall performance of the algorithm. This paper uses three evaluation criteria to evaluate the function of each heart rate measurement algorithm, namely, average absolute error (Error 1), and Bland-Altman method and Pearson correlation coefficient. At the same time, the generalization performance of SVM classifier is evaluated by 10% discount cross validation.
Tab. 1 list the average absolute error (Error 1) of the algorithms respectively. In these tables we compare an SVM based heart rate measurement algorithm with several other mainstream algorithms, such as GREEN, ICA and CHROM [24][25][26][27]. The results show that on average, the SVM-based algorithm performs better than all other algorithms, although the ICA and CHROM perform marginally better for some specific datasets. It can be seen from the observation in the Tab. 1 that the estimated heart rate curve of this algorithm basically coincides with the real heart rate curve, while the estimated heart rate curves of GREEN algorithm and ICA algorithm have incorrect heart rate estimates at some time points. For example, in the period of 0-50 s, the estimated heart rate value of CHROM algorithm is greatly deviated from the real heart rate value. In addition, in the time periods of 110-116 s, 140-149 s, 210-225 s and 263-270 s the estimated heart rate value of SVM algorithm also has obvious deviation from the actual heart rate value. As the performance of this algorithm is completely superior than GREEN, ICA and CHROM. Furthermore, the estimated heart rate 110-116 s, 140-149 s, 210-225 s and 263-270 s, the estimated heart rate value of SVM algorithm also has obvious deviation from the real heart rate value. Since the performance of this algorithm is completely better than that of GREEN, ICA and CHROM. Pearson correlation coefficient is the linear correlation between real heart rate and estimated heart rate through a scatter plot. Its evaluation criteria: the greater the absolute value of the correlation coefficient, the stronger the correlation. The Fig. 3 shows the results of correlation analysis on the test data. Most of the data points fall on the linear line, and the correlation coefficient is 0.9637, indicating a strong correlation.

Conclusion
Heart rate value can be used as an important physiological parameter to measure human health, and it plays an important role in disease detection and prevention. The traditional tactile method of heart rate detection relies on skilled medical personnel to perform, and may be inconvenient for the patient. This article introduces a non-contact real-time heart rate measurement method based on the principle of IPPG. This method can obtain a more accurate heart rate value. The important thing is that it does not need to touch the human body and will not interfere with people's daily life. It provides a lot of convenience for modern medical treatment. In this paper, we describe an SVM-based algorithm to optimize the spectral peak tracking method and improve the generalization ability and robustness of non-contact heart rate measurements. The algorithm divides motion noise reduction in multi-channel IPPG signals into two parts. First, a principal component analysis method (PCA) is used to process the motion acceleration signal to obtain the motion noise-related reference signal, and then band-pass filter (BPF) is used to filter the motion noise. The compression and the row thinning characteristic of the spectrum matrix are combined to form a sparse signal reconstruction model, and the objective function of the model is optimized by a FAST-ICA method. Then the down-step work to remove the motion noise is completed by spectral subtraction. Finally, using SVM-based heart rate spectrum peak tracking method, it can detect the spectrum peak corresponding to the heart rate in the optimized IPPG signal. This paper tests the performance of the heart rate measurement algorithm based on SVM. The average absolute error (Error1) of the algorithm on 15 sets of data is 1.20 beats/min, the correlation coefficient is 0.9637. In addition, the heart rate measurement of the SVM algorithm based on SVM describe in this paper is compared with several well-known algorithms. From the results, we can observe that the SVM algorithm is consistent and provides an accurate real heart rate estimate on most datasets. Hence, the proposed algorithm effectively removes motion noise in multi-channel IPPG signals and achieves accurate measurements of the heart rate. Meanwhile, because less manual adjustment parameters are involved in the heart rate spectral peak tracking stage, and the SVM classifier is used, compared with the traditional IPPG, the SVM-based algorithm proposed in this paper is more robust and adaptable to the environment, and has higher accuracy.