## 2 Materials and Methods
### Improved Unsupervised Homography Estimation Model
#### 2.2.2 Unsupervised Multi-Stage Homography Estimation Model for Improved Scale Invariance  
Previous studies have shown that using a multi-stage approach to progressively estimate homography can effectively handle large variations in viewpoint in input images [25, 26, 27]. Therefore, building on the improved HomographyNet introduced in Section 2.2.1, this paper proposes an unsupervised multi-scale, multi-stage homography estimation method. Initially, the input image pairs are processed into a three-level, down-sampled image pyramid. Subsequently, at different stages of the method, images of varying resolutions are used as inputs, starting with high-resolution images. Local homography transformations are estimated on the high-resolution inputs, while global homography transformations are estimated on the lower-resolution inputs. The coarse-to-fine integration refines the relationships between the homography transformations across progressively scaled images, thereby enhancing the homography estimation network's ability to learn scale invariance. The overall network architecture of the proposed method in this paper is illustrated in Figure 5. Template image \(I_{A}\) and target image \(I_{B}\) are inputted in a channel-stacked manner. Image patches of the same size are extracted at corresponding positions for downsampling, constructing a three-level image pyramid with varying resolutions. The resolution of each subsequent level in the pyramid is half of the previous one, with the resolutions of the three pyramid levels being 512 \(\times\) 512, 256 \(\times\) 256, and 128 \(\times\) 128, respectively. These three pyramid levels serve as inputs for different stages of the network. The overall network model consists of three stages, each sharing the same network structure. Each stage includes the Improved HomographyNet layer, the Tensor DLT layer, and the Spatial Transformation layer. The latter two layers draw inspiration from the work described in [15], as detailed in Sections 2.1.2 and 2.1.3, and therefore will not be elaborated on here. In the first stage, image patches of size 512 \(\times\) 512 are inputted into the homography estimation network comprising the Improved HomographyNet layer, the Tensor DLT layer, and the Spatial Transformation layer. This process yields homography matrix \(H_{1}\), which  
Figure 4: Structure of the improved HomographyNet model. Figure 5: Structure of the unsupervised multi-scale, multi-stage homography estimation network. transforms image \(P_{B}^{1}\) to \(P_{A}^{1}\), while retaining the offsets \(\Delta_{1}\) corresponding to the coordinates of the four corner points. To minimize the overall network's training error, and considering the coupling between stages, the input image resolution in the second stage is half of the previous stage. Therefore, the coordinate offsets predicted in the first stage are scaled down by a factor of 2: \(\Delta_{1}^{t}=\Delta_{1}/2\). Subsequently, \(P_{A}^{2}\) is transformed by the inverse homography transformation, \(H_{1}S\), to obtain \(\overline{P}_{A}^{2}\), where \(S\) is the scaling factor of \(1/2\). Then, \(\overline{P}_{A}^{2}\) and \(P_{B}^{2}\) are inputted into the second-stage homography estimation network, following a process similar to the first stage, resulting in \(H_{2}\) and \(\Delta_{2}\). The third stage follows the same procedure to obtain \(H_{3}\) and \(\Delta_{3}\). The final coordinate offsets in the four-point parameterized form corresponding to the entire homography matrix are:  
\[\Delta=\left(\frac{\Delta_{1}}{2}+\Delta_{2}\right)/2+\Delta_{3} \tag{12}\]  
The homography estimation networks in the first to third stages estimate homography transformations at different scales based on input images of varying resolutions, which helps improve the network's ability to learn scale invariance. The unsupervised multi-scale homography estimation network proposed in this paper trains the network in an unsupervised manner by minimizing the pixel differences between images at each stage.