A method, apparatus, device and medium for positioning a UAV

By introducing nonmaximum suppression and attention mechanisms into the UAV positioning method, key points are screened and optimized, solving the problems of uneven distribution of key points and insufficient adaptability to complex environments in monocular vision positioning, improving the positioning accuracy and efficiency of UAVs, and expanding high-end application scenarios.

CN121962270BActive Publication Date: 2026-07-21AVIC (CHENGDU) UAS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AVIC (CHENGDU) UAS CO LTD
Filing Date
2026-03-31
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Monocular vision positioning in drones faces challenges such as uneven spatial distribution of key points, the difficulty of balancing computational efficiency and accuracy, and insufficient adaptability to complex environments, resulting in low positioning accuracy and efficiency, making it difficult to apply in high-end scenarios.

Method used

By introducing a nonmaximum suppression strategy and attention mechanism into the UAV localization method, key points with the highest reliability scores are selected. The feature representation is updated by combining self-attention and cross-attention mechanisms, optimizing key point matching, suppressing redundant features, improving localization accuracy and efficiency, and enhancing adaptability to complex environments.

Benefits of technology

It improves the uniformity of spatial distribution of key points, enhances the numerical stability and accuracy of UAV positioning, meets real-time processing requirements, strengthens adaptability to complex environments, and expands the application of UAVs in high-end scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962270B_ABST
    Figure CN121962270B_ABST
Patent Text Reader

Abstract

The application discloses a UAV positioning method and device, equipment and medium, and relates to the field of UAV positioning. The method comprises the following steps: acquiring a shooting image of a target scene and a corresponding reference image by a UAV; determining initial key points, reliability scores and feature representations of the key points from the target image; the target image is any one of the two images; determining a target key point with the maximum reliability score in the neighborhood of the target key point; determining a to-be-matched key point from the neighborhood of the target key point by using a non-maximum suppression strategy and based on the reliability score; updating the feature representation of the to-be-matched key point by using an attention mechanism, and determining a matchable score of the to-be-matched key point based on the updated feature representation, so as to determine the to-be-matched key point with the score meeting the matching requirement as the preferred key point of the neighborhood; and determining a distribution matrix based on the matching confidence between the preferred key points in the two images, so as to accurately position the UAV.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of unmanned aerial vehicle (UAV) positioning, and in particular to a UAV positioning method, apparatus, equipment, and medium. Background Technology

[0002] Visual positioning technology for unmanned aerial vehicles (UAVs) is the fundamental support for core tasks such as autonomous navigation, precision operations, and target tracking. It acquires environmental images through visual sensors and combines feature extraction and matching algorithms to estimate its own pose, without relying on GPS (Global Positioning System) signals. This gives it irreplaceable advantages in obstructed environments such as indoor spaces, urban canyons, and tunnels. Currently, mainstream visual positioning solutions are divided into three categories: monocular, binocular, and multi-view. Among them, monocular visual positioning has become the preferred solution for UAV onboard systems due to its low hardware cost, small device size, and low power consumption.

[0003] The core logic of monocular vision localization is to first extract key points from the captured image and the reference image, and then match all key points in the captured image and the reference image to establish the correspondence between the captured image and the reference image. Finally, the position and attitude information of the UAV are solved by PnP (Perspective-n-Point, a pose calculation algorithm).

[0004] Currently, monocular vision localization faces three main challenges: First, the spatial distribution of key points is uneven, tending to cluster in textured areas, leading to excessive redundant features, deteriorating the numerical stability of UAV position calculation, and reducing pose estimation accuracy. Second, there is the challenge of balancing computational efficiency and positioning accuracy; high-precision algorithms often come with high computational complexity, making it difficult to meet the millisecond-level real-time processing requirements of UAVs. Third, there is insufficient adaptability to complex environments; changes in lighting, atmospheric scattering, and target occlusion can easily cause feature matching failures, leading to UAV positioning interruptions. These issues severely restrict the application of UAVs in high-end scenarios such as precision surveying, emergency rescue, and autonomous inspection. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a UAV positioning method, apparatus, device, and medium that can suppress redundant key points, making the spatial distribution of key points more uniform, while improving the numerical stability of UAV position calculation, thereby increasing UAV positioning accuracy and efficiency, and enhancing the adaptability of UAV positioning to complex environments. The specific solution is as follows: In a first aspect, this application discloses a method for locating unmanned aerial vehicles (UAVs), including: Acquire images of the target scene captured by the drone, along with corresponding reference images; Initial key points and key point information are determined from the target image; the target image is any one of the captured image and the reference image; the key point information includes the reliability score and feature representation of the key points; Target key points are determined from the initial key points based on reliability scores; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius; Using a nonmaximum suppression strategy and based on reliability scores, key points to be matched are determined from the neighborhood of the target key point. The feature representation of the key points to be matched is updated through an attention mechanism, and the matchability score of the key points to be matched is determined based on the updated feature representation. The key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood. The attention mechanism includes a self-attention mechanism and a cross-attention mechanism. An assignment matrix is ​​determined based on the matching confidence between preferred key points in the captured image and the reference image, and the positioning result of the UAV is determined based on the assignment matrix.

[0006] Optionally, determining the initial key points and key point information from the target image includes: The normalized target image is input into the encoder for feature extraction to obtain the output feature maps corresponding to a preset number of coding layers connected in sequence in the encoder; the preset number of coding layers correspond to their respective number of channels; The output feature maps corresponding to the target coding layers are reshaped to a preset size and then fused to obtain a fused feature map; the target coding layer is a specified coding layer among the preset number of coding layers; The first convolutional layer is used to extract features from the fused feature map to obtain a target feature map with a preset number of channels; The target feature map is regressed using a second convolutional layer to determine the initial key points and key point information in the target image.

[0007] Optionally, the step of determining key points to be matched from the neighborhood of the target key point using a non-maximum suppression strategy and based on reliability scores, updating the feature representation of the key points to be matched using an attention mechanism, and determining the matchability score of the key points to be matched based on the updated feature representation, so as to determine the key points to be matched whose matchability scores meet preset matching requirements as preferred key points in the neighborhood, includes: Determine other key points besides the target key point from the neighborhood of the target key point; When the reliability scores of the other key points are not all less than the target score, the other key points are sorted in descending order of reliability scores, and the first key point in the sorted key points and the target key point are both determined as key points to be matched; the target score is a value determined based on the reliability score of the target key point; The feature representation of the key point to be matched is updated by an attention mechanism, and the matching score of the key point to be matched is determined based on the updated feature representation. If there are key points among the key points to be matched that can be matched with a score that meets the preset matching requirements, then the key points to be matched that can be matched with a score that meets the preset matching requirements are determined as the preferred key points in the neighborhood, and the key points to be matched that can be matched with a score that does not meet the preset matching requirements are pruned. If there are no matching key points whose scores meet the preset matching requirements among the key points to be matched, then the key points whose matching scores do not meet the preset matching requirements are pruned, and the next key point in the sorted key points is determined as the new key point to be matched. Then, the process jumps back to the step of updating the feature representation of the key points to be matched through the attention mechanism.

