# Deep Clustering Efficient Learning Network for Motion Recognition Based on Self-Attention Mechanism
## 3 Method
### Self-Attention Mechanism Fusion Depth Clustering Learning Network Model  
#### 3.2.1 Long Short Term Memory  
Because traditional neural networks only use independent data vectors each time when dealing with prediction problems, there is no concept similar to \"memory\", which is used to deal with various tasks related to \"memory\". The proposal of the recurrent  
Figure 1: Overall flow chart of algorithm. First, input the video frame data to locate and detect the key people, and then extract the features through convolution. Secondly, incorporate the self attention mechanism here to enhance the features, and then cluster through DEC. Finally, conduct behavior analysis and inference through LSTM. neural network solves the above problems to a certain extent, but it is easy to have the problem of gradient disappearing when dealing with long-term dependence problems. In addition, RNN will remember the previous state of the network during the calculation process, which greatly increases the calculation amount and the calculation time of the model. Long term short-term memory network (LSTM) introduces a gating structure so that the network can not only remember the past information, but at the same time, it can selectively forget some unimportant information to achieve the modeling of long sequences. In order to further obtain the relationship between regional features, this paper uses the depth learning network model under the self-attention mechanism to obtain the context information of the image. The algorithm model structure is shown in Figure 2.  
Among the two inputs in Figure 2, the input above is the memory state \(c_{t-1}\) of the unit, and the following input is the output \(h_{t-1}\) of the upper layer. In both outputs, the upper output is the memory state \(c_{t}\) of the next unit, and the lower output is the output \(h_{t}\) of the current layer. The three sigmoid activation functions of the intermediate structure represent three gate control units; since the output of the Sigmoid function is 0 1, the control valve mechanism can be realized. \(f_{t}\) is the forgetting gate output, which is mainly used to selectively forget the output of the previous node; \(i_{t}\) is the output value of the input gate, and \(S_{t}\) and \(h_{t-1}\) are the control, which is obtained by adding the product of the weight matrix and the output of the previous layer and the input at the current time. It is combined with the sigmoid function \(\sigma\) externally; output gate \(O_{t}\) is used to output the hidden state \(h_{t}\). \(y_{t}\) is the output of the next time, the sum of the corresponding weight matrix and the output of the current layer plus the offset term, embedded into the activation function. \(x_{t}\) is the input of the current time, and Tanh is the activation function. The specific formula is  
\[i_{t}=\sigma(\mathbf{W}_{xi}x_{t}+\mathbf{W}_{hi}h_{t-1}+b_{i}) \tag{3}\]  
\[f_{t}=\sigma\Big{(}\mathbf{W}_{xf}x_{t}+\mathbf{W}_{hf}h_{t-1}+b_{f}\Big{)} \tag{4}\]  
\[C_{t}=f_{t}C_{t-1}+i_{t}\tanh(\mathbf{W}_{xC}x_{t}+\mathbf{W}_{hc}h_{t-1}+b_{C}) \tag{5}\]  
\[O_{t}=\sigma(\mathbf{W}_{x0}x_{t}+\mathbf{W}_{h0}h_{t-1}+b_{o}) \tag{6}\]  
Figure 2: LSTM unit structure. \[h_{t}=O_{t}\tanh(C_{t}) \tag{7}\]  
\[y_{t}=\tanh(\mathbf{W}_{y}h_{t}+b_{y}) \tag{8}\]  
Among them, \(b_{t}\), \(b_{f}\), \(b_{C}\), \(b_{o}\), and \(b_{y}\) are the bias terms corresponding to the input gate, forgetting gate, cell state, output gate and output layer, respectively. \(\mathbf{W}_{x}\), \(\mathbf{W}_{hi}\), \(\mathbf{W}_{xf}\), \(\mathbf{W}_{hf}\), \(\mathbf{W}_{xc}\), \(\mathbf{W}_{hc}\), \(\mathbf{W}_{x0}\), \(\mathbf{W}_{h0}\), and \(\mathbf{W}_{y}\) are the weight matrix corresponding to the input layer to input gate, hidden layer to input gate, input layer to forgetting gate, hidden layer to forgetting gate, input layer to cell state, input layer to output layer, hidden layer to output layer.