85:12·C.Wang et al. 3.5 15 Page turning -Tag 1 -Tag 2 e2.5 Tag 1 10 -Tag 2 Page turning Threshold 0.5 m产 MWNYDAA 0 0.5 1 1.52 2.5 3 0 0.5 1.522.5 3 Time (ms) ×104 Time (ms) ×104 (a)Raw phase sequences of two tags (b)KL divergence sequences of two tags Fig.9.Calculating KL divergence from the phase sequence. the raw phase sequence of the RF-signals,which reduces the ambient noises but keeps the signals caused by the respiration and heartbeat. Moreover,in COTS RFID system,the EPC Gen2 standard [32]adopts a framed slotted Aloha protocol to interrogate the tags in a random manner,which makes the uniform sampling over the tags impossible.To tackle this issue,assuming that the phase sequences change continuously,we use a cube spline interpolation method [13] to resample the phase sequence with uniform sampling rate.In particular,we resample the phase sequence with the sampling interval of 4 ms. Next,we demonstrate to segment the signal sequence for IBI estimation according to the activeness of the user. Since RF-ECG is designed to estimate the IBI in a relative stationary environment,we need to firstly remove the signal sequence with apparent fluctuations due to the larger activities,and then focus on the other stable signal for the IBI estimation.Toward this end,we design an adaptive scheme to calculate the activeness of the user based on the KL divergence [15].For the signal sequence,we use a sliding window to divide the sequence,and calculate the discrete probability distribution function(PDF)of the signal within the window.Then given the PDF of two consecutive windows P and Q,the KL divergence is defined as: Dk=∑PO P() “Q0 (14) where P(i)and O(i)is the probability value of index i. The KL divergence measures the information loss when the distribution O is used to approximate the distribution P.Thus,a large value of the KL divergence indicates a large activity of the user,which leads to large difference between distribution P and O.Figure 9 presents two KL divergence sequences calculated from two phase sequences: the signal of tag 1 contains an activity of page turning and the signal of tag 2 contains only small activities such as breathing.Based on the KL divergence,we can clearly detect the activity of page turning.which have larger KL divergence value compared with the empirical threshold. For the detected activities based on the KL divergence,we can classify them based on the activity duration into two kinds,i.e.,long activity (2s)and short activity (s 2s).For the long activity,we just skip the sequence, because these activities are related to the movement of the whole human body,and thus the signal sequence is too noisy for the fine-grained IBI estimation.In regard to the short activity,it is usually caused by the small actions,e.g.,page turning,scratching or shrugging.Since the human body almost stays at the same position,we can remove the sudden phase change due to the small actions and still leverage the scheme in Section 4.5 for the Proc.ACM Interact.Mob.Wearable Ubiquitous Technol,Vol.2,No.2,Article 85.Publication date:June 2018.85:12 • C. Wang et al. Time (ms) ×104 0 0.5 1 1.5 2 2.5 3 Phase (radian) 0 0.5 1 1.5 2 2.5 3 3.5 Tag 1 Tag 2 Page turning (a) Raw phase sequences of two tags Time (ms) ×104 0 0.5 1 1.5 2 2.5 3 KL divergence 0 5 10 15 Tag 1 Tag 2 Page turning Threshold (b) KL divergence sequences of two tags Fig. 9. Calculating KL divergence from the phase sequence. the raw phase sequence of the RF-signals, which reduces the ambient noises but keeps the signals caused by the respiration and heartbeat. Moreover, in COTS RFID system, the EPC Gen2 standard [32] adopts a framed slotted Aloha protocol to interrogate the tags in a random manner, which makes the uniform sampling over the tags impossible. To tackle this issue, assuming that the phase sequences change continuously, we use a cube spline interpolation method [13] to resample the phase sequence with uniform sampling rate. In particular, we resample the phase sequence with the sampling interval of 4 ms. Next, we demonstrate to segment the signal sequence for IBI estimation according to the activeness of the user. Since RF-ECG is designed to estimate the IBI in a relative stationary environment, we need to firstly remove the signal sequence with apparent fluctuations due to the larger activities, and then focus on the other stable signal for the IBI estimation. Toward this end, we design an adaptive scheme to calculate the activeness of the user based on the KL divergence [15]. For the signal sequence, we use a sliding window to divide the sequence, and calculate the discrete probability distribution function (PDF) of the signal within the window. Then given the PDF of two consecutive windows P and Q, the KL divergence is defined as: DK L = Õ i P(i) · ln P(i) Q(i) , (14) where P(i) and Q(i) is the probability value of index i. The KL divergence measures the information loss when the distributionQ is used to approximate the distribution P. Thus, a large value of the KL divergence indicates a large activity of the user, which leads to large difference between distribution P andQ. Figure 9 presents two KL divergence sequences calculated from two phase sequences: the signal of tag 1 contains an activity of page turning and the signal of tag 2 contains only small activities such as breathing. Based on the KL divergence, we can clearly detect the activity of page turning, which have larger KL divergence value compared with the empirical threshold. For the detected activities based on the KL divergence, we can classify them based on the activity duration into two kinds, i.e., long activity (> 2s) and short activity (≤ 2s). For the long activity, we just skip the sequence, because these activities are related to the movement of the whole human body, and thus the signal sequence is too noisy for the fine-grained IBI estimation. In regard to the short activity, it is usually caused by the small actions, e.g., page turning, scratching or shrugging. Since the human body almost stays at the same position, we can remove the sudden phase change due to the small actions and still leverage the scheme in Section 4.5 for the Proc. ACM Interact. Mob. Wearable Ubiquitous Technol., Vol. 2, No. 2, Article 85. Publication date: June 2018