[0008] Optionally, after determining other key points besides the target key point from the neighborhood of the target key point, the method further includes: When the reliability scores of all other key points are less than the target score, all key points in the neighborhood are prohibited from participating in the feature representation update of the attention mechanism, and it is determined that there are no preferred key points in the neighborhood.

[0009] Optionally, updating the feature representation of the key point to be matched through an attention mechanism and determining the matchability score of the key point to be matched based on the updated feature representation includes: The self-attention mechanism is used to determine a first attention score between the key point to be matched and each key point in the target image; Based on the first attention score and the feature representation of each key point in the target image, a first transformation feature of the key point to be matched is determined, and the feature representation of the key point to be matched is updated using the first transformation feature to obtain the updated first feature representation. The cross-attention mechanism is used to determine a second attention score between the key point to be matched and each key point in another image; the other image is an image other than the target image in the captured image and the reference image. Based on the second attention score and the feature representation of each key point in the other image, a second transformation feature of the key point to be matched is determined, and the first feature representation is updated using the second transformation feature to obtain an updated second feature representation; The matching score of the key point to be matched is determined based on the second feature representation.

[0010] Optionally, the key point information also includes the location information of the key points; correspondingly, determining the first attention score between the key point to be matched and each key point in the target image through the self-attention mechanism includes: The query vector is determined based on the feature representation of the key points to be matched, and the first key vector is determined based on the feature representation of each key point in the target image. A first attention score is determined based on the location information of the key points to be matched and each key point in the target image, the query vector, and the first key vector. Furthermore, determining the second attention score between the keypoint to be matched and each keypoint in another image through the cross-attention mechanism includes: A second key vector is determined based on the first feature representation, and a third key vector is determined based on the feature representation of each key point in another image. A second attention score is then determined based on the second key vector and the third key vector.

[0011] Optionally, determining the assignment matrix based on the matching confidence between preferred key points in the captured image and the reference image, and determining the positioning result of the UAV based on the assignment matrix, includes: Based on the updated feature representations of preferred key points in the captured image and the reference image, a similarity score is determined between the preferred key points in the captured image and the reference image; Based on the similarity score and the matchability score of preferred key points in the captured image and the reference image, the matching confidence between preferred key points in the captured image and the reference image is determined, and an allocation matrix is ​​determined based on the matching confidence. The projection transformation relationship between the captured image and the reference image is determined based on the allocation matrix, and the positioning result of the UAV is determined using the PnP algorithm and based on the projection transformation relationship.

[0012] Secondly, this application discloses a drone positioning device, comprising: The image acquisition module is used to acquire images of the target scene taken by the drone and corresponding reference images; The first determining module is used to determine initial key points and key point information from the target image; the target image is any one of the captured image and the reference image; the key point information includes the reliability score and feature representation of the key points; The second determining module is used to determine a target key point from the initial key points based on the reliability score; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius; The third determining module is used to determine key points to be matched from the neighborhood of the target key point using a non-maximum suppression strategy and based on the reliability score. It updates the feature representation of the key points to be matched through an attention mechanism and determines the matchability score of the key points to be matched based on the updated feature representation. The key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood. The attention mechanism includes a self-attention mechanism and a cross-attention mechanism. The UAV positioning module is used to determine an allocation matrix based on the matching confidence between preferred key points in the captured image and the reference image, and to determine the positioning result of the UAV according to the allocation matrix.

[0013] Thirdly, this application discloses an electronic device, including: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned UAV positioning method.

[0014] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned UAV positioning method.

[0015] In this application, images of a target scene captured by a drone and corresponding reference images are acquired; initial key points and key point information are determined from the target images; the target image is any one of the captured images and the reference images; the key point information includes the reliability score and feature representation of the key points; target key points are determined from the initial key points based on the reliability score; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius; using a non-maximum suppression strategy and based on the reliability score, key points to be matched are determined from the neighborhood of the target key point; the feature representation of the key points to be matched is updated through an attention mechanism, and the matchability score of the key points to be matched is determined based on the updated feature representation, so that the key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood; the attention mechanism includes a self-attention mechanism and a cross-attention mechanism; an allocation matrix is ​​determined based on the matching confidence between the preferred key points in the captured images and the reference images, and the positioning result of the drone is determined according to the allocation matrix.

