{'fraction_non_alphanumeric': 0.03860911270983213, 'fraction_numerical': 0.017300445357999315, 'mean_word_length': 4.77125345986556, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fast and Robust Dynamic Hand Gesture Recognition via Key Frames Extraction and Feature Fusion

Gesture recognition is a hot topic in computer vision and pattern recognition, which plays a vitally important role in natural human-computer interface. Although great progress has been made recently, fast and robust hand gesture recognition remains an open problem, since the existing methods have not well balanced the performance and the efficiency simultaneously. To bridge it, this work combines image entropy and density clustering to exploit the key frames from hand gesture video for further feature extraction, which can improve the efficiency of recognition. Moreover, a feature fusion strategy is also proposed to further improve feature representation, which elevates the performance of recognition. To validate our approach in a"wild"environment, we also introduce two new datasets called HandGesture and Action3D datasets. Experiments consistently demonstrate that our strategy achieves competitive results on Northwestern University, Cambridge, HandGesture and Action3D hand gesture datasets. Our code and datasets will release at https://github.com/Ha0Tang/HandGestureRecognition.


Introduction
Gesture recognition is to recognize category labels from an image or a video which contains gestures made by the user. Gestures are expressive, meaningful body motions involving physical movements of the fingers, hands, arms, head, face, or body with the intent of: conveying meaningful information or interacting with the environment.
Hand gesture is one of the most expressive, natural and common type of body language for conveying attitudes and emotions in human interactions. For example, in a television control system, hand gesture has the following attributes: "Pause","Play", "Next Channel", "Previous Channel", "Volume Up", "Volume Down" and "Menu Item". While in a recommendation system, hand gesture can express "Like" or "Dislike" emotions of users. Thus, it is one of the most fundamental problems in computer vision and pattern recognition, and has a wide range of applications such as virtual reality systems [1], interactive gaming platforms [2], recognizing sign language [3,4,5], enabling very young children to interact with computers [6], controlling robot [7,8], practicing music conducting [9], television control [10,11], automotive interfaces [12,13], learning and teaching assistance [14,15], and hand gesture generation [16]. There has been significant progress in hand gesture recognition, however, some key problems e.g., fast and robust are still challenging. Prior work usually puts emphasis on using whole data series, which always contain redundant information, resulting in degraded performance. For examples, Wang et al. [1] present a superpixel-based hand gesture recognition system based on a novel superpixel earth mover's distance metric. Ren et al. [2] focus on building a robust part-based hand gesture recognition system. Hikawa and Kaida [3] propose a posture recognition system with a hybrid network. Moreover, there are many approaches are also proposed for action or video recognition task, such as [17,18,19,20,21,22,23,24,25,26]. Liu and Shao [17] introduce an adaptive learning methodology to extract spatio-temporal features, simultaneously fusing the RGB and depth information, from RGB-D video data for visual recognition tasks. Liu et al. [26] propose to combine the Salient Depth Map (SDM) and the Binary Shape Map (BSM) for human action recognition task. Simonyan et al. [27] propose a two-stream ConvNet architecture which incorporates spatial and temporal networks to extract spatial and temporal features. Feichtenhofer et al. [28] study a number of ways of fusing ConvNet towers both spatially and temporally in order to best take advantage of this spatio-temporal information. In sum, all these efforts endeavor to decrease the computation burden in each solo frame, while overlooking all processing schemes in the whole frames would incur more computation burden than a few selected representative frames, which is a fundamental way to decrease the computation burden, greatly. This paper is devoted to bridge the gap between fast and robust hand gesture recognition, simply using solo popular cue e.g., RGB, which ensures great potential in practical use.
Key frames, also known as representative frames, extract the main content of a data series, which could greatly reduce the amount of processing data. In [29], the key frames of the video sequence are selected by their discriminative power and represented by the local motion features detected in them and integrated from their temporal neighbors. Carlsson and Sullivan [30] demonstrate that specific actions can be recognized in long video sequence by matching shape information extracted from individual frames to stored prototypes representing key frames of the action. However, we regard every frame in a video as a point in the 2-D coordinate space. Since we are focusing on distinguishing dynamic gesture from a data series while not reconstructing it, we simply introduce a measure to find which frames are more important for distinguishing and which are not. In consideration of information entropy [31,32,33] could be a useful measurement to quantify the information each frame contains, we introduce frame entropy as an quantitative feature to describe each frame and then map these values into a 2-D coordinate space. How to describe this 2-D space is a hard nut to crack for its uneven distribution. Therefore, we further propose an integrated strategy to extract key frames using local extreme points and density clustering. Local extreme points includes the local maximum and local minimum points, which represent the most discriminative points of frame entropy. Shao and Ji [34] also propose a key frame extraction method based on entropy. However, the differences between [34] and the proposed method are two-folder: (i) The entropy in [34] is calculated on motion histograms of each frame, while the proposed method directly calculate on each frame. (ii) [34] simply to find peaks in the curve of entropy and use histogram intersection to output final key frames, while the proposed method first selects the local peaks of entropy and then use density clustering to calculate the cluster centers as the final key frames. Density clustering [35] is the approach based on the local density of feature points, which is able to detect local clusters, while previous clustering approaches such as dynamic delaunay clustering [36], k-means clustering [37], spectral clustering [38] and graph clustering [39] cannot detect local clusters due to the fact that they only rely on the distance between feature points to do clustering.
In order to promote the accuracy, we also present a novel feature fusion method that combines appearance and motion cues. After extracting key frames, we replace the original video sequence with the key frames sequence, which could greatly enhance the time efficiency at the cost of accuracy. This feature fusion strategy takes advantage of both the motion and the appearance information in the spatiotemporal activity context under the hierarchical model. The experimental results show that the method proposed is accurate and effective for dynamic hand gesture recognition on four datasets. To summarize, the main contributions of this paper are: • A novel key frames extraction method is proposed, which improves efficiency of hand gesture processing.
• A feature strategy is presented in which appearance and motion cues are fused to elevate the accuracy of recognition.
• Experiments demonstrate that our method achieves the balance between efficiency and accuracy simultaneously in four datasets.

Key Frames Extraction and Feature Fusion Strategy for Hand Gesture Recognition
In this section, we will introduce the proposed key frames extraction and feature fusion strategy.

Key Frames Extraction
Key frames extraction is the key technology for video abstraction, which can remove the redundant information in the video greatly. The algorithm for key frames extraction will affect the reconstruction of video content. If a frame in video V can be represented by f i , where i is (1, 2, ..., n) and n is the total number of frames in video V . Hence, the key frames set S Keyframes is defined as follows: where f Keyframes denotes the key frames extraction procedure.
In this paper, a method of key frames extraction based on image entropy and density clustering is proposed, as we can see from Figure 1. Our key frames extraction methods are mainly divided into three steps, namely, 1) calculating image entropy, 2) finding local extreme points and 3) executing density cluster. The following section would expand upon on it.

