## 3 Methodology
### Loss Function  
The wide-angle image correction network is designed to train a control point prediction structure based on TPS, which encodes the positions of TPS control points and their corresponding feature point transformations through a multi-scale feature extraction mechanism. Under the guidance of the vector direction of the optical flow field, the network quantifies the degree of feature map distortion and minimizes it during training. In this study, four loss functions are jointly incorporated to optimize the training process: pixel-wise reconstruction loss (\(L_{Re}\) ), perceptual loss (\(L_{Pe}\)), grid regularization loss (\(L_{Grid}\)), and optical flow constraint loss (\(L_{Light}\)). Among them, the reconstruction and perceptual losses supervise the correction process at both the pixel and semantic levels, guiding the network to maintain structural consistency while improving perceptual quality. The reconstruction loss aims to penalize discrepancies between the output image and the original reference image, ensuring that the generated image remains as close as possible to the target in pixel space. This loss is typically measured using Mean Squared Error (MSE) or Mean Absolute Error (MAE). In this study, MSE is adopted as the primary metric for reconstruction loss, defined as Equation (5):  
\[MSE=\frac{1}{N}\sum_{i=1}^{N}{(y_{i}-y_{i^{\prime}})^{2}} \tag{5}\]  
where \(N\) denotes the total number of pixels, \(y_{i}\) represents the pixel value of the ground-truth image, and \(yit\) is the corresponding pixel value in the generated image. The perceptual loss provides supervision from the semantic level. In this study, a VGG-16 network pretrained on ImageNet is adopted as the feature extractor. Intermediate feature representations from both the input and target images are extracted from the ReLU3_3 layer, and their Euclidean distance is computed as the perceptual loss term. This formulation enhances the quality of structural restoration and semantic consistency. The loss is defined as Equation (6):  
\[Lpe=\left\|\phi(Y)-\phi(\hat{Y})\right\|_{2}^{2} \tag{6}\]  
\(\phi(\cdot)\) denotes the intermediate features extracted from the VGG-16 network. The perceptual loss is typically computed by passing both the input (rectified) image and the target image through a pretrained neural network to obtain their intermediate feature representations. These feature maps are then used as inputs to the loss function, where the distance between them is calculated using either the Euclidean distance (L2 norm) or the Manhattan distance (L1 norm), thereby promoting semantic alignment between the predicted output and the ground truth. The grid loss constrains the alignment between adjacent deformed grid edges. In Equation (7), \(M\) denotes the number of edge tuples in grid \(m\). By maximizing the cosine similarity between adjacent edges, the corresponding edge pairs tend to become collinear. As a result, the loss reaches its minimum, ensuring structural consistency in the corrected image. \[L_{Grid}=\frac{1}{M}\sum_{(\vec{e}\uparrow\bot\vec{e}\uparrow\vec{e})\in m}{ \left(1-\frac{\left\langle\overrightarrow{e}\uparrow\bot\overrightarrow{e} \uparrow\overrightarrow{e}\uparrow\overrightarrow{e}\right\rangle}{\left\| \overrightarrow{e}\uparrow\overrightarrow{e}\uparrow\overrightarrow{e} \downarrow\right\|\cdot\left\|\overrightarrow{e}\uparrow\overrightarrow{e} \downarrow\right\|}\right)} \tag{7}\]  
Here, the vectors \(e_{1}\) and \(e_{t2}\) represent the edges of all consecutively deformed mesh grids in the feature map. The optical flow distance loss \(L_{Light}\) is calculated using Equation (8) as the L1 distance between the predicted and ground-truth optical flows, with an exponentially increasingweighting scheme applied to emphasize regions with larger motion.