[0016] Therefore, after extracting initial key points from the captured image and the reference image, this application does not directly match all key points in the captured image and the reference image. Instead, it determines the target key point with the highest reliability score in its own neighborhood from the initial key points, and determines the preferred key point with a matching score that meets the matching requirements from the neighborhood of the target key point through a non-maximum suppression strategy and the reliability score of the key point. This allows for matching of the preferred key points in the captured image and the reference image to locate the UAV. In this way, this application comprehensively considers the reliability score and matchability score of key points, prioritizes the target key point with the highest reliability score in its own neighborhood, and retains key points in the neighborhood of the target key point whose matchability score meets the matching requirements based on a non-maximum suppression strategy, while suppressing key points whose matchability score does not meet the matching requirements. On the one hand, this can suppress redundant key points in the neighborhood of the target key point, reduce redundant features, break the limitation of key points clustering in texture-rich areas in traditional methods, and make the spatial distribution of key points more uniform and reasonable. On the other hand, by improving the spatial distribution of key points, the condition number of UAV position calculation can be optimized, the interference of redundant key points on the calculation process can be reduced, the numerical stability of UAV position calculation can be significantly improved, and the fluctuation of calculation results caused by uneven spatial distribution of key points can be avoided, thereby improving the UAV positioning accuracy. Furthermore, by suppressing the participation of key points whose matchability score does not meet the matching requirements in matching, the number of key points participating in matching can be reduced, the overall computational complexity can be reduced, the UAV positioning efficiency can be improved, and the real-time processing requirements of UAV positioning can be met. Furthermore, this application combines self-attention and cross-attention mechanisms to update the feature representation of key points, thereby improving the context awareness capability of key point feature matching, reducing the impact of environmental interference on the matching logic, and improving the adaptability of UAV positioning to complex environments. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0018] Figure 1 A flowchart of a drone positioning method provided in this application embodiment; Figure 2 A key point regression flowchart is provided for an embodiment of this application; Figure 3 A schematic diagram of an encoder structure provided in an embodiment of this application; Figure 4A schematic diagram of key point non-maximum suppression provided in an embodiment of this application; Figure 5 A preferred key point determination flowchart is provided for an embodiment of this application; Figure 6 This is a schematic diagram of a drone positioning result provided in an embodiment of this application; Figure 7 A flowchart of a drone positioning process is provided for an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a drone positioning device provided in an embodiment of this application; Figure 9 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Currently, monocular vision localization faces three main challenges: First, the spatial distribution of key points is uneven, tending to cluster in textured areas, leading to excessive redundant features, deteriorating the numerical stability of UAV position calculation, and reducing pose estimation accuracy. Second, there is the challenge of balancing computational efficiency and positioning accuracy; high-precision algorithms often come with high computational complexity, making it difficult to meet the millisecond-level real-time processing requirements of UAVs. Third, there is insufficient adaptability to complex environments; changes in lighting, atmospheric scattering, and target occlusion can easily cause feature matching failures, leading to UAV positioning interruptions. These issues severely restrict the application of UAVs in high-end scenarios such as precision surveying, emergency rescue, and autonomous inspection.

[0021] In response, this application provides a UAV localization method that, by comprehensively considering the reliability score and matchability score of key points and employing a non-maximum suppression strategy, can suppress redundant key points in the image, making the spatial distribution of key points more uniform. At the same time, it improves the numerical stability of UAV position calculation, enhances UAV localization accuracy and efficiency, and by combining self-attention mechanism and cross-attention mechanism, it can improve the adaptability of UAV localization to complex environments.

[0022] See Figure 1 As shown, an embodiment of the present invention discloses a method for locating unmanned aerial vehicles (UAVs), including: Step S11: Acquire images of the target scene taken by the drone and corresponding reference images.

[0023] In this embodiment of the application, the UAV takes pictures of the target scene with an airborne monocular camera during flight to obtain the captured image, acquire a reference image corresponding to the captured image, and register the captured image and the reference image to ensure that the spatial positions of the captured image and the reference image are roughly corresponding.

[0024] Step S12: Determine initial key points and key point information from the target image; the target image is any one of the captured image and the reference image; the key point information includes the reliability score and feature representation of the key points.

[0025] This application embodiment extracts initial keypoints from both the captured image and the reference image, and then extracts keypoint information from these initial keypoints. This keypoint information includes, but is not limited to, keypoint reliability scores, feature representations, and location information. The reliability score characterizes the reliability of the keypoint, and is positively correlated with the reliability of the keypoint. Keypoints refer to pixels in the image with significant features, used for keypoint feature matching and UAV localization.

[0026] like Figure 2 As shown, the process of extracting initial key points and key point information is illustrated using either the captured image or the reference image, denoted as the target image, as an example. The specific steps include: Step S121: Input the target image into the encoder to normalize the target image and obtain a normalized image; Step S122: The normalized image is downsampled sequentially using a preset number of coding layers in the encoder to obtain the output feature maps corresponding to the target coding layers respectively; the preset number of coding layers are connected sequentially and each has its own number of channels, and the target coding layer is the specified coding layer among the preset number of coding layers; Step S123: Reshape the output feature maps corresponding to the target coding layers to a preset size and perform feature fusion to obtain a fused feature map; Step S124: Use the first convolutional layer in the encoder to extract features from the fused feature map to obtain a target feature map with a preset number of channels; Step S125: Use the second convolutional layer in the encoder to perform keypoint regression on the target feature map to determine the initial keypoints and keypoint information in the target image.

[0027] It should be noted that the embodiments of this application pre-construct an encoder, which includes five sequentially connected coding layers, a first convolutional layer, and a second convolutional layer. The five coding layers correspond to 32, 64, 64, 128, and 256 channels respectively. Each coding layer is based on a 2×2 pooling layer and two 3×3 convolutional layers, and the output of one coding layer is the input of the next. The target coding layers are the last three coding layers, namely the third, fourth, and fifth coding layers. The first convolutional layer contains one 3×3 convolutional layer and one 1×1 convolutional layer, and the second convolutional layer contains one 1×1 convolutional layer.

[0028] Specifically, such as Figure 3 As shown, the target image is input into the encoder. First, the target image is normalized to obtain a normalized image, so that each image has a fixed width (w) and height (h) after normalization. Then, the normalized image is downsampled sequentially using five coding layers, and the output feature maps corresponding to the last three coding layers are extracted. The output feature maps corresponding to the last three coding layers are reshaped to a preset size (w / 8×h / 8) and feature concatenation is performed to obtain a concatenated feature map. Then, a 1×1 convolution is performed on the concatenated feature map to obtain a fused feature map.

[0029] The fused feature map can be represented as: F represents the fused feature map. This represents the output feature maps corresponding to the third, fourth, and fifth coding layers, respectively. `Concate()` represents feature concatenation. This represents a 1×1 convolution.

[0030] For the fused feature map, the first convolutional layer is used to extract features from the fused feature map, increasing the number of channels to 64 to obtain the target feature map. Since the size of the feature map is w / 8×h / 8 at this point, the receptive field of each pixel on the feature map is a set of 8×8 pixel spaces on the original image size. Then, the second convolutional layer is used to perform keypoint regression on the target feature map, reshaping each pixel on the feature map into a 65-dimensional feature. Here, x represents a pixel, R represents the set of real numbers, and w / 8×h / 8×65 represents the feature map with a width of 8, a height of 8, and a feature dimension (i.e., the number of image channels) of 65. This feature preserves the spatial granularity of each pixel. The first 64 dimensions represent the spatial information of the pixel in the original image, while the 65th dimension represents the probability that the pixel is detected as a keypoint within that space, thus determining the initial keypoints and keypoint information from the target image. In one case, the reliability score of a keypoint can be directly taken as the probability value of the pixel being detected as a keypoint.