Image Entropy.
In this section, we try to find a proper descriptive index to evaluate each frame in a video, facilitating key frame extraction. Informative frames could better summarize the whole video where they reside, while how to quantify the information each frame contains is a hard-nut to crack. Firstly, we calculate image entropy of each frame, and then map them into a two-dimensional coordinate space, as shown in Figure 1(b). Entropy is a nice way of representing the impurity or unpredictability of a set of data since it is dependent on the context in which the measurement is taken. As for a single video frame, the gray-scale color/intensity distribution of this frame can be seen as (e) Select the number of clustering. In this case, we choose 5 clusters.
(f) The final results of clustering. The points of 2, 5, 8, 9 and 10 are the clustering centers, therefore, the corresponding frames (2, 9, 14, 20 and 26) are the key frames of original sequence.
(g) The key frames are the 2, 9, 14, 20 and 26 frames. Now we use this sequence to replace the original sequences for the next step.
where p fi (j) denotes the probability density function of frame f i , which could be obtained by normalizing their histogram of gray-scale pixel intensities. Next we map the value E(f i ) to a two-dimensional coordinate space (the E(f i ) vs. i plot).

Local Extreme Points.
Secondly, we pick the local extreme points in the twodimensional coordinate space, illustrated by Figure 1(c). Local extreme points include the local maximum points and local minimum points. Local maximum points can be calculated as follows: (3) Local minimum points can also be calculated by the following formula: (4) where i = 1, 2, ..., n. Therefore, local extreme points P extreme can be united by: Local extreme points could further extract representative frames from the original video sequence. This procedure could be viewed as finding local representatives to roughly describe the original sequence.

