# Automatic Outdoor Patrol Robot Based on Sensor Fusion and Face Recognition Methods
## 2 Materials and Methods
### Face Recognition
#### 2.5.3 Convolutional Neural Network
* Since the length of the feature map is not necessarily a multiple of 2, there are also two schemes for edge processing:
* Ignore edges, save the extra edges directly. * Keep edges, the variable length of the feature map is filled with 0 as a multiple of 2, and then pooled. This is the edge processing method used in this study. Figure 14: The convolutional process. In the fully connected network of the CNN, the layer between the input layer and the output layer is called the hidden layer. The perceptron is calculated using the following formula:  
Connection weight: \(i\) is input neuron, \(j\) is output neuron:  
\[W_{ji}(n+1)=W_{ji}(n)+\Delta W_{ji}(n)+\alpha\Delta W_{ji}(n-1) \tag{14}\]  
Weight change (hidden neuron): \(k\) is the neuron in the output layer:  
\[\Delta W_{ji}(n)=\eta\dot{\varphi}_{j}(v_{j}(n))\sum_{k\in c}[\delta_{k}(n)W_ {kj}(n)]y_{i}(n) \tag{15}\]  
Weight change (output neuron):  
\[\Theta=[\theta ij]\,3\times 3 \tag{11}\]0  
Activation (sigmoid) function:  
\[\Theta=[\theta ij]\,3\times 3 \tag{11}\]1  
Local gradient (sigmoid): output layer:  
\[\Theta=[\theta ij]\,3\times 3 \tag{11}\]2  
Local gradient (sigmoid): hidden layer:  
\[\Theta=[\theta ij]\,3\times 3 \tag{11}\]3  
Total error:  
\[\Theta=[\theta ij]\,3\times 3 \tag{11}\]4  
Average error:  
\[\Theta=[\theta ij]\,3\times 3 \tag{11}\]5  
In Equations (14)-(21), \(W\) is the weight value of the neural network, \(ji\) is the order of the weights of the neural network (the rows and columns of the weight matrix), \(n\) is the iterative update timing, \(\eta\) is the learning rate, \(\alpha\) is the momentum, \(v\) is the total input of a single neuron, \(\delta\) is the local gradient, \(y\) is the value of the output layer neuron, \(\varphi\) is the activation function, \(e\) is the error value, \(k\) is the serial number of the output neuron, and \(d\) is the true value (ideal value). \[\Theta=[\theta ij]\,3\times 3 \tag{11}\]6 The pooling process. In the traditional perceptron structure, the sigmoid function is commonly used as the activation function. To overcome the problem of vanishing gradients in multi-layer networks, Rectified Linear Unit (ReLU) can be used instead of the sigmoid function. ReLU, also known as a modified linear unit, is a commonly used activation function in artificial neural networks and usually refers to a nonlinear function represented by a ramp function and its variants [45]. The more commonly used linear rectification function has a ramp function \(f(x)=\max(0,x)\), as shown in \[\Theta=[\theta ij]\,3\times 3 \tag{11}\]7  
In this study, the Softmax regression model was used for the final identification and classification. The Softmax regression model is an extension of the logistic regression model for multi-classification problems, wherein, the class label \(y\) can take more than two values, and Softmax regression is usually supervised [46]. In the Softmax regression, for the training set \(\{(x_{1},y_{1}),\ldots,(x_{m},y_{m})\}\), we have \(y_{(i)}\in\{1,2,\ldots,k\}\) (note that the category index here starts with 1, not 0). For a given test input \(x\), we can use the hypothesis function to estimate the probability value \(p(y{=}i\,x)\) for each category \(j\), that is, to estimate the probability of occurrence of each classification result of \(x\). Therefore, our hypothesis function will output a \(k\)-dimensional vector (the sum of the vector elements is 1) to represent the \(k\) estimated probability values. The hypothesis function \(h_{\theta}(\mathbf{x})\) has the following form:  
\[h_{\theta}\left(x_{(i)}\right)=\left[ \begin{array}{c}p(y_{1}=1|x_{1})\\ p(y_{2}=2|x_{2})\\ \cdot\\ \cdot\\ p(y_{k}=k|x_{k})\end{array} \right]=\frac{1}{\sum_{i=1}^{k}e^{\theta_{x(i)}} \left[ \begin{array}{c}e^{\theta_{1}(x_{1})}\\ e^{\theta_{2}(x_{2})}\\ \cdot\\ \cdot\\ e^{\theta_{k}(x_{k})}\end{array}