[0031] In this way, the embodiments of this application construct an encoder with alternating deep and shallow layers for deep feature extraction, enabling multi-scale feature extraction of the input image. By employing a minimal number of convolutional branches, low-level features are effectively utilized for multi-scale feature fusion. Furthermore, by fully fusing low-level image structural features with high-level semantic features, the limitations of single-scale feature extraction can be overcome, enhancing the richness of keypoint feature representation and ensuring stable feature descriptions of keypoints even under environmental changes, thereby improving the accuracy of keypoint localization. Simultaneously, to maintain spatial resolution without sacrificing speed, multi-layer downsampling is applied to the input image to reduce the amount of computational data, simplify the convolutional branch structure, and avoid complex and redundant network layer designs. In addition, the embodiments of this application introduce a reliability score for keypoints to facilitate the subsequent removal of low-reliability, low-quality, and mismatched keypoints, improving the stability and anti-interference capability of keypoint localization from the source, avoiding localization deviations caused by feature ambiguity or noise, and further improving the accuracy of keypoint localization.

[0032] During the encoder training process, for training image A and the corresponding reference image B, the keypoints detected on training image A and reference image B are described as follows: , This represents the set of key points on training image A and reference image B. Let h represent the keypoints with height h and width w in the training image A. This represents a keypoint in reference image B with height h and width w. The ground truth label for each keypoint is described as follows: , Let A represent the ground truth label for a keypoint with height h and width w in training image A. This represents the set of truth labels for key points in training image A. This represents the ground truth label for a keypoint with height h and width w in reference image B. Let B represent the set of ground truth labels for keypoints in reference image B. The loss function for keypoint detection is then: ; ; For ease of explanation, the descriptions of training image A and reference image B are omitted from the formula. That is, this loss function can be used to calculate the corresponding keypoint detection loss for either training image A or reference image B. Here, exp() represents an exponential function with base e. This represents the predicted value of a keypoint with height h and width w under the ground truth label y. This represents the predicted value of a keypoint with height h and width w in feature dimension c. This represents the summation of the predicted values ​​for a keypoint with height h and width w across all feature dimensions after performing an exponential operation; H represents the image height, W represents the image width, and c represents the feature dimension of a pixel, which also represents the number of image channels. This represents the detection loss of a keypoint with height h and width w. This represents the loss for keypoint detection across the entire image. Furthermore, during encoder training, a sample cap is set for cases without keypoints to avoid class imbalance.

[0033] Step S13: Determine the target key point from the initial key points based on the reliability score; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius.

[0034] Since keypoints tend to be generated in localized areas with prominent features, keypoints with high reliability and repeatability are more likely to be generated in areas with obvious texture features. However, for geographical scenes with different attributes, their structural texture features have different distribution characteristics. Overly dense concentration of keypoints in a certain area will lead to a severe imbalance in keypoint distribution, resulting in a decrease in the global representation capability of the image.

[0035] Since the location information and reliability score of each keypoint can be correlated one-to-one, generally speaking, keypoints with higher reliability scores tend to have greater matching potential. Therefore, compared to directly globally filtering multiple keypoints with the highest reliability scores, this application first sorts the initial keypoints extracted from the target image by their reliability scores, and sets an NMS (Non-Maximum Suppression) radius r for each sorted keypoint. Then, it determines whether the initial keypoint has the maximum reliability score in a neighborhood centered at itself with radius r. If it does, the initial keypoint is identified as a target keypoint to participate in subsequent steps; otherwise, it is suppressed from participating in subsequent steps. Figure 4 The diagram shown is a key point diagram after non-maximum suppression. The black bold × in the diagram represents the key point with a local maximum reliability score.

[0036] In contrast to directly filtering the highest reliability scores globally, which often results in keypoints being concentrated in localized areas with obvious textures and neglecting keypoints in less textured areas, leading to a severely uneven distribution of keypoints, this application filters keypoints with the highest reliability scores within a neighborhood centered on the keypoint itself and with radius r. This allows for the selection of keypoints with locally highest reliability scores, ensuring that the selected keypoints can be located in either localized or less textured areas. This avoids the concentration of keypoints in localized areas and achieves a more even distribution of keypoints while suppressing keypoints with low local reliability scores.

[0037] Step S14: Using a non-maximum suppression strategy and based on the reliability score, determine the key points to be matched from the neighborhood of the target key point. Update the feature representation of the key points to be matched through an attention mechanism, and determine the matchability score of the key points to be matched based on the updated feature representation. The key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood. The attention mechanism includes a self-attention mechanism and a cross-attention mechanism.

[0038] In this embodiment, after selecting target key points with local maximum reliability scores from the target image, a non-maximum suppression strategy is used and based on the reliability scores to select key points to be matched from the neighborhood of the target key points. Then, the feature representations of the key points to be matched are updated through self-attention and cross-attention mechanisms, and the matchability score of the key points to be matched is determined based on the updated feature representations. Finally, the key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood of the target key points, thereby determining the preferred key points in the target image.

[0039] It should be noted that the matchability score of a keypoint represents the probability that a keypoint will be matched with a corresponding keypoint in another image. In one case, the preset matching requirement can be that the matchability score is greater than the preset matching score.

[0040] like Figure 5 As shown, determining the preferred key point from the neighborhood of the target key point specifically includes the following steps: Step S141: Determine other key points besides the target key point from the neighborhood of the target key point; Step S142: When the reliability scores of other key points are not all less than the target score, sort the other key points in descending order of reliability scores, and determine the first key point in the sorted key points and the target key point as key points to be matched; the target score is a value determined based on the reliability score of the target key point. Step S143: Update the feature representation of the key point to be matched through the attention mechanism, and determine the matchability score of the key point to be matched based on the updated feature representation. Step S144: If there are key points among the key points to be matched that can be matched with a score that meets the preset matching requirements, then the key points to be matched that can be matched with a score that meets the preset matching requirements are determined as the preferred key points in the neighborhood, and the key points to be matched that can be matched with a score that does not meet the preset matching requirements are pruned. Step S145: If there are no matching key points whose scores meet the preset matching requirements, the matching key points whose scores do not meet the preset matching requirements are pruned, and the next key point in the sorted key points is determined as the new matching key point. Then, the process jumps back to the step of updating the feature representation of the matching key points through the attention mechanism.

[0041] It should be noted that, for other key points in the neighborhood of the target key point, if the reliability scores of all other key points are less than the target score, then all key points in that neighborhood are suppressed. This means that all key points in that neighborhood are prohibited from participating in the feature representation update of the attention mechanism, and it is determined that there are no preferred key points in that neighborhood. The target score can be 80% of the reliability score of the target key point.

