# Driver Fatigue Detection Based on Residual Channel Attention Network and Head Pose Estimation
## 3 Materials and Methods
### Facial State Recognition
Then a trainable parameter \(\alpha\), which is greater than 0 and no more than 1, is set as the weight of GAP. Relatively, the weight of the GMP layer is \(1-\alpha\). Section 4.2 describes how to train \(\alpha\). The proposed module can ensure the weight of GAP and GMP is positive. Then \(\alpha\text{F}_{\text{gmp}}\) and \((1-\alpha)\text{F}_{\text{gap}}\) are added and sent to an MLP to extract features. The MLP has only one hidden layer. The proposed module sets the parameter of reduction rate \(k\) according to [26]. The hidden layer of the MLP contains C/\(k\) neurons. Next, the sigmoid function is used to activate the output of the MLP to get the final channel weight \(\text{F}_{\text{CA}}\). \(\text{F}_{\text{CA}}\) and \(\text{M}_{\text{input}}\) are multiplied element-wise to get the final channel attention feature map of the current RCAB. \(\text{M}_{\text{input}}\) and \(\text{M}_{\text{output}}\) contain a residual \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Layer** & **Kernel Size** & **Filters** & **Stride** & **Output** \\ \hline - & \(1\times 1\) & 16 & 1 & \(56\times 56\times 16\) \\ - & \(1\times 1\) & 16 & 1 & \(56\times 56\times 16\) \\ RCAB1 & \(1\times 1\), \(3\times 3\) & 32 & 1 & \(56\times 56\times 32\) \\ Max-Pooling & \(2\times 2\) & - & 2 & \(28\times 28\times 32\) \\ RCAB2 & \(1\times 1\), \(3\times 3\) & 64 & 1 & \(28\times 28\times 64\) \\ Max-Pooling & \(2\times 2\) & - & 2 & \(14\times 14\times 64\) \\ RCAB3 & \(1\times 1\), \(3\times 3\) & 128 & 1 & \(14\times 14\times 128\) \\ Max-Pooling & \(2\times 2\) & - & 2 & \(7\times 7\times 128\) \\ FC Layer1 & 512 & FC & - & 512 \\ FC Layer2 & 512 & FC & - & 2 \\ Softmax & 2 & Softmax & - & 2 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The structure of the RCAN. connection. The calculation process of the channel attention module can be simplified as the following equations:  
\[\mathrm{F_{CA}}=\mathit{sigmoid}(\mathrm{MLP}(\mathrm{\alpha F_{gap}}+(1-\alpha) \mathrm{F_{gmp}})) \tag{1}\]  
\[\mathrm{M_{output}}=\left(\mathrm{F_{CA}}\otimes\mathrm{M_{input}}\right)\ +\ \mathrm{M_{input}} \tag{2}\]  
where \(\otimes\) denotes element-wise multiplication. MLP represents the send feature vector (\(\mathrm{\alpha F_{gap}}+(1-\alpha)\mathrm{F_{gmp}}\)) to generate the corresponding feature vector. After extracting the features of three RCABs in the RCAN, the feature vectors of the original image are aggregated into a fully connected layer. The last layer of the fully connected layer is the output of the RCAN. The eye and mouth states are classified by the RCAN. Therefore, the output contains two neurons: open/close eye or open/close mouth. Softmax classifier is used to get the probability of the output. The Softmax classifier equation is as follows:  
\[P_{i}=\frac{\mathrm{exp}(\gamma_{i})}{\sum\limits_{i=1}^{2}\mathrm{exp}( \gamma_{i})} \tag{3}\]  
where \(\gamma_{i}\) represents the output of the RCAN, while \(P(\gamma_{i})\) represents the probability of the classification result. To verify the effectiveness of RCAN, this study compares the RCAN with ResNetXt [27], InceptionV4 [28], EfficientNet [24], and added ablation experiments to verify the effectiveness of the channel attention module.