Image matching method and device, storage medium and electronic device
By extracting target image features through a trained first network model, the accuracy problem of traditional image matching methods under changes in lighting and viewing angle is solved. In particular, in UAV visual positioning, the accuracy of image matching and UAV positioning accuracy are improved.
Patent Information
- Application Number
- CN202310344386.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-03-31
AI Technical Summary
Traditional image matching methods are easily affected by changes in lighting and viewing angle, resulting in low image matching accuracy. This is especially true in UAV visual positioning scenarios, where the accuracy is further reduced due to the difference in rotation angle between the UAV and the preset image.
By training a first network model, which aggregates image features of sample images at different rotation angles, extracts target image features, and performs matching based on these features, including training the aggregated image features of sample images and the predicted image features, until a preset stopping iteration condition is met.
It improves the accuracy of image matching, can adapt to image feature matching under different rotation angles, and enhances the accuracy of UAV visual positioning.
Smart Images

Figure CN118736248B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to an image matching method, apparatus, storage medium, and electronic device. Background Technology
[0002] Image matching technology is widely used in many areas of daily life. It can be used for tasks such as visual navigation, image stitching, 3D reconstruction, visual positioning, scene depth calculation, and target detection and tracking. In the drone business, image matching is mainly used for the visual positioning of drones.
[0003] Traditional image matching methods, such as SIFT (Scale-invariant Feature Transform), SURF (Speeded-Up Robust Features), and ORB (Oriented Fast and Rotated BRIEF), are all based on geometric features for matching. These methods are easily affected by changes in lighting and viewing angle, resulting in relatively low accuracy. Therefore, improving the accuracy of image matching is a pressing issue. Summary of the Invention
[0004] To address the aforementioned problems, this disclosure provides an image matching method, apparatus, storage medium, and electronic device.
[0005] In a first aspect, this disclosure provides an image matching method, including:
[0006] The target image to be matched is input into the first network model to obtain the target image features output by the first network model.
[0007] Based on the features of the target image, determine whether the target image matches a preset image;
[0008] The first network model is trained using sample images and corresponding aggregated image features, which are obtained from the image features of the sample images at different rotation angles.
[0009] Optionally, before inputting the target image to be matched into the first network model, the method further includes:
[0010] The target neural network model is trained based on the sample image features of the sample image to obtain the first network model. The sample image features include the aggregated image features and the estimated image features. The estimated image features are the image features of the sample image obtained by the target neural network.
[0011] Optionally, training the target neural network model based on the sample image features of the sample images to obtain the first network model includes:
[0012] Based on the sample image, the model training steps are executed cyclically until the trained target neural network model is determined to meet the preset stopping iteration condition, and the trained target neural network model is used as the first network model.
[0013] The model training steps include:
[0014] The sample image is input into the target neural network model to obtain the predicted image features;
[0015] Obtain the aggregated image features corresponding to the sample image;
[0016] The target loss value is determined based on the estimated image features and the aggregated image features;
[0017] If the target neural network model does not meet the preset stopping iteration condition based on the target loss value, the parameters of the target neural network model are updated according to the target loss value to obtain the trained target neural network model.
[0018] Optionally, obtaining the aggregated image features corresponding to the sample image includes:
[0019] The sample image is rotated according to a preset rotation direction and / or multiple preset rotation angles to obtain multiple rotated images corresponding to the sample image;
[0020] The multiple rotated images are input into a preset second network model to obtain the aggregated image features.
[0021] Optionally, the second network model includes multiple feature extraction sub-networks, with different feature extraction sub-networks corresponding to different preset rotation angles. The step of inputting the multiple rotated images into the preset second network model to obtain the aggregated image features includes:
[0022] The multiple rotated images are respectively input into the multiple feature extraction sub-networks to obtain the rotated image features output by each feature extraction sub-network;
[0023] For each of the rotated image features, the rotated image feature is rotated according to the preset rotation angle and / or the opposite direction of the preset rotation direction corresponding to the rotated image feature to obtain the reverse rotated image feature corresponding to the rotated image feature;
[0024] The aggregated image features are obtained by vector stitching the multiple reverse-rotated image features.
[0025] Optionally, the aggregated image features include aggregated image feature point information and aggregated image description information, and the estimated image features include estimated image feature point information and estimated image description information; determining the target loss value based on the estimated image features and the aggregated image features includes:
[0026] A first loss value is determined based on the difference between the aggregated image feature point information and the estimated image feature point information;
[0027] A second loss value is determined based on the difference between the aggregated image description information and the estimated image description information;
[0028] The third loss value is determined based on the feature point information of the aggregated image and the description information of the aggregated image;
[0029] The target loss value is determined based on the first loss value, the second loss value, and the third loss value.
[0030] Optionally, the sample image includes a first sample image and a second sample image, and there is an overlapping region between the first sample image and the second sample image. Determining the third loss value based on the aggregated image feature point information and the aggregated image description information includes:
[0031] Multiple sampling points are determined within the overlapping area;
[0032] First feature point information and first image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the first sample image, and second feature point information and second image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the second sample image.
[0033] The third loss value is determined based on the first difference between the plurality of first feature point information and the plurality of second feature point information, and the second difference between the plurality of first image description information and the plurality of second image description information.
[0034] Optionally, determining whether the target image matches a preset image based on the target image features includes:
[0035] Based on the features of the target image, determine the matching degree between the target image and the preset image;
[0036] If the matching degree is greater than or equal to a preset matching degree threshold, the target image is determined to match the preset image.
[0037] Secondly, this disclosure provides an image matching apparatus, comprising:
[0038] The acquisition module is used to input the target image to be matched into the first network model to obtain the target image features output by the first network model;
[0039] A matching module is used to determine whether the target image matches a preset image based on the features of the target image;
[0040] The first network model is trained using sample images and corresponding aggregated image features, which are obtained from the image features of the sample images at different rotation angles.
[0041] Optionally, the device further includes:
[0042] The model training module is used to train the target neural network model based on the sample image features of the sample image to obtain the first network model. The sample image features include the aggregated image features and the estimated image features. The estimated image features are the image features of the sample image obtained through the target neural network.
[0043] Optionally, the model training module is further configured to:
[0044] Based on the sample image, the model training steps are executed cyclically until the trained target neural network model is determined to meet the preset stopping iteration condition, and the trained target neural network model is used as the first network model.
[0045] The model training steps include:
[0046] The sample image is input into the target neural network model to obtain the predicted image features;
[0047] Obtain the aggregated image features corresponding to the sample image;
[0048] The target loss value is determined based on the estimated image features and the aggregated image features;
[0049] If the target neural network model does not meet the preset stopping iteration condition based on the target loss value, the parameters of the target neural network model are updated according to the target loss value to obtain the trained target neural network model.
[0050] Optionally, the model training module is further configured to:
[0051] The sample image is rotated according to a preset rotation direction and / or multiple preset rotation angles to obtain multiple rotated images corresponding to the sample image;
[0052] The multiple rotated images are input into a preset second network model to obtain the aggregated image features.
[0053] Optionally, the second network model includes multiple feature extraction sub-networks, with different feature extraction sub-networks corresponding to different preset rotation angles. The model training module is further used for:
[0054] The multiple rotated images are respectively input into the multiple feature extraction sub-networks to obtain the rotated image features output by each feature extraction sub-network;
[0055] For each of the rotated image features, the rotated image feature is rotated according to the preset rotation angle and / or the opposite direction of the preset rotation direction corresponding to the rotated image feature to obtain the reverse rotated image feature corresponding to the rotated image feature;
[0056] The aggregated image features are obtained by vector stitching the multiple reverse-rotated image features.
[0057] Optionally, the aggregated image features include aggregated image feature point information and aggregated image description information, and the estimated image features include estimated image feature point information and estimated image description information; the model training module is further configured to:
[0058] A first loss value is determined based on the difference between the aggregated image feature point information and the estimated image feature point information;
[0059] A second loss value is determined based on the difference between the aggregated image description information and the estimated image description information;
[0060] The third loss value is determined based on the feature point information of the aggregated image and the description information of the aggregated image;
[0061] The target loss value is determined based on the first loss value, the second loss value, and the third loss value.
[0062] Optionally, the sample image includes a first sample image and a second sample image, and there is an overlapping region between the first sample image and the second sample image. The model training module is further configured to:
[0063] Multiple sampling points are determined within the overlapping area;
[0064] First feature point information and first image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the first sample image, and second feature point information and second image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the second sample image.
[0065] The third loss value is determined based on the first difference between the plurality of first feature point information and the plurality of second feature point information, and the second difference between the plurality of first image description information and the plurality of second image description information.
[0066] Optionally, the matching module is further configured to:
[0067] Based on the features of the target image, determine the matching degree between the target image and the preset image;
[0068] If the matching degree is greater than or equal to a preset matching degree threshold, the target image is determined to match the preset image.
[0069] Thirdly, this disclosure provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in the first aspect of this disclosure.
[0070] Fourthly, this disclosure provides an electronic device, comprising:
[0071] A memory on which computer programs are stored;
[0072] A processor for executing the computer program in the memory to implement the steps of the method described in the first aspect of this disclosure.
[0073] The above technical solution involves inputting the target image to be matched into a first network model to obtain the target image features output by the first network model; and determining whether the target image matches a preset image based on the target image features. The first network model is trained using sample images and their corresponding aggregated image features, which are obtained from the image features of the sample images at different rotation angles. In other words, this disclosure extracts target image features from a target image using a first network model, and then matches the target image with a preset image based on these features. Since the first network model is trained using aggregated image features of sample images, which include the image features of the sample images at different rotation angles, the target image features extracted by the first network model can also reflect the image features of the target image at different rotation angles, resulting in higher accuracy for image matching based on these target image features.
[0074] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0075] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:
[0076] Figure 1 This is a flowchart illustrating an image matching method according to an exemplary embodiment of the present disclosure;
[0077] Figure 2 This is a flowchart illustrating another image matching method according to an exemplary embodiment of the present disclosure;
[0078] Figure 3 This is a flowchart illustrating a model training step according to an exemplary embodiment of the present disclosure;
[0079] Figure 4 This is a schematic diagram illustrating a model training method according to an exemplary embodiment of the present disclosure;
[0080] Figure 5 This is a block diagram illustrating an image matching apparatus according to an exemplary embodiment of the present disclosure;
[0081] Figure 6 This is a block diagram illustrating another image matching apparatus according to an exemplary embodiment of the present disclosure;
[0082] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0083] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.
[0084] It should be noted that all actions involving the acquisition of signals, information, or data in this disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with authorization from the owner of the relevant device.
[0085] In the following description, the words "first" and "second" are used only to distinguish the purpose of the description and should not be interpreted as indicating or implying relative importance or order.
[0086] First, the application scenarios of this disclosure will be explained. Traditional image matching methods require finding the maxima or minima of pixels in the image as feature points, and then using the surrounding pixels of these feature points to calculate the corresponding descriptors. Therefore, they are easily affected by changes in lighting and viewing angle, resulting in relatively low accuracy in image matching. In related technologies, image matching methods based on deep learning can solve the problems of lighting and viewing angle changes, but the direction of the descriptors used in the image matching process is fixed.
[0087] The inventors of this disclosure have discovered that in the visual positioning scenario of a drone, there may be a certain angle between the global 3D map used by the drone and the drone's yaw angle, which may cause the current image captured by the drone and the preset image to be matched to be not in the same direction. When the direction of the descriptor is fixed, the image matching accuracy is also relatively low.
[0088] To address the aforementioned problems, this disclosure provides an image matching method, apparatus, storage medium, and electronic device. The method extracts target image features from a target image using a first network model, and then matches the target image with a preset image based on these target image features. Since the first network model is trained using aggregated image features of sample images, including image features of the sample images at different rotation angles, the target image features extracted by the first network model can also reflect the image features of the target image at different rotation angles, resulting in higher accuracy for image matching based on these target image features.
[0089] The present disclosure will now be described in conjunction with specific embodiments.
[0090] Figure 1 This is a flowchart illustrating an image matching method according to an exemplary embodiment of the present disclosure. The method can be used with electronic devices, such as drones, terminals, etc. The present disclosure does not limit the application of this method; however, a drone is used as an example in this embodiment. Figure 1 As shown, the method may include:
[0091] S101. Input the target image to be matched into the first network model to obtain the target image features output by the first network model.
[0092] The target image can be an environmental image collected by the drone during flight. The first network model can be a student network, which can be trained by multiple sample images and the aggregated image features corresponding to each sample image. The aggregated image features can be obtained by the image features of the sample image at different rotation angles.
[0093] In this step, after acquiring the target image, the target image can be input into the first network model, and the first network model can extract features from the target image to obtain the target image features.
[0094] S102. Based on the characteristics of the target image, determine whether the target image matches the preset image.
[0095] The preset image can be multiple pre-stored environmental images. Taking the visual positioning scenario of the drone as an example, multiple environmental images of different locations can be pre-acquired and stored, along with the location information corresponding to each environmental image. The drone can determine its current location by using the environmental image that matches the target image. For example, if the drone matches the target environmental image, its current location can be determined based on the location information corresponding to the target environmental image.
[0096] In this step, after acquiring the target image features, the target image and the preset image can be compared based on these features. In one possible implementation, the matching degree between the target image and the preset image can be determined based on the target image features. If the matching degree is greater than or equal to a preset matching degree threshold, the target image and the preset image are considered to match. The preset matching degree threshold can be pre-set based on experience. For example, the matching degree between the target image and the preset image can be determined based on the target image features using existing techniques, which will not be elaborated further here.
[0097] When there are multiple preset images, the matching degree between the target image and each preset image can be determined, and the matching degree can be used to determine whether the target image matches the preset image.
[0098] Using the above method, target image features are extracted from the target image through the first network model, and then the target image and preset image are matched based on the target image features. Since the first network model is trained by the aggregated image features of the sample image, the aggregated image features include the image features of the sample image at different rotation angles. Thus, the target image features extracted by the first network model can also reflect the image features of the target image at different rotation angles, and the accuracy of image matching based on the target image features will be higher.
[0099] Figure 2 This is a flowchart illustrating another image matching method according to an exemplary embodiment of the present disclosure, such as... Figure 2 As shown, the method may further include:
[0100] S103. Train the target neural network model based on the sample image features to obtain the first network model.
[0101] The sample image can be an environmental image collected during the flight of the UAV. The sample image includes multiple images, and the sample image features include aggregated image features and estimated image features. The estimated image features are the image features of the sample image obtained through the target neural network.
[0102] In this step, after acquiring the sample image, the predicted image features corresponding to the sample image can be obtained through the target neural network, and the aggregated image features corresponding to the sample image can be obtained through a preset second network model. A target loss value is determined based on the predicted image features and the aggregated image features, and the parameters of the target neural network model are updated based on the target loss value to obtain the trained target neural network model. If the trained target neural network model meets a preset stopping iteration condition, it is used as the first network model. The second network model can be a teacher network, which can be trained using existing model training methods, and will not be elaborated here.
[0103] In one possible implementation, the model training steps can be executed iteratively based on the sample image until the trained target neural network model is determined to meet the preset stopping iteration condition, and the trained target neural network model is used as the first network model. Figure 3 This is a flowchart illustrating a model training step according to an exemplary embodiment of the present disclosure, such as... Figure 3 As shown, the model training steps may include:
[0104] S31. Input the sample image into the target neural network model to obtain the predicted image features.
[0105] In this step, one sample image can be randomly selected from multiple sample images and input into the target neural network model. The target neural network model then extracts features from the sample image to obtain the predicted image features.
[0106] S32. Obtain the aggregated image features corresponding to the sample image.
[0107] In one possible implementation, features can be extracted from the sample image from multiple directions. For example, features of the sample image can be extracted from the top, bottom, left, and right directions to obtain multiple image features. After fusing the multiple image features, the aggregated image features are obtained.
[0108] In one possible implementation, the sample image can be rotated according to a preset rotation direction and / or multiple preset rotation angles to obtain multiple rotated images corresponding to the sample image; these multiple rotated images are then input into a preset second network model to obtain the aggregated image features. The preset rotation direction can be clockwise or counterclockwise, and this disclosure does not limit this. The preset rotation angle can be determined based on a preset number of rotations. For example, if the preset number of rotations is 4, the preset rotation angle can include 0°, 90°, 180°, and 270°. The preset number of rotations can be preset based on the hardware configuration of the drone. For example, if the drone has strong computing power, a larger preset number of rotations can be set, such as 6; if the drone's algorithm is weak, a smaller preset number of rotations can be set, such as 3.
[0109] For example, if the preset rotation direction is clockwise, and the preset rotation angle includes 0°, 90°, 180°, and 270°, then the sample image can be rotated by 0°, 90°, 180°, and 270° clockwise respectively to obtain four rotated images corresponding to the sample image. These four rotated images are then input into the second network model, which performs feature extraction on them to obtain the aggregated image features corresponding to the sample image.
[0110] It should be noted that in the above embodiments, the sample image is rotated according to a preset rotation direction and multiple preset rotation angles. This disclosure may also rotate the sample image only according to the preset rotation direction, without limiting the angle of each rotation. This disclosure may also rotate the sample image multiple times according to multiple preset rotation angles, without limiting the direction of each rotation.
[0111] The second network model may include multiple feature extraction sub-networks, each corresponding to a different preset rotation angle. The weights of these sub-networks can be identical. It should be noted that different feature extraction sub-networks can also be trained specifically with different weights; this disclosure does not limit this approach. If the sample image is rotated only according to the preset rotation direction, different feature extraction sub-networks can also correspond to different preset rotation directions.
[0112] In one possible implementation, after acquiring multiple rotated images, the multiple rotated images can be input into the multiple feature extraction sub-networks respectively to obtain the rotated image features output by each feature extraction sub-network; for each rotated image feature, the rotated image feature is rotated according to the preset rotation angle and / or the opposite direction of the preset rotation direction corresponding to the rotated image feature to obtain the reverse rotated image feature corresponding to the rotated image feature; the multiple reverse rotated image features are vector-stitched to obtain the aggregated image feature.
[0113] It should be noted that the specific method of rotating the image feature described above can be determined based on the rotation method of the sample image. For example, if multiple rotated images are obtained by rotating the sample image according to a preset rotation direction and multiple preset rotation angles, then the image feature is rotated according to the preset rotation angle corresponding to the image feature and the opposite direction of the preset rotation direction. If multiple rotated images are obtained by rotating the sample image according to a preset rotation direction, then the image feature is rotated according to the opposite direction of the preset rotation direction corresponding to the image feature. If multiple rotated images are obtained by rotating the sample image according to multiple preset rotation angles, then the image feature is rotated according to the preset rotation angle corresponding to the image feature. For example, the image feature can be rotated in the opposite direction of the preset rotation angle. For instance, if the preset rotation angle is 30°, then the image feature can be rotated by -30°.
[0114] For example, if the preset rotation direction is clockwise, and the preset rotation angle includes 0°, 90°, 180°, and 270°, and the feature extraction subnetwork includes feature extraction subnetwork A, feature extraction subnetwork B, feature extraction subnetwork C, and feature extraction subnetwork D, then the rotated image A obtained by rotating the sample image 0° clockwise can be input into feature extraction subnetwork A. Feature extraction subnetwork A performs feature extraction on the rotated image A to obtain rotated image feature A. Then, rotating the rotated image feature A counterclockwise by 0° yields the reverse rotated image feature A. Similarly, the rotated image B obtained by rotating the sample image 90° clockwise can be input into feature extraction subnetwork B, and feature extraction can be performed on the rotated image B. The rotated image feature B is obtained, and then rotated 90° counterclockwise to obtain the reverse rotated image feature B. The rotated image C, obtained by rotating the sample image 180° clockwise, is input into the feature extraction subnetwork C. Feature extraction is performed on rotated image C through feature extraction subnetwork C to obtain rotated image feature C. Rotated image feature C is then rotated 180° counterclockwise to obtain the reverse rotated image feature C. The rotated image D, obtained by rotating the sample image 270° clockwise, is input into the feature extraction subnetwork D. Feature extraction is performed on rotated image D through feature extraction subnetwork D to obtain rotated image feature D. Rotated image feature D is then rotated 270° counterclockwise to obtain the reverse rotated image feature D. After obtaining the reverse rotated image features A, B, C, and D, they can be vector-stitched to obtain the aggregated image feature. For example, if the reverse-rotated image is represented in RGB form, the vectors of the R, G, and B channels of the reverse-rotated image feature A, the reverse-rotated image feature B, the reverse-rotated image feature C, and the reverse-rotated image feature D can be vector-concatenated to obtain the aggregated image feature.
[0115] It should be noted that if the preset rotation angle is When rotating the sample image, it can be rotated along the dimensions of the R and G channels. When rotating the image feature, it can be rotated along the dimensions of the R and G channels. The execution order of steps S31 and S32 described above is merely illustrative. This disclosure does not limit the execution order of steps S31 and S32, and steps S31 and S32 can be executed simultaneously.
[0116] S33. Determine the target loss value based on the estimated image features and the aggregated image features.
[0117] In one possible implementation, the aggregated image features include aggregated image feature point information and aggregated image description information, and the estimated image features include estimated image feature point information and estimated image description information. After determining the aggregated image features corresponding to the sample image, a first loss value can be determined based on the difference between the aggregated image feature point information and the estimated image feature point information; a second loss value can be determined based on the difference between the aggregated image description information and the estimated image description information; a third loss value can be determined based on the aggregated image feature point information and the aggregated image description information; and a target loss value can be determined based on the first loss value, the second loss value, and the third loss value. The aggregated image feature point information includes information about feature points in the rotated image, the aggregated image description information includes description information corresponding to each feature point, the estimated image feature point information includes information about feature points in the sample image, and the estimated image description information includes description information corresponding to each feature point. This description information is used to characterize the local image information of the location of the feature point; for example, this description information can be a descriptor from the prior art.
[0118] It should be noted that this disclosure does not limit the order in which the first loss value, the second loss value, and the third loss value are determined. The first loss value, the second loss value, and the third loss value can be determined simultaneously, or they can be determined in a preset order.
[0119] For example, the first loss value can be calculated using the following formula:
[0120] L1 = (Score1 - Score2) 2 (1)
[0121] Where L1 is the first loss value, Score1 is the aggregated image feature point information, and Score2 is the estimated image feature point information.
[0122] The second loss value can be calculated using the following formula:
[0123] L2 = (Desc1 - Desc2) 2 (2)
[0124] Where L2 is the second loss value, Desc1 is the aggregated image description information, and Desc2 is the estimated image description information.
[0125] It should be understood that, in some feasible implementations, the multiple sample images used to train the target neural network model include a first sample image and a second sample image, and it is permissible that there is an overlapping region between the first sample image and the second sample image. First feature point information and first image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the first sample image, and second feature point information and second image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the second sample image. For example, the aggregated image features include first aggregated image features corresponding to the first sample image and second aggregated image features corresponding to the second sample image. The first aggregated image features include first aggregated image feature point information and first aggregated image description information. The second aggregated image features include second aggregated image feature point information and second aggregated image description information. After determining the aggregated image features, multiple sampling points can be determined within the overlapping area. These multiple sampling points can be randomly determined and are not limited here. For each sampling point, first feature point information corresponding to the sampling point is determined from the first aggregated image feature point information, first image description information corresponding to the sampling point is determined from the first aggregated image description information, second feature point information corresponding to the sampling point is determined from the second aggregated image feature point information, and second image description information corresponding to the sampling point is determined from the second aggregated image description information. The third loss value is determined based on the first difference between the multiple first feature point information and the multiple second feature point information, and the second difference between the multiple first image description information and the multiple second image description information.
[0126] It should be noted that the number of randomly determined sampling points can be determined based on the computing power of the drone. If the computing power of the drone is relatively strong, more sampling points can be determined, for example, 512 sampling points. If the computing power of the drone is relatively strong, more sampling points can be determined, for example, 256 sampling points.
[0127] For example, after randomly determining 512 sampling points in the overlapping area of the first sample image and the second sample image, for each sampling point, the first feature point information corresponding to the sampling point can be determined from the first aggregated image feature point information, the first image description information corresponding to the sampling point can be determined from the first aggregated image description information, the second feature point information corresponding to the sampling point can be determined from the second aggregated image feature point information, and the second image description information corresponding to the sampling point can be determined from the second aggregated image description information. After determining the first feature point information, second feature point information, first image description information, and second image description information for each sampling point, the third loss value can be calculated using the following formula:
[0128]
[0129] Where L3 is the third loss value, C is the number of sampling points, d represents the d-th sampling point out of C sampling points, q represents the q-th sampling point out of C sampling points, and s d For the first feature point information corresponding to the d-th sampling point, s′ d For the second feature point information corresponding to the d-th sampling point, s q For the first feature point information corresponding to the q-th sampling point, s′ q f represents the second feature point information corresponding to the q-th sampling point. d f′ represents the first image description information corresponding to the d-th sampling point. d Let M() be the second image description information corresponding to the d-th sampling point, and M() be the contrast loss function of the prior art.
[0130] After determining the first loss value, the second loss value, and the third loss value, the target loss value can be calculated using the following formula:
[0131] L=L1+L2+L3 (4)
[0132] Where L is the target loss value.
[0133] S34. If the target neural network model does not meet the preset stopping iteration condition based on the target loss value, update the parameters of the target neural network model based on the target loss value to obtain the trained target neural network model.
[0134] The preset stopping iteration condition can be any stopping iteration condition in the prior art, and this disclosure does not limit it.
[0135] In this step, after determining the target loss value, it can be determined whether the target loss value is less than or equal to a preset loss value threshold. If the target loss value is less than or equal to the preset loss value threshold, it means that the target neural network model meets the preset stopping iteration condition, and the target neural network model is used as the first network model. If the target loss value is greater than the preset loss value threshold, it means that the target neural network model does not meet the preset stopping iteration condition. The parameters of the target neural network model are updated according to the target loss value to obtain the trained target neural network model.
[0136] It should be noted that the above steps S31 to S34 are the processing flow for a single sample image. After obtaining the trained target neural network model, the trained target neural network model can be used as a new target neural network model, and a new sample image can be determined from multiple sample images. The above steps S31 to S34 are then executed until the trained target neural network model is determined to meet the preset stopping iteration condition.
[0137] Figure 4 This is a schematic diagram illustrating a model training method according to an exemplary embodiment of the present disclosure, such as... Figure 4 As shown, after the sample image is input into the second network model, the sample image is rotated n times by the second network model, and the rotation angles include θ0, θ1, ..., θn. n-1 The process involves obtaining n rotated images of the sample image, inputting each of these n rotated images into n feature extraction subnetworks, and extracting features from each of these subnetworks to obtain n rotated image features. For each rotated image feature, it is then rotated in the opposite direction according to its corresponding rotation angle to obtain a reverse rotated image feature. For example, taking a rotation angle θ1, after rotating the sample image by θ1 to obtain rotated image 1, this rotated image 1 is input into feature extraction subnetwork 1 to obtain rotated image feature 1. This rotated image feature 1 is then rotated by -θ1 to obtain reverse rotated image feature 1. After obtaining n reverse rotated image features, these n reverse rotated image features are vector-concatenated to obtain the aggregated image feature point information and the aggregated image description information.
[0138] The sample image is input into the target neural network model, and feature extraction is performed through the feature extraction subnetwork in the target neural network model to obtain the predicted image features corresponding to the sample image. The predicted image features include predicted image feature point information and predicted image description information. The target loss value is determined based on the aggregated image feature point information, aggregated image description information, predicted image feature point information, and predicted image description information, and the parameters of the target neural network model are updated based on the target loss value.
[0139] Using the above model training method, the sample image is rotated to obtain rotated images of the sample image at different rotation angles. The rotation image features of each rotated image are extracted, and each rotated image feature is rotated again in the opposite direction to obtain multiple reverse rotation image features. The multiple reverse rotation image features are vector-concatenated to obtain aggregated image features. The aggregated image features integrate the image features of the sample image at different rotation angles, so that the first network model trained based on the aggregated image features can also extract the image features of the image at different rotation angles, thereby improving the accuracy of the first network model in extracting image features.
[0140] Figure 5 This is a block diagram illustrating an image matching apparatus according to an exemplary embodiment of the present disclosure, such as... Figure 5 As shown, the device may include:
[0141] The acquisition module 501 is used to input the target image to be matched into the first network model to obtain the target image features output by the first network model;
[0142] The matching module 502 is used to determine whether the target image matches a preset image based on the features of the target image;
[0143] The first network model is trained using sample images and the aggregated image features corresponding to those sample images. These aggregated image features are obtained from the image features of the sample images at different rotation angles.
[0144] Optionally, Figure 6 This is a block diagram illustrating another image matching apparatus according to an exemplary embodiment of the present disclosure, such as... Figure 6 As shown, the device also includes:
[0145] The model training module 503 is used to train the target neural network model based on the sample image features of the sample image to obtain the first network model. The sample image features include the aggregated image features and the estimated image features. The estimated image features are the image features of the sample image obtained through the target neural network.
[0146] Optionally, the model training module 503 is also used for:
[0147] Based on the sample image, the model training steps are executed repeatedly until the trained target neural network model is determined to meet the preset stopping iteration condition, and the trained target neural network model is used as the first network model.
[0148] The training steps for this model include:
[0149] The sample image is input into the target neural network model to obtain the predicted image features;
[0150] Obtain the aggregated image features corresponding to the sample image;
[0151] Based on the estimated image features and the aggregated image features, the target loss value is determined;
[0152] If the target neural network model does not meet the preset stopping iteration condition based on the target loss value, the parameters of the target neural network model are updated according to the target loss value to obtain the trained target neural network model.
[0153] Optionally, the model training module 503 is also used for:
[0154] The sample image is rotated according to a preset rotation direction and / or multiple preset rotation angles to obtain multiple rotated images corresponding to the sample image;
[0155] The multiple rotated images are input into a preset second network model to obtain the aggregated image features.
[0156] Optionally, the second network model includes multiple feature extraction sub-networks, with different feature extraction sub-networks corresponding to different preset rotation angles. The model training module 503 is also used for:
[0157] The multiple rotated images are respectively input into the multiple feature extraction sub-networks to obtain the rotated image features output by each feature extraction sub-network;
[0158] For each of the rotated image features, rotate the rotated image feature according to the preset rotation angle and / or the opposite direction of the preset rotation direction corresponding to the rotated image feature to obtain the reverse rotated image feature corresponding to the rotated image feature;
[0159] The aggregated image features are obtained by vector stitching of the multiple reverse-rotated image features.
[0160] Optionally, the aggregated image features include aggregated image feature point information and aggregated image description information, and the estimated image features include estimated image feature point information and estimated image description information; the model training module 503 is also used for:
[0161] The first loss value is determined based on the difference between the feature point information of the aggregated image and the feature point information of the predicted image;
[0162] The second loss value is determined based on the difference between the aggregated image description information and the estimated image description information;
[0163] The third loss value is determined based on the feature point information and description information of the aggregated image;
[0164] The target loss value is determined based on the first loss value, the second loss value, and the third loss value.
[0165] Optionally, the sample image includes a first sample image and a second sample image, with an overlapping region between the first sample image and the second sample image. The aggregated image feature includes a first aggregated image feature corresponding to the first sample image and a second aggregated image feature corresponding to the second sample image. The model training module 503 is further configured to:
[0166] Multiple sampling points were determined within the overlapping region;
[0167] The first feature point information and the first image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the first sample image, and the second feature point information and the second image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the second sample image.
[0168] The third loss value is determined based on the first difference between the plurality of first feature point information and the plurality of second feature point information, and the second difference between the plurality of first image description information and the plurality of second image description information.
[0169] Optionally, the matching module 502 is also used for:
[0170] Based on the features of the target image, determine the degree of matching between the target image and the preset image;
[0171] If the matching degree is greater than or equal to the preset matching degree threshold, the target image is determined to match the preset image.
[0172] Using the aforementioned device, target image features are extracted from the target image through the first network model. Then, the target image and a preset image are matched based on these target image features. Since the first network model is trained using aggregated image features of sample images, which include the image features of the sample images at different rotation angles, the target image features extracted by the first network model can also reflect the image features of the target image at different rotation angles. Therefore, the accuracy of image matching based on these target image features will be higher.
[0173] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0174] Figure 7 This is a block diagram illustrating an electronic device 700 according to an exemplary embodiment of the present disclosure. Figure 7 As shown, the electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output interface 704, and a communication component 705.
[0175] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the image matching method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The multimedia component 703 may include a screen and audio components. The screen may be, for example, a touchscreen, and the audio component is used for outputting and / or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. Input / output interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 705 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.
[0176] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the image matching method described above.
[0177] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the image matching method described above. For example, the computer-readable storage medium may be the memory 702 including the program instructions described above, which may be executed by the processor 701 of the electronic device 700 to complete the image matching method described above.
[0178] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the image matching method described above when executed by the programmable device.
[0179] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure. It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this disclosure will not further describe the various possible combinations.
[0180] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.
Claims
1. An image matching method, characterized in that, include: The target image to be matched is input into the first network model to obtain the target image features output by the first network model. Based on the features of the target image, determine whether the target image matches a preset image; The first network model is trained using sample images and corresponding aggregated image features, wherein the aggregated image features are obtained from the image features of the sample images at different rotation angles. The process includes, before inputting the target image to be matched into the first network model, the following steps: The target neural network model is trained based on the sample image features of the sample image to obtain the first network model. The sample image features include the aggregated image features and the estimated image features. The estimated image features are the image features of the sample image obtained by the target neural network.
2. The method according to claim 1, characterized in that, The step of training the target neural network model based on the sample image features of the sample image to obtain the first network model includes: Based on the sample image, the model training steps are executed cyclically until the trained target neural network model is determined to meet the preset stopping iteration condition, and the trained target neural network model is used as the first network model. The model training steps include: The sample image is input into the target neural network model to obtain the predicted image features; Obtain the aggregated image features corresponding to the sample image; The target loss value is determined based on the estimated image features and the aggregated image features; If the target neural network model does not meet the preset stopping iteration condition based on the target loss value, the parameters of the target neural network model are updated according to the target loss value to obtain the trained target neural network model.
3. The method according to claim 2, characterized in that, The step of obtaining the aggregated image features corresponding to the sample image includes: The sample image is rotated according to a preset rotation direction and / or multiple preset rotation angles to obtain multiple rotated images corresponding to the sample image; The multiple rotated images are input into a preset second network model to obtain the aggregated image features.
4. The method according to claim 3, characterized in that, The second network model includes multiple feature extraction sub-networks, each corresponding to a different preset rotation angle. The step of inputting the multiple rotated images into the preset second network model to obtain the aggregated image features includes: The multiple rotated images are respectively input into the multiple feature extraction sub-networks to obtain the rotated image features output by each feature extraction sub-network; For each of the rotated image features, the rotated image feature is rotated according to the preset rotation angle and / or the opposite direction of the preset rotation direction corresponding to the rotated image feature to obtain the reverse rotated image feature corresponding to the rotated image feature; The aggregated image features are obtained by vector stitching the multiple reverse-rotated image features.
5. The method according to claim 2, characterized in that, The aggregated image features include aggregated image feature point information and aggregated image description information; the estimated image features include estimated image feature point information and estimated image description information; determining the target loss value based on the estimated image features and the aggregated image features includes: A first loss value is determined based on the difference between the aggregated image feature point information and the estimated image feature point information; A second loss value is determined based on the difference between the aggregated image description information and the estimated image description information; The third loss value is determined based on the feature point information of the aggregated image and the description information of the aggregated image; The target loss value is determined based on the first loss value, the second loss value, and the third loss value.
6. The method according to claim 5, characterized in that, The sample image includes a first sample image and a second sample image, and there is an overlapping region between the first sample image and the second sample image. Determining the third loss value based on the aggregated image feature point information and the aggregated image description information includes: Multiple sampling points are determined within the overlapping area; First feature point information and first image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the first sample image, and second feature point information and second image description information corresponding to each sampling point are determined from the aggregated image features corresponding to the second sample image. The third loss value is determined based on the first difference between the plurality of first feature point information and the plurality of second feature point information, and the second difference between the plurality of first image description information and the plurality of second image description information.
7. The method according to any one of claims 1-6, characterized in that, The step of determining whether the target image matches a preset image based on the target image features includes: Based on the features of the target image, determine the matching degree between the target image and the preset image; If the matching degree is greater than or equal to a preset matching degree threshold, the target image is determined to match the preset image.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-7.
9. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-7.
Citation Information
Patent Citations
Cross-view image matching method for unmanned aerial vehicle image and satellite image
CN112580546A
