# Gait Recognition via Deep Learning of the Center-of-Pressure Trajectory
## Materials and Methods
### Transfer Learning  
The objective was to analyze the ability of the models to generalize on new--not previously learned--gats. The first aim was to find the minimal number of strides required to tune a pretrained model for a correct classification of gaits of previously unseen individuals. Indeed, for future efficient applications, it is important to know whether gaits can be learned based on only a few strides. The second aim was to assess the model's accuracy when extra individuals were added to the dataset. The gait data from the six subjects not included in the model development were used. I applied the principles of transfer learning; the best models trained on the 30 subjects were fine-tuned based on the new gait data. First, most model parameters were frozen. That is, their trainable attributes were set to _false_; only the weights of the last two convolutional layers, and the parameters of the batch normalization layers, were kept trainable (see Figure 3). The output (softmax) layer was then replaced with a new layer with six neurons to match the new classification task. Regarding optimization, the learning rate was set to 0.0002 for the fine-tuning of the weights of the last layers. To investigate the discriminative power of the new model, the output of its untrainable part and the output of the two trainable layers, were analyzed using t-distributed stochastic neighbor embedding (t-sne, Scikit-Learn implementation) [49]. T-sne is a nonlinear dimensionality reduction algorithm that embeds high-dimensional data in a low-dimensional space of two dimensions for the purpose of visualization. Here, t-sne helped to visualize whether the segments of each individual  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{2}{c}{**30 Subjects**} & \multicolumn{2}{c}{**36 Subjects (Transfer Learning)**} \\ \hline
**Trial** & **CNN** & **sepCNN** & **CNN** & **sepCNN** \\ \hline
1 & 0.998 & 1.000 & 1.000 & 1.000 \\
2 & 1.000 & 1.000 & 0.999 & 1.000 \\
3 & 0.976 & 0.998 & 0.999 & 0.999 \\
4 & 1.000 & 0.999 & 0.999 & 1.000 \\
5 & 0.998 & 0.9  
were clustered together. New CNN and speCNN models were trained with the 4050 segments of the training set (10 epochs, batch size = 32) and then inferred on the 450 segments of the test sets. T-sne reduced the dimension of the flattened layer outputs to two dimensions (Figure 4). The new models were then trained and tested on very small samples, as follows. From the full test set containing 450 segments, 60 were randomly selected (10 per subject). Next, a variable number of random segments were drawn from the training set of 4050 segments--6, 12, 30, or 60; that is, 1, 2, 5, or 10 per subject, respectively. Finally, the overall accuracy of the test set was computed. Fifty repetitions of this procedure were conducted for each segment number (for a total of 200 repetitions). Boxplots were used to show result distributions (Figure 5). To fulfill the second objective, a dataset containing all the available data was built; that is, 108,000 footsteps divided into 27,000 segments (24,300 in the training sets, 2700 in the test set) from 36 individuals. The best CNN and sepCNN were modified for the new classification task: their 30-neuron last layers were replaced with 36-neuron dense ones. Only the last two convolutional layers were set to trainable. The accuracy was tested in 10 trials (Table 2). Figure 4: T-distributed stochastic neighbor embedding (t-sne) analysis of the last outputs of the CNNs used in transfer learning. The parameters of the best CNNs (Table 1) were frozen except for the last block of convolutional layers (trainable block, Figure 3). After training on the training set containing the gait data of six previously unseen individuals (4050 segments), the fine-tuned CNNs were fed with the test set (450 segments). The flattened outputs of the last convolutional layers (labeled-1, -2 and -3) were analyzed through t-sne to highlight the separation of the features. Note that the -3 output corresponds to the output of the non-trainable part of the CNNs.