# Classroom Expression Recognition Based on Deep Learning
## 3 Theoretical Framework of Facial Expression Recognition
### Construction of Face Data Enhancement Model Based on Generative Adversarial Network
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Part** & **Input \(\rightarrow\) Output Shape** & **Layer Information** \\ \hline Down-samping & \((h,\,\omega,3+n_{\text{c}})\rightarrow(h,\,\omega,64)\) & CONV-(N64, K7 \(\times\) 7, S1, P3), IN, ReLU \\  & \((h,\,\omega,64)\rightarrow(\frac{1}{2},\,\frac{\omega}{128},\,128)\) & CONV-(N128, K4 \(\times\) 4, S2, P1), IN, ReLU \\  & \((\frac{h}{2},\,\frac{\omega}{128},\,128)\rightarrow(\frac{1}{2},\,\frac{ \omega}{12},\,256)\) & CONV-(N256, K4 \(\times\) 4, S2, P1), IN, ReLU \\ \hline Bottleneck & \((\frac{h}{2},\,\frac{\omega}{12},\,256)\rightarrow(\frac{1}{2},\,\frac{ \omega}{12},\,256)\) & Residual Block: \\  & \((\frac{h}{2},\,\frac{\omega}{12},\,256)\rightarrow(\frac{1}{2},\,\frac{ \omega}{12},\,256)\) & CONV-(N256, K3 \(\times\) 3, S1, P1), IN, ReLU \\  & \(\ldots\ldots\ldots\) & \(\ldots\ldots\ldots\) \\ \hline Up-sampling & \((\frac{h}{2},\,\frac{\omega}{12},\,256)\rightarrow(\frac{h}{2},\,\frac{ \omega}{128})\) & DECONV-(N128, K4 \(\times\) 4, S2, P1), IN, ReLU \\  & \((\frac{h}{2},\,\frac{\omega}{128},\,128)\rightarrow(h,\,\omega,64)\) & DECONV-(N64, K4 \(\times\) 4, S2, P1), IN, ReLU \\  & \((\frac{h}{2},\,\frac{\omega}{12},\,64)\rightarrow(h,\,\omega,3)\) & CONV-(N3, K7 \(\times\) 7, S1, P3), Tanh \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Generator network architecture. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer** & **Input \(\rightarrow\) Output Shape** & **Layer Information** \\ \hline Input Layer & \((h,\,\omega,3)\rightarrow(\frac{1}{2},\,\frac{\omega}{12},\,64)\) & CONV-(N64, K4 \(\times\) 4, S2, P1), Leaky ReLU \\ \hline Hidden Layer & \((\frac{h}{2},\,\frac{\omega}{12},\,64)\rightarrow(\frac{h}{2},\,\frac{ \omega}{12},\,128)\) & CONV-(N128, K4 \(\times\) 4, S2, P1), Leaky ReLU \\ Hidden Layer & \((\frac{h}{2},\,\frac{\omega}{12},\,128)\rightarrow(\frac{1}{2},\,\frac{ \omega}{12},\,256)\) & CONV-(N256, K4 \(\times\) 4, S2, P1), Leaky ReLU \\ Hidden Layer & \((\frac{h}{2},\,\frac{\omega}{12},\,256)\rightarrow(\frac{1}{2},\,\frac{ \omega}{12},\,512)\) & CONV-(N1512, K4 \(\times\) 4, S2, P1), Leaky ReLU \\ Hidden Layer & \((\frac{h}{2},\,\frac{\omega}{12},\,512)\rightarrow(\frac{h}{2},\,\frac{ \omega}{12},\,1024)\) & CONV-(N1024, K4 \(\times\) 4, S2, P1), Leaky ReLU \\ \hline Output Layer (Dsrc) & \((\frac{h}{2},\,\frac{\omega}{12},\,2048)\rightarrow(\frac{h}{2},\,\frac{ \omega}{12},\,1)\) & CONV-(N1, K3 \(\times\) 3, S1, P1) \\ Output Layer (Dcls) & \((\frac{h}{2},\,\frac{\omega}{12},\,2048)\rightarrow(1,\,1,\,\text{nd})\) & CONV-(N(nd), K\(\frac{h}{2}\,\,\frac{\omega}{12},\,\text{SI},\,\text{P0})\) \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Discriminator network architecture. The original loss function is cumbersome to solve and may yield multiple optimal solutions. During this process, the subtle differences between the original image and the generated image result in relatively small, squared values. Consequently, the L2 loss function is preferable to the original loss function in terms of gradient computation and convergence speed. The formula for the L2 loss function is as follows:  
\[\text{loss}(\text{x},\text{y})=\frac{1}{\text{n}}{\sum_{\text{a}=1}^{\text{n }}}(y_{\text{i}}-\text{f}(\text{x}_{\text{i}})^{2}) \tag{1}\]  
The structure of MultiResUNet is illustrated in Figure 7, where the left side represents the compression path, and the right side represents the expansion path. As shown in the figure, the compression path consists of four MultiRes Blocks, each utilizing three 3 \(\times\) 3 convolution kernels instead of the traditional 7 \(\times\) 7 convolution kernels used in U-Net, along with a maximum pooling operation. Notably, the last MultiRes Block does not perform a pooling operation; instead, its output is passed directly to the expansion path. The pooling operation serves to extract the most significant information from the feature map, reducing its size to half of the original dimensions.