Journal of Applied Mathematics

Journal of Applied Mathematics / 2014 / Article
Special Issue

Applied Mathematics in Biomedical Sciences and Engineering 2014

View this Special Issue

Research Article | Open Access

Volume 2014 |Article ID 528071 | 7 pages | https://doi.org/10.1155/2014/528071

Enhanced Template Matching Using Dynamic Positional Warping for Identification of Specific Patterns in Electroencephalogram

Academic Editor: Kiwoon Kwon
Received25 Mar 2014
Accepted04 Apr 2014
Published27 Apr 2014

Abstract

Template matching is an approach for signal pattern recognition, often used for biomedical signals including electroencephalogram (EEG). Since EEG is often severely contaminated by various physiological or pathological artifacts, identification and rejection of these artifacts with improved template matching algorithms would enhance the overall quality of EEG signals. In this paper, we propose a novel approach to improve the accuracy of conventional template matching methods by adopting the dynamic positional warping (DPW) technique, developed recently for handwriting pattern analysis. To validate the feasibility and superiority of the proposed method, eye-blink artifacts in the EEG signals were detected, and the results were then compared to those from conventional methods. DPW was found to outperform the conventional methods in terms of artifact detection accuracy, demonstrating the power of DPW in identifying specific one-dimensional data patterns.

1. Introduction

Template matching has been one of the most popular approaches in pattern recognition over the past few decades [14]. This technique is designed to match parts of a signal (or image) to a predefined template signal (or image) in order to quantify similarity of shapes among test and template signals. Thanks to its applicability in detecting various kinds of patterns, successful applications in a variety of different research fields have been reported. Such fields include eye-region detection [5, 6], human authentication [7], stock change categorization [8], handwriting recognition [9], signature verification [10], and electroencephalogram (EEG) artifact detection [1113].

Pattern-detection studies on EEG signals have been conducted for the purpose of identifying pathologically driven EEG patterns or EEG artifacts [11, 12, 1416]. However, there is still a need for better identification of eye-blink and motion artifacts, so that they can be rejected nearly perfectly in hopes of obtaining more reliable EEG analyses results. Precise automatic identification of artifacts is of great necessity in applications requiring online EEG processing or long-term EEG monitoring. Aside from the need for better artifact detection, there is also a need for better detection of abnormal EEG patterns associated with various brain disorders in order to achieve improved diagnostic decisions or better lesion localization [17, 18].

Dynamic time warping (DTW), a technique for enhanced template matching, has been widely studied in speech recognition [19, 20] and is gradually being applied in other ways, such as shape-boundary matching [21], facial recognition [22], signature verification [23], and EEG pattern detection [12]. DTW is a method that has been applied to achieve more accurate quantification of differences between template and test-signal subpatterns, through optimal matching of corresponding points. Instead of assuming uniform distributions among corresponding points between template and test subpatterns, DTW finds the best corresponding points by warping the template pattern at the time axis. Recent studies have shown higher accuracies for template matching with DTW than for conventional template matching methods that assume uniform distributions among corresponding points [2426].

Dynamic positional warping (DPW) is a modification of DTW that was developed to improve accuracy in distance quantification [27]. It was originally developed for the accurate matching of contour data with two-dimensional shapes and frequently used for signature verification. By allowing for the signal to be warped on the ordinate axis in addition to the time axis, DPW can more accurately identify corresponding points than can conventional DTW.

The main goal of this study was to investigate whether DPW could be extended to one-dimensional pattern recognition problems. To approach this aim, we applied DPW for the detection of eye-blink artifact patterns in frontal EEG data acquired from 24 healthy subjects. The detection accuracy of DPW was then compared to those of the conventional template matching methods.

2. Materials and Methods

2.1. Experimental Data and Preprocessing