[0042] If the reliability scores of other key points are not all less than the target score, that is, if there are key points among the other key points with a reliability score not less than the target score, then sort the other key points in descending order of reliability score to obtain sorted key points. Then, the first key point among the sorted key points and the target key point are both determined as key points to be matched.

[0043] The feature representations of the keypoints to be matched are updated using self-attention and cross-attention mechanisms, and the matchability score of the keypoints is determined based on the updated feature representations. If the matchability score does not meet the preset matching requirements, it indicates that even if the keypoint has a high reliability score, it is difficult to match a corresponding keypoint in another image, or it is unlikely to establish a good matching relationship with a keypoint in another image. In this case, the keypoint has low matchability and needs to be pruned to prevent it from participating in subsequent matching. If the matchability score meets the preset matching requirements, it indicates that the keypoint is relatively easy to match a corresponding keypoint in another image, i.e., the keypoint has high matchability. In this case, the keypoint can be determined as a preferred keypoint in the neighborhood of the target keypoint and participate in subsequent matching, and the process of determining the preferred keypoint in the neighborhood of the target keypoint can be terminated.

[0044] However, if none of the keypoints to be matched in this round meet the preset matching requirements, the next keypoint in the sorted keypoints needs to be identified as the new keypoint to be matched. The feature representation of this new keypoint is then updated using self-attention and cross-attention mechanisms to determine if it is a preferred keypoint in the neighborhood of the target keypoint. This process continues until a preferred keypoint is identified from the neighborhood of the target keypoint, or until the matching scores of other keypoints (or the sorted keypoints) do not meet the preset matching requirements. If the matching scores of other keypoints (or the sorted keypoints) do not meet the preset matching requirements, it indicates that there is no preferred keypoint in the neighborhood of the target keypoint.

[0045] According to one example, updating the feature representation of the keypoint to be matched using an attention mechanism and determining the matchability score of the keypoint based on the updated feature representation specifically includes the following steps: Step S1431: Determine the first attention score between the key point to be matched and each key point in the target image through a self-attention mechanism; Step S1432: Based on the first attention score and the feature representation of each key point in the target image, determine the first transformation feature of the key point to be matched, and use the first transformation feature to update the feature representation of the key point to be matched, so as to obtain the updated first feature representation. Step S1433: Determine the second attention score between the key point to be matched and each key point in another image through a cross-attention mechanism; the other image is the image other than the target image in the captured image and the reference image. Step S1434: Based on the second attention score and the feature representation of each key point in another image, determine the second transformation feature of the key point to be matched, and use the second transformation feature to update the first feature representation to obtain the updated second feature representation; Step S1435: Determine the matchable score of the key point to be matched based on the second feature representation.

[0046] In the self-attention mechanism, a query vector is determined based on the feature representations of the keypoints to be matched, and a first key vector is determined based on the feature representations of each keypoint in the target image. A first attention score is determined based on the positional information of the keypoints to be matched and each keypoint in the target image, the query vector, and the first key vector. Then, based on the first attention score and the feature representations of each keypoint in the target image, a first transformed feature of the keypoint to be matched is determined, and the feature representation of the keypoint to be matched is updated using the first transformed feature to obtain the updated first feature representation. The formulas involved are as follows: ; ; ; In the self-attention mechanism, i represents the keypoint to be matched in the target image, j represents each keypoint in the target image, and I represents the target image. Let q represent the first attention scores for keypoints i and j. i This represents the query vector for key point i, where T represents the transpose operation; k j p represents the key vector of key point j. i p represents the location information of key point i. j W represents the location information of key point j; W represents the projection matrix, which is a matrix obtained through pre-training. Indicates the transformation feature; softmax() represents the normalization exponential function. This represents the feature representation of key point j. Let represent the feature representation of keypoint i; MLP represents a multilayer perceptron; [ | ] represents feature concatenation. R()∈128×128 represents the rotation encoding of relative positions.

[0047] In the cross-attention mechanism, a second key vector is determined based on the first feature representation of the keypoint to be matched, and a third key vector is determined based on the feature representation of each keypoint in another image. A second attention score is then determined based on the second and third key vectors. Next, a second transformed feature is determined based on the second attention score and the feature representation of each keypoint in the other image, and the first feature representation is updated using the second transformed feature to obtain the updated second feature representation. The formulas involved are as follows: ; ; ; In the cross-attention mechanism, i represents the key point to be matched in the target image, j represents each key point in the other image, I represents the target image, and O represents the other image in the cross-attention mechanism; Let represent the second attention score between keypoint i in target image I and keypoint j in another image O; T represents the transpose operation; k represents the key vector. Let i represent the key vector of key point i in the target image I. Let represent the key vector of key point j in another image O; softmax() represents the normalization exponential function; W represents the projection matrix, which is a matrix obtained through pre-training. Indicates transformation features; This represents the feature representation of key point j in another image O. represents the feature representation of key point i in target image I; MLP represents multilayer perceptron; [ | ] represents feature concatenation.

[0048] For the matchable scores of key points, the following approach is adopted: This formula is used for calculation, where sigmoid() represents the activation function, and Linear() is a pre-learned linear transformation with bias. The feature representation of key point i, This represents the matchability score of keypoint i, and the matchability score ranges from [0,1]. The closer it is to 0, the less likely the keypoint is to be matched with a corresponding keypoint in another image.

[0049] In this way, the embodiments of this application introduce attention mechanisms, including self-attention and cross-attention mechanisms, to dynamically update the feature representations of key points, strengthen the contextual associations between key points, and make key point matching more closely match the actual spatial correspondence. Simultaneously, an adaptive non-maximum suppression strategy is used to adjust the suppression radius of key points based on their reliability scores, prioritizing the retention of high-reliability key points while suppressing redundant key points in dense regions. This breaks the limitation of traditional methods where key points cluster in texture-rich areas, resulting in a more uniform and reasonable spatial distribution of key points. Furthermore, the embodiments of this application incorporate a pruning strategy for low-matching key points to eliminate them, suppressing their participation in key point feature matching, reducing the number of key points involved in matching and calculation, and lowering the overall computational complexity.

[0050] Step S15: Determine the assignment matrix based on the matching confidence between preferred key points in the captured image and the reference image, and determine the positioning result of the UAV according to the assignment matrix.

