An image registration method based on Swin Transformer and CNN dual-branch coupling

By combining the dual-branch coupling network of Swin Transformer and CNN in image registration, the problem of insufficient long-distance mapping and local detail capture capabilities in image registration is solved, and efficient image registration accuracy and speed are achieved.

CN115082293BActive Publication Date: 2024-09-06NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210650873.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-10
Publication Date
2024-09-06
Estimated Expiration
2042-06-10

AI Technical Summary

Technical Problem

Existing deep learning-based image registration methods have performance limitations in capturing long-range mapping relationships and local detail information in images, resulting in insufficient registration accuracy and speed.

Method used

Using a dual-branch coupling network structure based on Swin Transformer and CNN, the self-attention features of Swin Transformer and the convolutional features of CNN are complementary and integrated through a two-way interaction mechanism. A dual-branch feature coupling module is designed to enhance the generalization ability and features of the model. expressiveness.

Benefits of technology

Significantly improves the accuracy and speed of image registration, can be trained in an unsupervised end-to-end model without additional labels, and achieves efficient capture and matching of image registration tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082293B
    Figure CN115082293B
Patent Text Reader

Abstract

The invention discloses an image registration method based on Swin Transformer and CNN dual-branch coupling. The method comprises the following steps: 1. performing standard preprocessing steps such as gray value normalization, center cropping and resampling on all images in the original data; 2. splicing the floating image and the fixed image and sending them to the registration network, and passing through the two encoder branches of Swin Transformer and CNN in parallel; 3. at each stage of Swin Transformer, the Swin Transformer feature map and the CNN feature map of the corresponding resolution are subjected to feature interaction and fusion through the dual-branch feature coupling module; 4. the decoder adaptively adjusts the deep features from the encoder and the features from the upper layer, and finally outputs the deformation field between the floating image and the fixed image; 5. the floating image and the deformation field are input into the spatial transformation network to obtain the registered image. 6. calculating the similarity loss between the registered image and the fixed image and the regularization loss of the deformation field, and training the network through back propagation. The invention uses Swin Transformer and CNN dual branches for feature extraction, fully utilizing the advantages of the two branches, and realizing feature complementarity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image registration, and in particular, is an optimization method for effectively improving image registration performance. Technical Background

[0002] Deformable image registration (DIR) is a basic task in image processing, which has important clinical application value and has attracted the attention of many scholars in recent years. Many traditional registration methods minimize the cost function in an iterative manner. However, these methods involve a lot of calculations and it takes a lot of time to register a pair of images. In recent years, with the rapid development of deep learning (DL), image registration research based on deep learning has attracted widespread attention from researchers with its advantages of short time consumption and high accuracy. Generally speaking, methods based on deep learning can be divided into supervised methods and unsupervised methods. In image registration, the real deformation field is very difficult to obtain, and the real deformation field manually labeled may introduce unnecessary errors. Therefore, supervised learning-based methods generally obtain deformation field labels through traditional algorithms or simulated deformation. However, the registration accuracy of these methods is highly dependent on the quality of the generated deformation field. Because unsupervised learning-based methods do not require a real deformation field, the network can be trained based on the similarity between the registered image and the fixed image, so research in this direction is gradually increasing. In recent years, a large number of unsupervised image registration methods based on convolutional neural networks (CNN) have been proposed, and all have achieved good results. However, due to the constraints of the convolution kernel, CNN cannot effectively capture the long-range mapping relationship between moving and fixed images, thus limiting its performance.

[0003] Recently, Transformer-based network structures have been introduced into various computer vision tasks due to their powerful performance. Unlike convolution operations, the self-attention mechanism in Transformer has an effective receptive field of infinite size, which enables Transformer to capture long-range spatial information. Although the general Transformer has strong long-range modeling capabilities and can effectively capture long-range position correspondences, there are too many voxels in the image registration task, and it is difficult for the network to find the true corresponding voxel pairs. At the same time, due to the characteristics of the convolution kernel, CNN is much better than Transformer in capturing local detail information. In addition, Transformer divides the original image into multiple windows, and there is a lack of interaction between windows. In the image registration task, due to the different positions of the corresponding voxel pairs of the fixed image and the floating image, they are likely to exist in two different windows, making it difficult for them to match each other. In order to enhance the efficiency of capturing local relationships, Swin Transformer local window self-attention greatly improves efficiency while improving performance. Swin Transformer calculates self-attention under each window, and introduces a shift window operation in order to better interact with other windows. Shifting windows performs very well in general visual tasks. In practice, it is indirectly achieved by shifting feature maps. In image registration tasks, such operations may not be very meaningful, and the positional relationship of corresponding points in different windows cannot be effectively captured. The convolution kernel of CNN slides on overlapping feature maps, which can effectively avoid the situation where corresponding points in different windows in Transformer cannot be captured. Summary of the invention