In this study, eye-blink artifacts in continuous EEG signals were selected as the target patterns to be detected. The reason for this is that, while eye-blink artifacts were regarded as representative artifacts contaminating EEG signals, it was difficult to accurately identify them due to high variability among events or individuals. EEG data were recorded from 24 healthy participants using a multichannel EEG recording system (ActiveTwo AD-box, BioSemi, The Netherlands) at a sampling rate of 2,048 Hz, while the participants performed spot-the-difference puzzles for 25 seconds. Two slightly different images were presented on the left and right halves of a display, and the participants were asked to find the differences between two images for 15 seconds. The task was repeated five times for each participant. A particular frontal channel Fp2 in the international 10–20 system was used for the eye-blink artifact detection. To verify eye-blink detection accuracy, it was necessary to use a ground-truth dataset indicating the presence of an eye-blink artifact. For this aim, time ranges of eye-blink artifacts were marked by two experienced researchers based on visual inspection of EEG data.

Before the primary analyses, EEG data were high-pass filtered with a 0.1 Hz cutoff frequency, downsampled to a 64 Hz sampling rate in order to reduce the computation cost, and median-filtered with a five-point width in order to smooth the data. The width of the median filter was determined empirically.

2.2. Procedure for Template Matching

In order to evaluate and compare different distance metrics, a typical template matching protocol was implemented. The template matching protocol was designed to be as simple as possible so as to exclude any potential influence from any confounding factors. Figure 1 illustrates the schematic diagram of our study protocol.

The core parts of this process include distance calculation between templates and test patterns (denoted by Step 1 in Figure 1) and an overall similarity decision based on a predetermined threshold (denoted by Step 3 in Figure 1). Both of these steps are common among studies using template matching approaches [11, 12, 28]. In the current study, test patterns were extracted from the continuous test EEG data using a fixed-size sliding window, and the distances between the template and test EEG signals were evaluated at every time point (the number of sliding windows was denoted by ). The size of the sliding window was set to be the same as the length of the template as this was an assumption indispensable for applying linear template matching such as correlation and root-mean-square error. The decision step was only applied for the local minima of the distance array, and equal widths were assumed for the detected pattern and template. When ranges of adjacent detected patterns overlapped with one another, the detected pattern ranges were merged into a single range in order to avoid duplicate detection.

Template signals were randomly selected by a computer as in [4], so as to eliminate any possible bias toward the use of a specific method. When used by experts, manual template selection has the potential for achievement of higher performance outcomes [11, 12] compared to random selection; however, manual selection processes are highly dependent on experts’ subjective decisions and can lead to biased results.

Approaches for better use of training data involve construction of a single template by averaging patterns in a single cluster or selection of best-fit templates for each cluster. Unfortunately, however, these methods do not generally show high performance when template widths and shapes have large variances. In this study, we adopted a normalization method [29], considering large variances of template widths and shapes due to random selection of templates. There are two advantages for normalization approach compared to the conventional approaches: effects of improper template selection can be minimized by distance-averaging; variations in template width and shape do not need to be considered. Normalized distance (denoted by ) between the th test pattern and templates can be calculated by where is distance between the th template and the th test pattern, is the number of templates, and is a normalization factor, given as

The test pattern is accepted if is a local minimum and if this local minimum is lower than a predefined threshold. This overall process was repeated 20 times in order to achieve an unbiased comparison.

2.3. Traditional Distance Metrics

Because it is generally assumed that target-pattern shapes are unchanging, Euclidean distance and correlation-coefficients have been most commonly used for template matching applications [4, 30]. Three traditional distance metrics are investigated in this study, which are root-mean-square error (RMSE) based on Euclidean distances (with linear matching), correlation coefficient, and Kurtosis. Kurtosis was considered in this study because it is widely used in biomedical data analysis [31, 32]. Between two signals and , with and as the respective signal lengths, distances for each metric are defined as follows.

Root-mean-square error:

Correlation:

Kurtosis: where and denote th data in signals and , respectively. Note that RMSE and correlation are calculable only for identical signal lengths. Thus, a common variable was used to represent the signal length in (3) and (4).

2.4. Dynamic Time Warping