Density Clustering.
After obtaining the extreme points, as shown in Figure  1(c), we try to cluster these points into N (N is a predefined constant for all the datasets) categories, as, {1, 2}, {3, 4, 5, 6, 7}, {8}, {9} and {10}. The distribution of these extreme points have the characteristics, the cluster centers are surrounded by neighbors with a lower local density and that they are at a relatively large distance from any points with a higher local density.
Therefore, we adopt density clustering [35] to further cluster these extreme points P extreme , as shown in Figure  1(d-f). Density clustering could better catch the delicate structure of 2-D space where extreme points reside than traditional clustering strategies, e.g. K-means. First, we search for a local density maximum point as a cluster center, and then spread the cluster label from high density to low-density points sequentially. For each data point P k , we compute two quantities: corresponding local density (neighborhood has a density, not the data point) ρ P k and its distance δ P k from points of higher density. Both these quantities depend only on the distances d P k P l between data points, which are assumed to satisfy the triangular inequality. The local density ρ P k of data point P k is defined as: where χ(x) = 1 if x < 0 and χ(x) = 0 when otherwise, and d c is a cutoff distance. Basically, ρ P k is equal to the number of points that are closer than d c to point P k . The algorithm is sensitive only to the relative magnitude of ρ P k in different points, which implies that, the results of the analysis are robust with respect to the choice of d c for large datasets. A different way of defining ρ P k as: δ P k is measured by finding the minimum distance between the point P k and any other point with higher density: which uses a Gaussian kernel to calculate. We can see from these two kernels, cutoff kernel is discrete value, while Gaussian kernel is a continuous value, which guarantees a smaller probability of conflict.
As we can see from Figure 1(d), we calculate ρ and δ using Formula (6) and (8). Then select the number of clustering center N , namely, the N largest δ values, e.g., in Figure  1(e), we select 5 cluster centers. Figure 1(f) illustrates the final results of clustering, in which the points of 2, 5, 8, 9 and 10 are the clustering centers, therefore, the corresponding x-coordinates (the 2, 9, 14, 20 and 26 frames, shown in figure 1(g)) are the key frames S Keyframes in the original video V (shown in Figure 1(a)). The pipeline of the proposed key frames extraction method is summarized in Algorithm 1. Note that the proposed density clustering cannot handle the situation where the entropy of the video sequence is monotone increasing or decreasing since we need to select the local extreme points. While in our experiments, we observer that there is no one video sequence which frame entropy is monotone increasing or decreasing all the time, it means we can always obtain the local extreme points.

Feature Fusion Strategy
In view of each key frame and the relationship between each key frame, for better representing each key frame sequence, we not only try to describe each frame of key frame, but also the variation between the key frames. That is, we not only extract the most representative frames and map them into a simple 2-D space, but also describe how these frames move in this space. We believe this two-phase strategy could set up a "holographic" description of each hand gesture sequence. Hadid and Pietikäinen [40] also Algorithm 1 The proposed key frames extraction method.

Require:
The original hand gesture video V , as shown in Figure 1(a) and the number of key frames N (N is a pre-defined constant for all the datasets).

