# Evaluation of Human Action Based on Feature-Weighted Dynamic Time Warping
## 5 Template Creation and Action Evaluation  
The overall framework of the action evaluation process  
DTW is an algorithm that can compute the similarity of two time series of different lengths. It evaluates the similarity of two action sequences by dynamically adjusting the length of the action sequence to be measured and calculating the cumulative shortest distance from the template action sequence. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Angle (Rad)** & **Composition of Key Points** & **Angle (Rad)** & **Composition of Key Points** \\ \hline \(\theta_{1}^{k}\) & Left elbow–left shoulder–left hip & \(\theta_{3}^{k}\) & Right elbow–right shoulder–right hip \\ \(\theta_{2}^{k}\) & Left shoulder–left elbow–left wrist & \(\theta_{4}^{k}\) & Right shoulder–right elbow–right wrist \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Angle features. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Normalized** & **Combination of Key** & **Normalized** & **Combination of** \\
**Distance (mm)** & **Points** & **Distance (mm)** & **Key Points** \\ \hline \(d_{1}^{k}\) & Left hand–head & \(d_{5}^{k}\) & Right hand–head \\ \(d_{2}^{k}\) & Left hand–nose & \(d_{6}^{k}\) & Right hand–nose \\ \(d_{3}^{k}\) & Left hand–right shoulder & \(d_{4}^{k}\) & Right hand–left shoulder \\ \(d_{4}^{k}\) & Left hand–left hip & \(d_{8}^{k}\) & Right hand–right hip \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Distance features. Let us suppose that there are two time series \(x(i)\) and \(y(j)\), where \(i=1,2,\cdots,m\) and \(j=1,2,\cdots,n\). The warping path is denoted by \(W\) to represent the alignment or mapping of the time series \(x(i)\) and \(y(j)\), \(W=\{w_{k}\},k=1,2,\cdots,p\), and \(p\) denotes the length of \(W\). The warping path should satisfy three constraints of boundary condition, continuity, and monotonicity. Construct an \(m\times n\) lattice matrix with \(x(i)\) and \(y(i)\) sequence lengths with m and n as rows and columns, respectively, as shown in Figure 8. The DTW algorithm accumulates \(d(i,j)\) to find the grid point with the shortest cumulative distance \(\gamma(i,j)\) to plan the optimal path. The calculation of the cumulative distance \(\gamma(i,j)\) of any point in the grid is shown in the following equation:  
\[\gamma(i,j)= \begin{cases}d(i,j)&i=1,j=1\\ \gamma(i-1,j)+d(i,j)&i>1,j=1\\ \gamma(i,j-1)+d(i,j)&i=1,j>1\\ \min(\gamma(i-1,j),\gamma(i,j-1),\gamma(i-1,j-1))+d(i,j)&i>1,j>1\end{cases}  \tag{4}\]  
where \(d(i,j)\) is the Euclidean distance between elements in the \(x(i)\) sequence and elements in the \(y(i)\) sequence, \(\gamma(i,j)\) is the cumulative distance of the grid at \(d(i,j)\) from (1,1) to (\(i,j\)), and \(\min(\gamma(i-1,j),\gamma(i,j-1),\gamma(i-1,j-1))\) denotes the selection of the point with the smallest cumulative distance. In this paper, the tested action feature matrix \(F_{m}\) is replaced by \(x(i)\), and the template action feature matrix \(F_{m}\) is replaced by \(y(j)\). The calculation of \(d(i,j)\) in Equation (4) is  
Figure 8: DTW warping path diagram. Figure 7: Overall framework of action evaluation process. shown in Equation (5), since the feature matrix is a combination of angle features and distance features:  
\[d(i,j)=\sqrt{\sum_{k=1}^{l}(F_{m}(i,k)-F_{m}^{\prime}(j,k))^{2}} \tag{5}\]  
where \(F_{m}(i,k)\) is the \(k\)th feature value of the \(i\)th frame feature vector in \(F_{m}\), \(F_{m}^{\prime}(j,k)\) is the \(k\)th feature value of the \(j\)th frame feature vector in the action feature matrix \(F_{m}\), and \(l\) is the number of feature values. Template creation  
In this paper, the DBA algorithm is used to obtain the average time series of multiple action template time series of each type of action to obtain a unique template of each type of action, which reduces the matching calculation time between the action time series to be measured and multiple template action time series, improves the efficiency of action evaluation, and eliminates the contingency of selecting action templates.