In spite of various modifications of DTW in previous decades, original kernel models for calculating distance are still being widely used in many applications. In this study, we adopted a common implementation of DTW [19] and empirically determined parameters for slope constraints. The DTW distance between two signals is defined as where and are respective template and test pattern lengths, and is the distance between two subsignals and , defined as where = 0, and and are th slope constraints on pattern axes, which limit the number of skipping (jumping) data points. denotes the th pair of the slope constraints on template and test pattern axes and can be written as where is the maximum branch length of slope constraints. Note that the values at the starting points of the two patterns are adjusted to be overlapped.

2.5. Dynamic Positional Warping (DPW)

DPW was originally proposed for accurate quantification of differences between two-dimensional data such as an object’s contour or handwritten characters, by searching similar subsequences recursively [27]. When employed for one-dimensional data, the DPW distance between time series signals and can be written as follows: where most notations are the same as those used in the original DTW equations ((6) and (7)). In these equations, and represent preceding corresponding points that minimize . As shown in (9) and (10), the forms of the equations are the same as those of conventional DTW equations, except with regard to distance calculation between two points. Note that and are substituted for and , respectively, in (10).

Figure 2 compares the mechanisms of DPW and DTW in one-dimensional data-matching applications. When two signals are compared and points and are matched as a corresponding pair (Figure 2(a)), DTW shifts a subsequence that begins with on the time axis such that the shifted point is moved to the same time index as the subsequence starting with (Figure 2(b)). This process, denoted as time warping, allows for distance calculation between points and by placing them closely on time axis. In the case of DPW, upon matching and , the subsequence starting from is warped so that is overlapped onto . Please note this subsequence warping costs the distance (on the axis of ordinate) between the two points and , while the warping cost on the time axis is free (refer to [27] for more detailed description on the original DPW method).

3. Results and Discussion

Receiver operating characteristic (ROC) curves were used to compare pattern-detection performances among the various template matching approaches introduced in Section 2. To evaluate ROC curves, recall rates were evaluated with respect to fixed precision rates for each iteration of each participant. Then, for each precision rate, recall rates were averaged across all the iterations and participants. Figure 3 shows ROC curves illustrating detection accuracies for five different methods. DPW showed the highest accuracy among all methods investigated, with an accuracy of 82% for equal precision and recall rates. DPW accuracy was 10% higher than that for conventional DTW (where accuracy rating was 72%) and even higher than those for conventional distance metrics (RMSE: 49%, correlation: 34%, and Kurtosis: 11%). These results demonstrate that positional warping, as has been used for two-dimensional pattern recognition problems, might be also effective in one-dimensional pattern recognition problems.

The extremely low accuracies of RMSE and correlation may be surprising, considering that both distance metrics are so commonly used for template matching applications. The poor performances found for both metrics are thought to partly originate from high target-pattern shape variations. It is also possible that these poor performances were the result of the chosen task being more difficult than typical tasks. Since the templates in the current task were selected randomly from ground-truth datasets, there may have been many templates with irregular shapes. Despite these difficult conditions, the proposed DPW approach showed much higher detection accuracy than the DTW approach, suggesting that DPW might be used as a new and powerful method for extracting specific signal patterns for EEG applications.

Table 1 summarizes the best detection accuracies among 20 iterations, evaluated for each participant. Accuracy was calculated as the percentage of precision or recall for equal precision and recall values in ROC curves. When ROC curves were evaluated for each participant and best accuracies were selected among the 20 iteration results, the conventional methods based on correlation coefficients or RMSEs yielded better accuracies than the results shown in Figure 3. Nevertheless, DPW still outperformed the other metrics, ranking the highest for 22 of 24 participants. The averaged detection accuracy for DPW (96.10%) was 3.62% higher than that for DTW (92.38%).


Subject IDCorrelationRMSEKurtosisDTWDPW