[0004] The present invention discloses an image registration method based on dual-branch coupling of Swin Transformer and CNN. The method designs a novel dual-branch coupled network structure, which is a U-shaped network composed of a classic encoder and a decoder. The encoder consists of a Swin Transformer branch and a CNN branch, and can effectively utilize the self-attention features based on Transformer and the convolution features based on CNN. By adopting a feature coupling module, the feature mapping of Swin Transformer and the feature mapping of CNN are complementarily fused in an interactive manner, which fully promotes the feature expression capabilities of the two encoder branches, thereby further improving the registration performance.

[0005] The technical solution to realize the present invention is: an image registration method based on Swin Transformer and CNN dual-branch coupling, comprising the following steps:

[0006] Step 1: Perform standard preprocessing of grayscale normalization, center cropping, resampling and affine transformation on all images in the original data;

[0007] Step 2: The floating image and the fixed image are stitched together and sent to the registration network, passing through the two encoder branches of SwinTransformer and CNN in parallel;

[0008] Step 3: At each stage of Swin Transformer, the Swin Transformer feature map is interacted and fused with the CNN feature map of the corresponding resolution through a dual-branch feature coupling module;

[0009] Step 4: The decoder adaptively adjusts the deep features from the encoder and the features from the upper layer, and finally outputs the deformation field between the floating image and the fixed image;

[0010] Step 5: Input the floating image and deformation field into the spatial transformation network to obtain the registered image;

[0011] Step 6: Calculate the similarity loss between the registered image and the fixed image and the regularization loss of the deformation field, and train the network through back-propagation.

[0012] Compared with the prior art, the present invention has the following significant features: (1) The Swin Transformer encoder and the CNN encoder are designed in parallel, and the self-attention features based on the Swin Transformer and the convolution features based on the CNN are integrated to enhance the generalization ability of the model. (2) A two-way interaction mechanism is adopted to promote the feature extraction capabilities of the Swin Transformer and the CNN, and the feature mappings of the two are complemented. (3) The network is an unsupervised end-to-end model, and each module is trained and inferred uniformly, without the need for additional labels for training. (4) The method of the present invention has a fast registration speed and high registration accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a flow chart of the present invention.

[0014] Figure 2 It is a network structure diagram of the present invention.

[0015] Figure 3 This is a schematic diagram of the Swin Transformer Block.

[0016] Figure 4 This is the structural diagram of the dual-branch feature coupling module.

[0017] Figure 5 It is a schematic diagram of the registration images of fixed images, floating images and different methods in the LBPA40 dataset.

[0018] Figure 6 This is a schematic diagram of the difference between the registered image and the fixed image in the LBPA40 dataset using different methods. DETAILED DESCRIPTION

[0019] The present invention designs a registration network based on the dual-branch coupling of Swin Transformer and CNN. The method adopts a parallel design, and through a two-way interaction, the self-attention feature based on Swin Transformer and the convolution feature based on CNN promote each other, enhance their respective feature representation, and thus capture the precise spatial correspondence between the input motion and the fixed image. The network structure diagram of the present invention can be found in Figure 2 .

[0020] The present invention will be further described below in conjunction with the accompanying drawings.

[0021] See also Figure 1 , the steps of the present invention are described in detail.

[0022] In the first step, all images in the original data are subjected to standard preprocessing steps such as grayscale normalization, center cropping, resampling, and affine transformation. The grayscale normalization step shrinks the image grayscale value to the [0,1] interval, and its calculation formula is as follows:

[0023]

[0024] Among them, I min and I max Respectively represent the minimum and maximum grayscale values ​​in the image.

[0025] In the second step, the floating image and the fixed image are concatenated and sent to the registration network, passing through the two encoder branches of SwinTransformer and CNN in parallel. The floating image and the fixed image are set as M and F respectively.

[0026] In the Swin Transformer branch, the input image is first divided into non-overlapping 3D image patches, each of which is 2×P×P×P in size. represents the i-th image block, where i∈{1,...,N}, is the total number of image blocks; each image block is flattened and regarded as a Token, and then a linear mapping layer is used to project each Token to a feature representation of dimension C:

[0027]