Ensure:
The key frames S Keyframes in original video V , as shown in Figure 1(g). 1: Calculate image entropy E(fi) of each frame in V using Formula 2; 2: Map E(fi) to a two-dimensional coordinate space; 3: Find local maximum points Pmax in the two-dimensional coordinate space using Formula (3); 4: Find local minimum points Pmin in the two-dimensional coordinate space using Formula (4); 5: Obtain Pextreme by uniting the local maximum points Pmax and local minimum points Pmin using Formula (5); 6: Calculate ρ for each point in Pextreme using Formula (6)  demonstrate that excellent results can be obtained combining appearance feature and motion feature for dynamic video analysis. Jain et al. [41] propose a two-stream fully convolutional neural network which fuses together motion and appearance in a unified framework, and substantially improve the state-of-the-art results for segmenting unseen objects in videos. Xu et al. [42] consider exploiting the appearance and motion information resided in the video with a attention mechanism for the image question answering task. For this purpose, we propose a feature fusion strategy to capture these two phases: appearance based approach can only be applied to each frame, which represents the differences of space merely; while, motion based method can describe the evolution with the time. Thus we combine appearance and motion feature for better describe image sequence. Meanwhile, to better weight these two feature, we also introduce an efficient strategy to balance them. Tang et al. [16] also propose a feature fusion method which fuses features extracted from different sleeves to boost the recognition performance. Figure 2 shows the whole proposed feature fusion procedure for the obtained key frames. After extracting key frames, we take the key frames sequence in place of the original sequence. We begin by extracting key frames from the original sequence, and then extract appearance and motion features (hist1 and hist2 in Figure 2) from the key frames sequence, respectively. For further increase the importance of the useful feature, we add weights to appearance and motion features. By feeding hist1 and hist2 to the SVM classifier separately, we obtain two classification accuracy R = {R a , R m }. Based on the assumption that the higher the rate is, the better representation becomes, we compute the weights as follows: Finally, considering that the weight of the lowest rate is 1, the other weights can be obtained according to a linear relationship of their differences to that with the lowest rate. The final step is written as: in which W = {α, β} is the weight vector corresponding to hist1 and hist2.
There are many existing descriptors for us to extract hist1 and hist2. In other words, the fusion strategy does not depend on specific descriptors, which guarantees its great potential in applications. In term of hist1, we can use Gist [43], rootSIFT [44], HSV, SURF [45], HOG [46], LBP [47] or its variation CLBP [48] to extract appearance cue of each image. As for hist2, LBP-TOP, VLBP [49] and SIFT 3D [50] are used to extract motion cues from the whole key frames sequence. We also use Bag-of-Feature (BoF) [24,51] to represent these appearance and motion cues. At the end of the procedure, we concatenate weighted hist1 and hist2 to obtain the final representation hist (as shown in Figure 2).

Hand Gesture Recognition Framework
The hand gesture recognition framework based on key frames and feature fusion is composed of two stages, training and testing, which is summarized in Algorithm 2. In the training stage, we first extract key frames S Keyframes using Algorithm 1 (step 3). Then we extract appearance features from each key frame using descriptors such as SURF, LBP, etc. After obtaining the appearance features, we employ BoF [24,51] to represent these features for hist1 q (step 4). Next we use LBP-TOP, VLBP or SIFT 3D to extract motion features from the whole key frames sequence, producing the corresponding histogram hist2 q (step 5). After that, hist1 q and hist2 q are fed to separate classifiers to obtain R = {R a , R m } (step 6). And then, we calculate α and β by Formula (9) and (10) (step 7). Then the training histogram hist q is constructed from αhist1 q and βhist2 q (step 8). In the end of the iteration, we obtain the training representation vector hist. Then hist and corresponding labels L label are fed to a SVM classifier (step 10). During the testing stage, testing hand gesture representation is obtained in the same way as the training stage (step 12). Thereby the trained SVM classifier is used to predict the gesture label t label (step 13).

Algorithm 2
The proposed hand gesture recognition framework.

Require:
L hand gesture videos for training, as shown in Figure 1(a), corresponds to the gesture labels L label ; Testing hand gesture video t.

Ensure:
The hand gesture label t label . 1: TRAINING STAGE: 2: for q = 1 to L do α and β ← using by Formula (9) and (10); 8: hist q ← {αhist1, βhist2}; 9: end for 10: Classifier ← hist ∪ L label ; 11: TESTING STAGE: 12: Obtain hand gesture representation hist t for testing t using the same method as the training stage; 13: Obtain t label by the classifier after calculation; 14: return t label .