186.96 61.32 22.86 94.97 98.55
284.25 90.67 39.46 97.60 98.28
349.19 60.83 15.98 77.42 85.27
469.02 84.38 15.77 93.65 95.41
549.28 73.69 18.45 83.50 92.39
626.67 84.44 13.33 90.00 91.55
780.72 92.80 30.95 94.64 98.66
888.19 92.86 48.00 98.01 100.00
962.96 98.77 31.34 98.77 99.38
1071.83 71.33 17.94 93.57 95.11
1140.00 86.67 20.71 91.55 100.00
1261.32 91.74 13.24 93.28 99.26
1357.48 41.88 15.10 79.21 96.56
1460.83 78.89 30.19 91.43 97.14
1563.89 76.07 15.01 94.36 98.65
1680.63 94.18 34.05 96.84 98.95
1760.87 54.01 22.79 84.28 80.82
1840.30 86.38 24.00 97.37 98.72
1965.01 72.08 18.37 89.81 94.95
2017.59 76.67 17.69 93.33 94.94
2179.20 91.67 22.13 92.51 97.94
2263.11 41.63 25.10 91.88 96.70
2365.55 90.23 23.08 100.00 98.08
2440.99 97.53 20.71 99.17 99.17

Average61.08 78.78 23.18 92.38 96.10

In addition, the influence of the number of templates on detection accuracy was investigated. The detection accuracy was evaluated by increasing the number of templates and then averaging across all iterations and participants (Table 2). The results show a weak influence of the number of templates on detection accuracy. Except for correlation, accuracy did not change significantly as the number of templates increased. Instead, the standard deviations of DTW and DPW decreased significantly, demonstrating the possibility for more stable pattern detection by the use of sufficient numbers of templates in DTW and DPW.


Number of templatesCorrelationRMSEKurtosisDTWDPW

1
2
3
4
5
6
7
8
9
10

4. Conclusion

In this paper, we investigated whether DPW, originally developed for two-dimensional pattern recognition, could be successfully employed for one-dimensional pattern recognition. To validate our alternative hypothesis that DPW is effective for one-dimensional data analysis, DPW was applied to the problem of EEG eye-blink artifact detection. DPW outperformed conventional template matching methods including DTW, demonstrating that this positional warping method, which warps signals on both ordinate and abscissa axes, is also effective in one-dimensional pattern recognition. This study suggests the possibility of applying DPW to many other types of signal patterns and applications. We are also planning to combine DPW with other methodologies in our future studies.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

Acknowledgments

This work was supported in part by the IT R&D program of MSIP/KEIT (KI10045461, Development of Cultural Contents Evaluation Technology Based on Real-Time Biosignal of Multiple Subjects), in part by the IT R&D program of MOTIE/MISP/KEIT (10045452, Development of Multimodal Brain-Machine Interface System Based on User Intent Recognition), and in part by the National Research Foundation of Korea (NRF) funded by the Ministry of Science, ICT and Future Planning (NRF-2012R1A2A2A03045395).

