# Detection of Freezing of Gait Using Template-Matching-Based Approaches

Authors: Cheng Xu; Jie He; Xiaotong Zhang; Cunda Wang; Shihong Duan
Journal: Journal of Sensors
 (2017)

---

## Abstract

Every year, injuries associated with fall incidences cause lots of human suffering and assets loss for Parkinson’s disease (PD) patients. Thereinto, freezing of gait (FOG), which is one of the most common symptoms of PD, is quite responsible for most incidents. Although lots of researches have been done on characterized analysis and detection methods of FOG, large room for improvement still exists in the high accuracy and high efficiency examination of FOG. In view of the above requirements, this paper presents a template-matching-based improved subsequence Dynamic Time Warping (IsDTW) method, and experimental tests were carried out on typical open source datasets. Results show that, compared with traditional template-matching and statistical learning methods, proposed IsDTW not only embodies higher experimental accuracy (92%) but also has a significant runtime efficiency. By contrast, IsDTW is far more available in real-time practice applications.


---

## Body

## 1. Introduction

Parkinson’s disease is a kind of common neurological disorder caused by dopamine and gradually loss of function of other subcortical neurons. PD usually causes the patients’ movement function disorder, starting from tremors of one side body or activity clumsy, and further involves the contralateral limb [1, 2]. Clinical manifestations of Parkinson’s disease are mainly for static tremor, bradykinesia, myotonia, and freezing of gait. Among them, FOG is a kind of typical symptom. The patient is not easily maintaining the balance of the body and is likely to fall on the road surface with even a bit uneven. Its typical symptoms are loss of ability to walk in a sudden feet stuckness on the ground and disability to move in a few minutes or being no longer able to move again. FOG seems to be common in the start period of walking, turning, and moving close to the target or when one is worried whether he is able to get through the known obstacles, for example, getting through the revolving door. Every year, fall incidence rates range from 50% to 70%. It is one of the main reasons for disability to PD patients [1].Freezing of gait (FOG) is one of the cardinal symptoms of the PD which is defined as an inability of a person to move one’s feet in spite of the fact that he/she intends to move [3]. Existing methods for prevention and cure of FOG mainly rely on drugs, the most widely used of which is levodopa (LD) [4]. However, drug’s effect duration is generally 2–6 h, and different patients’ drug resistance is various to different kinds of drugs. These specificities may lead to large fluctuations, showing up as the patient suddenly cannot move or can suddenly move freely. These two appearances alternate in a few minutes, namely, “On-Off” phenomenon. Once “On-Off” appears, it is hardly to be cured [5].In addition, some nondrug therapy methods can also be used in the prevention and treatment of FOG. PD patients complete the corresponding action according to the instructions (like music rhythm, visual cues, etc.) [6–8]. These coordination practices are proved to be effective in keeping FOG from getting worse. Plotnik et al. [6] suggested that external tempo clues were of great help to increase walking speed significantly for PD patients. Compared with treatment methods relying on drugs, with the instruction of external information, PD patients could be prepared in advance and can respond to the possibility of FOG, as well as the happening of “On-Off” phenomenon.For both drug and nondrug therapy methods, the detection and forewarning of FOG are significantly important. Wearable sensors are widely used to realize the real-time detection and alarming of FOG for PD patients. Previous studies usually focus on the fusion of sensors like baroreceptor, IMU, and so on. They capture the sensor signals when PD patients in activity do deep analysis of the wavelets and give out alarms before FOG occurs. The research topics about forewarning of FOG based on wearable sensors mainly concentrate on the selection of sensors [5], locations [9], and high effective algorithms [10].Different from the traditional statistical methods [5–10], template matching is a high effective recognition method with both high recognition accuracy and efficiency, which has been applied to physical activity [11–13]. Muscillo et al. [11] proposed user-dependent templates to target recognition of arm-specific tasks. Likewise, Chen and Shen [12] focused on recognizing activities performed with the right upper limb using a classification framework based on template matching. Stiefmeier et al. [13] proposed an innovative approach consisting of encoding motion data into sequence of finite symbols and performing activity recognition by using string-matching algorithms. However, to the best of our known, no effort has been paid in the real-time detection of FOG.To summarize, traditional statistical methods for FOG detection have low accuracy and efficiency, and it can hardly meet the requirements for practice real-time applications. Template-matching method is of high performance advantages; however, it is seldom used in FOG detection. The purpose of this paper was to investigate the use of template matching for the detection of FOG.The rest of this paper is organized as follows: typical template-matching methods are introduced in Section2. In Section 3, the framework of our system is presented and an improved sDTW algorithm (IsDTW) is illustrated. The proposed algorithm is verified on an open dataset and results are analyzed in Section 4. Proposed IsDTW algorithm is compared with both traditional template methods and statistical methods in recognition accuracy and real-time performance. The conclusions of our work are given in Section 5.