Datasets and Settings
To evaluate the effectiveness of the proposed method, we conduct experiments on two publicly available datasets (Cambridge [52] and Northwestern University Hand Gesture datasets [53]) and two collected datasets (HandGesture and Action3D hand gesture datasets, both will be released after paper accepted). Some characteristics of these datasets are listed in Table 1.
Cambridge Hand Gesture dataset is a commonly used benchmark gesture data set with 900 video clips of 9 hand gesture classes defined by 3 primitive hand shapes (i.e., flat, spread, V-shape) and 3 primitive motions (i.e., leftward, rightward, contract). For each class, it includes 100 sequences captured with 5 different illuminations, 10 arbitrary motions and 2 subjects. Each sequence is recorded in front of a fixed camera having coarsely isolated gestures in spatial and temporal dimensions.
Northwestern University Hand Gesture dataset is a more diverse data set which contains 10 categories of dynamic hand gestures in total: move right, move left, rotate up, rotate down, move downright, move right-down, clockwise circle, counterclockwise circle, "Z" and cross. This dataset is performed by 15 subjects and each subject contributes 70 sequences of these ten categories with seven postures (i.e., Fist, Fingers extended, "OK", Index, Side Hand, Side Index and Thumb).
These two datasets mentioned above are both with clear backgrounds, and sequences snipped tightly around the gestures. However, how well will this method work on videos from "the wild" with significant clutter, extraneous motion, continuous running video without pre-snipping? To validate our approach, we introduce two new datasets, called HandGesture and Action3D datasets.
We also acquired Action3D dataset which consisting of 1620 image sequences of 6 hand gesture classes (box, high wave, horizontal wave, curl, circle and hand up), which are defined by 2 different hands (right and left hand) and 5 situations (sit, stand, with a pillow, with a laptop and with a person). Each class contains 270 image sequences (5 different situations × 2 different hands × 3 times × 9 subjects). Each sequence was recorded in front of a fixed camera having roughly isolated gestures in space and time. All video sequences were uniformly resized into 320 × 240 in our method.

Parameter Analysis
Two parameters are involved in our framework: the number of key frames N and the dictionary number D in BoF. Firstly, we extract N = 3, 4, ..., 9 key frames from the original video, respectively. And then extract SURF features from each key frame. Every key point detected by SURF provides a 64-D vector describing the texture of it. Finally, we adopt BoF to represent each key frame with  Figure 3 presents the accuracy results on the four datasets. From Figure  3 (a) and (c), the accuracy first rises to the peak when D = 64 and then drops after reaching the peak. However, as shown in Figure 3 (b) and (d), the accuracy reaching the peak when D = 16. Thus, we set D = 64 on the Cambridge and Northwestern datasets, and D = 16 on our two proposed datasets. It is observe that the more key frames we have, the more time will be consumed. Thus, to balance accuracy and efficiency, we set N = 5 on all the four datasets in the following experiments.