[0051] In this embodiment, after determining the preferred key points in the captured image and the reference image, a similarity score is determined between the preferred key points in the captured image and the reference image based on the updated feature representation of the preferred key points. Based on the similarity score and the matchability score of the preferred key points in the captured image and the reference image, a matching confidence score is determined between the preferred key points in the captured image and the reference image. An assignment matrix is ​​then determined based on the matching confidence score between the preferred key points in the captured image and the reference image. Finally, the projection transformation relationship between the captured image and the reference image is determined based on the assignment matrix, and the UAV's positioning result is determined using the PnP algorithm and based on the projection transformation relationship. The formulas involved are as follows: ; ; Where C represents the captured image, D represents the reference image, i represents a key point in the captured image, and j represents a key point in the reference image. This represents the feature representation of key point i in captured image C. This represents the feature representation of key point j in reference image D. This represents the similarity score between keypoint i and keypoint j. Linear() represents a linear function, and T represents the transpose operation. This indicates the matchable score for key points. Let i represent the matchability score of keypoint i in the captured image C. This represents the matchability score of keypoint j in reference image D. and This indicates a bidirectional Softmax function, meaning a Softmax function that calculates horizontally by row and a Softmax function that calculates vertically by column. This represents the matching confidence between keypoint i and keypoint j.

[0052] Furthermore, after determining the allocation matrix, the projection transformation relationship between the captured image and the reference image is determined based on the allocation matrix. The PnP algorithm is then used to solve for the latitude, longitude, and attitude information of the UAV based on the projection transformation relationship, thereby obtaining the UAV's positioning result. It should be noted that, as... Figure 6 As shown, the UAV positioning method optimized in this application through multiple dimensions can maintain high matching accuracy even in complex weather conditions, and the UAV positioning accuracy can reach up to 10 meters. At the same time, it achieves millisecond-level feature matching speed, ensuring that the output frequency of UAV pose calculation is not less than 5Hz. It is fully adaptable to scenarios where UAV onboard computing resources are limited, and meets the strict real-time requirements of UAV autonomous navigation, target tracking and other tasks.

[0053] Furthermore, the encoder, attention mechanism, non-maximum suppression strategy, determination of the assignment matrix, and UAV localization in this application constitute a UAV localization model. The model structure and the specific process for implementing UAV localization are as follows: Figure 7 As shown, the specific implementation steps can be found in the description of steps S11 to S15 above.

[0054] It should be noted that this application uses synthetic and real datasets to pre-train and fine-tune the UAV localization model, and employs a matching loss function to supervise the learning of the assignment matrix, thereby driving the UAV localization model to converge towards the real matching relationship. The matching loss function is shown below: ; Loss represents the matching loss, L represents the total number of layers in the attention mechanism, and l represents the l-th layer of the attention mechanism. Let represent the matching confidence of keypoint i and keypoint j in layer l, M represent the set of keypoint pairs consisting of keypoint i and keypoint j, and |M| represent the total number of keypoint pairs in set M. This represents the matchable score of keypoints in layer l. This represents the matchability score of keypoint i in the l-th layer. This represents the matchability score of keypoint j in layer l. This represents the set of keypoints in training image A that cannot participate in feature matching. This represents the set of keypoints in reference image B that cannot participate in feature matching. Represents the set of key points The total number of key points in the middle, Represents the set of key points The total number of key points. The model parameters of the UAV localization model are adjusted using matching loss, thereby driving the feature matching algorithm towards the ground truth.

[0055] Therefore, after extracting initial key points from the captured image and the reference image, this application does not directly match all key points in the captured image and the reference image. Instead, it determines the target key point with the highest reliability score in its own neighborhood from the initial key points, and determines the preferred key point with a matching score that meets the matching requirements from the neighborhood of the target key point through a non-maximum suppression strategy and the reliability score of the key point. This allows for matching of the preferred key points in the captured image and the reference image to locate the UAV. In this way, this application comprehensively considers the reliability score and matchability score of key points, prioritizes the target key point with the highest reliability score in its own neighborhood, and retains key points in the neighborhood of the target key point whose matchability score meets the matching requirements based on a non-maximum suppression strategy, while suppressing key points whose matchability score does not meet the matching requirements. On the one hand, this can suppress redundant key points in the neighborhood of the target key point, reduce redundant features, break the limitation of key points clustering in texture-rich areas in traditional methods, and make the spatial distribution of key points more uniform and reasonable. On the other hand, by improving the spatial distribution of key points, the condition number of UAV position calculation can be optimized, the interference of redundant key points on the calculation process can be reduced, the numerical stability of UAV position calculation can be significantly improved, and the fluctuation of calculation results caused by uneven spatial distribution of key points can be avoided, thereby improving the UAV positioning accuracy. Furthermore, by suppressing the participation of key points whose matchability score does not meet the matching requirements in matching, the number of key points participating in matching can be reduced, the overall computational complexity can be reduced, the UAV positioning efficiency can be improved, and the real-time processing requirements of UAV positioning can be met. Furthermore, this application combines self-attention and cross-attention mechanisms to update the feature representation of key points, thereby improving the context awareness capability of key point feature matching, reducing the impact of environmental interference on the matching logic, and improving the adaptability of UAV positioning to complex environments.

[0056] See Figure 8 As shown, an embodiment of the present invention discloses a drone positioning device, comprising: Image acquisition module 11 is used to acquire images of the target scene taken by the drone and corresponding reference images; The first determining module 12 is used to determine initial key points and key point information from the target image; the target image is any one of the captured image and the reference image; the key point information includes the reliability score and feature representation of the key points; The second determining module 13 is used to determine a target key point from the initial key points based on the reliability score; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius; The third determining module 14 is used to determine key points to be matched from the neighborhood of the target key point using a non-maximum suppression strategy and based on the reliability score, update the feature representation of the key points to be matched through an attention mechanism, and determine the matchability score of the key points to be matched based on the updated feature representation, so as to determine the key points to be matched that meet the preset matching requirements as the preferred key points in the neighborhood; the attention mechanism includes a self-attention mechanism and a cross-attention mechanism; The UAV positioning module 15 is used to determine an allocation matrix based on the matching confidence between preferred key points in the captured image and the reference image, and to determine the positioning result of the UAV according to the allocation matrix.