[0028] in, Represents a linear mapping, the dimension of the output z0 is N×C;

[0029] After the linear mapping layer, this branch has 4 consecutive stages. The first stage consists of a linear mapping layer and multiple Swin Transformer blocks; each of the remaining 3 stages consists of a Patch Merging layer and multiple Swin Transformer blocks; the Swin Transformer block outputs the same number of tokens as the input, and the PatchMerging layer concatenates the features of each group of 2×2×2 adjacent tokens to produce an 8C-dimensional feature embedding; a linear layer is then used to reduce the feature size of the representation to 2C; in this branch, the output of two consecutive Swin Transformer blocks is calculated as follows:

[0030]

[0031]

[0032]

[0033]

[0034] Among them, W-MSA and SW-MSA are conventional and window-blocked multi-head self-attention modules respectively; and z l Represents the output of W-MSA and SW-MSA; MLP and LN represent multi-layer perceptron and regularization layer respectively; the calculation shift window mechanism uses 3D cyclic shift to calculate self-attention, and its calculation formula is:

[0035]

[0036] Where Q, K, V represent Query, Key, and Value matrices respectively, and d represents the dimensions of Query and Key;

[0037] The CNN branch adopts a feature pyramid structure, in which the resolution of the feature map decreases with the depth of the network, but the number of channels increases layer by layer; 3D convolution is uniformly adopted, the convolution kernel size is 3×3×3, and each convolution is followed by a LeakyReLU layer, and downsampling is performed through the maximum pooling layer.

[0038] For double branch structures, see Figure 2 .

[0039] In the third step, at each stage of Swin Transformer, the Swin Transformer feature map is interacted and fused with the CNN feature map of the corresponding resolution through the dual-branch feature coupling module; the CNN branch first uses 3×3×3 convolution to extract the feature map of the upper layer after downsampling, and then uses 1×1×1 convolution to adaptively align the feature map with the Swin Transformer feature map. At the same time, the LayerNorm module is used to regularize it and add it to the Swin Transformer feature map; then, the Swin Transformer branch sends the fused features to the Swin Transformer Blocks to obtain a new feature representation; the CNN feature map is aligned through 1×1×1 convolution and BatchNorm modules and then added to the CNN feature map; finally, a 3×3×3 convolution is used to adaptively adjust the aggregated features to further improve the registration accuracy. The details of the dual-branch feature coupling module are as follows: Figure 4 shown.

[0040] In the fourth step, the decoder adaptively adjusts the deep features from the encoder and the features from the upper layer, and finally outputs the deformation field between the floating image and the fixed image. The encoder feature map is connected to the upper feature map from the decoding path through a skip connection, and then passes through two consecutive 3×3×3 convolutional layers, and uses an upsampling layer to increase the resolution of the feature map by a factor of 2; except for the last convolutional layer, each convolutional layer is followed by a LeakyReLU unit activation; finally, a 3×3×3 convolution is performed to obtain the deformation field between the input image pairs. For the specific process, please refer to Figure 2 .

[0041] The fifth step is to input the floating image and deformation field into the spatial transformation network to obtain the registered image The deformation field obtained by the spatial transformation network Perform nonlinear distortion on the floating image M. In the output image, for each voxel p, the values ​​of the eight adjacent voxels are linearly interpolated:

[0042]

[0043] in is the set of adjacent voxels of p′, q is a voxel in the set of adjacent voxels, and d is the space in the x, y, and z directions.

[0044] The sixth step is to calculate the similarity loss between the registered image and the fixed image and the regularization loss of the deformation field, and train the network through back propagation. The network loss function L consists of the image similarity term and the deformation field regularization term, and its calculation formula is:

[0045]

[0046] in represents the image similarity loss, represents the deformation field regularization loss, and λ represents the regularization parameter. The local normalized cross-correlation (LNCC) commonly used in the field of image registration is used as the image similarity loss, and its calculation formula is:

[0047]

[0048] Among them, Ω represents the spatial domain of the input image, p represents the voxel in the spatial domain, and Indicates that the size of voxel p is n 3 The average voxel value in the local window. The L2 norm of the deformation field gradient is used as the regularization loss, and its calculation formula is:

[0049]

[0050] in is the difference field between adjacent voxels in Ω, here referred to as the gradient field.

[0051] The effect of the present invention can be further illustrated by the following simulation experiment:

[0052] Simulation conditions

[0053] The simulation of the present invention uses two three-dimensional brain data sets, Mindbogle101 and LBPA40.

