# Pupil Refinement Recognition Method Based on Deep Residual Network and Attention Mechanism
## 2 Pupil Refinement Recognition Methods  
### Pupil Refinement Recognition Model  
The pupil refinement recognition model is based on a deep learning framework. The backbone network selects the deep residual network ResNet101 and uses its pre-trained parameters on ImageNet to remove the specific classification task part (full connection layer) [12]. The step size of the last residual block is set to 1 to avoid the spatial resolution of the pupil feature map being too small. At the same time, the BN (BatchNorm1d) layer is added to make the input of the model meet the same distribution in the training and accelerate the convergence of the network model. The pupil refinement recognition model uses the deep residual network ResNet101 as the backbone network. ResNet101 is a deep convolutional neural network consisting of 101 layers, including a 7 \(\times\) 7 convolutional layer as the input layer, followed by four stages containing several residual blocks, with each residual block consisting of two 3 \(\times\) 3 convolutional layers, and equipped with batch normalization and ReLU activation functions. This network structure aims to alleviate the gradient vanishing problem through residual connections, allowing for the training of deeper networks. In the pupil refinement recognition model, ResNet101 is used to extract features from pupil images. Its pre-training parameters are obtained on the ImageNet dataset and adjusted to adapt to pupil recognition tasks, removing specific classification task parts (fully connected layers) and making appropriate modifications to the network structure to avoid low spatial resolution of feature maps. In order to process the infrared spectrum pupil image, the network parameters of the first convolution block of the backbone network ResNet101 are different so as to obtain the low-level characteristics specific to each pupil [13]. The network parameters of other depth convolution blocks are shared by spectral data so that the pupil data for the same category will not be too different after being mapped to the feature space. The method in this article mainly consists of three parts: the backbone network ResNet101, channel attention module, and external attention module. The overall model structure is shown in Figure 1.  
In this model, the pupil image captured by infrared spectroscopy is input and pre-processed using an image preprocessing module to remove internal noise from the pupil image, providing high-quality image data for subsequent feature extraction. The ResNet101 backbone network is used to capture subtle changes in the pupil, identify weak inter-class changes, and extract different features of the pupil image. The ResNet101 backbone network consists of multiple convolutional layers, pooling layers, and residual blocks. A channel attention module is inserted after a residual block in an intermediate layer of ResNet101. This module will weight the features of different channels, emphasizing the useful channel features for pupil recognition and suppressing the influence of irrelevant channels. An external attention module is inserted before another residual block or fully connected layer at a deeper level in ResNet101. This module will further extract key features of the pupil and enhance the model's ability to identify subtle changes in the pupil. The channel attention module is used to efficiently use the effective information of different channel pupil features, suppress the influence of irrelevant components on the fine recognition of pupils, and obtain more critical and useful pupil features. The external attention module is used to enhance the expression of key features of pupils and extract more abstract and differentiated pupil features. Through the global average pooling layer, the spatial dimension of the pupil feature map in the nonspectral domain is compressed to reduce the amount of data for subsequent processing, while retaining key feature information.