Experiment Evaluation
To evaluate the necessity and efficiency of the proposed strategy, we test it in multi-aspect: (1) necessity of key frames extraction; (2) different kernel tricks; (3) different fusion strategies; (4) different clustering methods; (5) performance comparisons with the state-of-the-art; (6) efficiency. (1)-(4) demonstrate the rationality and validity of the methods. (5) compares the proposed method with others. (6) shows its efficiency.
(1) Comparison with Different Key Frames Extraction Methods. We discuss whether our key frames method is necessary or not here. For the Cambridge and Action3D dataset, we only extract LBP-TOP, and then concatenate the three orthogonal planes of LBP-TOP. For the Northwestern and HandGesture dataset, 200 points are randomly selected from each video using SIFT 3D. As we can see from Table 2, our approach outperforms the other four methods on both accuracy and efficiency, thereby our approach is not only theoretical improvement, but also has an empirical advantage.
(2) Gaussian Kernel vs. Cutoff Kernel. We also compare the Gaussian and cutoff kernel. We adopt SURF to extract feature from each key frame. Comparison results are shown in the Table 3. As we can observe that there is small different between using the Gaussian and cutoff kernel.
(3) Comparison with Different Feature Fusion Strategies. We demonstrate that combining appearance (hand posture) and motion (the way hand is moving) boosts hand gesture recognition task here. Moreover, we also compare different schemes based on appearance and motion, respectively. For feature fusion, we set α and β to 8 and 1, respectively. As shown in Table 4, fusion strategies are much better than appearance or motion based methods, which demonstrates the necessity of our feature fusion strategy. Motion-based method achieve the worst results, which can illustrate that in our task spatial cues is more important than the temporal cues. The spatial cues represents/extracts the difference between different gesture classes, also called inter-class differences. While the temporal cues captures the difference among different frames in the same gesture sequences, also called intra-class differences. Inter-class differences are always greater than intra-class differences, which means the spatial cues can represent more discriminative feature than the temporal cues. In our task, we observe that the differences between different types of gestures are much greater than the differences between the same gesture sequence, which means the spatial cues is more discriminative than the temporal cues. However, if hand gesture moves fast and change hugely in one sequence, the temporal cues could be more important.
(4) Comparison with Different Clustering Methods. We also compare different clustering methods for the key frames extraction. As shown in Table 5, we can see that density clustering is much better than K-means, OPTICS [54] and DBSCAN [55]. (5) Comparison with State-of-the-Arts. For the Cambridge and Northwestern datasets, we compare our results with the state-of-the-art methods in Tables 6 and 7. We achieve 98.23% ± 0.84% and 96.89% ± 1.08% recognition accuracy on the Cambridge and Northwestern dataset, both of which exceed the other baseline methods. (6) Efficiency. Finally, We investigate our approach in terms of computation time of classifying one test video. We run our experiment on a 3.40-GHz i7-3770 CPU with 8 GB memory. The proposed method is implemented using Matlab. Code and datasets will release after paper accepted. As we can see from Table 8 that the time of classifying one test sequence is 4.31s, 10.89s, 13.06s and 4.26s for the Cambridge, Northwestern, HandGesture and Action3D datasets. We observe that the proposed key frame extraction methods including entropy calculation and density clustering can be finished within around 1s on the Cambridge, Northwestern and Action3D datasets. While for the HandGesture dataset which contains about 200 frames in a single video, it only cost about 3s per video. We also note that the most time-consuming part is feature extraction, and we have two solutions to improve it, (i) we can reduce the size of images, we note that Cambridge and Action3D only consume about 4s, while Northwestern and HandGesture cost about 11s and 13s respectively.

Northwestern
Methods Accuracy Liu and Shao [59] Genetic Programming 96.1% Shen et al. [53] Motion Divergence fields 95.8% Our method Key Frames + Feature Fusion 96.89% ± 1.08%  [59] 6.45s 13.32s 15.32s 6.43s Zhao and Elgammal [29] 5.34s 11.78s 14.98s 5.21s tion3D datasets. We re-implement both methods with the same running settings for fair comparison, including hardware platform and programming language. The results are shown in Table 8, and we can see that the proposed method achieve better results than both methods.

Conclusion
In order to build a fast and robust gesture recognition system, in this paper, we present a novel key frames extraction method and feature fusion strategy. Considering the speed of recognition, we propose a new key frames extraction method based on image entropy and density clustering, which can greatly reduce the redundant information of original video. Moreover, we further propose an efficient feature fusion strategy which combines appearance and motion cues for robust hand gesture recognition. Experimental results show that the proposed approach outperforms the state-of-the-art methods on the Cambridge (98.23% ± 0.84%) and Northwestern (96.89% ± 1.08%) datasets. For evaluate our method on videos from "the wild" with significant clutter, extraneous motion and no pre-snipping, we introduce two new datasets, namely HandGesture and Action3D. We achieve accuracy of 99.21%± 0.88% and 98.98% ± 0.65% on the HandGesture and Ac-tion3D datasets, respectively. From the respect of the recognition speed, we also achieve better results than the state-of-the-art approaches for classifying one test sequence on the Cambridge, Northwestern, HandGesture and Ac-tion3D datasets.