Heterogeneous image matching and positioning method and system based on twin network and supervised training
Through the method based on twin network and supervised training, using the level-by-level nested feature extraction and multi-attention fusion mechanism, the ideal cross-correlation map is generated for weakly supervised training, which solves the problem of low accuracy and robustness of heterosource image matching in the existing technology. It solves the problem of poor performance and achieves high-precision and robust feature extraction and matching positioning.
Patent Information
- Application Number
- CN202111255618.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-27
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-10-27
AI Technical Summary
In the existing technology, heterogeneous image matching methods based on artificially designed features have low matching accuracy and weak robustness, and the Siamese network ignores the features of other receptive fields during the feature extraction process, resulting in the extracted features being unable to fully express the real image. Semantic information of the image.
Using methods based on twin networks and supervised training, feature extraction is optimized through discriminant loss and regression loss in the training stage, and multi-receptive field features are extracted by using step-by-step nested dense cross-layer connections and multi-attention fusion mechanisms to generate ideal Weakly supervised training is performed on cross-correlograms to improve the accuracy of matching cross-correlograms.
It improves the accuracy and robustness of heterosource image matching, ensures that the extracted feature maps can maintain low-level features and high-level features, achieves pixel-level fusion, and improves the accuracy of matching and positioning and the adaptability of the network.
Smart Images

