# Detection of Helmet Use in Motorcycle Drivers Using Convolutional Neural Network
## 2 Materials and Methods
### Model Generation and Validation  
The use of deep learning tools such as Convolutional Neural Networks (CNN) has had excellent results in applications that deal with unstructured data such as images. This algorithm, which is based on the human visual system and takes its name from a linear mathematical operation between matrices called convolution [34], can recognize visual patterns directly from the pixels of an image [35]. These networks (CNN) typically contain three main components; the main one is the convolution operations, that consists of taking a group of nearby pixels from the input image and mathematically operating these groups against a small matrix called kernel, that goes through the entire image to finally produce a new matrix that contains certain distinctive features of the image, an example of this operation is shown in Figure 3, and we can see it described mathematically in Equation (1);  
\[Y=f(\sum_{i=1}^{n}X_{i}*W+b_{i}) \tag{1}\]  
where \(n\) refers to the number of elementes, \(*\) denotes the operation of convolution, \(b\) is the bias of outputs, \(W\) is a filter of size \(\text{Kx}\times\text{Ky}\) and \(f\) is the activation function. Another important component is pooling operations, which reduce the size of images while preserving the most important features of the image; finally, we also have nonlinear activation operations called activation functions, which are necessary to avoid learning trivial linear representations of the image [36]. In the proposed methodology will use Tensorflow [37], a second-generation technology developed by Google, specialized for the implementation of large-scale machine learning models, which supports the use of deep learning models such as CNNs. Today Google has  
Figure 3: Example of convolution operation. made available to researchers different pre-trained models, such as Inception v3, which has been shown to achieve greater than 78.1% accuracy in training the data set with more than 1 million images entitled ImageNet [38]. One of the main characteristics of Inception networks in scenarios where memory or computational capacity are limited, is that the computational cost required to run them is much lower than other types of networks such as VGGNet or its successors. Table 2 shows the architecture of the Inception v3 CNN, and the Figure 4 shows a high level diagram of the model, where 3 main sections can be identified, number one the basic convolutional block that is used for feature extraction, number two the improved inception module in which multi-scale convolutions are conducted in parallel, and the convolutional results of each branch are further concatenated, and number 3 the classifier [36; 39]. The inception V3 network consists of ReLU activation functions which can remove the back propagation vanishing gradient problem during training and reduce the training time [40]. The equation of this function is shown below. \[y=max(0,x) \tag{2}\]  
Once the CNN architecture has been established, the Transfer Learning technique will be applied, which is a tool already validated by the scientific community and presented by [PERSON] et al. [41], which allows us to reduce the time and computational cost for training the classification model of helmet use in motorcyclists, which is usually very high when training a deep learning model from scratch. This technique tries to transfer the learning from one domain to another domain, which is categorized into four groups, among which is network-based, in which it refers to the partial reuse of a pre-trained network in a certain domain, which includes the structure and connection parameters as shown in Figure 5.