## 2. Template-Matching Methods

Template-matching algorithm is an approach for comparing two-time sequences in terms of both their state and dynamics. Time series can be used to classify primitive physical activities from data provided by wearable sensors, such as accelerometers. Template matching is a high-level machine learning technique that identifies the parts on one sample that match a predefined template.


### 2.1. Problem Formulation

A typical pair of sequences for template matching is shown in Figure1. Define sequence X as template signal and Y as recorded signal, whose lengths are, respectively, n and m; namely, (1)X=t1,x1,t2,x2,…,ti,xi,…,tn,xn,Y=t1,y1,t2,y2,…,tj,yj,…,tm,ym.Figure 1
A typical pair of sequences for template matching.Each subsequence of the time series will be compared with the templateX. Distance based similarity between the template and the time series segment (denoted as dist(X,Yij)) is computed. Finally, we will identify the best similarity measures by the distance as the probable template occurrences. The smaller the distance is, the more similar they are. We are intending to find the optimal subsequence in Y whose dist(X,Yij) value is smaller than given threshold.Distance based similarity measurement method could be various, and we will introduce some of the most widely used methods.


### 2.2. Typical Template-Matching Methods

#### 2.2.1. Euclidean Distance

Euclidean metric, namely, Euclidean distance, is a common adopted definition of distance. It refers to the actual distance between two points in multidimensional space or the natural length of vector (namely, the distance between this point and the origin point). Respectively, denoteX=[x1,x2,…,xi,…,xm] and Y=[y1,y2,…,yi,…,yn] as two temporal sequences. Thus, the distance di  (i=0,…,n-m-1,n<m) could be calculated from vectors X and Y. For theith sample, the regularized Euclidean distance could be represented as(2)di=∑k=1mYi+k-Xk2.


#### 2.2.2. Dynamic Time Wrapping (DTW)

DTW could be used to measure the similarity or distance of these two sequences. The core of DTW is based on the idea of dynamic programming (DP), automatically searching for the optimal path with local optimization method. Taking the minimum accumulation of distortion between two vectors as the objective could avoid errors caused by different time length.In order to align the sequencesX and Y, a n×m matrix is needed, while element (i,j) represents the DTW distance d(xi,yj) (generally 1st normal form d(xi,yj)1) between xi and yj. Namely, each element in the matrix stands for the similarity between two points in X and Y, and the smaller the distance is, the greater the similarity is. DP is applied to find optimal path crossing a number of grids in the matrix and calculation is conducted among the points crossed by the path.The paths that satisfy all above conditions could be as many as exponential, but the minimum cost path is the one we are interested in. Thus, the following equation could be achieved:(3)DistX,Y=dxi,yj+min⁡Disti-1,j-1Disti-1,jDisti,j-1.


#### 2.2.3. Subsequence Dynamic Time Wrapping (sDTW)

sDTW is designed for searching repeated “child segments” from a long sequence. The core idea of sDTW is dividing distance matrixD into subbands and using traditional DTW to search the optimal path in subbands. Firstly, divide D into several inclined strip-like regions with the same width. Among the overlap, s1 and s2 are, respectively, the starting point of the two subbands. Assume that the displacement from s1 to s2 is R and the width of inclined region is 2R+1. Thus, for a m×n matrix, the number of its contained regions is (n-1)/R+(m-1)/R.Afterwards, find the optimal path in each strip-like region using DTW. In each optimal path, only a small segment is corresponding to the similar parts of these two consecutive sequences. So we need to cut out the specific subpaths, which should meet these requirements: (1) the points contained in subpath; namely, the length of subpath is smaller than L; (2) the average of all points in the subpath; namely, the average of subpath is smaller than θ. Given a subpath with N points, whose length is L and its average is θ, working out the LCMA (length-constrained minimum average) is as follows: (4)f=min1≤s≤t≤N⁡1t-s+1∑k=stDistik,jk,t-s+1≥L.


#### 2.2.4. Cross Correlation

In signal processing, it is often to study the similarity of two signals, in order to implement signal detection, recognition, and extraction. The method that could be used to analyze the similarity of signals is called cross correlation. Given two temporal sequencesX and Y, whose length is, respectively, n and m, its cross correlation function is defined as follows: (5)CYXτ=1n-1∑i=0n-1Yi+τXi.Generally speaking, cross correlation index could be used to normalize the standard deviation of two signals, and the cross correlation coefficient is defined as follows:(6)γYXτ=CYXτσYYσXX,where σXX and σYY are, respectively, the standard deviation of X and Y and the value of γYX(τ) is between −1 and +1. If γYX(τ)=-1, it illustrates that X and Y have the same shape but opposite phase. If γYX(τ)=0, it illustrates that X and Y have no similarities. If γYX(τ)=-1, it illustrates that X and Y are totally the same. When the signal is compared with itself, it is called self-correlation, defined as follows: (7)R^YYτ=1m-1∑i=0m-τ-1Yi+τYi.This function is often used to identify periodic signals from white noise in order to recognize signal cycle and repetitive patterns.


