# Deep Learning Models for Yoga Pose Monitoring
## 3 Proposed System
### Pose Prediction
\[l_{r}=\sigma(W_{l}\cdot[h_{r-1},x_{r}]+b_{l}) \tag{2}\]  
\[m_{r}=\sigma(W_{m}\cdot[h_{r-1},x_{r}]+b_{m}) \tag{3}\]  
\[\hat{C}_{r}=tanh(W_{C}\cdot[h_{r-1},x_{r}]+b_{c}) \tag{4}\]  
\[C_{r}=l_{r}*C_{r-1}+i_{r}*\hat{C}_{r} \tag{5}\]  
\[o_{r}=\sigma(W_{o}\cdot[h_{r-1},x_{r}]+b_{o}) \tag{6}\]  
\[h_{r}=o_{r}*tanh(C_{r}) \tag{7}\]  
where  
* \(l_{r},m_{r},o_{r}\) and \(h_{r}\) are the outputs of forget gate, input gate, output gate and current state, respectively;
* \(W_{f},W_{m}\) and \(W_{o}\) are the weights of forget gate, input gate and output gate, respectively;
* \(x_{r}\) is the current state input;
* \(b_{l},b_{m}\) and \(b_{o}\) are the bias of forget gate, input gate and output gate, respectively;
* \(m_{r}\) is the output of input gate;
* \(\hat{C}_{r}\) and \(C_{r}\) are the current and previous cell state. The final layer used is a Dense layer that uses Softmax as the activation function, which assigns probabilities of different poses based on the current given input [35]. The mathematical equation of Softmax activation function is presented in Equation (8). \[\sigma(\underline{z})_{i}=\frac{e^{z_{i}}}{\sum_{j=1}^{K}e^{z_{j}}} \tag{8}\]  
where \(\sigma\) is the softmax, \(\underline{z}\) is the input vector, \(e^{z_{i}}\) is the standard exponential function for input vector, \(K\) is the number of classes in the multi-class classifier and \(e^{z_{j}}\) is the standard exponential function for output vector. The output obtained after this layer is polled on 45 frames to get the final prediction. The Adam optimizer [36] is employed with learning rate equal to 0.0001; this optimizerhelps the model to fast converge by the addition of momentum term and scaling term as proved in Equation (9). It combines the idea of momentum and RMSprop optimizer and helps to avoid the exponential decay of learning rate issue. Figure 2:0  
where \(\theta_{new}\) and \(\theta_{old}\) are the new and old weight value, respectively, \(\eta\) is the learning rate, \(\dot{m}\) is the momentum term, \(\hat{s}\) is the scaling term, \(\epsilon\) is the smoothing term to avoid zero division error and \(\phi\) is the element wise division operation. The loss function used is categorical cross-entropy which is very popular for multi-class classification tasks [37]. Equation (10) depicts the mathematical equation used in categorical cross-entropy loss function. Figure 2:1  
where \(E_{CC}\) is the categorical cross-entropy, \(N\) is the number of pairs available in training set, \(C\) is the number of categories, \(p_{ic}\) is a binary indicator function that detects whether the \(i^{th}\) training pattern belongs to \(c^{th}\) category and \(y_{ic}\) is a predicted probability distribution for \(i^{th}\) observation belonging to class \(c\). The metric used to gauge the performance of the model is accuracy [38], where the particular model was trained for a total of 50 epochs. Initially, the growth was exponential and became steady after a few epochs. Specifically, after each epoch, we checked whether the accuracy has been improved and became better than the best accuracy obtained. If it is better than the best accuracy, then the best accuracy is replaced by the current accuracy. All the parameters used in the model have been perfectly tuned using hyper-parameter tuning in order to obtain the most optimized results [39; 40].