Table of Contents Author Guidelines Submit a Manuscript
Journal of Sensors
Volume 2017, Article ID 1260734, 8 pages
Research Article

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

1School of Computer and Communication Engineering, University of Science and Technology, Beijing, China
2Beijing Key Laboratory of Knowledge Engineering for Materials Science, Beijing, China

Correspondence should be addressed to Jie He; nc.ude.btsu@eijeh

Received 21 July 2017; Accepted 2 October 2017; Published 6 November 2017

Academic Editor: Mucheol Kim

Copyright © 2017 Cheng Xu et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.


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.

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.) [68]. 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 [510], template matching is a high effective recognition method with both high recognition accuracy and efficiency, which has been applied to physical activity [1113]. 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 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.

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 Figure 1. Define sequence as template signal and as recorded signal, whose lengths are, respectively, and ; namely,

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

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 ) 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 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, denote and as two temporal sequences. Thus, the distance   () could be calculated from vectors and . For the ith sample, the regularized Euclidean distance could be represented as

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 sequences and , a matrix is needed, while element represents the DTW distance (generally 1st normal form ) 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:

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 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, and are, respectively, the starting point of the two subbands. Assume that the displacement from to is and the width of inclined region is . Thus, for a matrix, the number of its contained regions is .

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: () the points contained in subpath; namely, the length of subpath is smaller than ; () 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:

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 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 , it illustrates that and have the same shape but opposite phase. If , it illustrates that and have no similarities. If , 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.

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 , and the query subsequence is denoted as . stands for the subsequence from time to time in sequence . The framework of the whole system is presented in Figure 2.

Figure 2: System framework diagram.
3.1. Template Generation

The template sequence is , and its length is the predefined window length. The sequence contains several sensor data subsequences, such as accelerometer data , , . The sample data contains lots of labeled FOG and non-FOG data. Divide these data into subsequences with length of , 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.
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, and . denotes the minimum DTW value of sequence and subsequence . denotes the start time of sequence , namely, . could be obtained by following methods:where and . Similarly, could be obtained by following methods: where .

IsDTW is targeted for searching all possible subsequences that the similarity satisfies the given threshold between sequence and template , namely , where and . The whole algorithm could be described as shown in Algorithm 1.

Algorithm 1

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 years and disease duration is 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.

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.

Figure 4: A typical pair of sequences for DTW comparison.
4.2. Results Discussion

Figure 5 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, ) 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.

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.

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.

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 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.

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.

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.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Authors’ Contributions

Cheng Xu and Jie He are co-first authors and contributed equally to this work.


