# Unsupervised 3D Motion Summarization Using Stacked Auto-Encoders
## 4 The Proposed Sae Scheme for Dance Sequence Summarization  
The structure of the proposed SAE is depicted in Figure 4. As is observed, an SAE includes two modes of operations; the _encoding_ and _decoding_ mode. The goal of training is to minimize a loss function, say \(L(\cdot)\) over a mean square error criterion. In particular, if \(x\) are the input data, then the loss function is expressed as \(L(x,g(\beta(x)))\). In this notation \(\beta(\cdot)\) is the overall non-linear function of the SAE encoder, whereas \(g(\cdot)\) denotes the non-linear function of the decoder. Therefore the relationship \(g(\beta(x)))\) denotes the operation of the encoding followed by the decoding. In our particular implementation, three hidden layers are used for encoding phase. As we are moving deeper and deeper in the encoding hidden layers, the number of neurons that a hidden layer consists of is reduced. This forces the encoder to compress the input signals into a lower transformed versions of them. The input signal \(\vec{x}_{k}\in R^{n}\) of the encoder are the kinematic driven attributes of 3D skeletal human's joint points (see Section 3.1). Variable \(n\) denotes the dimension of the input signal, that is, it is equal to the number of frames of the dance sequence \(N\), by the number of joints per dance \(M\), by the number of dancers \(D\). That is, \(n=N*M*D\). In our case, we focus on two dancers and on 40 humans' joints thus, \(M=40\) and \(D=2\). In addition, number \(N\) depends on the length of the dance sequence. In the current notation, we have omitted the dependence of the feature vector \(\vec{x}_{k}\) on time \(t\) just for simplicity purposes. The \(\vec{x}_{k}\) triggers the first hidden layer to generate a transformed version of it of lower dimension. In particular, the output of the first hidden layer \(\vec{h}_{k}^{(1)}\in R^{m(1)}\) is given by  
\[\vec{h}_{k}^{1}=f(W_{1}^{T}*\vec{x}_{k}+\vec{b}_{1}), \tag{1}\]  
where \(W_{1}\) is the encoding weight matrix, \(\vec{b}_{1}\) is the corresponding bias vector and \(f(\cdot)\) the sigmoid vector-valued function. Variable \(m^{(1)}\) denotes the dimension of the first hidden layer output signal. It is held that \(m^{(1)}<<n\) in order to yield a compressed version of the input signal \(\vec{x}_{k}\). In a similar way, the output of the second hidden layer transforms the hidden signals of the first layer (that is the \(\vec{h}_{k}^{(1)}\in R^{m^{(1)}}\)) into a further dimensionality reduced representation \(\vec{h}_{k}^{2}\in R^{m^{(2)}}\). Then, the ne woutput will be given as \(\vec{h}_{k}^{2}=f(W_{2}^{T}*\vec{h}_{k}^{(1)}+\vec{b}_{2})\), where \(W_{2}\) is the respective weight matrix of the second hidden layer, \(\vec{b}_{2}\) the respective bias and again \(f(\cdot)\) the sigmoid vector-valued function. It is held that \(m^{(2)}<<m^{(1)}\), so that a further compression is carried out. With the same way, the output of the second hidden layer \(\vec{h}_{k}^{2}\) is propagated to the third hidden layer to produce a new reduced version \(\vec{h}_{k}^{3}\in R^{m^{(3)}}\) of the input signal with a much lower dimension \(m^{(3)}<<m^{(2)}\). The parameters of the SAE, that is, the matrices \(W_{i}^{T}\) as well as the bias \(\vec{b}_{i}\), are given through a training procedure minimizing a least square loss function \(L(\cdot)\). The unsupervised operation of SAE is to generate as outputs, signals which are as close as possible to the input signals \(\vec{x}_{k}\). This is achieved through minimization of the following loss function. \[min\sum_{i=1}^{Q}L(\vec{x}_{k},\hat{\vec{x}}_{k}), \tag{2}\]  
where \(\hat{\vec{x}}_{k}\) denotes the approximate version of the input signal \(\vec{x}_{i}\) as generated by the encoder-decoder. This means that \(\hat{\vec{x}}_{k}=g(\beta(\vec{x}_{k}))\). Training is performed over a set of \(Q\) samples of the same form of \(\vec{x}_{k}\). Dropout is used to reduce overfitting in the training process of neural networks.