# Smart Footwear Insole for Recognition of Foot Pronation and Supination Using Neural Networks
## 2 Data Acquisition and Representation
### User Application  
The user application implemented for this work has been developed using the MS Visual Studio 2017 IDE with Windows Forms interfaces. It consists on a graphical application that allows the user to connect with the instrumented insole, train and run the deep learning system.  
In this section, the application is described and shown. Its advantages are described below:  
* Real-Time monitoring: the application allows to connect with the instrumented insole and start logging the information received and shows it in real time representing the force received from each sensor by a color scale on an image of a foot. The sampling frequency can be configured by the user. This utility is illustrated in Figure 6-left.
* Dataset generation: while the user is monitoring the instrumented insole, the information received can be stored in a csv file in order to be used lately for the neural network training process. The user tags the information received between spinator, neutral and pronator. Each entry of the dataset has eight values: the arithmetic mean of all the received values from of each sensor (seven) during each step, and the tag selected by the user. The process implemented to collect the dataset is divided in two phases: filtering and noise removal (in the embedded system), integration and normalization (in the computer). This process is explained in Figure 7. So, finally, the file will contain several steps' information with its classification. The user tag selection and the file creation can be observed in Figure 6-left.  
Figure 5: States machine.  
* Neural Network training: the second tab of the application allows the user to interact with the Deep Learning system. For the training mechanism, user can configure the number of epochs used, the learn rate and the momentum [21]. The training dataset can be selected from the computer (from the datasets stored by the \"dataset generation\" utility), or alternatively the neural network weights stored from a previous training can be used (see Figure 6-right).
* Neural Network storing: the weights calculated while training the network can be stored in the computer in order to avoid a future training. To do that, the option \"save NN weights\" must be checked (see Figure 6-right).
* Real-Time classification: after training the network, the system can be tested using the utilities presented in the third tab (see Figure 8-left). Selecting the sampling frequency, the user can monitor in real time the information received by the instrumented insole while the classification mechanism is working. The system counts the number of steps, shows the last step classification (after the three step phases are finished) and the overall classification.  
Figure 6: User Application 1: (**left**) Monitoring and Data storing, (**right**) Training.  
Figure 7: Filtering and Normalization process. (**left**) Embedded system: filtering algorithm for each sensor. (**right**) Computer: normalization algorithm and storage/classification.  
* Results generation: finally, when the working monitoring is stopped, the application shows the final results of the classification (see Figure 8-right). Positive results, negative results and the confusion matrix are shown. The classification outputs are compared with the real step type (this information is obtained experimentally with our instrumented insole thanks to the study done in [22], that will be detailed in the \"Results and Discussion\" section).  
So far, it has been explained how data is acquired, transmitted and represented in the user application. Next section will focus on the training and classification steps.