## 2.1. Problem Formulation

A typical pair of sequences for template matching is shown in Figure1. Define sequence X as template signal and Y as recorded signal, whose lengths are, respectively, n and m; namely, (1)X=t1,x1,t2,x2,…,ti,xi,…,tn,xn,Y=t1,y1,t2,y2,…,tj,yj,…,tm,ym.Figure 1
A typical pair of sequences for template matching.Each subsequence of the time series will be compared with the templateX. Distance based similarity between the template and the time series segment (denoted as dist(X,Yij)) is computed. Finally, we will identify the best similarity measures by the distance as the probable template occurrences. The smaller the distance is, the more similar they are. We are intending to find the optimal subsequence in Y whose dist(X,Yij) value is smaller than given threshold.Distance based similarity measurement method could be various, and we will introduce some of the most widely used methods.


## 2.2. Typical Template-Matching Methods

### 2.2.1. Euclidean Distance

Euclidean metric, namely, Euclidean distance, is a common adopted definition of distance. It refers to the actual distance between two points in multidimensional space or the natural length of vector (namely, the distance between this point and the origin point). Respectively, denoteX=[x1,x2,…,xi,…,xm] and Y=[y1,y2,…,yi,…,yn] as two temporal sequences. Thus, the distance di  (i=0,…,n-m-1,n<m) could be calculated from vectors X and Y. For theith sample, the regularized Euclidean distance could be represented as(2)di=∑k=1mYi+k-Xk2.


### 2.2.2. Dynamic Time Wrapping (DTW)

DTW could be used to measure the similarity or distance of these two sequences. The core of DTW is based on the idea of dynamic programming (DP), automatically searching for the optimal path with local optimization method. Taking the minimum accumulation of distortion between two vectors as the objective could avoid errors caused by different time length.In order to align the sequencesX and Y, a n×m matrix is needed, while element (i,j) represents the DTW distance d(xi,yj) (generally 1st normal form d(xi,yj)1) between xi and yj. Namely, each element in the matrix stands for the similarity between two points in X and Y, and the smaller the distance is, the greater the similarity is. DP is applied to find optimal path crossing a number of grids in the matrix and calculation is conducted among the points crossed by the path.The paths that satisfy all above conditions could be as many as exponential, but the minimum cost path is the one we are interested in. Thus, the following equation could be achieved:(3)DistX,Y=dxi,yj+min⁡Disti-1,j-1Disti-1,jDisti,j-1.


### 2.2.3. Subsequence Dynamic Time Wrapping (sDTW)

sDTW is designed for searching repeated “child segments” from a long sequence. The core idea of sDTW is dividing distance matrixD into subbands and using traditional DTW to search the optimal path in subbands. Firstly, divide D into several inclined strip-like regions with the same width. Among the overlap, s1 and s2 are, respectively, the starting point of the two subbands. Assume that the displacement from s1 to s2 is R and the width of inclined region is 2R+1. Thus, for a m×n matrix, the number of its contained regions is (n-1)/R+(m-1)/R.Afterwards, find the optimal path in each strip-like region using DTW. In each optimal path, only a small segment is corresponding to the similar parts of these two consecutive sequences. So we need to cut out the specific subpaths, which should meet these requirements: (1) the points contained in subpath; namely, the length of subpath is smaller than L; (2) the average of all points in the subpath; namely, the average of subpath is smaller than θ. Given a subpath with N points, whose length is L and its average is θ, working out the LCMA (length-constrained minimum average) is as follows: (4)f=min1≤s≤t≤N⁡1t-s+1∑k=stDistik,jk,t-s+1≥L.


### 2.2.4. Cross Correlation

In signal processing, it is often to study the similarity of two signals, in order to implement signal detection, recognition, and extraction. The method that could be used to analyze the similarity of signals is called cross correlation. Given two temporal sequencesX and Y, whose length is, respectively, n and m, its cross correlation function is defined as follows: (5)CYXτ=1n-1∑i=0n-1Yi+τXi.Generally speaking, cross correlation index could be used to normalize the standard deviation of two signals, and the cross correlation coefficient is defined as follows:(6)γYXτ=CYXτσYYσXX,where σXX and σYY are, respectively, the standard deviation of X and Y and the value of γYX(τ) is between −1 and +1. If γYX(τ)=-1, it illustrates that X and Y have the same shape but opposite phase. If γYX(τ)=0, it illustrates that X and Y have no similarities. If γYX(τ)=-1, it illustrates that X and Y are totally the same. When the signal is compared with itself, it is called self-correlation, defined as follows: (7)R^YYτ=1m-1∑i=0m-τ-1Yi+τYi.This function is often used to identify periodic signals from white noise in order to recognize signal cycle and repetitive patterns.


