# Gait Energy Response Functions for Gait Recognition against Various Clothing and Carrying Status
## 3 Gait Recognition Using GERF
### Training of GERF  
We optimize Global GERF and SD-GERF on a training set that includes covariate variations to make the transformed GEI discriminative under covariate variations. Suppose the whole training set contains of two subsets \(\mathcal{S}\) and \(\mathcal{D}\), where the subset \(\mathcal{S}\) and \(\mathcal{D}\) are the sets of GEI pairs of the same and different subjects, respectively. To achieve better discrimination capability, it is preferable to decrease the sum of squared distances \(D_{\mathcal{S}}\) for the same-subject pairs \(\mathcal{S}\) while increasing the squared distances \(D_{\mathcal{D}}\) for the different-subject pairs \(\mathcal{D}\). Here, \(D_{\mathcal{S}}\) and \(D_{\mathcal{D}}\) are calculated as  
\[\begin{split} D_{\mathcal{S}}&=\sum_{(I_{1},I_{2}) \in\mathcal{S}}d_{I_{1},I_{2}}^{2}&=\!\!\mathbf{f}^{T}S\mathbf{f}\\ D_{\mathcal{D}}&=\sum_{(I_{1},I_{2})\in\mathcal{D}} d_{I_{1},I_{2}}^{2}&=\!\!\mathbf{f}^{T}S\mathbf{f}\,,\end{split} \tag{9}\]  
where \(S_{\mathcal{S}}\) and \(S_{\mathcal{D}}\) are computed as \(S_{\mathcal{S}}=\sum_{(I_{1},I_{2})\in\mathcal{S}}A_{I_{1},I_{2}}\) and \(S_{\mathcal{D}}=\sum_{(I_{1},I_{2})\in\mathcal{D}}A_{I_{1},I_{2}}\), respectively.  
In addition, a regularization term \(D_{R}\) is introduced to make the GERF smoother using first-order and second-order total variations [39], that is defined as  
\[\begin{split} D_{R}&=w_{1}^{I}\sum_{i=1}^{I_{\max}} (f_{i}-f_{i-1})^{2}+w_{2}^{I}\sum_{i=1}^{I_{\max}-1}(f_{i+1}-2f_{i}+f_{i-1})^{ 2}\\ &=\!\!\mathbf{f}^{T}(w_{1}^{I}S_{R_{1}}+w_{2}^{I}S_{R_{2}})\mathbf{f}\\ &=\!\!\mathbf{f}^{T}S_{R}\mathbf{f}\end{split} \tag{10}\]  
for Global GERF, and defined as \[D_{R} =w_{1}^{l}\sum_{i=1}^{N_{l}}\sum_{j=0}^{N_{y}}(f_{i,j}-f_{i-1,j})^{2}\] \[+w_{2}^{l}\sum_{i=1}^{N_{l}-1}\sum_{j=0}^{N_{y}}(f_{i+1,j}-2f_{i,j}+ f_{i-1,j})^{2}\] \[+w_{1}^{y}\sum_{i=0}^{N_{l}}\sum_{j=1}^{N_{y}}(f_{i,j}-f_{i,j-1})^ {2} \tag{11}\] \[+w_{2}^{y}\sum_{i=0}^{N_{l}}\sum_{j=1}^{N_{y}-1}(f_{i,j+1}-2f_{i,j }+f_{i,j-1})^{2}\] \[=f^{T}(w_{1}^{l}S_{R_{1}}^{l}+w_{2}^{l}S_{R_{2}}^{l}+w_{1}^{y}S_{R _{1}}^{y}+w_{4}^{y}S_{R_{2}}^{y})f\] \[=f^{T}S_{R}f\]  
for SD-GERF, where \(w_{1}^{l}\), \(w_{2}^{l}\), \(w_{1}^{y}\) and \(w_{2}^{y}\) are weighting parameters for the first-order and second-order smoothness terms for adjacent intensities and rows, respectively. The coefficient matrices \(S_{R_{1}}^{l}\), \(S_{R_{2}}^{l}\), \(S_{R_{1}}^{y}\), and \(S_{R_{2}}^{y}\) can be easily derived referring to the previous paper [20].  
Finally, we optimize the GERF to maximize the Fisher ratio between the sum of squared distances \(D_{\mathcal{D}}\) for the different-subject pairs and those \(D_{\mathcal{S}}\) for the same-subject pairs plus the regularization term \(D_{R}\) under an \(L_{2}\) norm constraint on \(f\) as  
\[\mathbf{f}^{*}=\arg\max_{f}\frac{\mathbf{f}^{T}S_{\mathcal{D}}\mathbf{f}}{\mathbf{f}^{T}(S_{ \mathcal{S}}+S_{R})\mathbf{f}}\quad\text{s.t.}\quad\|\mathbf{f}\|=1. \tag{12}\]  
We then formulate this optimization problem as the following generalized eigenvalue problem which is similar to the well-known LDA formulation,  
\[S_{\mathcal{D}}\mathbf{f}=\lambda(S_{\mathcal{S}}+S_{R})\mathbf{f}\quad\text{s.t.} \quad\|\mathbf{f}\|=1, \tag{13}\]  
where \(\lambda\) and \(\mathbf{f}\) are an eigenvalue and its corresponding eigenvector, respectively. We therefore analytically obtain the optimal GERF \(\mathbf{f}^{*}\) in a closed-form solution by assigning the eigenvector corresponding to the largest eigenvalue without any iterations.