# Human Activity Recognition Using Cell Phone-Based Accelerometer and Convolutional Neural Network
## 3 Research Methodology
### CNN for Human Activity Recognition  
A convolutional neural network, abbreviated as CNN or ConvNet, is a deep learning method that falls under the category of artificial neural networks (ANN). It is mostly applied to analyze visual imagery in common [38]. CNNs have had pioneering results over the years in an array of fields related to pattern recognition, from voice recognition to image processing and video recognition. Additionally, they also have applications in recommender systems [39], image classification, image segmentation and analysis, natural language processing [40], brain-computer interfaces [41] and financial time-series [42]. The striking feature of CNN is that it reduces the number of parameters in neural networks. This advantage has motivated researchers to build bigger models to work out sophisticated tasks, which was otherwise not achievable with classic artificial neural networks [43]. The CNN architecture consists of three layers viz. an input layer, hidden layers and an output layer. The hidden layers consist of convolutional layers which perform a dot product (Frobenius inner product) of the convolution kernel with the input matrix associated with the layers. The activation function related to this dot product is ReLU. A feature map is generated using the convolution operation. Furthermore, it contributes to the input of the next layer. Pooling layers and fully connected layers are the next type of layers that enter the picture. The pooling layers minimize the dimensions of data through the combination of the outputs of neuron clusters into a single neuron in consecutive layers, respectively. Therefore, the computational power required to process the data is reduced. On the other hand, the fully connected (FC) layer extracts the features from the previous layers along with their corresponding filters and accordingly performs classification. In this type of layer, the Softmax activation function is used to classify inputs. The outcome of this function is the probability value lying between 0 and 1. The input layer requires that the data be reshaped. In 2D CNN, the kernel moves in two directions and hence the adjective \"2D\" is used to refer to such CNNs. The input and output data of 2D CNN are 3-dimensional. Therefore, the proposed 2D CNN model is given 3-dimensional input data as the values of three accelerometer readings (\(x,y,z\)-axes). The accelerometer readings represent time-series data. It is to be noted that the individual accelerometer data of each axis are 2-dimensional. The first dimension represents the time-steps and the second dimension represent the acceleration for the respective axis. \begin{table}
\begin{tabular}{c c} \hline \hline
**Human Activity** & **Label** \\ \hline Downstairs & 0 \\ Jogging & 1 \\ Sitting & 2 \\ Standing & 3 \\ Upstairs & 4 \\ Walking & 5 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Human activities and their corresponding labels. Furthermore, the CNN networks are prone to overfitting data due to the full connectivity of its layers. Overfitting can be regularized using weight decay, skipped connections or dropout [44] methods. During the development of the 2D CNN model, we have used the dropout method to reduce overfitting. Additionally, the activity data are collected from each person involved in the experiment for each activity to minimize overfitting. After pre-processing of data is complete, each record (associated with each activity) is fed into the neural network. Once reshaping of data takes place, the convolutional layer, pooling layer, and the fully connected layers present in the hidden layer perform the necessary operation on the data with Softmax activation at the final layer. The activities can be classified into six classes which implies the creation of 6 output values, one for each activity. Figure 1 indicates the CNN model development to perform HAR. Now, we briefly describe the model development process as depicted in Figure 1. The human subject performs any one of the six activities.