## 3 Proposed Method
### Integration Module of CoT between CNN and ViT  
In the CoT_AdaptiveViT model framework, the CoT module acts as a transition module connecting the CNN feature extraction network and the Transformer encoder. The CoT module can help the model to learn fine-grained correlation information between local regions, to more accurately capture subtle differences in facial expressions and reduce the impact of lighting changes on expression features. By enhancing the correlation of local regions, the perception of expression features can be improved to better cope with the problem of blurred or missing expression features caused by lighting changes. The CoT module is proposed to make full use of the rich context between neighboring keys as a way to enhance the visual representation ability. In the paper, the CoT module is used to replace the 3 \(\times\) 3 convolutional network in the ResNet architecture, which demonstrates strong advantages in computer vision tasks such as image recognition and target detection. Unlike the use in the original paper, we use it to connect the CNN and ViT. Through the connection, the local features extracted from the CNN can be better integrated into the overall model, providing richer local information for the subsequent global feature extraction, helping to maintain the consistency between the local area features and the global expression, avoiding the distortion of local features caused by lighting changes, thus improving the stability and accuracy, ensuring the adaptability and robustness of our model in complex scenes. The overall implementation steps be divided into the overlay work of static context and dynamic context, as shown in Figure 2. Specifically, the input feature map \(X\in\mathbb{R}^{H\times W\times C}\), the size of the convolution kernel is defined as \(K\), which is used as the range of the local region. The steps of static context information acquisition are: firstly, use the \(K\times K\) convolution kernel to extract the context information, to obtain the static context representation of feature \(X\), which is denoted as \(K^{1}=Conv_{x}(X)\); the steps of dynamic context information acquisition are: splice the \(K^{1}\) obtained from the previous step and \(X\) in the channel dimension, to obtain a richer and more diversified representation of the features, and then to enhance the feature representation ability. Then, two consecutive \(1\times 1\) convolution operations (one with activation function, denoted as \(W_{\theta}\), and one without activation function, denoted as \(W_{\delta}\)), are used to obtain the attention matrix \(\Lambda\): \([K^{1},Q]\,W_{\theta}W_{\delta}\), and the weights are normalized using the Softmax function, secondly, the \(1\times 1\) convolution is used to operate on the input feature maps \(X\), which is finally multiplied by the normalized weight matrix, thus obtaining \(K^{1}\) and \(X\). Finally, multiply it by the normalized weight matrix to obtain \(K^{2}=softmax(A)*(X)\). This step utilizes the additional guidance of the static \(K^{1}\) to enhance learning capability, so it can dynamically learn the correlation of the local region and obtain dynamic contextual information. Finally, these two are summed to obtain the output of the final CoT module, as shown in Equation (1). \[CoT(X)=Conv_{x}(X)+softmax(A)*(X)\]where A denotes the attention matrix, and \(Conv_{k}\) denotes the convolution operation with convolution kernel size \(K\). In this process, the dimensions of the feature maps before and after the input are kept constant. The value of the convolution kernel \(K\) we chose is 3. By introducing the CoT module, we can make full use of the relationship between local and global features to improve the performance of the facial expression recognition model through the fusion of dynamic and static contexts.