References

  1. A. Goshtasby, “Template matching in rotated images,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 7, no. 3, pp. 338–344, 1985. View at: Google Scholar
  2. J. Frank, S. Mannor, J. Pineau, and D. Precup, “Time series analysis using geometric template matching,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 35, no. 3, pp. 740–754, 2013. View at: Publisher Site | Google Scholar
  3. S. Omachi and M. Omachi, “Fast template matching with polynomials,” IEEE Transactions on Image Processing, vol. 16, no. 8, pp. 2139–2149, 2007. View at: Publisher Site | Google Scholar
  4. J.-H. Chen, C.-S. Chen, and Y.-S. Chen, “Fast algorithm for robust template matching with M-estimators,” IEEE Transactions on Signal Processing, vol. 51, no. 1, pp. 230–243, 2003. View at: Publisher Site | Google Scholar
  5. K. Peng, L. Chen, S. Ruan, and G. Kukharev, “A robust algorithm for eye detection on gray intensity face without spectacles,” Journal of Computer Science & Technology, vol. 5, no. 3, pp. 127–132, 2005. View at: Google Scholar
  6. R. Wagner and H. L. Galiana, “Evaluation of three template matching algorithms for registering images of the eye,” IEEE Transactions on Biomedical Engineering, vol. 39, no. 12, pp. 1313–1319, 1992. View at: Publisher Site | Google Scholar
  7. Z. Lin and L. S. Davis, “Shape-based human detection and segmentation via hierarchical part-template matching,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 32, no. 4, pp. 604–618, 2010. View at: Publisher Site | Google Scholar
  8. T.-C. Fu, F.-L. Chung, R. Luk, and C.-M. Ng, “Stock time series pattern matching: template-based vs. rule-based approaches,” Engineering Applications of Artificial Intelligence, vol. 20, no. 3, pp. 347–364, 2007. View at: Publisher Site | Google Scholar
  9. S. D. Connell and A. K. Jain, “Template-based online character recognition,” Pattern Recognition, vol. 34, no. 1, pp. 1–14, 2001. View at: Publisher Site | Google Scholar | Zentralblatt MATH
  10. M. Faundez-Zanuy, “On-line signature recognition based on VQ-DTW,” Pattern Recognition, vol. 40, no. 3, pp. 981–992, 2007. View at: Publisher Site | Google Scholar | Zentralblatt MATH
  11. Y. Li, Z. Ma, W. Lu, and Y. Li, “Automatic removal of the eye blink artifact from EEG using an ICA-based template matching approach,” Physiological Measurement, vol. 27, no. 4, pp. 425–436, 2006. View at: Publisher Site | Google Scholar
  12. A. Aarabi, K. Kazemi, R. Grebe, H. A. Moghaddam, and F. Wallois, “Detection of EEG transients in neonates and older children using a system based on dynamic time-warping template matching and spatial dipole clustering,” NeuroImage, vol. 48, no. 1, pp. 50–62, 2009. View at: Publisher Site | Google Scholar
  13. E. Olejarczyk, A. Jozwik, W. Zmyslowski et al., “Automatic detection and analysis of the EEG sharp wave-slow wave patterns evoked by fluorinated inhalation anesthetics,” Clinical Neurophysiology, vol. 123, no. 8, pp. 1512–1522, 2012. View at: Publisher Site | Google Scholar
  14. H. Nolan, R. Whelan, and R. B. Reilly, “FASTER: fully automated statistical thresholding for EEG artifact rejection,” Journal of Neuroscience Methods, vol. 192, no. 1, pp. 152–162, 2010. View at: Publisher Site | Google Scholar
  15. A. Delorme, T. Sejnowski, and S. Makeig, “Enhanced detection of artifacts in EEG data using higher-order statistics and independent component analysis,” NeuroImage, vol. 34, no. 4, pp. 1443–1449, 2007. View at: Publisher Site | Google Scholar
  16. T. A. Camilleri, K. P. Camilleri, and S. G. Fabri, “Automatic detection of spindles and K-complexes in sleep EEG using switching multiple models,” Biomedical Signal Processing and Control, vol. 10, pp. 117–127, 2014. View at: Publisher Site | Google Scholar
  17. G. Wang, G. Worrell, L. Yang, C. Wilke, and B. He, “Interictal spike analysis of high-density eeg in patients with partial epilepsy,” Clinical Neurophysiology, vol. 122, no. 6, pp. 1098–1105, 2011. View at: Publisher Site | Google Scholar
  18. M. S. Aldrich, E. A. Garofalo, and I. Drury, “Epileptiform abnormalities during sleep in Rett syndrome,” Electroencephalography and Clinical Neurophysiology, vol. 75, no. 5, pp. 365–370, 1990. View at: Publisher Site | Google Scholar
  19. L. Rabiner and B. H. Juang, Fundamentals of Speech Recognition, Prentice Hall, New York, NY, USA, 1993.
  20. C. Myers, L. R. Rabiner, and A. E. Rosenberg, “Fully automated statistical thresholding for EEG artifact rejection,” IEEE Transactions on Acoustics, Speech, and Signal Processing, 1980. View at: Google Scholar
  21. N. Alajlan, I. El Rube, M. S. Kamel, and G. Freeman, “Shape retrieval using triangle-area representation and dynamic space warping,” Pattern Recognition, vol. 40, no. 7, pp. 1911–1920, 2007. View at: Publisher Site | Google Scholar | Zentralblatt MATH
  22. H. Sahbi and N. Boujemaa, “Robust face recognition using dynamic space warping,” in Biometric Authentication, M. Tistarelli, J. Bigun, and A. K. Jain, Eds., vol. 2359 of Lecture Notes in Computer Science, pp. 121–132, Springer, 2002. View at: Publisher Site | Google Scholar | Zentralblatt MATH
  23. H. Feng and C. C. Wah, “Online signature verification using a new extreme points warping technique,” Pattern Recognition Letters, vol. 24, no. 16, pp. 2943–2951, 2003. View at: Publisher Site | Google Scholar
  24. Y.-S. Jeong, M. K. Jeong, and O. A. Omitaomu, “Weighted dynamic time warping for time series classification,” Pattern Recognition, vol. 44, no. 9, pp. 2231–2240, 2011. View at: Publisher Site | Google Scholar
  25. B. S. Raghavendra, D. Bera, A. S. Bopardikar, and R. Narayanan, “Cardiac arrhythmia detection using dynamic time warping of ECG beats in e-healthcare systems,” in Proceedings of the IEEE International Symposium on a World of Wireless, Mobile and Multimedia Networks (WoWMoM '11), pp. 1–6, June 2011. View at: Publisher Site | Google Scholar
  26. M. Parizeau and R. Plamondon, “Comparative analysis of regional correlation, dynamic time warping, and skeletal tree matching for signature verification,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 12, no. 7, pp. 710–716, 1990. View at: Publisher Site | Google Scholar
  27. W.-D. Chang and J. Shin, “Dynamic positional warping: dynamic time warping for online handwriting,” International Journal of Pattern Recognition and Artificial Intelligence, vol. 23, no. 5, pp. 967–986, 2009. View at: Publisher Site | Google Scholar
  28. H.-C. Huang and B. H. Jansen, “EEG waveform analysis by means of dynamic time-warping,” International Journal of Bio-Medical Computing, vol. 17, no. 2, pp. 135–144, 1985. View at: Publisher Site | Google Scholar
  29. W.-D. C. W. D. Chang and J. S. J. Shin, “DPW approach for random forgery problem in online handwritten signature verification,” in Proceedings of the 4th International Conference on Networked Computing and Advanced Information Management (NCM '08), vol. 1, pp. 347–352, September 2008. View at: Publisher Site | Google Scholar
  30. S. Kim and J. McNames, “Automatic spike detection based on adaptive template matching for extracellular neural recordings,” Journal of Neuroscience Methods, vol. 165, no. 2, pp. 165–174, 2007. View at: Publisher Site | Google Scholar
  31. T. Akiyama, M. Osada, M. Isowa et al., “High kurtosis of intracranial electroencephalogram as a marker of ictogenicity in pediatric epilepsy surgery,” Clinical Neurophysiology, vol. 123, no. 1, pp. 93–99, 2012. View at: Publisher Site | Google Scholar
  32. L. Canuet, R. Ishii, M. Iwase et al., “MEG-SAM kurtosis analysis in the localization of the epileptogenic tuber in tuberous sclerosis: a case report,” International Congress Series, vol. 1300, pp. 653–656, 2007. View at: Publisher Site | Google Scholar

Copyright © 2014 Won-Du Chang and Chang-Hwan Im. 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.


More related articles

1993 Views | 657 Downloads | 9 Citations
 PDF  Download Citation  Citation
 Download other formatsMore
 Order printed copiesOrder

Related articles

We are committed to sharing findings related to COVID-19 as quickly and safely as possible. Any author submitting a COVID-19 paper should notify us at help@hindawi.com to ensure their research is fast-tracked and made available on a preprint server as soon as possible. We will be providing unlimited waivers of publication charges for accepted articles related to COVID-19. Sign up here as a reviewer to help fast-track new submissions.