## 2.2.1. Euclidean Distance

Euclidean metric, namely, Euclidean distance, is a common adopted definition of distance. It refers to the actual distance between two points in multidimensional space or the natural length of vector (namely, the distance between this point and the origin point). Respectively, denoteX=[x1,x2,…,xi,…,xm] and Y=[y1,y2,…,yi,…,yn] as two temporal sequences. Thus, the distance di  (i=0,…,n-m-1,n<m) could be calculated from vectors X and Y. For theith sample, the regularized Euclidean distance could be represented as(2)di=∑k=1mYi+k-Xk2.


## 2.2.2. Dynamic Time Wrapping (DTW)

DTW could be used to measure the similarity or distance of these two sequences. The core of DTW is based on the idea of dynamic programming (DP), automatically searching for the optimal path with local optimization method. Taking the minimum accumulation of distortion between two vectors as the objective could avoid errors caused by different time length.In order to align the sequencesX and Y, a n×m matrix is needed, while element (i,j) represents the DTW distance d(xi,yj) (generally 1st normal form d(xi,yj)1) between xi and yj. Namely, each element in the matrix stands for the similarity between two points in X and Y, and the smaller the distance is, the greater the similarity is. DP is applied to find optimal path crossing a number of grids in the matrix and calculation is conducted among the points crossed by the path.The paths that satisfy all above conditions could be as many as exponential, but the minimum cost path is the one we are interested in. Thus, the following equation could be achieved:(3)DistX,Y=dxi,yj+min⁡Disti-1,j-1Disti-1,jDisti,j-1.


## 2.2.3. Subsequence Dynamic Time Wrapping (sDTW)

sDTW is designed for searching repeated “child segments” from a long sequence. The core idea of sDTW is dividing distance matrixD into subbands and using traditional DTW to search the optimal path in subbands. Firstly, divide D into several inclined strip-like regions with the same width. Among the overlap, s1 and s2 are, respectively, the starting point of the two subbands. Assume that the displacement from s1 to s2 is R and the width of inclined region is 2R+1. Thus, for a m×n matrix, the number of its contained regions is (n-1)/R+(m-1)/R.Afterwards, find the optimal path in each strip-like region using DTW. In each optimal path, only a small segment is corresponding to the similar parts of these two consecutive sequences. So we need to cut out the specific subpaths, which should meet these requirements: (1) the points contained in subpath; namely, the length of subpath is smaller than L; (2) the average of all points in the subpath; namely, the average of subpath is smaller than θ. Given a subpath with N points, whose length is L and its average is θ, working out the LCMA (length-constrained minimum average) is as follows: (4)f=min1≤s≤t≤N⁡1t-s+1∑k=stDistik,jk,t-s+1≥L.


## 2.2.4. Cross Correlation

In signal processing, it is often to study the similarity of two signals, in order to implement signal detection, recognition, and extraction. The method that could be used to analyze the similarity of signals is called cross correlation. Given two temporal sequencesX and Y, whose length is, respectively, n and m, its cross correlation function is defined as follows: (5)CYXτ=1n-1∑i=0n-1Yi+τXi.Generally speaking, cross correlation index could be used to normalize the standard deviation of two signals, and the cross correlation coefficient is defined as follows:(6)γYXτ=CYXτσYYσXX,where σXX and σYY are, respectively, the standard deviation of X and Y and the value of γYX(τ) is between −1 and +1. If γYX(τ)=-1, it illustrates that X and Y have the same shape but opposite phase. If γYX(τ)=0, it illustrates that X and Y have no similarities. If γYX(τ)=-1, it illustrates that X and Y are totally the same. When the signal is compared with itself, it is called self-correlation, defined as follows: (7)R^YYτ=1m-1∑i=0m-τ-1Yi+τYi.This function is often used to identify periodic signals from white noise in order to recognize signal cycle and repetitive patterns.


## 3. System Overview and Algorithm Design

Former researchers have studied the detection method for FOG with time and frequency domain features extracted by FFT [9]. These studies have already achieved a good accuracy but poor real-time characteristic. In this chapter, based on the point of template matching, we proposed an improved subsequence Dynamic Time Wrapping (IsDTW) method, to realize the real-time and high precision FOG detection and alarm. IsDTW gives out a good real-time performance as well as high accuracy.The whole process could be divided into two stages:(1)
Data preprocessing: the main work is template generating and threshold confirmation, namely, model training stage.(2)
Subsequence searching: estimate the similarity using proposed algorithm, and detect FOG.Notations. The original signal is denoted as X=t1,x1,t2,x2,…,ti,xi,…,tn,xn, and the query subsequence is denoted as Y={(t1,y1),(t2,y2),…,(tj,yj),…,(tm,ym)}. Xi,j stands for the subsequence from time i to time j in sequence X. The framework of the whole system is presented in Figure 2.Figure 2
System framework diagram.