[0057] Therefore, after extracting initial key points from the captured image and the reference image, this application does not directly match all key points in the captured image and the reference image. Instead, it determines the target key point with the highest reliability score in its own neighborhood from the initial key points, and determines the preferred key point with a matching score that meets the matching requirements from the neighborhood of the target key point through a non-maximum suppression strategy and the reliability score of the key point. This allows for matching of the preferred key points in the captured image and the reference image to locate the UAV. In this way, this application comprehensively considers the reliability score and matchability score of key points, prioritizes the target key point with the highest reliability score in its own neighborhood, and retains key points in the neighborhood of the target key point whose matchability score meets the matching requirements based on a non-maximum suppression strategy, while suppressing key points whose matchability score does not meet the matching requirements. On the one hand, this can suppress redundant key points in the neighborhood of the target key point, reduce redundant features, break the limitation of key points clustering in texture-rich areas in traditional methods, and make the spatial distribution of key points more uniform and reasonable. On the other hand, by improving the spatial distribution of key points, the condition number of UAV position calculation can be optimized, the interference of redundant key points on the calculation process can be reduced, the numerical stability of UAV position calculation can be significantly improved, and the fluctuation of calculation results caused by uneven spatial distribution of key points can be avoided, thereby improving the UAV positioning accuracy. Furthermore, by suppressing the participation of key points whose matchability score does not meet the matching requirements in matching, the number of key points participating in matching can be reduced, the overall computational complexity can be reduced, the UAV positioning efficiency can be improved, and the real-time processing requirements of UAV positioning can be met. Furthermore, this application combines self-attention and cross-attention mechanisms to update the feature representation of key points, thereby improving the context awareness capability of key point feature matching, reducing the impact of environmental interference on the matching logic, and improving the adaptability of UAV positioning to complex environments.

[0058] In some specific embodiments, the first determining module 12 includes: The normalization unit is used to input the target image into the encoder to normalize the target image and obtain a normalized image; The downsampling unit is used to downsample the normalized image sequentially using a preset number of coding layers in the encoder to obtain the output feature maps corresponding to the target coding layers respectively; the preset number of coding layers are connected sequentially and each has its own number of channels, and the target coding layer is a specified coding layer among the preset number of coding layers. The feature fusion unit is used to reshape the output feature maps corresponding to the target coding layers to a preset size and perform feature fusion to obtain a fused feature map. The feature extraction unit is used to extract features from the fused feature map using the first convolutional layer in the encoder to obtain a target feature map with a preset number of channels; The keypoint regression unit is used to perform keypoint regression on the target feature map using the second convolutional layer in the encoder to determine the initial keypoints and keypoint information in the target image.

[0059] In some specific embodiments, the third determining module 14 includes: The first key point determination unit is used to determine other key points besides the target key point from the neighborhood of the target key point; The second key point determination unit is used to sort the other key points in descending order of reliability score when the reliability scores of the other key points are not all less than the target score, and to determine the first key point in the sorted key points and the target key point as key points to be matched; the target score is a value determined based on the reliability score of the target key point. The feature representation update submodule is used to update the feature representation of the key point to be matched through an attention mechanism, and to determine the matchability score of the key point to be matched based on the updated feature representation. The third key point determination unit is used to determine the key point to be matched that meets the preset matching requirements as the preferred key point in the neighborhood if there is a key point among the key points to be matched that can be matched with a score that meets the preset matching requirements, and to prune the key points to be matched that do not meet the preset matching requirements. The keypoint pruning unit is used to prune the keypoints to be matched if there are no keypoints among the keypoints to be matched whose matching scores meet the preset matching requirements, and to determine the next keypoint among the sorted keypoints as the new keypoints to be matched, and then jump back to the step of updating the feature representation of the keypoints to be matched through the attention mechanism.

[0060] In some specific embodiments, the UAV positioning device is further configured to: when the reliability scores of the other key points are all less than the target score, prohibit all key points in the neighborhood from participating in the feature representation update of the attention mechanism, and determine that there are no preferred key points in the neighborhood.

[0061] In some specific embodiments, the feature represents an update submodule, including: The first attention score determination unit is used to determine the first attention score between the key point to be matched and each key point in the target image through the self-attention mechanism. The first feature representation update unit is used to determine the first transformation feature of the key point to be matched based on the first attention score and the feature representation of each key point in the target image, and to update the feature representation of the key point to be matched using the first transformation feature to obtain the updated first feature representation. The second attention score determination unit is used to determine a second attention score between the key point to be matched and each key point in another image through the cross-attention mechanism; the other image is an image other than the target image in the captured image and the reference image. The second feature representation update unit is used to determine the second transformation feature of the key point to be matched based on the second attention score and the feature representation of each key point in the other image, and to update the first feature representation using the second transformation feature to obtain the updated second feature representation; A matchable score determination unit is used to determine the matchable score of the key point to be matched based on the second feature representation.

[0062] In some specific embodiments, the key point information also includes the location information of the key point; Accordingly, the first attention score determination unit is specifically used to: determine a query vector based on the feature representation of the key point to be matched, and determine a first key vector based on the feature representation of each key point in the target image; and determine a first attention score based on the position information of the key point to be matched and each key point in the target image, the query vector, and the first key vector. Furthermore, the second attention score determination unit is specifically used to: determine a second key vector based on the first feature representation, and determine a third key vector based on the feature representation of each key point in another image, and determine a second attention score based on the second key vector and the third key vector.

[0063] In some specific embodiments, the UAV positioning module 15 includes: A similarity score determination unit is used to determine the similarity score between the captured image and the reference image based on the updated feature representation of the preferred key points in the captured image and the reference image; The allocation matrix determination unit is used to determine the matching confidence between the preferred key points in the captured image and the reference image based on the similarity score and the matchability score of the preferred key points in the captured image and the reference image, and to determine the allocation matrix based on the matching confidence. The UAV positioning unit is used to determine the projection transformation relationship between the captured image and the reference image based on the allocation matrix, and to determine the positioning result of the UAV using the PnP algorithm and based on the projection transformation relationship.

[0064] Furthermore, embodiments of this application also disclose an electronic device, Figure 9 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0065] Figure 9 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the UAV positioning method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0066] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0067] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0068] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the UAV positioning method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.

