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

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.


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][7][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][6][7][8][9][10], template matching is a high effective recognition method with both high recognition accuracy and efficiency, which has been applied to physical activity [11][12][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 stringmatching 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 Section 2. 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.

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.
(1) Each subsequence of the time series will be compared with the template .Distance based similarity between the template and the time series segment (denoted as dist(,   )) 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  whose dist(,   ) 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.

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 sequences  and , a  ×  matrix is needed, while element (, ) represents the DTW distance ‖(  ,   )‖ (generally 1st normal form ‖(  ,   )‖ 1 ) between   and   .Namely, each element in the matrix stands for the similarity between two points in  and , 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: Dist (,  − 1) . (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 matrix  into subbands and using traditional DTW to search the optimal path in subbands.Firstly, divide  into several inclined strip-like regions with the same width.Among the overlap, 1 and 2 are, respectively, the starting point of the two subbands.Assume that the displacement from 1 to 2 is  and the width of inclined region is 2 + 1.Thus, for a  ×  matrix, the number of its contained regions is ⌊( − 1)/ + ( − 1)/⌋.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 ; (2) the average of all points in the subpath; namely, the average of subpath is smaller than .Given a subpath with  points, whose length is  and its average is , working out the LCMA (length-constrained minimum average) is as follows:

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 sequences  and , whose length is, respectively,  and , its cross correlation function is defined as follows: 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: where   and   are, respectively, the standard deviation of  and  and the value of   () is between −1 and +1.If   () = −1, it illustrates that  and  have the same shape but opposite phase.If   () = 0, it illustrates that  and  have no similarities.If   () = −1, it illustrates that  and  are totally the same.When the signal is compared with itself, it is called self-correlation, defined as follows: This function is often used to identify periodic signals from white noise in order to recognize signal cycle and repetitive patterns.

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  = {(

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.

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.[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.67years.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."

Datasets. The method proposed in this paper is verified on open source dataset
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.
Figure 4 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.

Results
Discussion. Figure 5 shows the templatematching 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, ) 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.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 Figure 6, 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.

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:  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.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.
Taking 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 realtime 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.
Therefore, 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.

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

Figure 1 :
Figure 1: A typical pair of sequences for template matching.

Figure 4 :Figure 5 :
Figure 4: A typical pair of sequences for DTW comparison.

( 1 )
Each algorithm performs differently on various datasets.The best result was obtained when all data

Table 1 :
The list of selected features.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).