# Detection and Classification of Human Activity for Emergency Response in Smart Factory Shop Floor
## 3 TestBed Materials and Machine Learning Model
### Proposed CNN Architecture Description  
Since 2006, deep learning has attracted diverse research applications due to its superior capability over traditional algorithms. One of such deep learning is CNN. CNN have been used in speech recognition, behavior recognition, image classification, face detection, handwriting recognition, and recommender systems. In CNN, learning process is influenced by parameter sharing, sparse intervention, and equivalent representation of data [52]. In Figure 7, the control flow from data input to classification is shown. As is common with all machine learning operation, the dataset to be used is first pre-processed as this enables the would be model to be train with meaningful data. Three basic steps were taken in the pre-processing stage, and they include:  
1. Implementing a correlation test. This step is aimed at eliminating data redundancy by removing highly correlated features. Performing of correlation test also reduces the complexity and computational cost of the model. In performing correlation test, we made use of the Pearson Correlation Coefficient (PCC) given as: \[\rho_{X,Y}=\frac{\text{cov}(X,Y)}{\sigma_{X}\sigma_{Y}},\] (3) where \(\rho\) is PCC, \(\sigma_{X}\), and \(\sigma_{Y}\) are the standard deviations of \(X\) and \(Y\), respectively, and \(\text{cov}(X,Y)\) is the covariance. 2. Data balancing is done to ensure even distribution of samples in classes. An uneven distribution of the total number of class samples leads to a model that leans/favors the class with majority sample, while the minority sample class(es) suffers. 3. The data is converted into an image format. CNN was original meant for image classification, but, over the years, it has evolved and is now being used for both time series classification and feature extraction [53]. As CNN is the algorithm of choice in this paper (mainly due to its high accuracy), there is need to convert the dataset to be used into an image format to be recognized by the CNN. Figure 6: Visualization and saving of the RP-LIDAR data using RoboStudio application. The imbalance data can be resolved by a process of either undersampling or oversampling. The former leads to loss of (probably) important data as it involves reducing the number of samples in the majority class(es) till it equals that of the minority class. However with oversampling, data loss would no longer occur, and, by using the Adaptive Synthetic (ADASYN) algorithm, synthetic data of the minority class are generated to level up with that of the majority class [54]. The structure of the CNN model used in this paper is presented in Figure 8. It consists of two convolutional layers, each of which is followed by a max pooling layer. Max pooling is carried out to reduce the dimension of the dataset. The convolutional layers have 128 and 64 filters, respectively, and are activated using the Rectified Linear Unit (ReLU) activation function. At the end of the second max pooling layer is a dropout layer, followed by a flatten layer. The output of the flatten layer is fed as input for the fully connected (FC) layer. The FC layers is made up of two dense layers separated by a dropout layer. The primary aim of dropout layers is for the model to unlearn a portion of the previous stage, hence reducing overfitting. Finally, the output layer which gives the final classification result. Basically, CNN is a multi-layer neural network made of convolution layers (c-layers) and sub-sampling layers (s-layers) [55]. While the c-layer is for feature extraction, the s-layer is used for feature mapping. One common challenge faced by CNN is the high dimentionality, resulting in overfitting of classifiers. This problem, however, is solved by the pooling process (sub-sampling or down-sampling).