[0054] Mindboggle101 and LPBA40 contain 101 T1-weighted MR images and 40 T1-weighted MR images, respectively. Each image of Mindboggle101 has a segmentation mask with 25 anatomical markers, and each image of LPBA40 has a segmentation mask with 56 anatomical markers. For the Mindbogle101 dataset, 42 images with 1722 pairs of images from the NKIRS-22 and NKI-TRT-20 subsets were selected for training, and 20 images with 380 pairs of images from the OASIS-TRT-20 subset were used for testing. On the LPBA40 dataset, the first 30 images with 870 pairs of images were used as the training set, and the remaining 10 images with 90 pairs of images were used as the test set. The Dice coefficient and 95% Hausdorff distance (HD95) were used to evaluate the registration results. The larger the value of the Dice coefficient, the larger the overlap between the two regions and the better the registration effect. The smaller the value of HD95, the smaller the distance between the point sets in the two regions and the better the registration effect.

[0055] The experiment was conducted under the Ubuntu 18.04 operating system. The hardware facilities used were two NVIDIA GeForce RTX 2080Ti GPUs with 11G video memory. The software environment was python 3.7. The model was implemented based on the Pytorch framework. Adam was used as the optimizer, the batch size was set to 1, the learning rate was 1e-4, and the regularization parameter λ was set to 1 on the Mindbogle101 dataset and to 5 on the LBPA40 dataset.

[0056] Simulation content

[0057] In order to test the performance of the algorithm of the present invention, the proposed image registration method based on the coupling of Swin Transformer and CNN dual branches (Proposed) is compared with other advanced registration algorithms currently in the world. The comparison methods include: VoxelMorph (VM), Vit-V-Net (VVN) and TransMorph (TM), etc. At the same time, in order to prove the effectiveness of the fusion of Swin Transformer and CNN dual encoder branches in the method of the present invention, VoxelMorph-Huge (VM-H, increasing the number of convolutional layer channels) and TransMorph-Large (TM-L, increasing the embedding dimension C, the number of Swin Transformer Blocks and the number of Heads) are also compared. The hyperparameters of all comparative experiments remain consistent.

[0058] Analysis of simulation experiment results

[0059] Table 1 shows the initial values ​​of the two evaluation indicators in the two data sets, the results of various comparison methods and the results of the method of the present invention, and also gives the inference time of each method. It can be seen that compared with other methods, the method of the present invention has the best registration accuracy on the test sets of the Mindbogle101 and LBPA40 data sets. Compared with VoxelMorph-Huge and Transmorph-Large, the method of the present invention has higher registration accuracy with less inference time, which proves the effectiveness of the complementary fusion of Swin Transformer and CNN dual branches in the method of the present invention. See the effect diagram of the method of the present invention and the comparison method for details. Figure 5-6 The simulation experimental results of the above two sets of real data sets demonstrate the effectiveness of the method of the present invention.

[0060] Table 1

[0061]

Claims