### 3.1. Template Generation

The template sequence isY=t1,y1,t2,y2,…,tj,yj,…,tm,ym, and its length m is the predefined window length. The sequence contains several sensor data subsequences, such as accelerometer data Ax, Ay, Az. The sample data contains lots of labeled FOG and non-FOG data. Divide these data into subsequences with length of m, and average them with method of “interp1” integrated in Matlab. Apply this operation to each axis of the subsequences, and finally the template of FOG is achieved, as shown in Figure 3.Figure 3
Gait template: (a) regular gaits; (b) FOG template.
(a)
(b)


### 3.2. Threshold Confirmation

The most urgent issue to be solved in proposed algorithm is how to determine the threshold value of loss of function. In common sense, due to the differences of various subjects and noise, the expected threshold value could vary from person to person. For the above reasons, in this paper, we proposed a dynamic threshold estimation method based on former statistical model. In data preprocessing stage, we construct an Artificial Neural Network (ANN) classifier to obtain the optimal threshold valueε, which is suitable for each subject, using labeled training data. This method depends on machine learning technique, running on a large amount of actual data, which makes it have higher running speed and credibility.


### 3.3. Similarity Computation: Improved Subsequence DTW: IsDTW

Similar to DTW, we proposed this improved sDTW method to compute the similarity of two sequences by updating distance matrix. In each loop of the algorithm processing, two variables are stored,D(t,k) and X(t,k). D(t,k) denotes the minimum DTW value of sequence Y and subsequence Si,t. X(t,k) denotes the start time of sequence Xi,t, namely, i=X(t,k). D(t,k) could be obtained by following methods:(8)Dt,k=xt-yk+Dbest,Dbest=min⁡Distt,k-1Distt-1,kDistt-1,k-1,where D(t,0)=0 and D(0,0)=D(0,k)=+∞(t=1,2,…,nandk=1,2,…,m). Similarly, X(t,k) could be obtained by following methods: (9)Xt,k=Xt,k-1,IfDbest=Dt,k-1Xt-1,k,IfDbest=Dt-1,kXt-1,k-1,IfDbest=Dt-1,k-1,where X(t,0)=t.IsDTW is targeted for searching all possible subsequencesXi,j that the similarity satisfies the given threshold ε between sequence X and template Y, namely Dist(Xi,j,Y)≤ε, where j=i+m-1 and i=1,2,…,n-m+1. The whole algorithm could be described as shown in Algorithm 1.Algorithm 1
Input: xt at time t
Output: similar subsequences: Si,t
For
k
=
1 to mdo
Calculate D(t,k) and X(t,k)
End
IF
D
m
i
n
≤
ε
then
IF
∀
D
(
t
,
k
)
>
D
m
i
n
∨
X
(
t
,
k
)
>
t
e
then
Return Dmin,ts,te
D
m
i
n
=
+
∞
For
k
=
1 to mdo
IF
X
(
t
,
k
)
≤
t
e
then
D
(
t
,
k
)
=
+
∞
End
End
End
End
If
D
(
t
,
m
)
≤
ε
∧
D
(
t
,
m
)
≤
D
m
i
n
then
D
m
i
n
=
D
(
t
,
m
)
t
s
=
X
(
t
,
m
)
t
e
=
t
End
For
k
=
0 to mdo
D
(
t
-
1
,
k
)
=
D
(
t
,
k
)
X
(
t
-
1
,
k
)
=
D
(
t
,
k
)
End


## 3.1. Template Generation

The template sequence isY=t1,y1,t2,y2,…,tj,yj,…,tm,ym, and its length m is the predefined window length. The sequence contains several sensor data subsequences, such as accelerometer data Ax, Ay, Az. The sample data contains lots of labeled FOG and non-FOG data. Divide these data into subsequences with length of m, and average them with method of “interp1” integrated in Matlab. Apply this operation to each axis of the subsequences, and finally the template of FOG is achieved, as shown in Figure 3.Figure 3
Gait template: (a) regular gaits; (b) FOG template.
(a)
(b)


## 3.2. Threshold Confirmation

The most urgent issue to be solved in proposed algorithm is how to determine the threshold value of loss of function. In common sense, due to the differences of various subjects and noise, the expected threshold value could vary from person to person. For the above reasons, in this paper, we proposed a dynamic threshold estimation method based on former statistical model. In data preprocessing stage, we construct an Artificial Neural Network (ANN) classifier to obtain the optimal threshold valueε, which is suitable for each subject, using labeled training data. This method depends on machine learning technique, running on a large amount of actual data, which makes it have higher running speed and credibility.


## 3.3. Similarity Computation: Improved Subsequence DTW: IsDTW