[0069] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed UAV positioning method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0070] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0071] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0072] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0073] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0074] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for locating unmanned aerial vehicles (UAVs), characterized in that, include: Acquire images of the target scene captured by the drone, along with corresponding reference images; Determine the initial key points and key point information from the target image; The target image is any one of the captured image and the reference image; the key point information includes the reliability score and feature representation of the key points; Target key points are determined from the initial key points based on reliability scores; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius; Using a non-maximum suppression strategy and based on reliability scores, key points to be matched are determined from the neighborhood of the target key point. The feature representation of the key points to be matched is updated through an attention mechanism, and the matchability score of the key points to be matched is determined based on the updated feature representation. The key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood. The attention mechanisms include self-attention mechanisms and cross-attention mechanisms; An assignment matrix is ​​determined based on the matching confidence between preferred key points in the captured image and the reference image, and the positioning result of the UAV is determined based on the assignment matrix. The process of determining key points to be matched from the neighborhood of the target key point using a non-maximum suppression strategy and based on reliability scores, updating the feature representation of the key points to be matched using an attention mechanism, and determining the matchability score of the key points to be matched based on the updated feature representation, so as to determine the key points to be matched whose matchability scores meet preset matching requirements as the preferred key points in the neighborhood, includes: Determine other key points besides the target key point from the neighborhood of the target key point; When the reliability scores of the other key points are not all less than the target score, the other key points are sorted in descending order of reliability scores, and the first key point in the sorted key points and the target key point are both determined as key points to be matched; the target score is a value determined based on the reliability score of the target key point; The feature representation of the key point to be matched is updated by an attention mechanism, and the matching score of the key point to be matched is determined based on the updated feature representation. If there are key points among the key points to be matched that can be matched with a score that meets the preset matching requirements, then the key points to be matched that can be matched with a score that meets the preset matching requirements are determined as the preferred key points in the neighborhood, and the key points to be matched that can be matched with a score that does not meet the preset matching requirements are pruned. If there are no matching key points whose scores meet the preset matching requirements among the key points to be matched, then the key points whose matching scores do not meet the preset matching requirements are pruned, and the next key point in the sorted key points is determined as the new key point to be matched. Then, the process jumps back to the step of updating the feature representation of the key points to be matched through the attention mechanism.

2. The UAV positioning method according to claim 1, characterized in that, The process of determining initial key points and key point information from the target image includes: The target image is input into the encoder to normalize the target image and obtain a normalized image; The normalized image is downsampled sequentially using a preset number of coding layers in the encoder to obtain the output feature maps corresponding to the target coding layers respectively; the preset number of coding layers are connected sequentially and each has its own number of channels; the target coding layer is a specified coding layer among the preset number of coding layers. The output feature maps corresponding to the target coding layers are reshaped to a preset size and then fused to obtain a fused feature map. The first convolutional layer in the encoder is used to extract features from the fused feature map to obtain a target feature map with a preset number of channels; The second convolutional layer in the encoder is used to perform keypoint regression on the target feature map to determine the initial keypoints and keypoint information in the target image.

3. The UAV positioning method according to claim 1, characterized in that, After determining other key points besides the target key point from the neighborhood of the target key point, the method further includes: When the reliability scores of all other key points are less than the target score, all key points in the neighborhood are prohibited from participating in the feature representation update of the attention mechanism, and it is determined that there are no preferred key points in the neighborhood.

4. The UAV positioning method according to claim 1, characterized in that, The step of updating the feature representation of the key point to be matched through an attention mechanism, and determining the matchability score of the key point to be matched based on the updated feature representation, includes: The self-attention mechanism is used to determine a first attention score between the key point to be matched and each key point in the target image; Based on the first attention score and the feature representation of each key point in the target image, a first transformation feature of the key point to be matched is determined, and the feature representation of the key point to be matched is updated using the first transformation feature to obtain the updated first feature representation. The cross-attention mechanism is used to determine a second attention score between the key point to be matched and each key point in another image; the other image is an image other than the target image in the captured image and the reference image. Based on the second attention score and the feature representation of each key point in the other image, a second transformation feature of the key point to be matched is determined, and the first feature representation is updated using the second transformation feature to obtain an updated second feature representation; The matchability score of the key point to be matched is determined based on the second feature representation.

5. The UAV positioning method according to claim 4, characterized in that, Key point information also includes the location information of the key points; correspondingly, determining the first attention score between the key point to be matched and each key point in the target image through the self-attention mechanism includes: The query vector is determined based on the feature representation of the key points to be matched, and the first key vector is determined based on the feature representation of each key point in the target image. A first attention score is determined based on the location information of the key points to be matched and each key point in the target image, the query vector, and the first key vector. Furthermore, determining the second attention score between the keypoint to be matched and each keypoint in another image through the cross-attention mechanism includes: A second key vector is determined based on the first feature representation, and a third key vector is determined based on the feature representation of each key point in another image. A second attention score is then determined based on the second key vector and the third key vector.

6. The UAV positioning method according to any one of claims 1 to 5, characterized in that, The step of determining an allocation matrix based on the matching confidence between preferred key points in the captured image and the reference image, and determining the positioning result of the UAV based on the allocation matrix, includes: Based on the updated feature representations of preferred key points in the captured image and the reference image, a similarity score is determined between the preferred key points in the captured image and the reference image; Based on the similarity score and the matchability score of preferred key points in the captured image and the reference image, the matching confidence between preferred key points in the captured image and the reference image is determined, and an allocation matrix is ​​determined based on the matching confidence. The projection transformation relationship between the captured image and the reference image is determined based on the allocation matrix, and the positioning result of the UAV is determined using the PnP algorithm and based on the projection transformation relationship.

7. A drone positioning device, characterized in that, The drone positioning device is used to implement the drone positioning method as described in any one of claims 1 to 6, and the drone positioning device includes: The image acquisition module is used to acquire images of the target scene taken by the drone and corresponding reference images; The first determining module is used to determine initial key points and key point information from the target image; the target image is any one of the captured image and the reference image; the key point information includes the reliability score and feature representation of the key points; The second determining module is used to determine the target key point from the initial key points based on the reliability score; the target key point has the maximum reliability score in a neighborhood with itself as the center and a preset value as the radius; The third determining module is used to determine key points to be matched from the neighborhood of the target key point using a non-maximum suppression strategy and based on the reliability score. It updates the feature representation of the key points to be matched through an attention mechanism and determines the matchability score of the key points to be matched based on the updated feature representation. The key points to be matched whose matchability scores meet the preset matching requirements are determined as the preferred key points in the neighborhood. The attention mechanism includes a self-attention mechanism and a cross-attention mechanism. The UAV positioning module is used to determine an allocation matrix based on the matching confidence between preferred key points in the captured image and the reference image, and to determine the positioning result of the UAV according to the allocation matrix.

8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the UAV positioning method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the UAV positioning method as described in any one of claims 1 to 6.