Figure CN114022729B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image matching, and more specifically, to a heterogeneous image matching and positioning method and system based on a twin network and supervised training. Background Art
[0002] Matching guidance has high positioning accuracy, strong anti-interference ability, and good scene adaptability, and is widely used in the field of precision guidance. In order to ensure that the guidance system can work all day and has anti-interference ability under severe weather conditions, ground camouflage and other factors, the real-time image obtained by the seeker is generally an infrared image. However, the resolution of infrared images taken by satellites and other means is low and it is difficult to use them as reference images. Therefore, the data source for making reference images is generally visible light images. The imaging principles of infrared and visible light images are different, and there are huge differences in their grayscale distribution and texture characteristics, which make it difficult to match them directly.
[0003] Feature-based image matching is to extract image features and measure the similarity of the features to complete the matching. It is currently the main method for heterogeneous image matching. Since the reference image and the real-time image need to be matched in the same feature space, the matching performance of the artificially designed matching features in different scenes varies, resulting in low matching accuracy and poor adaptability of the matching method based on artificially designed features.
[0004] Patent CN113223068A discloses a multimodal image registration method and system based on deep global features. The main ideas are as follows: prepare and produce a data set; produce a data set; preprocess images; design a fully convolutional twin network structure; extract image features; obtain a similarity score map, and based on the similarity score map, use a contrast loss function to optimize the similarity score map, use a peak loss function to speed up the convergence speed, and use a sorting loss function to make the similarity distribution of positive samples close to the true distribution; jointly optimize the contrast loss, sorting loss, and peak loss, load the trained weights into the model, and read all test set data in turn to predict the translation parameters of the floating image in the reference image in the test set; determine the position of the floating image on the reference image to achieve multimodal image registration. However, this method has the following disadvantages: 1) In the process of feature extraction using the twin network, a series of convolutional layers are often used to extract high-level features, but the features of other receptive fields are ignored, so that the extracted features cannot fully express the semantic information of the real image; 2) After obtaining the similarity score map, the contrast loss function is directly used to optimize the similarity score map, but a strong optimization supervision direction cannot be proposed, which greatly tests the convergence fitting difficulty and convergence speed of the network during the training process. Summary of the invention
[0005] In response to the defects of the prior art and the need for improvement, the present invention provides a heterogeneous image matching and positioning method and system based on a twin network and supervised training. The purpose is to solve the problems that heterogeneous images cannot be directly matched and that traditional matching methods based on artificially designed features have low matching accuracy and weak robustness. Deep learning technology is used for feature extraction, so that it can automatically learn and extract matching features between two images based on the original input image and complete the matching, providing a new solution for heterogeneous image matching and positioning.
[0006] To achieve the above object, according to a first aspect of the present invention, a heterogeneous image matching and positioning method based on a twin network and supervised training is provided, the method comprising:
[0007] Training phase: Use the registered visible light-infrared image dataset as the training set, and perform the following processing on each training sample:
[0008] The visible light image is input into the first branch of the twin network to obtain the template feature map, and the infrared image is input into the second branch of the twin network to obtain the search feature map. The template feature map and the search feature map are normalized and correlated to generate a matching cross-correlation map. According to the actual matching positions of the visible light template map and the infrared search map, an ideal cross-correlation map is generated as the supervision information of the matching cross-correlation map.
[0009] Input the matching cross-correlation map and the ideal cross-correlation map into the discriminator, output the discrimination result of the input information as a whole, and calculate the discrimination loss; perform position regression on the matching cross-correlation map to obtain the estimated position of the visible light image on the infrared image; calculate the overall loss based on the estimated position and the actual matching position;
[0010] If the overall loss and the discriminant loss function converge at the same time, the training is completed. Otherwise, the discriminant loss is fed back to the twin network, and the parameters of the twin network are adjusted through back propagation to make the discriminant loss smaller and smaller.
[0011] Application stage: The visible light image is input into the first branch of the trained twin network, and the infrared image is input into the second branch of the trained twin network. The two outputs of the twin network are normalized and correlated. The calculation results are input for position regression to obtain the estimated position of the visible light image on the infrared image.
[0012] Preferably, the first branch of the twin network and the second branch of the twin network are identical and share weights and network parameters, and each branch includes:
[0013] Feature extraction module, used to extract features of different receptive fields;
[0014] The feature fusion module is used to fuse the two features with the smallest receptive field difference. The new feature obtained is then fused again with the feature with the second smallest receptive field difference, and so on. A step-by-step nested fusion method is adopted to fuse all the extracted receptive field features into a feature map.
[0015] Beneficial effect: The feature extraction module and feature fusion module of the twin network in the prior art both use concatenated convolutional layers for feature extraction, which results in only high-level features being extracted, but ignores the features of other receptive fields, so that the extracted features cannot fully express the semantic information of the real image. In the feature extraction module of the present invention, a series of nested dense cross-layer connections are used for feature extraction. Due to the use of upsampling, downsampling and skip connection network operations, the semantic differences between multiple features are reduced, and the difficulty of feature fusion is reduced; in addition, the prior art directly merges the extracted features on the channel, which results in the inability to learn the weights of features of different receptive fields, resulting in the same proportion of features in each receptive field. This fusion mechanism cannot pay attention to the spatial weights of local features and overall features in the channel, and can only fuse the entire channel features but cannot achieve pixel-level fusion. The final result is that the extracted features are distorted, which will directly affect the subsequent matching performance. The present invention uses a feature fusion module to perform step-by-step nesting and fuse features of different receptive field depths, so that the extracted feature map can not only maintain its low-level features such as edge contours, but also ensure high-level features such as texture details. When the feature map is used to perform normalized correlation operations and position estimation, the accuracy of matching and positioning is improved.
[0016] Preferably, the new feature obtained by fusing the two features with the smallest receptive field difference is as follows:
[0017]
[0018]
[0019] Among them, F fuse () represents the fusion feature, f n represents the feature with receptive field level n, α n represents the weight, n represents the receptive field level, and H() represents the convolution function.
[0020] Beneficial effect: The prior art directly merges the extracted features on the channel, which results in that the fused features cannot pay attention to the spatial weights of the local features and the overall features in the channel, and can only fuse the entire channel features but cannot achieve pixel-level fusion. The final result is that the extracted features have too much useless information, which is far from the real image semantic information, and then affects the subsequent matching performance. The present invention uses a multi-attention fusion mechanism to learn the correlation between the two features, and performs weight learning at each feature spatial position to obtain the correlation of the same spatial position between the two feature maps as the weight. The pixels of the two features are fused according to a certain weight. Due to the step-by-step nesting, the features of different receptive field depths are fused, so that the fused feature map can not only maintain its low-level features such as edge contours, but also ensure that it has high-level features such as texture details, thereby improving the accuracy of feature extraction and the matching rate of the image.
[0021] Preferably, the face value calculation formula of the ideal cross-correlation graph at position (x, y) is as follows:
[0022]
[0023] Among them, (x0, y0) represents the matching position point.
[0024] Beneficial effect: The prior art measures the matching correlation coefficient by simply using the cosine distance between any position and the matching position to measure the correlation between the two. However, although the cosine distance is suitable for measuring the correlation of feature pixels during matching, in the ideal cross-correlation diagram, what is directly measured is the matching accuracy between the predicted matching position and the actual position. The cosine distance cannot intuitively express the offset of the matching position, so it cannot play a good supervisory effect when it is subsequently input into the discriminant network. The present invention measures the spatial distance between any position and the matching position by using the above formula. The closer the distance to the matching position, the lower the correlation coefficient. Designing this cross-correlation diagram as the ideal cross-correlation diagram corresponding to each matching position ensures that the cross-correlation diagram has only one main peak, and the main peak decreases quickly. When the difference is more than a dozen pixels, the correlation coefficient will gradually approach 0. At the same time, the main peak occupies a certain position area, which can also effectively suppress the problem that the network is difficult to correctly fit the cross-correlation diagram due to the imbalance of the number of positive and negative samples, thereby achieving the effect of improving the robustness of the network.
[0025] Preferably, the discriminator comprises six layers of convolutional blocks, wherein:
[0026] The convolution kernel size of the first convolution layer is 2 and the stride is 1, which is used to reduce the feature map size to 128×128;
[0027] The convolution kernel size of the middle four layers is 4 and the stride is 2, which is used to reduce the size of the feature map;
[0028] The last layer of convolution kernel size is 1, which is used to reduce the dimension of the feature map.
[0029] Beneficial effects: In view of the lack of supervision of the true registration position in the prior art, the present invention uses a discriminator network to distinguish between the ideal cross-correlation graph and the matching cross-correlation graph. By adding the discriminant loss, the parameters of the twin network are continuously adjusted through back propagation to reduce the discriminant loss, thereby realizing continuous optimization of the twin network, so that the extracted feature map is closer to the real image semantic information, thereby improving the subsequent matching accuracy.
[0030] Preferably, the discrimination loss L D-net The calculation formula is as follows:
[0031]
[0032] Among them, x represents the input real sample, λ represents the gradient penalty weight, x′ represents the generated sample, b represents the fixed offset, and E x [] represents the expectation of the real sample, D() represents the probability that the discriminator judges whether the real sample is real, D(G(x)) represents the probability that the discriminator judges whether the sample generated by the generator is real, and G() represents the sample generated by the generator. represents the gradient penalty term, and ‖‖2 represents the 2-norm.
[0033] Beneficial effects: In view of the problems of difficult training and slow convergence speed in the existing loss technology, the present invention imposes a gradient penalty on the independence of each sample. Since the gradient penalty makes G(x) closer to the real sample x, and D(G(x)) does not exceed D(x) during the approach, the new loss function is easier to converge. In addition, a fixed offset b is added to ensure that the loss of the discriminator does not have a negative value and cause back propagation errors.
[0034] Preferably, position regression is performed on the matching cross-correlation graph to obtain an estimated position of the visible light image on the infrared image, which is achieved by a regression network, wherein the regression network includes a convolution module and a fully connected module;
[0035] The convolution module is used to downsample the matching cross-correlation graph and extract features to obtain the feature f _reg ;
[0036] Fully connected module, used to _reg Perform dimension conversion and output position estimation.
[0037] Beneficial effect: In view of the lack of prediction output for regression position in the prior art, the present invention uses a regression network to input the matching cross-correlation map into the regression network to perform matching position regression, thereby obtaining the network's position estimation for image matching.
[0038] Preferably, the overall loss calculation formula is as follows:
[0039] L G-net =-L G-adv +γL G-reg +b
[0040] L G-adv =E x [D(G(x))]
[0041]
[0042] Among them, L G-net Represents the overall loss, L G-adv represents the adversarial loss, L G-reg represents the regression loss, γ represents the regression loss weight, b represents the fixed offset, E x [] represents the expectation of the real sample, D(G(x)) represents the probability that the discriminator judges whether the sample generated by the generator is real, and R() represents the predicted output of the regression network for the sample generated by the generator. represents the mean square error function.
[0043] Beneficial effect: The prior art loss only uses the comparison loss function between the predicted matching position and the actual position to adjust and optimize the network parameters, which results in the overall loss function for measuring the network being not comprehensive enough. Although there is a comparison loss for the predicted position, the network parameters are adjusted directly from the predicted position by backpropagation. Only constraints are imposed on the output results, and the ideal optimization direction cannot be intuitively perceived. Such unsupervised learning will increase the difficulty of network convergence. The present invention optimizes the overall twin network through adversarial loss and regression loss composed of mean square error, wherein the adversarial loss enables the twin network to indirectly perceive the characteristic distribution of the ideal cross-correlation graph, thereby optimizing the cross-correlation graph, and the regression loss is a constraint on the matching position, ensuring that the regression network can correctly estimate the position of the matching cross-correlation graph, thereby optimizing the twin network and the regression network, and achieving a more accurate matching rate.
[0044] To achieve the above-mentioned object, according to a second aspect of the present invention, a heterogeneous image matching and positioning system based on a twin network and supervised training is provided, the system comprising: a computer-readable storage medium and a processor;
[0045] The computer-readable storage medium is used to store executable instructions;
[0046] The processor is used to read the executable instructions stored in the computer-readable storage medium to execute the heterogeneous image matching and positioning method based on the twin network and supervised training described in the first aspect.
[0047] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:
[0048] (1) The present invention performs feature extraction through a twin network with a multi-receptive field feature fusion module. Due to the step-by-step nesting and fusion of features with different receptive field depths, the extracted feature map can not only maintain its low-level features such as edge contours, but also ensure high-level features such as texture details. When the feature map is used to perform normalized correlation operations and perform position estimation, the accuracy of matching and positioning is improved.
[0049] (2) The present invention performs weak supervision by using the aligned visible light image and infrared image to generate an ideal cross-correlation graph, and inputs the matching cross-correlation graph and the ideal cross-correlation graph into the discriminant network together. The constructed twin network is trained by back-propagation through the discriminant loss function, and the network parameters are adjusted until the loss function converges to complete the training of the twin network. The matching cross-correlation graph is optimized to narrow the difference between the two. Such weak supervision makes the matching cross-correlation graph closer to the ideal effect and easier to fit, thereby improving the matching accuracy and making the network more adaptable. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flow chart of a heterogeneous image matching and positioning method based on a twin network and supervised training provided by the present invention.
[0051] Figure 2 A specific flow chart of a heterogeneous image matching and positioning method based on a twin network and supervised training provided by the present invention.
[0052] Figure 3 This is a schematic diagram of the overall network model structure provided by the present invention.
[0053] Figure 4 Schematic diagram of the twin network structure provided by the present invention.
[0054] Figure 5 This is a schematic diagram of the regression network structure provided by the present invention.
[0055] Figure 6 This is a schematic diagram of the discrimination network structure provided by the present invention.
[0056] Figure 7 The feature extraction experimental results of the twin network provided by the present invention, wherein the first column is the input infrared and visible light images, and the second column is the corresponding output feature extraction results.
[0057] Figure 8 The experimental comparison results of the matching cross-correlation graph provided by the present invention, wherein the first column is the input infrared and visible light images, and the second column is the matching cross-correlation graph generated by the algorithm of the present invention.
[0058] Fig. 9The experimental comparison results of street scene images extracted by the twin network feature provided by the present invention, wherein the first column is the input infrared and visible light images, the second column is the feature results extracted by using SiameseNCR, and the third column is the feature results extracted by the algorithm of the present invention.
[0059] Fig.10 The experimental comparison results of the twin network feature extraction of road scene images provided by the present invention, wherein the first column is the input infrared and visible light images, the second column is the feature results extracted using SiameseNCR, and the third column is the feature results extracted by the algorithm of the present invention.
[0060] Fig.11 The experimental comparison results of the matching cross-correlation graph provided by the present invention, wherein the first column is the input infrared and visible light images, the second column is the matching cross-correlation graph obtained by using SiameseNCR, and the third column is the matching cross-correlation graph after the algorithm of the present invention is optimized. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0062] The present invention provides a heterogeneous image matching and positioning method based on a twin network and supervised training, and its overall flow chart is as follows: Figure 1 As shown, the following steps are included:
[0063] S1. Build a twin network Net sia , respectively extract features from the image to be matched T and the heterogeneous search image I to obtain the corresponding feature map F T and F I ;
[0064] S2. Get the feature map F to be matched T Search feature graph F in heterogeneous source I Traverse up, perform normalized correlation operation at each traversal position, and obtain the matching cross-correlation graph M gen ;
[0065] S3. Build regression network Net reg , for the matching cross-correlation graph M gen Perform position regression and output the relative position estimation of the image to be matched T on the heterogeneous image I;
[0066] S4. Construct an ideal cross-correlation map M based on the actual position informationide , as the supervision information for matching cross-correlation graphs;
[0067] S5. Build the discriminant network Net dis , construct the discriminative loss and the overall generative loss function, and train the network.
[0068] The training network process of this embodiment uses a data set of registered visible light and infrared images for heterogeneous matching and positioning. The data comes from the public data set of vehicle road scenes released by Kaist Laboratory. In this embodiment, the visible light image is used as the template image T with a size of 128×128, and the infrared image is used as the heterogeneous search image I with a size of 256×256. The specific implementation process diagram is as follows: Figure 2 As shown in the figure, the overall idea of this method is:
[0069] The visible light image and the infrared image are simultaneously input into the twin network to extract the similar features of the two. After the correlation layer, the matching cross-correlation map M of the two sets of features is obtained. gen , the matching cross-correlation graph is used to obtain the estimated position through the regression network. On the other hand, the matching cross-correlation graph M gen Input to the discriminant network, and the ideal cross-correlation graph M ide is also input into the discriminant network, which measures the distance between the two cross-correlation graphs. The purpose of the discriminant network is to match the cross-correlation graph M gen With the ideal cross-correlation diagram M ide As far as possible, separate the matching cross-correlation graph M gen The ideal cross-correlation diagram M is false. ide At the same time, the generative network gets feedback from the discriminative network’s discriminative results and adjusts its network parameters so that the cross-correlation graph it generates is as true as possible after being judged by the discriminative network. The overall network model is as follows: Figure 3 shown.
[0070] First, the twin network is used to extract features from the visible light template image T and the infrared search image I to be matched, including:
[0071] S110: Construct a twin network to extract image features. First, build two identical network branches, and these two branches share weights and network parameters. Each branch network contains a feature extraction part and a feature fusion part. The single branch network structure of the twin network is as follows: Figure 4 shown.
[0072] S120: The feature extraction part builds a Unet++ network with a depth of 5. The network depth increases from left to right and from top to bottom. There are downsampling, upsampling and skip connections in the U-net++ network. Figure 4 As can be seen, the input image passes through the first layer of convolution module X0,0 Get feature x 0,0 , and x 0,0 Input to the second convolution module X 1,0 Downsample to get x 1,0 ; x 1,0 Then upsample the input to X 1,0 In the convolution module and combined with x 0,0 Perform a skip connection to get x 0,1 . As the depth of the network increases, this is analogous from left to right. The network downsampling process increases the receptive field of the extracted features, enabling them to perceive useful information in larger image blocks. The network jump connection and upsampling process achieve the initial fusion of different features. Different receptive fields extract different features. Small receptive fields focus on local features of the image and can reconstruct image details. Large receptive fields focus on image features in larger areas and can reconstruct overall image features. Each basic convolution block of the feature extraction module uses a VGG convolution module: the input feature passes through a convolution layer with a convolution kernel of 3×3 and then batch normalizes it, and then passes through an activation layer with an activation function of ReLU to obtain an intermediate feature. The intermediate feature then passes through a convolution layer with a convolution kernel of 3×3, and the output feature is batch normalized, and finally passes through an activation layer with an activation function of ReLU, and finally the output features f of different receptive fields of the convolution module are obtained. n , n=1,2,3,4.
[0073] S130: Build the feature fusion part. Use a nested multi-receptive field feature fusion method, design an attention fusion structure each time to fuse two features with small receptive field differences, and obtain a new feature F fuse Then, the features with large receptive field differences are fused again, and all the extracted features are fused into a feature map F using nested multi-receptive field feature fusion. The multi-receptive field feature fusion module fuses features of different receptive fields by using a pixel-level attention mechanism, where a fusion block is used for every two features, nested layer by layer, and its structure is as follows: Figure 4 As shown in the figure, each fusion block parameter is not shared. n Fusion, get F fuse (f n ) is:
[0074]
[0075] Where n = 2, 3, 4;
[0076] When n=1:
[0077] F fuse (f1) = f1
[0078] S131: Two specified features f n With F fuse (f n-1 )use To fuse the features, a pixel-level attention mechanism module is introduced to learn the pixel-level association weights of the two features. First, the feature f n With feature F fuse (f n-1 ) performs concat merging on the number of channels to obtain [f n ,F fuse (f n-1 )], and then the convolutional layer is used to learn the pixel-level attention map. At the same time, the mapping function restricts the weights in the attention map to [0,1]. The weight learning is shown in the following formula:
[0079]
[0080] Among them, g represents the mapping function and H represents the convolution function.
[0081] S132: Calculate the feature f n With F fuse (f n-1 ) n After that, the two features are fused according to a certain weight to obtain F fuse (f n ). Feature f n and F fuse (f n-1 ) The specific fusion method is:
[0082] FeatureFuse(f n ,F fuse (f n-1 ))=f n ×α n +F fuse (f n-1 )×(1-α n )
[0083] Among them, f n and F fuse (f n-1 )The attention weights of the two features are negatively correlated.
[0084] In the present invention, given four features f1, f2, f3, and f4 of the same size, four convolutional layers are first sampled to reduce the dimensionality of the features, and then the fusion of features with different receptive fields is achieved by nesting them in pairs. The present invention describes one of the fusion blocks in detail: for f1 and f2, first down-sampling with a step size of 2 is performed, and then the channels are merged, and then two convolutional layers Conv12 and Conv12_a with a convolution kernel size of 3 are used to learn the attention map Map; based on the obtained attention map Map, the features of f1 and f2 are fused to obtain f 12 =f1×Map+f2×(1-Map); finally, a convolution kernel with a convolution kernel size of 3 is used to convolve f 12 Further optimization obtains the final result f after f1 and f2 are fused 12 The feature f after f1 and f2 are fused 12 Then perform feature fusion with f3, and so on, nesting step by step.
[0085] By fusion of features of different receptive fields in a nested manner, the features from the encoder are gradually enriched, ensuring that image fusion will not be difficult due to large differences in semantic information.
[0086] S140: Input the template image T to be matched with a size of N×N and the heterogeneous search image I with a size of M×M into the twin network Net respectively. sia In the example, we get the corresponding template feature map F with a size of N×N T and a heterogeneous search feature map F of size M×M I .
[0087] The visible light template image to be matched passes through the twin network Net sia After that, we get the 128×128 visible light template feature map F T After the infrared search image passes through the twin network, a 256×256 visible light template feature map F is obtained. I .
[0088] After obtaining the visible light template feature map F T and infrared search feature map F I Then, F is calculated as follows T and F I The matching cross-correlation graph M gen ,include:
[0089] S210: The obtained feature map F to be matched T Search feature graph F in heterogeneous source I Traverse upward, treat the template feature map to be matched as a sliding window, and slide it on the search map in sequence with a step size of 1. At each search position, for two feature maps F of different sizesT and F I Perform normalized correlation operation to calculate the similarity between the template image and the search image at the corresponding position. Normalized correlation operation is to calculate the template feature map F with a smaller size. T In the search feature map F with large size I The cosine distance R(x,y) at each corresponding position (x,y) on the image is the cosine distance that measures the angle between the distributions of two samples. It distinguishes the differences from the sample direction. Its calculation complexity is higher than that of the Euclidean distance, but the cosine distance can measure the similarity of two samples as a whole, is insensitive to local bad pixels, and has better adaptability. Its calculation formula is:
[0090]
[0091] Among them, x<256, y<256, x′<128, y′<128 at the non-boundary position of the search graph; x′<256-x1, y′<256-y1, at the boundary position (x1, y1,) of the search graph. The final output result is a 129×129 correlation coefficient matrix, that is, the matching cross-correlation graph M gen .
[0092] In order to realize the back propagation of matching position estimation, after obtaining the matching cross-correlation map M gen After that, the present invention will match the cross-correlation graph M gen Input into the regression network for matching position regression to obtain the network's position estimate for image matching. The regression network is as follows: Figure 5 The specific steps are as follows:
[0093] S310: Build the main network of the regression network. The regression network consists of two parts, the convolutional module and the fully connected module.
[0094] The function of the regression network is to input the matching cross-correlation graph M generated in step S210. gen , learn the correlation coefficients and get the predicted matching position.
[0095] S320: Convolution module pair matching cross-correlation graph M gen Downsampling is performed and features are extracted. The convolution module includes five layers of convolution. The first layer has a convolution kernel size of 2 and a step size of 1. The next four layers have a convolution kernel size of 4 and a step size of 2. The output channels of the five convolution layers are 32, 64, 128, 256, and 512, respectively. The convolution module performs a correlation coefficient matrix M gen Perform s-fold downsampling and feature extraction to obtain a size of The characteristic f _reg .
[0096] S330: extract the feature f _regThe input is sent to the fully connected module, which contains 3 fully connected layers, and its output dimensions are 512, 512, and 2. The fully connected module performs dimension conversion, outputs the position estimate, realizes the regression of the network position estimate, and obtains the predicted matching position (x0, y0).
[0097] However, the predicted matching position is calculated from the matching cross-correlation map M gen The regression is obtained, and M gen It is obtained by using the twin network to extract the features of the template graph and the heterogeneous search graph and then performing similarity measurement. In this process, the accuracy of the features extracted by the twin network is limited. Therefore, an ideal cross-correlation graph is proposed to perform discriminative feedback on the matching cross-correlation graph.
[0098] Generate an adversarial network and construct an ideal cross-correlation graph M based on the actual matching position information ide , as the supervision information for matching the cross-correlation graph. The specific implementation steps are:
[0099] S410: Constructing an ideal cross-correlation graph M ide An ideal cross-correlation graph is constructed according to the given matching position information, and its size is (M-N+1)×(M-N+1), wherein the size of the search graph is M×M, and the size of the template graph to be matched is N×N.
[0100] In the embodiment of the present invention, the size of the template image to be matched is 128×128, the size of the heterogeneous search image is 256×256, and the ideal cross-correlation graph M is established. ide , size is 129×129.
[0101] S420: Calculate the cross-correlation graph value. Assuming the matching position point is (x0, y0), the value at this position is set to 1, and the value at any position (x, y) is given by the following formula:
[0102]
[0103] As can be seen from the formula, the farther the point is from the matching position (x0, y0), the lower the correlation coefficient is. Designing this cross-correlation diagram as the ideal cross-correlation diagram corresponding to each matching position ensures that there is only one main peak in the cross-correlation diagram, and the main peak decreases rapidly. When the difference is more than a dozen pixels, the correlation coefficient will gradually approach 0. At the same time, the main peak occupying a certain position area can also effectively suppress the network from being difficult to correctly fit the cross-correlation diagram due to the imbalance of the number of positive and negative samples.
[0104] Through the above analysis, in the embodiment of the present invention, weakly supervised learning is performed using a generative adversarial network, and discriminative feedback is performed on the matching cross-correlation graph, so that the matching cross-correlation graph can express the relevant information of the two feature graphs as effectively as possible. The specific steps of this method are as follows:
[0105] S510: Construct a discriminator network. The discriminator network structure is as follows: Figure 6 As shown in Figure 1, each layer contains a convolutional layer, a normalization layer, and an activation layer. The normalization layer uses batch normalization, and the activation layer uses LeakyReLU as the activation function.
[0106] Construct the main network of the discriminator, which contains six layers of convolutional blocks, and is specifically implemented as follows:
[0107] S511: The first convolutional layer uses a convolution kernel of size 2 and stride 1 to reduce the feature map size to 128×128 and increase the feature dimension.
[0108] S512: The middle four layers use convolution kernels of size 4 and stride 2 to reduce the feature map size and increase the dimensionality.
[0109] S513: The last layer uses a convolution kernel of size 1 to reduce the dimension of the feature map, and the output matrix is the discriminant network's overall discrimination result on the input information.
[0110] S520: Matching the cross-correlation map matrix M gen and the ideal cross-correlation matrix M ide They are input into the discriminator network respectively. The discriminator measures the distance between the two cross-correlation graphs, and the output matrix is the discriminant network's discriminant result on the overall input information.
[0111] S530: In the specific implementation process, the discriminant network loss function is L D-net (D):
[0112]
[0113] Among them, x is the input sample, λ is the gradient penalty weight, and in order to ensure that the discriminator loss does not have a negative value and cause gradient back propagation errors, the overall loss function also adds a fixed offset b, which is 1.0.
[0114] The visible light image T and the infrared image I are simultaneously input into the twin network to extract similar features of the two. The matching cross-correlation map of the two sets of features is obtained through the correlation layer, and the estimated position is obtained from the matching cross-correlation map through the regression layer. On the other hand, the matching cross-correlation map is input into the discriminant network, and the ideal cross-correlation map is also input into the discriminant network. The discriminant network measures the distance between the two cross-correlation maps. T and infrared search pattern F I After obtaining the matching cross-correlation graph, the ideal cross-correlation graph is still added. The advantages of using the discriminator for discriminant feedback are:
[0115] (1) The purpose of the discriminant network is to distinguish the matching cross-correlation graph from the ideal cross-correlation graph as much as possible, and to judge the matching cross-correlation graph as false and the ideal cross-correlation graph as true. At the same time, the generative network receives feedback from the discriminant network's judgment results and adjusts its network parameters so that the cross-correlation graph it generates is as true as possible after being judged by the discriminant network.
[0116] (2) The generator cannot directly perceive the feature distribution of the ideal cross-correlation graph, but indirectly perceives the possible feature distribution form of the ideal cross-correlation graph through the discrimination results fed back by the discriminator. The advantage of this is that the network does not completely constrain the cross-correlation graph generated by the generator, but uses a weak supervision method to prevent the generator network from forcibly generating the cross-correlation graph that is consistent with the ideal cross-correlation graph. Figure 1 The cross-correlation graph only needs to be close, which can effectively avoid the failure of feature extraction in the network optimization process.
[0117] S540: The generated loss function is divided into two parts: adversarial loss and regression loss:
[0118] The loss function of the adversarial loss is defined as:
[0119] L G-adv =E x [D(G(x))]
[0120] The loss function of regression loss is defined as:
[0121]
[0122] In summary, the overall loss function of the two is the loss function L of the generated network G-net :
[0123] L G-net =-L G-adv +γL G-re +b
[0124] Among them, γ is the regression loss weight. Similarly, to prevent the loss function from having negative values, a fixed offset b is added to the loss function, and the value is 1.0.
[0125] The adversarial loss enables the generative network to indirectly perceive the feature distribution of the ideal cross-correlation map, thereby optimizing the cross-correlation map. The regression loss is a constraint on the matching position, ensuring that the regression network can make correct position estimates of the cross-correlation map.
[0126] After the overall network is built, the data set is prepared and trained. In the specific implementation process, the 128×128 resolution images used in training are randomly cut from 300 256×256 resolution training sets. The 128×128 resolution images used in the test set are randomly cut from another 200 256×256 resolution test sets. In order to ensure the effectiveness of the selected data set, the cut images are screened to a certain extent, and images with larger information content are selected to meet the matching requirements. By calculating the standard deviation of image pixels normalized to 0~1, those with a standard deviation greater than 0.1 are considered to have rich image information and are retained, while those with a standard deviation less than 0.1 are eliminated.
[0127] All datasets for network training come from the visible light-infrared paired dataset of vehicle road scenes released by Kaist Laboratory. After the dataset was prepared, training and testing were carried out on the dataset, and the feature maps extracted by the twin network were visualized, such as Figure 7 As shown in the figure, the first row is a 256×256 resolution infrared image and its extracted feature map, and the second row is a 128×128 resolution visible light image with the same scene as the infrared image and its extracted feature map. It can be seen that the feature map extracted by the method proposed in the present invention is clear, and it responds to the corresponding target in the input image with small bright blocks, with small granularity and high distinction accuracy. At the same time, the present invention also visualizes the generated cross-correlation map, such as Figure 8 As shown, it can be seen that the optimized cross-correlation graph generated by the method proposed in the present invention has a prominent main peak and a secondary peak suppressed to a very small height.
[0128] In order to compare whether the optimization using the ideal cross-correlation graph can improve the feature extraction and matching effect of the network, the present invention conducted certain experimental comparisons:
[0129] The network structure SiameseNCR, which uses a twin network to generate feature maps and directly normalizes and calculates cross-correlation maps, is experimentally compared with the SiameseNCR-GAN network of the present invention, wherein SiameseNCR-GAN is a network that adds GAN to the SiameseNCR network to generate an ideal cross-correlation map, and performs discriminant feedback on the calculated cross-correlation map to optimize the cross-correlation map.
[0130] First, in order to compare the optimization capabilities of SiameseNCR network and SiameseNCR-GAN for extracting features from twin networks, these two networks are used to extract features from visible light images and infrared search images respectively. The results are shown in Figure 2. Fig. 9 and Fig.10As shown in the figure, they represent the comparison of feature extraction results of street scene images and road scene images. The first row is the infrared image with a resolution of 256×256, its feature map extracted by SiameseNCR network, and its feature map extracted by SiameseNCR-GAN network; the second row is the visible light image with a resolution of 128×128 that is the same as the infrared image scene, its feature map extracted by SiameseNCR network, and its feature map extracted by SiameseNCR-GAN network. The box in the figure indicates the corresponding position relationship between the infrared real-time image and the visible light image. Each input network contains an infrared image (large image) and a visible light image (small image). In addition, the feature extraction result image contains two visible light images, indicating that two matching processes have been performed.
[0131] As can be seen from the figure, the feature map generated by the SiameseNCR network is relatively fuzzy. Its corresponding response relationship with the original image can be observed, reflecting the contours and some texture details in the original image, but the generated images are not clear enough and have some irrelevant features. The feature map extracted by the SiameseNCR-GAN network is clearer, responding to the corresponding targets in the input image with smaller bright blocks, with smaller granularity and more precise discrimination. In addition, after SiameseNCR extracts features from the house and tree, the contours of its targets are fuzzy. For the entire house target, the extracted features of each region are fused together, making it difficult to distinguish the structure of the house. In the SiameseNCR-GAN results, although the features of the house are difficult to distinguish, they are clearer, and the feature contrast between the structures of the house is obvious. In the typical comparison of the feature extraction results of characters, the original two characters extracted by SiameseNCR are merged into one, which has no distinguishing degree. The image block at the zebra crossing is larger and there are shadows. Compared with the features extracted by SiameseNCR-GAN, the overlap of the features of the two characters is reduced, and the head and body of the characters can be clearly distinguished. The response block for the zebra crossing is also smaller and more distinguishable. In addition, the present invention also observed in the experiment that after the generated cross-correlation map is weakened by using a generative adversarial network for weak supervision, the extracted features are basically the responses of the corresponding targets, proving that the feature extraction results are effective.
[0132] In order to more objectively judge the feature extraction effect of the twin network parts of the two networks on the infrared image and the visible light image, the present invention cuts out the corresponding area of the infrared feature map and compares the similarity with the visible light feature map. The higher the similarity, the better the matching performance of the features extracted by the twin network. Considering that the present invention uses the cosine distance to measure the similarity of matching features in the relevant layer, the cosine distance is still used here to measure the similarity of the two feature maps. The measurement results are as follows:
[0133] Table 1 Similarity of features extracted from twin networks
[0134] Network Model Dataset A Dataset B SiameseNCR 0.714 0.735 SiameseNCR-GAN 0.853 0.867
[0135] From the similarity calculation results in the table, we can see that compared with the SiameseNCR network, after the cross-correlation graph optimization, the matching features extracted by the SiameseNCR-GAN network have higher similarity and significant improvement. Higher similarity means better performance when matching. Of course, in addition to ensuring a higher similarity with the corresponding area, it is also necessary to determine whether the similarity in the non-corresponding area is as low as possible to improve the matching positioning accuracy. The following will analyze the distribution of the cross-correlation graph.
[0136] In order to observe the optimization results of SiameseNCR-GAN on the cross-correlation graph, the present invention performs three-dimensional visualization of the feature cross-correlation graph generated in the network correlation layer and compares it with the cross-correlation graph based on the SiameseNCR network. The comparison results are shown in Figure 2. Fig.11 shown.
[0137] As can be seen from the figure, the SiameseNCR algorithm can make the main peak of the image matching cross-correlation graph near the actual position, but the error is large. In the SiameseNCR-GAN algorithm, after using the generative adversarial network to optimize the matching cross-correlation graph, the descending gradient of the main peak increases, and the main peak is more prominent, while the secondary peak is basically suppressed to a very small height, indicating that the generative adversarial network can effectively optimize the matching cross-correlation graph.
[0138] In order to further compare the optimization performance of the cross-correlation diagram, the extreme value, mean value and standard deviation of the correlation coefficient in the cross-correlation diagram are calculated in the embodiment of the present invention. The calculation results are shown in Table 2.
[0139] Table 2 Mean and standard deviation of cross-correlation graphs in different network models
[0140]
[0141] From the statistical results in the table, we can see that the average correlation coefficient is about 0.25 before the cross-correlation diagram optimization, while the average after optimization is about 0.05. The value before optimization is about 5 times that after optimization, indicating that the overall correlation coefficient is maintained at a low level after optimization. In addition, in the standard deviation of the correlation coefficient, the value before optimization is about 2 times that after optimization, indicating that the fluctuation after optimization is smaller. At the same time, the maximum values of the two cross-correlation diagrams are close, indicating that the main peak of the cross-correlation diagram after optimization is sharper, which is also related to Fig.11The distribution form of the given cross-correlation graph is consistent. From the above analysis, it can be seen that the main peak of the cross-correlation graph after SiameseNCR-GAN optimization is effectively highlighted, while the interference such as the secondary peak is significantly suppressed, indicating that SiameseNCR-GAN has achieved a good cross-correlation graph optimization effect.
[0142] Next, in order to further illustrate the heterogeneous image matching effect achieved by the method of the present invention, the present invention compares the grayscale direct matching, ORB feature point matching and Canny edge feature matching methods with the algorithm of the present invention. In addition, SiameseNCR is added to the comparative experiment to verify whether GAN has the ability to optimize the matching effect. ε is the error tolerance pixel during matching. Under different matching error tolerances, the matching accuracy results obtained by different methods are shown in Table 3:
[0143] Table 3 Matching accuracy results obtained by different methods
[0144] Matching method ε=1(pixel) ε=2(pixels) ε=3(pixels) Grayscale Matching 0.3% 1.0% 1.5% ORB feature point matching 0.5% 0.9% 1.2% Edge feature matching 43.9% 49.3% 74.8% SiameseNCR 30.8% 62.7% 88.1% SiameseNCR-GAN 68.7% 84.9% 93.7%
[0145] It can be seen from the second, third, fourth and sixth rows of Table 3 that, compared with the matching method based on artificially designed features, the SiameseNCR-GAN algorithm proposed in the present invention has a higher matching success rate, and its matching rate is significantly higher than the heterogeneous image matching methods based on grayscale, point features and line features, indicating that the algorithm proposed in the present invention can well solve the problem of difficulty in matching between heterogeneous images; it can be seen from the fifth and sixth rows of Table 3 that compared with the SiameseNCR algorithm, the matching performance of the SiameseNCR-GAN algorithm is greatly improved on different test sets, especially under low error tolerance conditions. The improvement is more significant, indicating that optimizing the cross-correlation graph using a generative adversarial network can improve the positioning accuracy of the image.
[0146] Based on the above analysis, the SiameseNCR-GAN algorithm proposed in the present invention can effectively extract stable matching features between heterogeneous images. The extracted feature structure is clear and has a large degree of distinction. The main peak of the matching cross-correlation graph obtained during matching is obvious, and the peak of the non-matching position is effectively suppressed. Comparing the matching rates of different algorithms on the test set, the algorithm proposed in the present invention has a higher overall matching rate under different imaging conditions, indicating that the SiameseNCR-GAN algorithm is more robust and has better comprehensive matching performance.
[0147] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A heterogeneous image matching and positioning method based on twin network and supervised training, It is characterized in that The method includes: Training phase: Use the registered visible light-infrared image dataset as the training set, and perform the following processing on each training sample: The visible light image is input into the first branch of the twin network to obtain the template feature map, and the infrared image is input into the second branch of the twin network to obtain the search feature map. The template feature map and the search feature map are normalized and correlated to generate a matching cross-correlation map. According to the actual matching positions of the visible light template map and the infrared search map, an ideal cross-correlation map is generated as the supervision information of the matching cross-correlation map. Input the matching cross-correlation map and the ideal cross-correlation map into the discriminator, output the discrimination result of the input information as a whole, and calculate the discrimination loss; perform position regression on the matching cross-correlation map to obtain the estimated position of the visible light image on the infrared image; calculate the overall loss based on the estimated position and the actual matching position; If the overall loss and the discriminant loss function converge at the same time, the training is completed. Otherwise, the discriminant loss is fed back to the twin network, and the parameters of the twin network are adjusted through back propagation to make the discriminant loss smaller and smaller. Application stage: The visible light image is input into the first branch of the trained twin network, and the infrared image is input into the second branch of the trained twin network. The two outputs of the twin network are normalized and correlated. The calculation results are input for position regression to obtain the estimated position of the visible light image on the infrared image.
2. The method according to claim 1, It is characterized in that The first branch of the twin network is the same as the second branch of the twin network, and shares weights and network parameters. Each branch includes: Feature extraction module, used to extract features of different receptive fields; The feature fusion module is used to fuse the two features with the smallest receptive field difference. The new feature obtained is then fused again with the feature with the second smallest receptive field difference, and so on. A step-by-step nested fusion method is adopted to fuse all the extracted receptive field features into a feature map.
3. The method according to claim 2, It is characterized in that The new feature obtained by fusing the features with the smallest difference in the two receptive fields is as follows: Among them, F fuse () represents the fusion feature, f n represents the feature with receptive field level n, α n represents the weight, n represents the receptive field level, and H() represents the convolution function.
4. The method according to claim 1, It is characterized in that The face value of the ideal cross-correlation plot at position (x, y) is calculated as follows: Among them, (x 0 ,y 0 ) indicates the matching location point.
5. The method according to claim 1, It is characterized in that The discriminator includes six layers of convolutional blocks, where: The convolution kernel size of the first convolution layer is 2 and the stride is 1, which is used to reduce the feature map size to 128×128; The convolution kernel size of the middle four layers is 4 and the stride is 2, which is used to reduce the size of the feature map; The last layer of convolution kernel size is 1, which is used to reduce the dimension of the feature map.
6. The method according to claim 1, It is characterized in that The discriminative loss L D-net The calculation formula is as follows: Among them, x represents the input real sample, λ represents the gradient penalty weight, x′ represents the generated sample, b represents the fixed offset, and E x [] represents the expectation of the real sample, D() represents the probability that the discriminator judges whether the real sample is real, D(G(x)) represents the probability that the discriminator judges whether the sample generated by the generator is real, and G() represents the sample generated by the generator. represents the gradient penalty term, || || 2 represents the 2-norm.
7. The method according to claim 1, It is characterized in that Performing position regression on the matching cross-correlation graph to obtain an estimated position of the visible light image on the infrared image, which is achieved by a regression network, wherein the regression network includes a convolution module and a fully connected module; The convolution module is used to downsample the matching cross-correlation graph and extract features to obtain the feature f _reg ; Fully connected module, used to _reg Perform dimension conversion and output position estimation.
8. The method according to claim 1, It is characterized in that The overall loss calculation formula is as follows: L G-net =-L G-adv +γL G-reg +b L G-adv =E x [D(G(x))] Among them, L G-net Represents the overall loss, L G-adv represents the adversarial loss, L G-reg represents the regression loss, γ represents the regression loss weight, b represents the fixed offset, E x [] represents the expectation of the real sample, D(G(x)) represents the probability that the discriminator judges whether the sample generated by the generator is real, and R() represents the predicted output of the regression network for the sample generated by the generator. represents the mean square error function.
9. A heterogeneous image matching and positioning system based on twin networks and supervised training, It is characterized in that The system includes: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is used to read the executable instructions stored in the computer-readable storage medium to execute the heterogeneous image matching and positioning method based on a twin network and supervised training as described in any one of claims 1 to 8.
Citation Information
Cited By
An image localization method including any target and background
CN119090963B