Similar to DTW, we proposed this improved sDTW method to compute the similarity of two sequences by updating distance matrix. In each loop of the algorithm processing, two variables are stored,D(t,k) and X(t,k). D(t,k) denotes the minimum DTW value of sequence Y and subsequence Si,t. X(t,k) denotes the start time of sequence Xi,t, namely, i=X(t,k). D(t,k) could be obtained by following methods:(8)Dt,k=xt-yk+Dbest,Dbest=min⁡Distt,k-1Distt-1,kDistt-1,k-1,where D(t,0)=0 and D(0,0)=D(0,k)=+∞(t=1,2,…,nandk=1,2,…,m). Similarly, X(t,k) could be obtained by following methods: (9)Xt,k=Xt,k-1,IfDbest=Dt,k-1Xt-1,k,IfDbest=Dt-1,kXt-1,k-1,IfDbest=Dt-1,k-1,where X(t,0)=t.IsDTW is targeted for searching all possible subsequencesXi,j that the similarity satisfies the given threshold ε between sequence X and template Y, namely Dist(Xi,j,Y)≤ε, where j=i+m-1 and i=1,2,…,n-m+1. The whole algorithm could be described as shown in Algorithm 1.Algorithm 1
Input: xt at time t
Output: similar subsequences: Si,t
For
k
=
1 to mdo
Calculate D(t,k) and X(t,k)
End
IF
D
m
i
n
≤
ε
then
IF
∀
D
(
t
,
k
)
>
D
m
i
n
∨
X
(
t
,
k
)
>
t
e
then
Return Dmin,ts,te
D
m
i
n
=
+
∞
For
k
=
1 to mdo
IF
X
(
t
,
k
)
≤
t
e
then
D
(
t
,
k
)
=
+
∞
End
End
End
End
If
D
(
t
,
m
)
≤
ε
∧
D
(
t
,
m
)
≤
D
m
i
n
then
D
m
i
n
=
D
(
t
,
m
)
t
s
=
X
(
t
,
m
)
t
e
=
t
End
For
k
=
0 to mdo
D
(
t
-
1
,
k
)
=
D
(
t
,
k
)
X
(
t
-
1
,
k
)
=
D
(
t
,
k
)
End


## 4. Results and Analysis

This section may be divided by subheadings. It should provide a concise and precise description of the experimental results and their interpretation as well as the experimental conclusions that can be drawn.


### 4.1. Datasets

The method proposed in this paper is verified on open source dataset [14]. Bachlin et al. recruited 10 PD patients as experimental subject, among which there are 7 male and 3 female, whose ages are 66.5±4.8 years and disease duration is 13.7±9.67 years. All subjects are with the history of FOG and could walk freely in the condition of “off-medicine” without external assistance. All data is collected and analyzed in the condition of “off-medicine.”Subjects are required to complete the data collecting under the following experimental scenarios: walking forward and backward in a straight line, randomly walking and stopping, rotating 360 degrees, and daily life activities. The entire experimental processes are recorded by video camera. Two medical personnel diagnose the two possible conditions, FOG and non-FOG, from the real-time video information. Every time FOG occurs, record the starting and ending time. Each subject is mounted with three triaxial accelerometers, respectively, placed on shank, thigh, and lower back. The sampling rate is set as 64 Hz. Eventually, sampled from 10 PD subjects, 8 hours and 20 minutes data are collected, which contains 237 events of FOG.Figure4 shows one patient’s actual recorded data during the experimental process. The subject ran into FOG condition exactly at the very beginning of the whole process and then continued walking normally after a short break; then, sensors detect trembling caused by FOG, and the legs got stuck; after a long time of FOG phenomenon, the subject came into a very fast march; finally, the subject rested down after a short FOG. The experimental results are matched with those given by the two medical personnel, which are marked in the figure with color fonts. Moreover, as shown in the figure, in the first and third FOG segments, short FOG stuckness is recognized rightly other than mistaken for rest; in the second FOG segment, the leg trembling caused by FOG is also recognized. These two points further verify the effectiveness of the proposed algorithm.Figure 4
A typical pair of sequences for DTW comparison.


### 4.2. Results Discussion

Figure5 shows the template-matching results with using IsDTW to detect FOG and regular gaits. It could be clearly seen that when FOG template compares with pathological data, shown in Figure 5(a), the DTW path tends to be more straight and the cumulative distance (namely, D) is smaller. It indicates that the compared two subsequences have higher similarity, and in other words, the detection result is FOG. When FOG template compares with disease-free data, shown in Figure 5(b), the DTW path is more winding and the cumulative distance is bigger, and the detection result is non-FOG.Figure 5
IsDTW matching diagram: (a) with FOG; (b) with regular gaits.
(a)
(b)The effect of FOG detection and sensor locations has been analyzed separately by ROC curve as follows. IsDTW is applied to the dataset and ROC curves of each subset are drawn in Figure6, namely, lower back mounted sensor (blue curve), thigh mounted sensor (brown curve), shank mounted sensor (red curve), and all three sensors (green curve). Since the detection method has a better performance when the ROC curve is closer to upper left corner, we conclude from visual inspection that it is with better performance when all sensor data is used. When only shank data is adopted, the result shows less better performance. This may be because the shank part can more reflect the characteristics of FOG.Figure 6
ROC diagram.