This work is supported by National Natural Science Foundation of China (NSFC), Projects no. 61671056, no. 61302065, no. 61304257, and no. 61402033, the National Key R&D Program of China, no. 2016YFC0901303, Beijing Natural Science Foundation, Project no. 4152036, and Tianjin Special Program for Science and Technology, no. 16ZXCXSF00150.


  1. N. E. Allen, A. K. Schwarzel, and C. G. Canning, “Recurrent falls in Parkinson's disease: a systematic review,” Parkinson’s Disease, vol. 2013, Article ID 906274, 16 pages, 2013. View at Publisher · View at Google Scholar · View at Scopus
  2. J. A. Obeso, C. W. Olanow, and J. G. Nutt, “Levodopa motor complications in Parkinson's disease,” Trends in Neurosciences, vol. 23, no. 10, pp. S2–S7, 2000. View at Publisher · View at Google Scholar · View at Scopus
  3. J. G. Nutt, B. R. Bloem, N. Giladi, M. Hallett, F. B. Horak, and A. Nieuwboer, “Freezing of gait: moving forward on a mysterious clinical phenomenon,” The Lancet Neurology, vol. 10, no. 8, pp. 734–744, 2011. View at Publisher · View at Google Scholar · View at Scopus
  4. F. C. F. Chang, D. S. Tsui, N. Mahant et al., “24h Levodopa-carbidopa intestinal gel may reduce falls and "unresponsive" freezing of gait in Parkinson's disease,” Parkinsonism & Related Disorders, vol. 21, no. 3, pp. 317–320, 2015. View at Publisher · View at Google Scholar · View at Scopus
  5. S. T. Moore, D. A. Yungher, T. R. Morris et al., “Autonomous identification of freezing of gait in Parkinson's disease from lower-body segmental accelerometry,” Journal of NeuroEngineering and Rehabilitation, vol. 10, no. 1, article 19, 2013. View at Publisher · View at Google Scholar · View at Scopus
  6. M. Plotnik, S. Shema, M. Dorfman et al., “A motor learning-based intervention to ameliorate freezing of gait in subjects with Parkinson's disease,” Journal of Neurology, vol. 261, no. 7, pp. 1329–1339, 2014. View at Publisher · View at Google Scholar · View at Scopus
  7. P. Arias and J. Cudeiro, “Effect of rhythmic auditory stimulation on gait in parkinsonian patients with and without freezing of Gait,” PLoS ONE, vol. 5, no. 3, Article ID e9675, 2010. View at Publisher · View at Google Scholar · View at Scopus
  8. P. Arias and J. Cudeiro, “Effects of rhythmic sensory stimulation (auditory, visual) on gait in Parkinson's disease patients,” Experimental Brain Research, vol. 186, no. 4, pp. 589–601, 2008. View at Publisher · View at Google Scholar · View at Scopus
  9. F. B. Horak and M. Mancini, “Objective biomarkers of balance and gait for Parkinson's disease using body-worn sensors,” Movement Disorders, vol. 28, no. 11, pp. 1544–1551, 2013. View at Publisher · View at Google Scholar · View at Scopus
  10. A. Muro-de-la-Herran, B. García-Zapirain, and A. Méndez-Zorrilla, “Gait analysis methods: an overview of wearable and non-wearable systems, highlighting clinical applications,” Sensors, vol. 14, no. 2, pp. 3362–3394, 2014. View at Publisher · View at Google Scholar · View at Scopus
  11. R. Muscillo, M. Schmid, S. Conforto, and T. DprimeAlessio, “Early recognition of upper limb motor tasks through accelerometers: Real-time implementation of a DTW-based algorithm,” Computers in Biology and Medicine, vol. 41, no. 3, pp. 164–172, 2011. View at Publisher · View at Google Scholar · View at Scopus
  12. C. Chen and H. Shen, “A feature evaluation method for template matching in daily activity recognition,” in Proceedings of the IEEE International Conference on Signal Processing, Communications and Computing, (ICSPCC '13), IEEE, China, August 2013. View at Publisher · View at Google Scholar · View at Scopus
  13. T. Stiefmeier, D. Roggen, and G. Tröster, “Fusion of string-matched templates for continuous activity recognition,” in Proceedings of the 11th IEEE International Symposium on Wearable Computers, ISWC 2007, pp. 41–44, usa, October 2007. View at Publisher · View at Google Scholar · View at Scopus
  14. M. Chlin, M. Plotnik, D. Roggen et al., “Wearable assistant for Parkinson's disease patients with the freezing of gait symptom,” IEEE Transactions on Information Technology in Biomedicine A Publication of the IEEE Engineering in Medicine Biology Society, vol. 14, no. 2, pp. 436–446, 2010. View at Google Scholar
  15. J. Margarito, R. Helaoui, A. M. Bianchi, F. Sartor, and A. G. Bonomi, “User-independent recognition of sports activities from a single wrist-worn accelerometer: a template matching based approach,” IEEE Transactions on Biomedical Engineering, vol. 63, no. 4, pp. 788–796, 2016. View at Publisher · View at Google Scholar
  16. Y. Sun, “Iterative relief for feature weighting: algorithms, theories, and applications,” IEEE Transactions on Pattern Analysis & Machine Intelligence, vol. 29, no. 6, pp. 1035–1051, 2007. View at Google Scholar
  17. I. H. Witten and E. Frank, Data Mining: Practical Machine Learning Tools and Techniques With Java Implementations, Morgan Kaufmann, Burlington, Mass, USA, 2002. View at Publisher · View at Google Scholar