A deep learning-based image registration method
Through deep learning technology, the depth homography estimation model and affine transformation are used to solve the problem of poor robustness of image registration in low-texture scenes, achieve efficient and accurate image registration, and reduce the cost of manual annotation.
Patent Information
- Application Number
- CN202410853162.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Existing image registration methods have poor registration results in low-texture, weak texture and single-texture scenes, and traditional methods have poor robustness to scale, brightness changes, and rotation. Manually labeling samples is costly and difficult to ensure accuracy.
An image registration method based on deep learning is adopted, using the deep homography estimation model and affine transformation to achieve registration between images through the feature extraction network, feature enhancement network and homography estimation network. Model training does not rely on manual annotation. Reduce sample labeling costs and improve registration accuracy and efficiency.
It improves the accuracy and robustness of image registration, is suitable for low texture, weak texture and single texture scenes, reduces feature loss, can achieve efficient registration under unsupervised conditions, and reduces sample labeling costs.
Smart Images

Figure CN118397058B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image preprocessing, and in particular to an image registration method based on deep learning. Background Art
[0002] Image registration is a technology that realizes geometric calibration of images. It obtains the mapping relationship between the reference image and the image to be registered by calculating the homography matrix. In image registration, the homography matrix plays a pivotal role. By finding the corresponding feature points in multiple images and calculating the homography matrix corresponding to these points, image registration and reconstruction can be achieved.
[0003] Traditional image registration methods mainly include pixel-based methods and feature-based methods. In feature-based image registration methods, when using feature point detection operators to detect images, a large number of ordinary and clustered feature points often appear. The homography matrix calculated based on these feature points will over-describe the local area of the image, resulting in low registration quality. However, this method is not suitable for images in low-texture scenes. At present, there are few studies on image registration methods in low-texture, weak-texture and single-texture scenes. In pixel-based image registration methods, the pixel values of the pixels in the images are mainly used to directly estimate the transformation relationship between images. First, the homography matrix between the images is initialized; then, the homography matrix is used to transform each image, and the pixel value error of the pixels in the transformed image is calculated; finally, the optimization technology is used to minimize the error function to achieve image registration. This method has a good effect on images in low-texture scenes, but it has poor robustness to images with scale, brightness changes, and rotation.
[0004] Homography matrix estimation is a key step in image registration. With the rapid development of deep learning technology, deep learning has also been applied to image registration. The basic idea is to obtain a homography matrix estimation model that can be used for image registration through learning, so that the image registration of the image pair to be registered can be achieved using the estimated homography matrix of the image pair to be registered. At present, in the supervised learning image registration method, sample labeling is required first, but the cost of manually labeling samples is high, and it is usually difficult to ensure the accuracy of labeling. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides an image registration method based on deep learning, which is suitable for image registration methods in low-texture, weak-texture and single-texture scenes. The method uses a deep homography estimation model and affine transformation to achieve image registration. At the same time, the training of the deep homography estimation model does not rely on manually annotated labels, which reduces the cost of sample annotation and improves the registration accuracy and efficiency.
[0006] The present invention provides an image registration method based on deep learning, the method comprising:
[0007] S1 selects a reference image and multiple images to be registered in the image database, and selects multiple candidate points on each image to be registered;
[0008] S2: based on a preset size, each image to be registered and the reference image are cropped in turn to obtain a plurality of image tile pairs; the pair of image tile pairs includes a reference image tile and a to-be-registered image tile;
[0009] S3 constructs a depth homography estimation model, trains the depth homography estimation model based on a training data set, and obtains a trained depth homography estimation model;
[0010] S4 sequentially inputs each pair of image tiles into the trained depth homography estimation model to obtain a homography estimation matrix corresponding to each pair of image tiles;
[0011] S5 uses the homography estimation matrix to sequentially calculate the positions of multiple candidate points on each image to be registered on the reference image to obtain multiple control point pairs;
[0012] S6 constructs a triangulated network based on multiple control point pairs, and uses affine transformation to correct each triangulated network to achieve registration between each image to be registered and the reference image.
[0013] Specifically, the deep homography estimation model in step S3 includes a feature extraction network, a feature enhancement network, a feature fusion network and a homography estimation network; the feature enhancement network includes a self-attention mechanism unit and a cross-attention mechanism unit; wherein the feature extraction network is connected to the feature enhancement network, the feature enhancement network is connected to the feature fusion network, and the feature fusion network is connected to the homography estimation network.
[0014] Specifically, step S4 further includes:
[0015] S41 sequentially inputs each pair of image tiles into a feature extraction network in the trained depth homography estimation model to extract a first feature map of the reference image tile and a first feature map of the image tile to be registered;
[0016] S42 respectively calculates the reference position code of the first feature map of the reference image tile and the to-be-registered position code of the first feature map of the to-be-registered image tile; and calculates the multi-head attention matrix of the first feature map of the reference image tile and the first feature map of the to-be-registered image tile;
[0017] S43 inputs the first feature map of the reference image tile and its corresponding reference position code, the first feature map of the image tile to be registered and its corresponding position code to be registered into the feature enhancement network, and calculates the second feature map of the reference image tile and the second feature map of the image tile to be registered after self-structural information enhancement in each pair of image tiles through the self-attention mechanism unit;
[0018] S44 calculates, through a cross attention mechanism unit, a third feature map of the reference image tile and a third feature map of the image tile to be registered after cross structural information enhancement for each pair of image tiles;
[0019] S45 inputs the third feature map of the reference image tile and the third feature map of the image tile to be registered into a feature fusion network for feature fusion to obtain a fourth feature map;
[0020] S46 converts the fourth feature map into a feature vector group and inputs it into the homography estimation network to predict the offset of the four corner points of the image tiles to be registered in each pair of image tiles relative to the four corner points on the reference image tiles, and obtains the homography estimation matrix corresponding to each pair of image tiles.
[0021] Specifically, the method for calculating the multi-head attention matrix in step S42 is:
[0022] Dot Product Attention The calculation formula is:
[0023]
[0024] Among them, Q, K, and V represent the Queue, Key, and Value matrices of the dot product attention, respectively. k is the dimension of Q and K matrices;
[0025] Each attention head i The calculation formula is:
[0026]
[0027] in, , , is a trainable parameter, indicating the matrix of Q, K, and V corresponding to the i-th attention head;
[0028] Multi-head attention matrix The calculation formula is:
[0029]
[0030] Among them, W 0 Represents a trainable weight matrix used to weight the multi-head attention results.
[0031] Specifically, the method of calculating the second feature map of the reference image tile after self-structural information enhancement and the second feature map of the image tile to be registered in each pair of image tiles by the self-attention mechanism unit in step S43 is:
[0032] For each pair of image tiles, the corresponding self-structure enhancement feature information is calculated by the following formula to obtain the second feature map of the reference image tile and the second feature map of the image tile to be registered after self-structure information enhancement; the calculation formula of the self-structure enhancement feature is:
[0033]
[0034] Where X self is the self-structural enhancement feature of the first feature map of the reference image tile or the first feature map of the image tile to be registered, X is the first feature map of the input reference image tile or the first feature map of the image tile to be registered, P x Encode the position of the first feature map of the input reference image tile or the first feature map of the image tile to be registered.
[0035] Specifically, the method of calculating the third feature map of the reference image tile and the third feature map of the image tile to be registered after cross-structure information enhancement for each pair of image tiles in step S44 through the cross-attention mechanism unit is:
[0036] For each pair of image tiles, the second feature map of the reference image tile after self-structural information enhancement and the second feature map of the image tile to be registered are respectively calculated by the following formula to obtain the third feature map of the reference image tile after cross-structural information enhancement and the third feature map of the image tile to be registered; the cross-structural enhancement feature information is obtained by adding the feedforward network FFN in the interactive structure enhancement network to the interactive structure enhancement feature information residual, and the specific calculation formula is:
[0037]
[0038] in To enhance the feature information residual of the interactive structure, the calculation formula is:
[0039]
[0040] Where X q is the self-structural enhancement feature of the first feature map of the image tile to be registered, X kv is the self-structure enhancement feature of the first feature map of the reference image tile, P q is the position code to be registered of the first feature map of the image tile to be registered, P kvEncodes the reference position of the first feature map of the reference image tile.
[0041] Specifically, the network structure of the feature extraction network in step S3 is ResNet-50; the specific network structure includes: a first convolutional layer, a first BN layer, an activation function layer, a maximum pooling layer, a second convolutional layer, a second BN layer, a third convolutional layer, a third BN layer, a fourth convolutional layer, a fourth BN layer, a fifth convolutional layer, and a fifth BN layer; the number of convolution kernels of the first to fifth convolutional layers is set to 64, 64, 128, 256, and 512 respectively, and the convolution kernel sizes are set to 7, 3, 3, 3, and 3 respectively, and the step sizes of the first, second, and third convolutional layers are set to 2, the step sizes of the fourth and fifth convolutional layers are set to 1, and the convolution kernel void rates in the fourth and fifth convolutional layers are set to 2 and 4; the size of the pooling area kernel of the maximum pooling layer is set to 3×3, and the step sizes are set to 2; the first to fifth BN layers all use batch normalization functions, the activation function layer uses linear rectification functions, and the maximum pooling layer uses regional maximum pooling functions.
[0042] Specifically, the method for training the depth homography estimation model based on the training data set in step S3 includes:
[0043] S31 obtains multiple samples from the MS-COCO public dataset, selects the middle area of each sample, and cuts out multiple reference sample tiles with a resolution of 256*256;
[0044] S32 randomly moves the coordinates of the four corner points of each reference sample tile by the same value in turn to obtain a corresponding plurality of sample tiles to be registered; the plurality of reference sample tiles and the corresponding plurality of sample tiles to be registered are used as a training data set, wherein the training data set includes a plurality of pairs of training data, and a pair of training data includes a reference sample tile and a corresponding sample tile to be registered;
[0045] S33 sequentially inputs multiple pairs of training data in the training data set into the deep homography estimation model for iterative training, and uses the homography estimation matrix output during the training process to spatially transform the sample tile to be registered onto the reference sample tile, and respectively calculates the errors of the horizontal and vertical coordinates corresponding to the four corner points in the sample tile to be registered and the four corner points in the reference sample tile after the spatial transformation;
[0046] S34 constructs a loss function of the deep homography estimation model and updates the model according to the error until the loss function converges.
[0047] Compared with the prior art, the present invention has the following beneficial effects:
[0048] (1) The present invention combines homography estimation matrix transformation and affine transformation to achieve image registration, and enhances the feature matching process through global and local features to improve the accuracy of image registration; the present invention constructs a deep homography estimation model to predict the offset of the four corner points of the image tile to be registered relative to the four corner points of the reference image tile, and then obtains the homography matrix; uses the homography estimation matrix to obtain multiple control point pairs, and then uses affine transformation to achieve registration between the image to be registered and the reference image; solves the problem of large remote sensing images and poor global matching, and the method is suitable for image registration in low-texture, weak-texture and single-texture scenes;
[0049] (2) The deep homography estimation model constructed by the present invention includes a feature enhancement network, in which a self-attention mechanism unit and a cross-attention mechanism unit are introduced. The self-attention mechanism improves the self-attention relationship between different pixels in the same tile, and the cross-attention mechanism establishes associations between different pixels in different tiles; and the features of the two tiles are fused to reduce the loss of features and better capture the matching between different features; and the global receptive field of the Transformer is used to establish a dense matching of the image tile to be registered and the reference image tile at the pixel level, and only a small number of feature points are required to achieve dense matching, thereby improving the accuracy and robustness of image registration;
[0050] (3) The method of the present invention uses the homography estimation matrix to perform spatial transformation, and uses the difference between the pixels in the changed sample tile and the reference sample tile as the loss function of the deep homography estimation model. It does not rely on manually annotated labels during the training process, which reduces the cost of sample annotation. It is an unsupervised homography estimation method, which can improve the registration accuracy and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 This is a flow chart of an image registration method based on deep learning in an embodiment of the present invention;
[0053] Figure 2 It is a technical framework diagram of the image registration method based on deep learning in an embodiment of the present invention;
[0054] Figure 3 Schematic diagram of the structure of a feature extraction network in a deep homography estimation model according to an embodiment of the present invention;
[0055] Figure 4 Schematic diagram of the structure of the feature enhancement network in the deep homography estimation model in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0057] See also Figure 1 , Figure 1 : is a flow chart of an image registration method based on deep learning in an embodiment of the present invention; an image registration method based on deep learning is provided in an embodiment of the present invention, and the method includes:
[0058] S1 selects a reference image and multiple images to be registered in the image database, and selects multiple candidate points on each image to be registered;
[0059] S2 performs cropping processing on each image to be registered and the reference image in turn based on a preset size to obtain multiple pairs of image tile pairs; the pair of image tile pairs includes a reference image tile and a to-be-registered image tile.
[0060] In the embodiment of the present invention, 120 pixels are selected as candidate points from the upper left to the lower right area at a 2m resolution on the image to be registered at the same horizontal axis interval to ensure that the candidate points are evenly distributed at different positions on the image to be registered. Then, based on the size of 256*256, a tile of the image to be registered is cut out near each candidate point, and a plurality of corresponding reference image tiles of size 256*256 are cut out from the reference image to form a plurality of pairs of image tiles.
[0061] S3 constructs a depth homography estimation model, trains the depth homography estimation model based on a training data set, and obtains a trained depth homography estimation model.
[0062] In the embodiment of the present invention, the deep homography estimation model in step S3 includes a feature extraction network, a feature enhancement network, a feature fusion network and a homography estimation network; the feature enhancement network includes a self-attention mechanism unit and a cross-attention mechanism unit; wherein the feature extraction network is connected to the feature enhancement network, the feature enhancement network is connected to the feature fusion network, and the feature fusion network is connected to the homography estimation network.
[0063] In an embodiment of the present invention, the method for training the depth homography estimation model based on the training data set in step S3 includes:
[0064] S31 obtains multiple samples from the MS-COCO public dataset, selects the middle area of each sample, and cuts out multiple reference sample tiles with a resolution of 256*256;
[0065] S32 randomly moves the coordinates of the four corner points of each reference sample tile by the same value in turn to obtain a corresponding plurality of sample tiles to be registered; the plurality of reference sample tiles and the corresponding plurality of sample tiles to be registered are used as a training data set, wherein the training data set includes a plurality of pairs of training data, and a pair of training data includes a reference sample tile and a corresponding sample tile to be registered.
[0066] In an embodiment of the present invention, a plurality of samples are synthesized by obtaining rigid transformation mainly based on displacement transformation based on the MS-COCO public dataset, and a plurality of reference sample tiles with a resolution of 256*256 are cut out from the middle area of each sample. The four vertex coordinates of the reference sample tiles are randomly moved by the same value to obtain the corresponding sample tiles to be registered. The maximum displacements in the x-direction and the y-direction are both 75% of the side length of the reference sample tiles, and a total of 50,000 pairs of training data sets of low-overlapping scenes with a minimum overlap rate of 10% are obtained.
[0067] S33 sequentially inputs multiple pairs of training data in the training data set into the deep homography estimation model for iterative training, and uses the homography estimation matrix output during the training process to spatially transform the sample tile to be registered onto the reference sample tile, and respectively calculates the errors of the horizontal and vertical coordinates corresponding to the four corner points in the sample tile to be registered and the four corner points in the reference sample tile after the spatial transformation;
[0068] S34 constructs a loss function of the deep homography estimation model and updates the model according to the error until the loss function converges.
[0069] In an embodiment of the present invention, the loss function of the depth homography estimation model is as follows:
[0070]
[0071] Among them, L represents the error of the horizontal and vertical coordinates of the corner point, N is 4, represents the i-th corner point of the sample tile to be registered, Represents the i-th corner point of the reference sample tile.
[0072] S4 inputs each pair of image tiles into the trained depth homography estimation model in turn to obtain the homography estimation matrix corresponding to each pair of image tiles.
[0073] Please refer to Figure 2 , Figure 2FIG. 4 is a technical framework diagram of an image registration method based on deep learning in an embodiment of the present invention; in the embodiment of the present invention, step S4 further includes:
[0074] S41 sequentially inputs each pair of image tiles into the feature extraction network in the trained depth homography estimation model, and respectively extracts the first feature map of the reference image tile and the first feature map of the image tile to be registered.
[0075] The feature extraction network constructed in the embodiment of the present invention sequentially extracts the first feature map F of the reference image tile in each pair of image tiles through the ResNet-50 network. 1 ' and the first feature map of the image tile to be registered. Please refer to Figure 3 , Figure 3 It is a structural schematic diagram of the feature extraction network in the deep homography estimation model of an embodiment of the present invention; the network structure of the feature extraction network in step S3 is ResNet-50; the number of convolution kernels of the first to fifth convolution layers is set to 64, 64, 128, 256, 512, respectively, and the convolution kernel sizes are set to 7, 3, 3, 3, 3, respectively, the step sizes of the first, second and third convolution layers are set to 2, the step sizes of the fourth and fifth convolution layers are set to 1, and the convolution kernel void rates in the fourth and fifth convolution layers are set to 2 and 4; the size of the pooling area kernel of the maximum pooling layer is set to 3×3, and the step sizes are set to 2; the first to fifth BN layers all adopt batch normalization function, the activation function layer adopts linear rectification function, and the maximum pooling layer adopts regional maximum pooling function.
[0076] In an embodiment of the present invention, the above-mentioned normalization function is as follows:
[0077]
[0078] Where y represents the batch normalization function, γ L represents the scaling parameter of the Lth BN layer in the trained deep twin convolutional neural network, x L , l represents the lth input of the Lth BN layer in the trained deep twin convolutional neural network, L = 1, 2, 3, 4, 5; l = 1, 2, 3, ..., m; m represents the number of elements in the input set, ∑ represents the summation operation, ε L , β L They respectively represent the batch offset parameter and the overall offset parameter of the Lth BN layer in the trained deep twin convolutional neural network.
[0079] The regional maximum pooling function is as follows:
[0080]
[0081] Among them, h represents the regional maximum pooling function, max represents the maximum value operation, the coordinate system takes the upper left corner vertex of the input matrix as the origin, the horizontal right is the positive direction of the horizontal axis, and the vertical downward is the positive direction of the vertical axis. In this coordinate system, Indicates the maximum pooling function input matrix located at the horizontal coordinate N x With the vertical coordinate N y The element value at , ϵ represents the symbol, i and j represent the horizontal and vertical coordinates of the upper left corner vertex of the pooling area in the input matrix of the maximum pooling function, and k represents the size of the pooling kernel.
[0082] S42 respectively calculates the reference position code of the first feature map of the reference image tile and the to-be-registered position code of the first feature map of the image tile to be registered; and calculates the multi-head attention matrix of the first feature map of the reference image tile and the first feature map of the image tile to be registered.
[0083] In an embodiment of the present invention, the method for calculating the multi-head attention matrix in step S42 is:
[0084] The calculation formula of dot product attention (Q, K, V) is:
[0085]
[0086] Among them, Q, K, and V represent the Queue, Key, and Value matrices of the dot product attention, respectively. k is the dimension of Q and K matrices;
[0087] Each attention head i The calculation formula is:
[0088]
[0089] in, , , is a trainable parameter, indicating the matrix of Q, K, and V corresponding to the i-th attention head;
[0090] Multi-head attention matrix The calculation formula is:
[0091]
[0092] Among them, W 0 Represents a trainable weight matrix used to weight the multi-head attention results.
[0093] The values of Q, K, and V are obtained by multiplying the feature vector by the initialization weight. Q and K determine the matching information between features by calculating the inner product to measure the similarity between each pixel in V. The input of the self-attention mechanism unit is the feature of a single image tile, and the input of the cross-attention mechanism is the feature of two corresponding image tiles. Therefore, after passing through the feature enhancement module, the features of the strong texture area will gradually be assigned to the weak texture area.
[0094] S43 inputs the first feature map of the reference image tile and its corresponding reference position code, the first feature map of the image tile to be registered and its corresponding position code to be registered into the feature enhancement network, and calculates the second feature map of the reference image tile and the second feature map of the image tile to be registered after self-structural information enhancement in each pair of image tiles through the self-attention mechanism unit.
[0095] In an embodiment of the present invention, the method of calculating the second feature map of the reference image tile after self-structural information enhancement and the second feature map of the image tile to be registered in each pair of image tiles by the self-attention mechanism unit in step S43 is:
[0096] For each pair of image tiles, the corresponding self-structure enhancement feature information is calculated by the following formula to obtain the second feature map of the reference image tile and the second feature map of the image tile to be registered after self-structure information enhancement; the calculation formula of the self-structure enhancement feature is:
[0097]
[0098] Where X self is the self-structural enhancement feature of the first feature map of the reference image tile or the first feature map of the image tile to be registered, X is the first feature map of the input reference image tile or the first feature map of the image tile to be registered, P x The first feature map of the input reference image tile or the first feature map of the image tile to be registered is encoded as the position.
[0099] S44 calculates, through a cross-attention mechanism unit, the third feature map of the reference image tile and the third feature map of the image tile to be registered after cross-structural information enhancement for each pair of image tiles.
[0100] In an embodiment of the present invention, the method of calculating the third feature map of the reference image tile and the third feature map of the image tile to be registered after cross-structure information enhancement for each pair of image tiles in step S44 by the cross-attention mechanism unit is:
[0101] For each pair of image tiles, the second feature map of the reference image tile after self-structural information enhancement and the second feature map of the image tile to be registered are respectively calculated by the following formula to obtain the third feature map of the reference image tile after cross-structural information enhancement and the third feature map of the image tile to be registered; the cross-structural enhancement feature information is obtained by adding the feedforward network FFN in the interactive structure enhancement network to the interactive structure enhancement feature information residual, and the specific calculation formula is:
[0102]
[0103] in To enhance the feature information residual of the interactive structure, the calculation formula is:
[0104]
[0105] Where X q is the self-structural enhancement feature of the first feature map of the image tile to be registered, X kv is the self-structure enhancement feature of the first feature map of the reference image tile, P q is the position code to be registered of the first feature map of the image tile to be registered, P kv Encodes the reference position of the first feature map of the reference image tile.
[0106] Please refer to Figure 4 , Figure 4 Schematic diagram of the structure of the feature enhancement network in the deep homography estimation model in an embodiment of the present invention; the feature enhancement network consists of two self-attention mechanism units and two cross-attention mechanism units; the image tile features are enhanced by utilizing self-structure information enhancement and cross-structure information enhancement, and the cross-attention mechanism is used to effectively guide the alignment of the two modal features.
[0107] In the embodiment of the present invention, the cross-attention mechanism introduces position encoding to maintain the position of the input sequence elements, and the first feature map of the reference image tile and the first feature map of the image tile to be registered are used as the input of the feature enhancement network. The input first feature map is regarded as a two-dimensional patch grid and two sets of embeddings are learned, named x embedding and y embedding. Each embedding is used for one axis, and the x embedding is connected with the y embedding to obtain the final position encoding P of the input feature. x . And with the help of the self-attention mechanism, the attention of the modality itself and the features between different modalities is obtained, and the image tile features are enhanced by attention, which can more effectively process the features between different modalities.
[0108] S45 inputs the third feature map of the reference image tile and the third feature map of the image tile to be registered into a feature fusion network for feature fusion to obtain a fourth feature map;
[0109] S46 converts the fourth feature map into a feature vector group and inputs it into the homography estimation network to predict the offset of the four corner points of the image tiles to be registered in each pair of image tiles relative to the four corner points on the reference image tiles, and obtains the homography estimation matrix corresponding to each pair of image tiles.
[0110] In the embodiment of the present invention, the correspondence between the image tile to be registered and the reference image tile is found by calculating the homography matrix between the two images. This 3×3 matrix contains rotation, translation and scaling information. Through the homography matrix H, any pixel point in a tile of the image to be registered can be mapped to the corresponding pixel point in the reference image tile, that is, the pixel point [u, w] in the image to be registered is mapped to the pixel point [u', w'] in the reference.
[0111]
[0112] Among them, H 11 , H 21 , ..., H 33 are the 9 parameters of the homography matrix H. The problem of finding 9 parameters is transformed into a problem of 8 parameters. The four-point parameterization provides an intuitive way to describe the homography transformation, which focuses on the position change of specific corner points in the image. This parameterization simplifies some optimization problems because it avoids directly dealing with complex matrix operations and instead focuses on the more intuitive concept of corner point displacement. , ...、 It is the offset of the four corner points of the image tile to be registered in each pair of image tiles relative to the four corner points on the reference image tile.
[0113]
[0114] Once the displacements of the four corner points are known, H can be easily 4point Convert to H matrix, The conversion can be achieved using a normalized direct linear transformation algorithm. The homography transformation is defined based on the position changes of the four corner points in the image tile to be registered. The position difference (i.e., offset) of each corner point between the image tile to be registered and the reference image tile is used to represent the homography. These offsets can be organized into an 8-degree-of-freedom "corner offset" matrix. There is a one-to-one correspondence between the "corner offset" matrix and the traditional 3×3 matrix representation of the homography. That is, given a "corner offset" matrix, a corresponding 3×3 homography matrix can be uniquely determined. .
[0115]
[0116] S5 uses the homography estimation matrix to sequentially calculate the positions of multiple candidate points on each image to be registered on the reference image to obtain multiple control point pairs;
[0117] S6 constructs a triangulated network based on multiple control point pairs, and uses affine transformation to correct each triangulated network to achieve registration between each image to be registered and the reference image.
[0118] In the embodiment of the present invention, a dense image triangulation network is constructed based on the control point pairs, and each triangular face is corrected respectively by using affine transformation, and the affine transformation is performed by using the following expression:
[0119]
[0120] Among them, a 1 、a 2 、a 3 、a 4 、a 5 、a 6 are the 6 parameters of the affine transformation, a 1 、a 2 、a 3 、a 4 is the rotation parameter, a 5 、a 6 is the translation parameter, , are the u and w coordinates before affine transformation, , are the u' and w' coordinates after affine transformation.
[0121] The six coefficients in the above formula are calculated according to the three vertices of the triangle, and then the triangle on the image to be registered is corrected to the triangle on the reference image according to the polynomial, thus completing the precise registration between the image to be registered and the reference image.
[0122] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0123] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0124] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0126] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A deep learning-based image registration method. It is characterized in that The method comprises: S1 selects a reference image and multiple images to be registered in the image database, and selects multiple candidate points on each image to be registered; S2: based on a preset size, each image to be registered and the reference image are cropped in turn to obtain a plurality of image tile pairs; the pair of image tile pairs includes a reference image tile and a to-be-registered image tile; S3 constructs a depth homography estimation model, trains the depth homography estimation model based on a training data set, and obtains a trained depth homography estimation model; S4 sequentially inputs each pair of image tiles into the trained depth homography estimation model to obtain a homography estimation matrix corresponding to each pair of image tiles; S5 uses the homography estimation matrix to sequentially calculate the positions of multiple candidate points on each image to be registered on the reference image to obtain multiple control point pairs; S6 constructs a triangulated network based on multiple control point pairs, and uses affine transformation to correct each triangulated network to achieve registration between each image to be registered and the reference image; Among them, the deep homography estimation model in step S3 includes a feature extraction network, a feature enhancement network, a feature fusion network and a homography estimation network; the feature enhancement network includes a self-attention mechanism unit and a cross-attention mechanism unit; wherein the feature extraction network is connected to the feature enhancement network, the feature enhancement network is connected to the feature fusion network, and the feature fusion network is connected to the homography estimation network.
2. The method according to claim 1, It is characterized in that Step S4 further comprises: S41 sequentially inputs each pair of image tiles into a feature extraction network in the trained depth homography estimation model to extract a first feature map of the reference image tile and a first feature map of the image tile to be registered; S42 respectively calculates the reference position code of the first feature map of the reference image tile and the to-be-registered position code of the first feature map of the to-be-registered image tile; and calculates the multi-head attention matrix of the first feature map of the reference image tile and the first feature map of the to-be-registered image tile; S43 inputs the first feature map of the reference image tile and its corresponding reference position code, the first feature map of the image tile to be registered and its corresponding position code to be registered into the feature enhancement network, and calculates the second feature map of the reference image tile and the second feature map of the image tile to be registered after self-structural information enhancement in each pair of image tiles through the self-attention mechanism unit; S44 calculates, through a cross attention mechanism unit, a third feature map of the reference image tile and a third feature map of the image tile to be registered after cross structural information enhancement for each pair of image tiles; S45 inputs the third feature map of the reference image tile and the third feature map of the image tile to be registered into a feature fusion network for feature fusion to obtain a fourth feature map; S46 converts the fourth feature map into a feature vector group and inputs it into the homography estimation network to predict the offset of the four corner points of the image tiles to be registered in each pair of image tiles relative to the four corner points on the reference image tiles, and obtains the homography estimation matrix corresponding to each pair of image tiles.
3. The method according to claim 2, It is characterized in that The method for calculating the multi-head attention matrix in step S42 is: The calculation formula of dot product attention (Q, K, V) is: Among them, Q, K, and V represent the Queue, Key, and Value matrices of the dot product attention, respectively. k is the dimension of Q and K matrices; Each attention head i The calculation formula is: head i =Attention(QW i Q ,KW i K ,VW i V ) Among them, W i Q , W i K , W i V is a trainable parameter, indicating the matrix of Q, K, and V corresponding to the i-th attention head; The calculation formula of the multi-head attention matrix MultiHead(Q,K,V) is: MultiHead(Q,K,V)=Concat(head 1 ,..,head n )W 0 Among them, W 0 Represents a trainable weight matrix used to weight the multi-head attention results.
4. The method according to claim 3, It is characterized in that The method of calculating the second feature map of the reference image tile enhanced by the self-structural information and the second feature map of the image tile to be registered in each pair of image tiles by the self-attention mechanism unit in step S43 is: For each pair of image tiles, the corresponding self-structure enhancement feature information is calculated by the following formula to obtain the second feature map of the reference image tile and the second feature map of the image tile to be registered after self-structure information enhancement; the calculation formula of the self-structure enhancement feature is: X self =X+MultiHead(X+P X ,X+P X ,X) Where X self is the self-structural enhancement feature of the first feature map of the reference image tile or the first feature map of the image tile to be registered, X is the first feature map of the input reference image tile or the first feature map of the image tile to be registered, P x The first feature map of the input reference image tile or the first feature map of the image tile to be registered is encoded as the position.
5. The method according to claim 4, It is characterized in that The method of calculating the third feature map of the reference image tile and the third feature map of the image tile to be registered after cross-structure information enhancement for each pair of image tiles in step S44 through the cross-attention mechanism unit is: For each pair of image tiles, the second feature map of the reference image tile after self-structural information enhancement and the second feature map of the image tile to be registered are respectively calculated by the following formula to obtain the third feature map of the reference image tile after cross-structural information enhancement and the third feature map of the image tile to be registered; the cross-structural enhancement feature information is obtained by adding the feedforward network FFN in the interactive structure enhancement network to the interactive structure enhancement feature information residual, and the specific calculation formula is: in To enhance the feature information residual of the interactive structure, the calculation formula is: Where X q is the self-structural enhancement feature of the first feature map of the image tile to be registered, X kv is the self-structure enhancement feature of the first feature map of the reference image tile, P q is the position code to be registered of the first feature map of the image tile to be registered, P kv Encodes the reference position of the first feature map of the reference image tile.
6. The method according to claim 1, It is characterized in that The network structure of the feature extraction network in step S3 is ResNet-50; the specific network structure includes: a first convolutional layer, a first BN layer, an activation function layer, a maximum pooling layer, a second convolutional layer, a second BN layer, a third convolutional layer, a third BN layer, a fourth convolutional layer, a fourth BN layer, a fifth convolutional layer, and a fifth BN layer; the number of convolution kernels of the first to fifth convolutional layers is set to 64, 64, 128, 256, and 512 respectively, and the convolution kernel sizes are set to 7, 3, 3, 3, and 3 respectively, and the step sizes of the first, second, and third convolutional layers are set to 2, the step sizes of the fourth and fifth convolutional layers are set to 1, and the convolution kernel void rates in the fourth and fifth convolutional layers are set to 2 and 4; the size of the pooling area kernel of the maximum pooling layer is set to 3×3, and the step sizes are set to 2; the first to fifth BN layers all use batch normalization functions, the activation function layer uses linear rectification functions, and the maximum pooling layer uses regional maximum pooling functions.
7. The method according to claim 2, It is characterized in that The method for training the depth homography estimation model based on the training data set in step S3 includes: S31 obtains multiple samples from the MS-COCO public dataset, selects the middle area of each sample, and cuts out multiple reference sample tiles with a resolution of 256*256; S32 randomly moves the coordinates of the four corner points of each reference sample tile by the same value in turn to obtain a corresponding plurality of sample tiles to be registered; the plurality of reference sample tiles and the corresponding plurality of sample tiles to be registered are used as a training data set, wherein the training data set includes a plurality of pairs of training data, and a pair of training data includes a reference sample tile and a corresponding sample tile to be registered; S33 sequentially inputs multiple pairs of training data in the training data set into the deep homography estimation model for iterative training, and uses the homography estimation matrix output during the training process to spatially transform the sample tile to be registered onto the reference sample tile, and respectively calculates the errors of the horizontal and vertical coordinates corresponding to the four corner points in the sample tile to be registered and the four corner points in the reference sample tile after the spatial transformation; S34 constructs a loss function of the deep homography estimation model and updates the model according to the error until the loss function converges.
