## 3 Methodology
### Thin Plate Spline Control Point Prediction Module  
TPS transformation is a non-rigid deformation method based on control point interpolation. It achieves locally continuous transformation and fine-grained adjustment of  
Figure 4: Structure of the Focus Block.  
Figure 3: Structure of the Swin Transformer Block.  
the image while preserving global affine properties by minimizing the bending energy functional quantitative measure of deformation smoothness.  
In this study, the image features extracted by the encoder are fed into the TPS prediction module to estimate the spatial distribution of TPS control points. It is important to note that the generation of control points is constrained to the regions defined by the input image mask, allowing the model to focus on areas exhibiting prominent distortions or structural variations. The module outputs the total number of TPS control points across the entire image, which serves as an indicator of local deformation complexity--where a higher number of control points suggests a more complex nonlinear rectification requirement.  
This module provides critical support for the subsequent geometric reconstruction of the image and enables accurate spatial transformation and distortion correction.  
Design of the Thin Plate Spline Control Point Prediction Module  
In the TPS control point prediction module, a series of convolutional layers with different kernel configurations are employed to progressively predict an increasing number of control points, progressively configured as \(10\times 10\), \(10\times 10\), \(12\times 12\), and \(14\times 14\). The number of TPS control points increases at each stage. The control points predicted by the previous head are upsampled and integrated into the next head's prediction. These control points are then arranged to form a grid structure.  
Subsequently, a TPS transformation is applied to warp this predicted grid, aligning it with a reference grid defined on the ground-truth image. The architecture of the TPS control point prediction module is illustrated in Figure 5.  
In implementation, considering that cascading fully connected layers incurs substantial computational and storage costs, we employ one or two convolutional layers after each TPS transformation head to predict the control points. The control point computation is defined by Equation (2).  
\[q^{(t)}=h^{(t)}[P(s^{(t-1)},q^{(t-1)})]+UP[q^{(t-1)}] \tag{2}\]  
Here, \(h_{t}\) denotes the TPS transformation at layer \(t\), while \(s^{(t)1}\) and \(q^{(t)1}\) represent the feature map and control points from the \((t-1)\)-th head, respectively. The operator \(P(\cdot,\cdot)\) denotes the warping operation applied to the feature map based on the predicted control points, and \(UP[\cdot]\) refers to a custom upsampling layer for control points.  
After generating the control point map, it is passed to the decoder, which transforms the feature vectors associated with the TPS control points into the target output sequence. This produces the motion estimation flow, which is then used for loss computation. The output control point map generated by the decoder is illustrated in Figure 6.  
Figure 5: Structure of the TPS prediction module.