# An Iris Image Super-Resolution Model Based on Swin Transformer and Generative Adversarial Network
## 3 Method
### Loss Function  
The loss function consists of three components: the loss function utilizing \(L_{1}\) norm, adversarial loss, and perceived loss, as shown in the following formula:  
\[L_{total} =\alpha L_{1}+\beta L_{per}+\gamma L_{G}^{Ra} \tag{5}\]  
where \(\alpha\), \(\beta\) and \(\gamma\) are the trade-off parameters to balance the weight of each loss. In Section 4.2.2, we will detail the specific values of the parameters in the experiments.  
The loss function utilizing \(L_{1}\) norm is a kind of pixel loss function which calculates the average absolute pixel difference between the generated image and the target image. It can be used to measure the pixel difference between the generated high-resolution image and the ground truth high-resolution image.  
Figure 10: Discriminator structure.  
The specific formula is as follows:  
\[L_{1} =\frac{1}{n}\sum_{i=1}^{n}\left\|\hat{\mathbf{I}}_{i}^{\mathbf{SR}}-\mathbf{I}_{ i}^{\mathbf{HR}}\right\| \tag{6}\]  
where \(n\) is the number of pixel points, \(\mathbf{I}_{i}^{\mathbf{SR}}\) is the \(i\)-th pixel point of the generated super-resolution image, and \(\mathbf{I}_{i}^{\mathbf{HR}}\) is the \(i\)-th pixel point of the target high-resolution image.  
Perceptual loss is introduced considering the structure and content of the images. The distance between the generated image and the feature representation of the target image in the pre-trained VGG network is calculated to guide the model to learn a more accurate image structure and content. The specific formula is as follows:  
\[L_{per} =\frac{1}{C_{j}H_{j}W_{j}}\left\|\phi_{j}\left(\mathbf{I}^{\mathbf{SR}} \right)-\phi_{j}\left(\mathbf{I}^{\mathbf{HR}}\right)\right\|^{2} \tag{7}\]  
where \(\phi_{j}\) is the feature image output from the \(j\)-th layer of the VGG network, and \(C_{j},H_{j},\) and \(W_{j}\) are the number of channels, height, and width of the feature map output from the \(j\)-th layer of the network.  
The training of GAN is divided into two parts: the training of the generator and the training of the discriminator. Two loss functions need to be defined: one for the generator network, which aims to provide stronger constraints and generate images with richer texture details, and one for the discriminator network, which aims to improve the ability to discriminate high-resolution images from super-resolution images. The two networks are trained alternately until convergence.  
The loss function of the generator is as follows:  
\[L_{\text{G}}^{Ra} =-\mathbb{E}_{\mathbf{I}^{\mathbf{HR}}}\left[\log\left(1-D_{Ra}\left(\mathbf{ I}^{\mathbf{HR}},\mathbf{I}^{\mathbf{SR}}\right)\right)\right]-\mathbb{E}_{\mathbf{I}^{\mathbf{SR}}} \left[\log\left(D_{Ra}\left(\mathbf{I}^{\mathbf{HR}},\mathbf{I}^{\mathbf{SR}}\right)\right)\right] \tag{8}\]  
The loss function of the discriminator is as follows:  
\[L_{\text{D}}^{Ra} =-\mathbb{E}_{\mathbf{I}^{\mathbf{HR}}}\left[\log\left(D_{Ra}\left(\mathbf{I }^{\mathbf{HR}},\mathbf{I}^{\mathbf{SR}}\right)\right)\right]-\mathbb{E}_{\mathbf{I}^{\mathbf{SR} }}\left[\log\left(1-D_{Ra}\left(\mathbf{I}^{\mathbf{HR}},\mathbf{I}^{\mathbf{SR}}\right)\right)\right] \tag{9}\]