1. An image registration method based on Swin Transformer and CNN dual-branch coupling, It is characterized in that The following steps are involved: Step 1: Perform standard preprocessing of grayscale normalization, center cropping, resampling and affine transformation on all images in the original data; Step 2: The floating image and the fixed image are spliced ​​and sent to the registration network, passing through the Swin Transformer and CNN encoder branches in parallel; The second step is to splice the floating image and the fixed image and send them to the registration network, and pass through the two encoder branches of Swin Transformer and CNN in parallel. The implementation method is as follows: randomly select the floating image and the fixed image in the processed data, splice them and send them to the registration network, and pass through the two encoder branches of Swin Transformer and CNN in parallel; the floating image and the fixed image are set as M and F respectively; In the Swin Transformer branch, the input image is first divided into non-overlapping 3D image patches, each of which is 2×P×P×P in size. represents the i-th image block, where i∈{1,...,N}, is the total number of image blocks; each image block is flattened and regarded as a Token, and then a linear mapping layer is used to project each Token to a feature representation of dimension C: in, Represents a linear mapping, output z 0 The dimension is N×C; After the linear mapping layer, the branch has 4 consecutive stages; the first stage consists of a linear mapping layer and multiple Swin Transformer blocks; and each of the remaining 3 stages consists of a Patch Merging layer and multiple Swin Transformer blocks; the Swin Transformer block outputs the same number of tokens as the input, and the PatchMerging layer concatenates the features of each group of 2×2×2 adjacent tokens, resulting in an 8C-dimensional feature embedding; a linear layer is then used to reduce the feature size of the representation to 2C; in this branch, the output of two consecutive Swin Transformer blocks is calculated as follows: Among them, W-MSA and SW-MSA are conventional and window-blocked multi-head self-attention modules respectively; and z l Represents the output of W-MSA and SW-MSA; MLP and LN represent multi-layer perceptron and regularization layer respectively; the calculation shift window mechanism uses 3D cyclic shift to calculate self-attention, and its calculation formula is: Where Q, K, V represent Query, Key, and Value matrices respectively, and d represents the dimensions of Query and Key; The CNN branch adopts a feature pyramid structure, in which the resolution of feature maps decreases with the depth of the network, but the number of channels increases layer by layer; 3D convolution is uniformly adopted, the convolution kernel size is 3×3×3, and each convolution is followed by a LeakyReLU layer, and downsampling is performed through a maximum pooling layer; Step 3: At each stage of Swin Transformer, the Swin Transformer feature map is interacted and fused with the CNN feature map of the corresponding resolution through a dual-branch feature coupling module; In the third step, at each stage of Swin Transformer, the Swin Transformer feature map is interacted and fused with the CNN feature map of the corresponding resolution through the dual-branch feature coupling module; the CNN branch first uses 3×3×3 convolution to extract the feature map of the upper layer after downsampling, and then uses 1×1×1 convolution to adaptively align the feature map with the Swin Transformer feature map. At the same time, the LayerNorm module is used to regularize it and add it to the Swin Transformer feature map; then, the Swin Transformer branch sends the fused features to Swin Transformer Blocks to obtain a new feature representation; the CNN feature map is aligned through 1×1×1 convolution and BatchNorm modules and then added to the CNN feature map; finally, a 3×3×3 convolution is used to adaptively adjust the aggregated features; Step 4: The decoder adaptively adjusts the deep features from the encoder and the features from the upper layer, and finally outputs the deformation field between the floating image and the fixed image; Step 5: Input the floating image and deformation field into the spatial transformation network to obtain the registered image; Step 6: Calculate the similarity loss between the registered image and the fixed image and the regularization loss of the deformation field, and train the network through back-propagation.

2. The image registration method based on Swin Transformer and CNN dual-branch coupling according to claim 1, It is characterized in that The first step is to perform standard preprocessing of grayscale value normalization, center cropping, resampling and affine transformation on all images in the original data; The gray value normalization step shrinks the image gray value to the [0,1] interval, and its calculation formula is as follows: Among them, I min and I max Respectively represent the minimum and maximum grayscale values ​​in the image.

3. The image registration method based on Swin Transformer and CNN dual-branch coupling according to claim 1, Features: In the fourth step, the decoder adaptively adjusts the deep features from the encoder and the features from the upper layer, and finally outputs the deformation field between the floating image and the fixed image. The encoder feature map is connected to the upper feature map from the decoding path through a skip connection, and then passes through two consecutive 3×3×3 convolutional layers, and uses an upsampling layer to increase the resolution of the feature map by a factor of 2; except for the last convolutional layer, each convolutional layer is followed by a LeakyReLU unit activation; finally, a 3×3×3 convolution is performed to obtain the deformation field between the input image pairs.

4. The image registration method based on Swin Transformer and CNN dual-branch coupling according to claim 1, Features: The fifth step is to input the floating image and deformation field into the spatial transformation network to obtain the registered image Spatial Transformer Networks with Predicted Deformation Fields The floating image M is nonlinearly warped; in the output image, for each voxel p, the values ​​of the eight adjacent voxels are linearly interpolated: in is the set of adjacent voxels of p′, q is a voxel in the set of adjacent voxels, and d is the space in the x, y, and z directions.

5. The image registration method based on Swin Transformer and CNN dual-branch coupling according to claim 1, Features: The sixth step is to calculate the similarity loss between the registered image and the fixed image and the regularization loss of the deformation field, and train the network through back propagation; the network loss function L consists of the image similarity term and the deformation field regularization term, and its calculation formula is: in represents the image similarity loss, represents the deformation field regularization loss, λ represents the regularization parameter; the local normalized cross correlation LNCC in the field of image registration is used as the image similarity loss, and its calculation formula is: Among them, Ω represents the spatial domain of the input image, p represents the voxel in the spatial domain, and Indicates that the size of voxel p is n 3 The average voxel value in the local window of ; the L2 norm of the deformation field gradient is used as the regularization loss, and its calculation formula is: in is the difference field between adjacent voxels in Ω, here referred to as the gradient field.