### 4.3. Compared with Template-Matching Methods

In this paper, several template-matching methods are selected to do FOG detection on open source dataset [14]. Various experimental results are achieved, as shown in Figure 7. The overall dataset contains sensor data collected from three accelerometers, shank, thigh, and lower back. Experiments are conducted with the whole dataset and each part of it, respectively. In different scenarios, our proposed IsDTW algorithm all outperformed the others. Following conclusions could be achieved:(1)
Each algorithm performs differently on various datasets. The best result was obtained when all data is utilized, while the second best is with only shank data. Thus, it can be seen that shank responses to the FOG phenomenon for maximum efficiency, and the other parts play a supporting roles.(2)
On different datasets, the proposed IsDTW algorithm all achieved the best result, which can to some extent reflects the stability of the algorithm. Meanwhile, the best result could be as high as 92%. Compared with the others, IsDTW keeps updating the minimum distance path and maintain a high efficiency as well as high accuracy. Besides, using ANN to update the dynamic threshold, it improves the migration ability of the algorithm.(3)
Generally, DTW related algorithms work better than Euclidean and cross correlation, which indicates that DTW has more advantages for the identification of sequences with variable length.Figure 7
Results comparison of IsDTW on different datasets.


### 4.4. Compared with Statistical Methods

For further verification of proposed IsDTW, comparison experiments are carried out between template-matching FOG detection methods and traditional statistical classification methods, including Decision Tree (DT), Naïve Bayesian Network (NBN), and Artificial Neural Network (ANN). According to [15], 13 common used time-domain and frequency domain features are selected, and 9 of them are chosen to be applied to classification with Relief method [16]. The chosen features are listed in Table 1.Table 1
The list of selected features.
Features
Domain
Mean
Time
Variance
Time
Root mean square
Time
Range (maximum–minimum)
Time
Total energy
Time
Skewness
Time
Main frequency
Frequency
Entropy
Frequency
Quartile
FrequencyTaking advantage of the open source tool Weka [17], comparison experiments are all performed and compared with proposed template-matching method. Results are shown in Table 2. It can be seen that IsDTW has significant advantages in classification accuracy, namely, IsDTW > ANN > NBN > DT. ANN stands out among statistical methods with an accuracy 0.88 but is still lower than that of IsDTW. In the meantime, its runtime efficiency performs lower than that of IsDTW which can hardly meet the requirements of real-time in practice applications. As DT is a kind of lightweight algorithm with simple principle, it has high efficiency but its accuracy may not meet the real-time needs.Table 2
Performance comparison of IsDTW with statistical machine learning methods.
Methods
DT
NBN
ANN
IsDTW
Accuracy
0.77
0.81
0.88
0.92
Runtime (s)
0.55
1.26
3.52
0.64Therefore, the IsDTW method proposed in this paper has the advantages of both high precision and real-time capability, and it may meet the demands of practical application.


## 4.1. Datasets

The method proposed in this paper is verified on open source dataset [14]. Bachlin et al. recruited 10 PD patients as experimental subject, among which there are 7 male and 3 female, whose ages are 66.5±4.8 years and disease duration is 13.7±9.67 years. All subjects are with the history of FOG and could walk freely in the condition of “off-medicine” without external assistance. All data is collected and analyzed in the condition of “off-medicine.”Subjects are required to complete the data collecting under the following experimental scenarios: walking forward and backward in a straight line, randomly walking and stopping, rotating 360 degrees, and daily life activities. The entire experimental processes are recorded by video camera. Two medical personnel diagnose the two possible conditions, FOG and non-FOG, from the real-time video information. Every time FOG occurs, record the starting and ending time. Each subject is mounted with three triaxial accelerometers, respectively, placed on shank, thigh, and lower back. The sampling rate is set as 64 Hz. Eventually, sampled from 10 PD subjects, 8 hours and 20 minutes data are collected, which contains 237 events of FOG.Figure4 shows one patient’s actual recorded data during the experimental process. The subject ran into FOG condition exactly at the very beginning of the whole process and then continued walking normally after a short break; then, sensors detect trembling caused by FOG, and the legs got stuck; after a long time of FOG phenomenon, the subject came into a very fast march; finally, the subject rested down after a short FOG. The experimental results are matched with those given by the two medical personnel, which are marked in the figure with color fonts. Moreover, as shown in the figure, in the first and third FOG segments, short FOG stuckness is recognized rightly other than mistaken for rest; in the second FOG segment, the leg trembling caused by FOG is also recognized. These two points further verify the effectiveness of the proposed algorithm.Figure 4
A typical pair of sequences for DTW comparison.


## 4.2. Results Discussion

Figure5 shows the template-matching results with using IsDTW to detect FOG and regular gaits. It could be clearly seen that when FOG template compares with pathological data, shown in Figure 5(a), the DTW path tends to be more straight and the cumulative distance (namely, D) is smaller. It indicates that the compared two subsequences have higher similarity, and in other words, the detection result is FOG. When FOG template compares with disease-free data, shown in Figure 5(b), the DTW path is more winding and the cumulative distance is bigger, and the detection result is non-FOG.Figure 5
IsDTW matching diagram: (a) with FOG; (b) with regular gaits.
(a)
(b)The effect of FOG detection and sensor locations has been analyzed separately by ROC curve as follows. IsDTW is applied to the dataset and ROC curves of each subset are drawn in Figure6, namely, lower back mounted sensor (blue curve), thigh mounted sensor (brown curve), shank mounted sensor (red curve), and all three sensors (green curve). Since the detection method has a better performance when the ROC curve is closer to upper left corner, we conclude from visual inspection that it is with better performance when all sensor data is used. When only shank data is adopted, the result shows less better performance. This may be because the shank part can more reflect the characteristics of FOG.Figure 6
ROC diagram.


## 4.3. Compared with Template-Matching Methods

In this paper, several template-matching methods are selected to do FOG detection on open source dataset [14]. Various experimental results are achieved, as shown in Figure 7. The overall dataset contains sensor data collected from three accelerometers, shank, thigh, and lower back. Experiments are conducted with the whole dataset and each part of it, respectively. In different scenarios, our proposed IsDTW algorithm all outperformed the others. Following conclusions could be achieved:(1)
Each algorithm performs differently on various datasets. The best result was obtained when all data is utilized, while the second best is with only shank data. Thus, it can be seen that shank responses to the FOG phenomenon for maximum efficiency, and the other parts play a supporting roles.(2)
On different datasets, the proposed IsDTW algorithm all achieved the best result, which can to some extent reflects the stability of the algorithm. Meanwhile, the best result could be as high as 92%. Compared with the others, IsDTW keeps updating the minimum distance path and maintain a high efficiency as well as high accuracy. Besides, using ANN to update the dynamic threshold, it improves the migration ability of the algorithm.(3)
Generally, DTW related algorithms work better than Euclidean and cross correlation, which indicates that DTW has more advantages for the identification of sequences with variable length.Figure 7
Results comparison of IsDTW on different datasets.


## 4.4. Compared with Statistical Methods

For further verification of proposed IsDTW, comparison experiments are carried out between template-matching FOG detection methods and traditional statistical classification methods, including Decision Tree (DT), Naïve Bayesian Network (NBN), and Artificial Neural Network (ANN). According to [15], 13 common used time-domain and frequency domain features are selected, and 9 of them are chosen to be applied to classification with Relief method [16]. The chosen features are listed in Table 1.Table 1
The list of selected features.
Features
Domain
Mean
Time
Variance
Time
Root mean square
Time
Range (maximum–minimum)
Time
Total energy
Time
Skewness
Time
Main frequency
Frequency
Entropy
Frequency
Quartile
FrequencyTaking advantage of the open source tool Weka [17], comparison experiments are all performed and compared with proposed template-matching method. Results are shown in Table 2. It can be seen that IsDTW has significant advantages in classification accuracy, namely, IsDTW > ANN > NBN > DT. ANN stands out among statistical methods with an accuracy 0.88 but is still lower than that of IsDTW. In the meantime, its runtime efficiency performs lower than that of IsDTW which can hardly meet the requirements of real-time in practice applications. As DT is a kind of lightweight algorithm with simple principle, it has high efficiency but its accuracy may not meet the real-time needs.Table 2
Performance comparison of IsDTW with statistical machine learning methods.
Methods
DT
NBN
ANN
IsDTW
Accuracy
0.77
0.81
0.88
0.92
Runtime (s)
0.55
1.26
3.52
0.64Therefore, the IsDTW method proposed in this paper has the advantages of both high precision and real-time capability, and it may meet the demands of practical application.


## 5. Conclusions

In this paper, we discuss the detection of FOG with utilizing of template-matching methods. Contrast experiments are carried out on open source dataset OPPORTUNITY. Template-matching methods are compared with Euclidean, DTW, sDTW, and cross correlation. Experimental results show that template-matching methods have certain advantages, and our proposed IsDTW apparently has higher accuracy. For comparison, IsDTW is compared with nontemplate methods (statistical methods), and the results show that our algorithm has not only higher experimental accuracy but to a certain extent is better than traditional methods on runtime efficiency, making it more applicable in practice applications.



---

*Source: 1260734-2017-11-06.xml*