Visual repositioning method and device, electronic equipment, storage medium and program product
By introducing semantic object screening and deep learning algorithms into visual relocation, it solves the problem of insufficient performance of existing technology in similar, repetitive and dynamic scenes, and improves the stability and accuracy of visual relocation.
Patent Information
- Application Number
- CN202410819121.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-10-08
AI Technical Summary
The existing technology has insufficient visual relocation performance in similar scenes, repeated scenes and dynamic scenes, which affects the stable operation of robots and autonomous driving equipment.
Through image retrieval and feature extraction based on the semantic objects of the image to be relocated, key images and feature points are screened, and deep learning algorithms are combined for feature matching and pose positioning to reduce the impact of non-semantic objects and dynamic scenes.
It improves the stability of visual relocation in boundary scenes and enhances the positioning accuracy and robustness of robots and autonomous driving equipment.
Smart Images

Figure CN118747773A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to artificial intelligence technology, and in particular to a visual repositioning method, device, electronic device, storage medium and program product. Background Art
[0002] As camera sensors are increasingly used in robots and autonomous driving equipment, visual relocalization technology is being used in more and more scenarios, which brings with it the boundary issues of various visual technologies, including similar scenes, repeated scenes, and dynamic scenes.
[0003] The performance of the visual algorithms of related technologies in these boundary scenes is no longer sufficient to support the stable operation of the robot. Summary of the invention
[0004] The embodiments of the present application provide a visual relocalization method, device, electronic device, storage medium and program product, which can improve the stability of visual relocalization in boundary scenes.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application embodiment provides a visual repositioning method, including:
[0007] Based on the image to be relocated, performing image retrieval processing on a retrieval database to obtain a plurality of candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera;
[0008] Based on the semantic objects included in the image to be relocated, screening out a key image of the image to be relocated from the multiple candidate images;
[0009] Performing feature extraction processing on the image to be relocated to obtain a first feature point, and performing feature extraction processing on the key image to obtain a second feature point;
[0010] Based on the semantic object included in the image to be relocated, a first feature point to be matched is selected from the first feature points, and based on the semantic object included in the key image, a second feature point to be matched is selected from the second feature points;
[0011] Feature matching processing is performed on the first feature point to be matched and the second feature point to be matched, and posture positioning processing is performed on the camera based on the obtained feature point matching relationship to obtain a repositioned posture of the camera.
[0012] The present application embodiment provides a visual repositioning device, comprising:
[0013] An image retrieval module is used to perform image retrieval processing on a retrieval database based on an image to be relocated, so as to obtain a plurality of candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera;
[0014] A first screening module, configured to screen out a key image of the image to be relocated from the plurality of candidate images based on the semantic objects included in the image to be relocated;
[0015] A feature extraction module, used to perform feature extraction processing on the image to be relocated to obtain a first feature point, and perform feature extraction processing on the key image to obtain a second feature point;
[0016] A second screening module, configured to screen out first feature points to be matched from the first feature points based on the semantic objects included in the image to be relocated, and to screen out second feature points to be matched from the second feature points based on the semantic objects included in the key image;
[0017] A feature matching module, used for performing feature matching processing on the first feature point to be matched and the second feature point to be matched;
[0018] The posture positioning module is used to perform posture positioning processing on the camera based on the obtained feature point matching relationship to obtain the repositioned posture of the camera.
[0019] An embodiment of the present application provides an electronic device, the electronic device comprising:
[0020] Memory for storing computer programs or computer executable instructions;
[0021] The processor is used to implement the visual repositioning method provided in the embodiment of the present application when executing the computer program or computer executable instructions stored in the memory.
[0022] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions, which, when executed by a processor, can implement the visual repositioning method provided in the embodiment of the present application.
[0023] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, can implement the visual repositioning method provided in the embodiment of the present application.
[0024] The embodiments of the present application have the following beneficial effects:
[0025] The key image of the image to be relocated is screened out from multiple candidate images through the semantic objects included in the image to be relocated, so that the influence of boundary scenes such as repeated scenes including non-semantic objects on image retrieval is reduced through the introduced semantic objects; the first feature points to be matched are screened out from the first feature points through the semantic objects included in the image to be relocated, and the second feature points to be matched are screened out from the second feature points based on the semantic objects included in the key image, so that the feature points in the image to be relocated and the key image are filtered by introducing semantic objects to reduce the influence of boundary scenes such as dynamic scenes on visual relocation, thereby improving the stability of visual relocation in boundary scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a schematic diagram of an application scenario of visual relocalization provided in an embodiment of the present application;
[0027] Figure 2 is a schematic diagram of the structure of an electronic device for visual relocation provided in an embodiment of the present application;
[0028] Figure 3 It is a first flow chart of the visual relocation method provided in an embodiment of the present application;
[0029] Figure 4 is a second flow chart of the visual relocation method provided in an embodiment of the present application;
[0030] Figure 5 is a third flow chart of the visual relocation method provided in an embodiment of the present application;
[0031] Figure 6 is a fourth flow chart of the visual relocation method provided in an embodiment of the present application;
[0032] Figure 7 It is a structural schematic diagram of the visual repositioning system provided in an embodiment of the present application.
[0033] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0035] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0036] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0037] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0039] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0040] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0041] 1) Artificial Intelligence (AI): A comprehensive technology in computer science that studies the design principles and implementation methods of various intelligent machines to enable machines to have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, such as natural language processing technology and machine learning / deep learning. With the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0042] 2) Deep learning: A subfield of machine learning that focuses on how to build models to simulate the workings of neurons in the human brain, and to learn and represent data features through multi-layer neural networks to achieve more complex and flexible decision-making processes. Deep learning models include multi-layer neural networks and convolutional neural networks, which learn features from massive data, automatically extract and identify useful information in the data, and thus achieve perception and understanding of the real world. Deep learning has been widely used in speech recognition, natural language processing, image recognition, machine translation and other fields, and has achieved good results.
[0043] 3) Semantic objects: refers to objects or objects with semantic information in the fields of computer vision and natural language processing. These objects are not just a collection of pixels in an image, but have semantic descriptions or labels that can help computer systems understand and process image or text data. In computer vision, semantic objects may include common objects such as people, animals, vehicles, furniture, etc., while in natural language processing, semantic objects can be entities, concepts or events in the vocabulary. By identifying and understanding semantic objects, computer systems can understand and process image and text data more accurately, realizing various applications such as image classification, object detection, semantic analysis, etc.
[0044] The embodiments of the present application can be applied to various visual relocalization scenarios, such as navigation scenarios, where visual relocalization technology can be used in various navigation devices that use cameras to capture the user's current environment and then match map data with the actual environment through a visual relocalization algorithm to provide users with accurate navigation information; augmented reality games, where augmented reality games can seamlessly connect the virtual world with the real world and allow players to interact with virtual objects. Therefore, this environment requires precise visual relocalization technology to accurately connect the virtual world with the real world; and robotic scenarios, where robots use visual sensors and visual relocalization technology to determine their own position in the environment. Visual relocalization technology plays an important role in the field of robotics, because accurate position is crucial for robots to perform tasks and avoid collisions.
[0045] The embodiments of the present application provide a visual relocalization method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the stability of visual relocalization in boundary scenes.
[0046] The visual repositioning method provided in the embodiment of the present application can be implemented by the terminal alone; it can also be implemented by the terminal and the server in collaboration. For example, the terminal alone undertakes the visual repositioning method described below, or the terminal sends a visual repositioning request to the server, and the server visually repositions the image to be relocated based on the received visual repositioning request, obtains the repositioning posture of the image to be relocated, and sends the repositioning posture of the image to be relocated to the terminal.
[0047] The following describes an exemplary application of the electronic device provided by the embodiment of the present application. The electronic device provided by the embodiment of the present application can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices, vehicle-mounted devices), smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals. The following describes an exemplary application when the electronic device is implemented as a terminal.
[0048] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of the visual relocalization system 10 provided in an embodiment of the present application, wherein the terminal 200 is connected to the server 100 via a network 300, wherein the network 300 may be a wide area network or a local area network, or a combination of the two.
[0049] In some embodiments, taking the electronic device as a terminal as an example, the visual relocation method provided in the embodiment of the present application can be implemented by the terminal. For example, the terminal 200 collects the image to be relocated, performs image retrieval processing on the retrieval database based on the image to be relocated, and obtains multiple candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera, and based on the semantic object included in the image to be relocated, a key image of the image to be relocated is screened out from multiple candidate images, and feature extraction processing is performed on the image to be relocated to obtain a first feature point, and feature extraction processing is performed on the key image to obtain a second feature point, and based on the semantic object included in the image to be relocated, a first feature point to be matched is screened out from the first feature point, and based on the semantic object included in the key image, a second feature point to be matched is screened out from the second feature point, and feature matching processing is performed on the first feature point to be matched and the second feature point to be matched, and the camera is positioned based on the obtained feature point matching relationship to obtain the repositioning posture of the camera, so as to achieve a stable visual relocation function.
[0050] In some embodiments, the visual relocation method provided in the embodiments of the present application can also be implemented by the server and the terminal in collaboration. For example, the terminal 200 collects the image to be relocated, and generates a visual relocation request (including the image to be relocated) based on the image to be relocated. The terminal 200 sends the visual relocation request to the server 100, and the server 100 parses the visual relocation request to obtain the image to be relocated. Based on the image to be relocated, the image retrieval processing is performed on the retrieval database to obtain multiple candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera, and based on the semantic objects included in the image to be relocated, the key image of the image to be relocated is screened out from the multiple candidate images, and the image to be relocated is processed. Perform feature extraction processing to obtain a first feature point, and perform feature extraction processing on the key image to obtain a second feature point, based on the semantic object included in the image to be relocated, filter out a first feature point to be matched from the first feature point, and based on the semantic object included in the key image, filter out a second feature point to be matched from the second feature point, perform feature matching processing on the first feature point to be matched and the second feature point to be matched, and perform posture positioning processing on the camera based on the obtained feature point matching relationship to obtain a relocated posture of the camera, and send the relocated posture to the terminal 200 to achieve a stable visual relocation function.
[0051] In some embodiments, the terminal or server can implement the visual relocation method provided in the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be microprogram-level commands, machine instructions or software instructions. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a game application; it can also be a small program embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.
[0052] In some embodiments, server 100 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms. Among them, the cloud service can be a visual relocation service for terminals to call.
[0053] The structure of the electronic device for visual relocation provided by the embodiment of the present application is described below. Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 for visual relocation provided in an embodiment of the present application. Taking the electronic device 500 as a terminal as an example, Figure 2 The electronic device 500 for visual relocation shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 570. It is understood that the bus system 570 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 570 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 570 is not described in detail. Figure 2 Various buses are labeled as bus system 570 .
[0054] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0055] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiment of the present application is intended to include any suitable type of memory. The memory 550 optionally includes one or more storage devices that are physically far away from the processor 510.
[0056] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0057] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0058] A network communication module 552, used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB), etc.;
[0059] In some embodiments, the visual repositioning device provided in the embodiments of the present application can be implemented in software. The visual repositioning device provided in the embodiments of the present application can be provided as various software embodiments, including various forms including applications, software, software modules, scripts or codes.
[0060] Figure 2 A visual relocalization device 555 stored in a memory 550 is shown, which may be software in the form of a program or plug-in, and includes a series of modules, including an image retrieval module 5551, a first screening module 5552, a feature extraction module 5553, a second screening module 5554, a feature matching module 5555, a posture positioning module 5556, a semantic recognition module 5557, and an optimization module 5558. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0061] As mentioned above, the visual relocation method provided in the embodiment of the present application can be implemented by various types of electronic devices, such as a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below. Figure 3 , Figure 3 is a flow chart of the visual relocation method provided in the embodiment of the present application, combined with Figure 3 The steps shown are explained.
[0062] In step 101, based on the image to be relocated, image retrieval processing is performed on a retrieval database to obtain a plurality of candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera.
[0063] The retrieval database includes a plurality of images, that is, a plurality of images are pre-stored in the retrieval database. Based on the image to be relocated, image retrieval processing is performed on the plurality of images in the retrieval database to determine a plurality of candidate images of the image to be relocated from the plurality of images. The plurality means at least two.
[0064] See also Figure 4 , Figure 4 is a flow chart of the visual relocation method provided in the embodiment of the present application, Figure 4 Show Figure 3 Step 101 in the above description can be implemented through steps 1011 to 1013.
[0065] In step 1011, a descriptor extraction process is performed on the image to be relocated using a first neural network model to obtain a first descriptor of the image to be relocated.
[0066] The embodiment of the present application is not limited to the model structure of the first neural network model. For example, the first neural network model may be a deep neural network model, a convolutional neural network model, etc. In computer vision and image processing, a descriptor is used to extract and represent image or object features. The descriptor can extract information from the image that is helpful for identification and classification. The descriptor can be a local feature of the image, such as edges, corners, textures, etc. The purpose of the descriptor is to convert the information in the image into a set of numerical values that can characterize certain characteristics of the image. These characteristics may be the shape, size, position, direction, or texture of the object in the image.
[0067] In some embodiments, taking the first neural network model as a mixed visual-semantic place recognition (MixVPR) model as an example, step 1011 can be implemented in the following manner: performing the following processing through the first neural network model: performing visual feature extraction processing on the image to be relocated to obtain the visual features of the image to be relocated; performing semantic feature extraction processing on the image to be relocated to obtain the semantic features of the image to be relocated; fusing the visual features and the semantic features to obtain the first descriptor of the image to be relocated.
[0068] Here, the MixVPR model is a model that combines visual information and semantic information. The MixVPR model not only takes into account the visual features in the image, but also uses semantic information to enhance the accuracy and robustness of feature extraction. The MixVPR model is implemented through a deep learning method, in which the convolutional neural network (CNN) in the MixVPR model is used to extract the visual features of the image, and the semantic features can come from the image description, etc. Specifically, the MixVPR model uses the visual features and semantic features extracted from the image to match the image to be relocated with the image in the retrieval database, so as to find the best matching candidate image.
[0069] In step 1012, descriptor extraction processing is performed on multiple images included in the retrieval database using the first neural network model to obtain a second descriptor for each image.
[0070] Among them, the processing process of step 1012 is similar to the processing process of step 1011, and will not be repeated here.
[0071] In step 1013, based on the similarity between the first descriptor and the second descriptor, a plurality of candidate images are screened out from the plurality of images.
[0072] Here, after determining the first descriptor of the image to be relocated and the second descriptor of each image in the retrieval database, the first descriptor and each second descriptor are similarly calculated to obtain the similarity between the first descriptor and each second descriptor (i.e., the similarity between the image to be relocated and each image). The embodiment of the present application is not limited to the calculation method of the similarity, for example, it can be cosine similarity calculation, Euclidean distance calculation, etc.
[0073] In some embodiments, step 1013 can be implemented in the following manner: when the similarity between the first descriptor and the second descriptor is greater than a similarity threshold, the image corresponding to the similarity is determined as a candidate image; or, the similarity between the first descriptor and the second descriptor is sorted in descending order, and the images corresponding to the first N similarities in the descending sorting result are determined as candidate images, where N is a positive integer greater than 1.
[0074] Following step 101 , in step 102 , based on the semantic objects included in the image to be relocated, a key image of the image to be relocated is screened out from a plurality of candidate images.
[0075] Among them, semantic objects refer to objects or objects with semantic information in the fields of computer vision and natural language processing.
[0076] In some embodiments, before step 102, semantic object recognition processing is performed on the image to be relocated to obtain the semantic objects included in the image to be relocated; semantic object recognition processing is performed on each candidate image to obtain the semantic objects included in each candidate image.
[0077] Here, the semantic object recognition model is used to perform semantic object recognition processing on the image to be relocated and the candidate image, respectively, to obtain the semantic object included in the image to be relocated and the semantic object included in each candidate image. The embodiment of the present application is not limited to the model structure of the semantic object recognition model. For example, the semantic object recognition model can be a deep neural network model, a convolutional neural network model, etc.
[0078] See also Figure 5 , Figure 5 is a flow chart of the visual relocation method provided in the embodiment of the present application, Figure 5 Show Figure 3 Step 102 in the above method can be implemented through steps 1021 to 1023.
[0079] In step 1021, static semantic objects included in the image to be relocated are determined from the semantic objects included in the image to be relocated, and static semantic objects included in each candidate image are determined from the semantic objects included in each candidate image.
[0080] The semantic objects include static semantic objects and dynamic semantic objects. Static semantic objects refer to static and fixed semantic objects, while dynamic semantic objects refer to dynamic and movable semantic objects.
[0081] In step 1022, based on the static semantic objects included in the image to be relocated and the static semantic objects included in each candidate image, the static semantic coincidence degree between the image to be relocated and each candidate image is determined.
[0082] The static semantic coincidence degree indicates the coincidence degree between the static semantic objects in the image to be relocated and the static semantic objects in the candidate image.
[0083] In some embodiments, step 1022 can be implemented in the following manner: performing the following processing for each candidate image: determining, from the candidate image, a target static semantic object that is identical to the static semantic object included in the image to be relocated, wherein the static semantic object includes at least one of a completely static semantic object and a semi-static semantic object; determining a first number of semantic objects included in the image to be relocated; and determining a ratio of a second number of target static semantic objects to the first number as a static semantic coincidence degree between the image to be relocated and the candidate image.
[0084] Among them, completely static semantic objects represent completely static and fixed semantic objects such as ceiling lights, vents, and water pipes; semi-static semantic objects represent at least partially dynamic semantic objects such as televisions, computers, refrigerators, and kettles. For example, the display screen of a TV may display dynamic images, the door of a refrigerator can be dynamic, and the objects inside the refrigerator are changing.
[0085] In step 1023, based on the static semantic coincidence between the image to be relocated and each candidate image, a key image of the image to be relocated is screened out from the plurality of candidate images.
[0086] In some embodiments, step 1023 can be implemented in the following manner: when the static semantic coincidence between the image to be relocated and each candidate image is greater than the coincidence threshold, the candidate image corresponding to the static semantic coincidence is determined as the key image; or, the static semantic coincidence between the image to be relocated and each candidate image is sorted in descending order, and the candidate images corresponding to the first M static semantic coincidences in the descending order are determined as the key images, where M is a positive integer greater than 0.
[0087] In the embodiment of the present application, through steps 1021 to 1023, the key images screened out have more semantic objects included in the image to be relocated, so as to exclude candidate images including non-semantic objects, thereby reducing the impact of boundary scenes such as repeated scenes including non-semantic objects on image retrieval by introducing static semantic coincidence.
[0088] Following step 102, in step 103, feature extraction processing is performed on the image to be relocated to obtain first feature points, and feature extraction processing is performed on the key image to obtain second feature points.
[0089] Here, the image to be relocated is subjected to feature extraction processing by the second neural network model to obtain the first feature point, and the key image is subjected to feature extraction processing to obtain the second feature point. The embodiment of the present application is not limited to the model structure of the second neural network model. For example, the second neural network model can be a deep neural network model, a convolutional neural network model, etc.
[0090] In some embodiments, step 103 can be implemented in the following manner: calling a second neural network model, wherein the second neural network model includes an encoder and a decoder; performing feature encoding processing on the image to be relocated by the encoder to obtain the encoded features of the image to be relocated, and performing feature decoding processing on the encoded features of the image to be relocated by the decoder to obtain the feature point probability of the image to be relocated, wherein the feature point probability is the probability that each pixel in the image to be relocated belongs to the feature point, and based on the feature point probability of the image to be relocated, determining the first feature point; performing feature encoding processing on the key image by the encoder to obtain the encoded features of the key image, and performing feature decoding processing on the encoded features of the key image by the decoder to obtain the feature point probability of the key image, wherein the feature point probability is the probability that each pixel in the key image belongs to the feature point, and based on the feature point probability of the key image, determining the second feature point of the key image.
[0091] Here, the second neural network model is taken as the Superpoint model as an example. The Superpoint model is a deep learning model used for feature point detection and description in images. The Superpoint model is based on a neural network structure and is used for feature point extraction tasks in the field of computer vision. It can automatically extract feature points with key information from images. First, the Superpoint model uses a series of convolutional neural network layers (i.e., encoders) to extract encoded features from the input image (the image to be relocated or the key image), where these convolutional layers can help identify local structures and patterns in the input image. Then, in order to process features of different scales, the Superpoint model uses a pyramid pooling method to extract features at different scales to ensure that the feature points are robust to changes in different scales. Next, the Superpoint model detects and locates feature points from the image through a keypoint detection network (i.e., a decoder). The feature point detection network includes convolutional layers and pooling layers, and the output of the network will be a feature map (including the probability of feature points of the input image). Finally, in order to reduce the number of repeated feature points, the Superpoint model uses a non-maximum suppression strategy to select a specified number of feature points from the feature map.
[0092] Following step 103 , in step 104 , first feature points to be matched are screened out from the first feature points based on the semantic objects included in the image to be relocated, and second feature points to be matched are screened out from the second feature points based on the semantic objects included in the key image.
[0093] In some embodiments, step 104 can be implemented in the following manner: from the semantic objects included in the image to be relocated, a dynamic semantic object included in the image to be relocated is determined, and when the first feature point is not a pixel point in the dynamic semantic object, the first feature point is determined as the first feature point to be matched; from the semantic objects included in the key image, a dynamic semantic object included in the key image is determined, and when the second feature point is not a pixel point in the dynamic semantic object, the second feature point is determined as the second feature point to be matched.
[0094] In the embodiment of the present application, semantic objects are introduced in step 104 to filter the dynamic feature points (i.e., feature points included in the dynamic semantic objects) in the image to be relocated and the key image, so as to reduce the influence of boundary scenes such as dynamic scenes on visual relocation.
[0095] In step 105, feature matching processing is performed on the first feature point to be matched and the second feature point to be matched to obtain a feature point matching relationship.
[0096] Here, the first feature point to be matched and the second feature point to be matched are subjected to feature matching processing by the feature matching model to obtain a feature point matching relationship, wherein the feature point matching relationship represents the corresponding relationship between the first feature point to be matched and the second feature point to be matched. The embodiment of the present application is not limited to the model structure of the feature matching model, for example, the feature matching model may be a deep neural network model, a convolutional neural network model, etc. The first feature point to be matched and the second feature point to be matched are both two-dimensional (2D) feature points.
[0097] Taking the feature matching model as the Superglue model as an example, the Superglue model performs 2D feature point to 2D feature point matching on the first feature point to be matched and the second feature point to be matched to obtain the feature point matching relationship. First, the first feature point to be matched (such as the Superpoint feature point) of the image to be relocated and the second feature point to be matched (such as the Superpoint feature point) of the key image are input into the Superglue model. Then, the Superglue model infers the first feature point to be matched in the image to be relocated and the second feature point to be matched in the key image to obtain a score matrix, wherein the score matrix is used to characterize the matching scores of the feature point matching point pairs of the first feature point to be matched and the second feature point to be matched, and then the matching relationship of the feature points is determined based on the score matrix. Finally, the homography matrix is used to further filter the feature point matching pairs to obtain the feature point matching relationship between the image to be relocated and the key image. This process is to iteratively select random samples to fit the homography matrix through the class-based Random Sample Consensus (RANSAC) algorithm, and iterate continuously until the internal point ratio meets the requirements (such as the set number), and the corresponding relationship of the feature point matching point pairs after the final iteration is determined as the feature point matching relationship.
[0098] In step 106, the image to be relocated is subjected to posture positioning processing based on the obtained feature point matching relationship to obtain a relocated posture of the image to be relocated.
[0099] Among them, the embodiments of the present application are not limited to the calculation method of posture positioning. For example, the perspective-non-perspective problem (Perspective-n-Point Problem, PNP) algorithm can be used for posture positioning, and the RANSAC algorithm can also be used for posture positioning.
[0100] In some embodiments, the feature point matching relationship includes multiple feature point pairs, each feature point pair includes a first feature point to be matched and a second feature point to be matched; step 106 can be implemented in the following ways: obtaining the initial posture of the camera; based on some feature point pairs, optimizing the initial posture of the camera to obtain the optimized posture of the camera; based on multiple feature point pairs, optimizing the optimized posture of the camera to obtain the repositioned posture of the camera.
[0101] Among them, since the key image is similar to the image to be relocated, the embodiment of the present application can determine the posture of the camera that captures the key image as the initial posture of the camera that captures the image to be relocated. Of course, the initial posture of the camera that captures the image to be relocated can also be directly estimated by the front-end visual odometer.
[0102] Taking the PNP algorithm as an example of the pose positioning algorithm, based on some feature point pairs, the PNP algorithm is used to optimize the initial pose of the camera that collects the image to be relocated, and the optimized pose of the camera that collects the image to be relocated is obtained. Based on multiple feature point pairs, the PNP algorithm is used to optimize the optimized pose of the camera that collects the image to be relocated, and the relocated pose of the camera that collects the image to be relocated is obtained, thereby using a two-stage pose optimization algorithm to reduce the situation where the optimization process falls into a local optimal solution.
[0103] In some embodiments, see Figure 6 , Figure 6 is a flow chart of the visual relocation method provided in the embodiment of the present application, Figure 6 Show Figure 3 Before step 106, the method further includes steps 107 to 110.
[0104] In step 107, a pixel coordinate system of the image to be relocated is determined, wherein the pixel coordinate system includes a first coordinate axis and a second coordinate axis.
[0105] The first coordinate axis of the pixel coordinate system is the u-direction coordinate axis, and the second coordinate axis is the v-direction coordinate axis. Alternatively, the first coordinate axis of the pixel coordinate system is the v-direction coordinate axis, and the second coordinate axis is the u-direction coordinate axis.
[0106] In step 108, determine the first maximum value and the first minimum value of the first feature point to be matched on the first coordinate axis, determine the second maximum value and the second minimum value of the first feature point to be matched on the second coordinate axis, determine the first boundary upper limit and the first boundary lower limit of the first coordinate axis, and determine the second boundary upper limit and the second boundary lower limit of the second coordinate axis.
[0107] Among them, taking the first coordinate axis of the pixel coordinate system as the u-direction coordinate axis and the second coordinate axis as the v-direction coordinate axis as an example, the first boundary upper limit and the first boundary lower limit respectively represent the boundary upper limit and the boundary lower line in the u direction, and the second boundary upper limit and the second boundary lower limit respectively represent the boundary upper limit and the boundary lower line in the v direction.
[0108] In step 109 , the coverage field ratio of the first feature point to be matched is determined based on the first maximum value, the first minimum value, the second maximum value, the second minimum value, the first boundary upper limit, the first boundary lower limit, the second boundary upper limit and the second boundary lower limit.
[0109] The coverage ratio of the first feature point to be matched is used to represent the ratio of the field of view of the image to be relocated covered by the first feature point to be matched.
[0110] In some embodiments, step 109 can be implemented by: determining a first sum of the inverse tangent value of the first minimum value and the inverse tangent value of the first minimum value, and determining a second sum of the inverse tangent value of the second minimum value and the inverse tangent value of the second minimum value; determining a third sum of the inverse tangent value of the first boundary upper limit and the inverse tangent value of the first boundary lower limit, and determining a fourth sum of the inverse tangent value of the second boundary upper limit and the inverse tangent value of the second boundary lower limit; determining a first ratio of the first sum to the third sum, determining a second ratio of the second sum to the fourth sum, and determining the product of the first ratio and the second ratio as the coverage field of view range ratio of the first feature point to be matched.
[0111] Continuing with the above example, the calculation process of the coverage field ratio is shown in formula (1).
[0112]
[0113] Among them, u max and u min They represent the maximum value (i.e., the first maximum value) and minimum value (i.e., the first minimum value) of the feature point of the image to be relocated in the u direction of the pixel coordinate system. Similarly, v max and v min They respectively represent the maximum value (i.e., the second maximum value) and the minimum value (i.e., the second minimum value) of the feature point of the image to be relocated in the v direction of the pixel coordinate system. and They respectively represent the upper limit (i.e., the first upper limit) and lower limit (i.e., the first lower limit) of the u direction of the camera pixel coordinate system. and They respectively represent the upper limit (i.e., the second upper limit) and lower limit (i.e., the second lower limit) of the v direction of the camera pixel coordinate system.
[0114] In step 110, when the coverage ratio of the first feature point to be matched is greater than the coverage ratio threshold of the field of view, it is determined to perform posture positioning processing on the camera.
[0115] For example, if the coverage field ratio of the first feature point to be matched is less than or equal to the set threshold (i.e., the coverage field ratio threshold), it can be determined that the feature points of the image to be relocated are concentrated in a local area. At this time, the pose obtained may have greater inaccuracy due to local error fluctuations. FOV When it is less than or equal to the set threshold, pose optimization is not performed, so the image to be relocated is filtered using the coverage field ratio of the feature points to avoid pose jumps.
[0116] In some embodiments, image retrieval processing, feature extraction processing, feature matching processing, and posture positioning processing are implemented through different functional modules, and the different functional modules are decoupled from each other.
[0117] For example, the image retrieval process is implemented through the image retrieval module, the feature extraction process is implemented through the feature extraction module, the feature matching process is implemented through the feature matching module, and the posture positioning process is implemented through the posture positioning module. The error evaluation method of each functional module is described below.
[0118] For the error evaluation scheme of the image retrieval module, the embodiment of the present application can evaluate the error of the image retrieval module by comparing the image retrieved (e.g., candidate image) with the image in the actual environment (i.e., the scene used for testing) (e.g., the image to be relocated), and calculating the accuracy and recall of the retrieval. For example, a series of images can be collected in the actual environment as query images, and then the image retrieval module is used to perform image retrieval, and finally the manually annotated image retrieval recognition results and the candidate images of the query image retrieved by the image are compared to obtain the error of the image retrieval module; in an indoor environment, the image retrieval module is used to retrieve pictures at different locations, and the proportion of the pictures retrieved at the correct location is calculated as the accuracy, and the proportion of the pictures retrieved that contain the pictures at the correct location is calculated as the recall. Of course, the embodiment of the present application is not limited to the above-mentioned error evaluation scheme for the image retrieval module.
[0119] For the error evaluation scheme of the feature extraction module, the embodiment of the present application can use the same or similar images to extract feature points of different features respectively, and then evaluate the accuracy and stability of the feature points during matching to evaluate the error of the feature extraction module. For example, in a park scene, a feature extraction algorithm is used to extract feature points in the image, and the accuracy and stability of the feature points during matching are evaluated to evaluate the error of the feature extraction module. Of course, the embodiment of the present application is not limited to the above-mentioned error evaluation scheme for the feature extraction module.
[0120] For the error evaluation scheme of the feature matching module, the embodiment of the present application can evaluate the accuracy of feature matching through known feature points in the actual scene, calculate the error distance between the matching points, and determine the error of the feature matching module. The embodiment of the present application can also use simulated data to evaluate feature matching, and evaluate the error of the feature matching module by comparing the consistency of the feature matching results of the simulated data and the manual annotation results. Of course, the embodiment of the present application is not limited to the above-mentioned error evaluation scheme for the feature matching module.
[0121] Regarding the error evaluation scheme for the posture positioning module, the embodiment of the present application can evaluate the error of the posture positioning module by actually moving the robot in the actual environment and recording the comparison between the actual posture of the robot and the calculated posture. The embodiment of the present application can also use simulation data to evaluate the posture positioning, and evaluate the error of the posture positioning module by comparing the difference between the real posture and the calculated posture. For example, in an indoor environment, the mobile robot records the real posture, and then uses the posture positioning algorithm to calculate the posture of the robot, and finally calculates the error between the calculated posture and the real posture to determine the error of the posture positioning module. Of course, the embodiment of the present application is not limited to the above-mentioned error evaluation scheme for the posture positioning module.
[0122] Among them, compared with the image retrieval module, feature extraction module and pose positioning module, the feature matching module will cause greater errors. Because in the actual environment, objects may be blocked, the lighting changes, the perspective is different, etc., which will reduce the accuracy of feature matching. The inaccuracy of feature matching will further affect the accuracy of pose calculation, and ultimately lead to repositioning errors. Therefore, improving the accuracy and robustness of the feature matching algorithm is the key to improving the accuracy of repositioning.
[0123] In some embodiments, error evaluation can be performed on different functional modules separately to obtain the error of each functional module. When the error of a functional module is greater than a first module error threshold, the algorithm built into the functional module is replaced with a new algorithm until the error of the functional module with the new algorithm built into it is less than a second module error threshold, wherein the second module error threshold is less than the first module error threshold.
[0124] Among them, the first module error thresholds corresponding to different functional modules may be different, and the second module error thresholds corresponding to different functional modules may also be different. Here, the error evaluation is performed on the above four functional modules respectively. When the error of a functional module is greater than the first module error threshold, the old algorithm of the functional module is directly replaced by a new algorithm to reduce the error of the functional module. Through this direct replacement method, the inferior algorithm can be quickly replaced to improve the maintainability of the visual relocalization system.
[0125] For example, the image retrieval module currently uses the old algorithm, the Network-based Visual Local Appearance Descriptor (NetVLAD) algorithm, to perform error evaluation on the image retrieval module to obtain the error of the image retrieval module. When the error of the image retrieval module is greater than the first module error threshold, the NetVLAD algorithm built into the functional module is replaced with a new algorithm (such as the MixVPR algorithm) until the error of the functional module with the new algorithm built into it is less than the second module error threshold.
[0126] In some embodiments, when the error between the actual posture of the camera and the repositioned posture is greater than a first error threshold, the algorithm built into at least one functional module is replaced with a new algorithm until the error between the repositioned posture obtained according to the visual repositioning method with the new algorithm built in and the actual posture is less than a second error threshold, wherein the second error threshold is less than the first error threshold.
[0127] Among them, the first error thresholds corresponding to different functional modules may be different, and the second error thresholds corresponding to different functional modules may also be different. Here, the error calculation is performed on the repositioning posture, and the combination of built-in algorithms in different functional modules (i.e., the visual repositioning method with a built-in new algorithm) is tested to determine the combination that is less than the second error threshold. Through this testing method, the collaborative performance of each functional module can be fully utilized to determine the most appropriate combination, so as to improve the maintainability of the visual repositioning system.
[0128] Below, taking robot visual relocalization as an example, an exemplary application of an embodiment of the present application in an actual application scenario will be described.
[0129] Here, the robot can be a self-moving device that moves in a certain space, and can be any mobile robot such as a sweeping robot, a wheeled robot, a legged robot, a flying car robot, etc. Among them, a camera is provided on the robot, and various images are collected by the camera provided on the robot. Therefore, based on the posture of the camera on the robot, the posture of the robot and the conversion relationship between the posture of the camera on the robot, the posture of the robot and the posture of the camera on the robot, the posture of the robot can be calculated.
[0130] The performance of the visual algorithms of the related art in boundary scenes such as similar scenes, repeated scenes and dynamic scenes is not enough to support the stable operation of the robot. In this regard, the embodiment of the present application provides a robust visual relocalization method to improve the stability of the robot in these boundary scenes.
[0131] The visual relocation process of the embodiment of the present application can be roughly divided into several links, including image retrieval, feature extraction, feature matching and posture positioning. The image set closest to the image to be relocated (such as the current image in the map data) is obtained through image retrieval, and then the feature point matching relationship (such as the correspondence between three-dimensional (3D) map points and two-dimensional (2D) image points) is obtained through feature extraction and feature matching. Finally, the accurate posture of the image to be relocated (that is, the accurate posture of the camera that captures the image to be relocated) is obtained through a 3D-2D posture estimation algorithm.
[0132] Related technologies usually use bag-of-words algorithms, manually designed feature points (such as corner detectors (Features from Accelerated Segment Test, FAST), fast and short image descriptors with rotation invariance (Oriented FAST and Rotated BRIEF, ORB), scale-invariant feature transform (Scale-Invariant Feature Transform, SIFT)), and manually designed feature matching methods (brute force search, nearest neighbor and optical flow) for visual relocation, while the embodiments of the present application use deep learning algorithms to replace these modules, such as the Network-based Visual Local Appearance Descriptor (NetVLAD) algorithm, the Mixed Visual-semantic Place Recognition (MixVPR) algorithm and the Any Location Recognition (AnyLoc) algorithm can replace the image retrieval module in the related technology; the Superpoint algorithm, r2d2 and Spatial-Channel Attention Network (Spatial-Channel AttentionNetwork, SOSNet) and other algorithms can replace the feature extraction methods in related technologies; Low Frame Rate Feature Tracking and Relocalization (LoFTR) algorithm, MatchFormer algorithm, Single Graph Network (SGMNet), Superglue algorithm and other algorithms can replace the feature matching methods in related technologies.
[0133] The embodiment of the present application describes a visual relocalization method based on deep learning, which isolates and decouples the functions of each part of the visual relocalization through a modular design, thereby improving the maintainability of the system; by using deep learning algorithms to replace the traditional algorithms used in each module, the visual relocalization performance can be significantly improved; by introducing semantic information, the performance of the visual algorithm in repeated scenes and dynamic scenes is improved; by filtering and retrieving image frames through feature point coverage of the field of view range, the problem of pose solution jumps can be avoided; through a two-stage pose positioning method, the pose solution can be prevented from falling into a local optimal solution. In short, the embodiment of the present application can significantly improve the performance of visual relocalization, so that the visual relocalization algorithm can be run robustly under conditions such as lighting changes, repeated scenes, occluded scenes, and dynamic scenes, thereby ensuring the long-term accuracy of robot positioning.
[0134] The following uses MixVPR, semantic recognition algorithms (such as YOLOv8), Superpoint, and Superglue in the embodiments of the present application as examples to illustrate the visual relocation method. Among them, since the embodiments of the present application adopt a modular design, MixVPR in the visual relocation method can be replaced with other image retrieval algorithms, such as NetVLAD and word bags. Similarly, the algorithms in the semantic recognition, feature extraction, and feature matching modules can also be replaced modularly. Among them, the function of the image retrieval module is to extract the MixVPR descriptor of the image for global retrieval in the map database, and determine the closest several key images to the MixVPR descriptor of the current input image in the map database as candidate images based on the distance of the MixVPR descriptor. Then use YOLOv8 to perform object semantic recognition on the current input image and the candidate images, and preliminarily filter the candidate images based on the semantic information to obtain the key images.
[0135] In order to obtain accurate positioning information, it is necessary to perform feature matching on the input image and the key image, and calculate accurate positioning information based on the perspective projection principle according to the matching relationship between the 3D map points in the map and the 2D features in the field of view of the input image. The features used here are Superpoint feature points, the feature point matching algorithm uses the superglue algorithm, and the pose positioning uses the perspective-non-perspective problem (Perspective-n-Point Problem, PNP) algorithm. After feature extraction, semantic information is used to filter dynamic object feature points to reduce the impact of dynamic objects on pose calculation.
[0136] Combine the following Figure 7 The visual relocation method provided by the embodiment of the present application is described. Figure 7It is shown that the visual relocalization method provided in the embodiment of the present application includes multiple modules, such as an image retrieval module, a feature extraction module, a feature matching module, a posture positioning module, and a semantic recognition module. The image retrieval module, the feature extraction module, the feature matching module, the posture positioning module, and the semantic recognition module are described in detail below.
[0137] 1) Image retrieval module 701
[0138] The image retrieval module 701 of the embodiment of the present application uses the MixVPR model to extract the MixVPR descriptor of the image through the MixVPR model, which is used to match all descriptors in the database of the MxiVPR descriptors constructed offline to obtain a series of most similar descriptors and corresponding candidate images (such as map key images). YOLOv8 is used to perform semantic recognition of image objects to filter candidate images. The processing process of the image retrieval module 701 is as follows.
[0139] First, the image to be relocated (such as the retrieval image) is input into the MixVPR model.
[0140] Then, the format of the retrieved image is converted to the format required by the MixVPR model. The format conversion process includes image value range adjustment, image size adjustment, and image tensorization.
[0141] Next, the MixVPR model is inferred to obtain the MixVPR descriptor corresponding to the retrieved image. For example, the dimension of the MixVPR descriptor is 1×4096.
[0142] Then, the cosine similarity between the MixVPR descriptor of the retrieved image and the MixVPR descriptors corresponding to all images in the MixVPR database is calculated. The calculation process of the cosine similarity is shown in formula (2).
[0143]
[0144] Among them, the similarity matrix S ij is the dot product between the MixVPR descriptor i of the retrieved image and the MixVPR descriptor j of the image in the database, and D is the dimension of the MixVPR descriptor, which is 4096 here.
[0145] Finally, according to the cosine similarity, the most similar images are selected from the MixVPR database as candidate images.
[0146] After selecting multiple most similar images from the MixVPR database as candidate images, the embodiment of the present application first uses YOLOv8 to perform object semantic recognition on the retrieval image and the candidate image to obtain the semantic objects included in the retrieval image and the semantic objects included in the candidate image.
[0147] Then, the object semantic coincidence degree (i.e., static semantic success degree) of the retrieved image and the candidate image is calculated. The calculation formula is shown in formula (3).
[0148]
[0149] Among them, completely static objects refer to completely static and fixed objects such as ceiling lights, vents, and water pipes, and semi-static objects refer to objects that are at least partially dynamic, such as televisions, computers, refrigerators, and kettles.
[0150] Finally, the candidate images are filtered based on the object semantic overlap to obtain the key image.
[0151] 2) Feature extraction module 702
[0152] The feature extraction module 702 of the embodiment of the present application uses the Superpoint model to extract Superpoint feature points on the search image, which are used by subsequent modules to perform 2D-2D matching with the Superpoint feature points of the key image. The processing process of the feature extraction module is as follows.
[0153] First, the retrieval image is input to the feature extraction module.
[0154] Then, the number of extracted feature points and the probability threshold of the Superpoint model are determined.
[0155] Next, the Superpoint model is used to infer the retrieved image to obtain a feature point probability image.
[0156] Then, the object semantic information is used to filter out the dynamic feature points of the retrieved image.
[0157] Finally, the feature points of the retrieved image are filtered by probability threshold and non-maximum suppression strategy, the feature points of the retrieved image are sorted according to the probability threshold, and a specified number of feature points (i.e., the required number of extracted feature points) are selected as the feature points to be matched in the retrieved image.
[0158] 3) Feature matching module 703
[0159] The feature matching module 703 of the embodiment of the present application adopts the Superglue model, which uses the feature point information output by the feature extraction module 702 to match 2D feature points to 2D feature points, and then determines the correspondence between the 2D feature points of the search image and the 3D feature points (such as 3D map points) of the key image. The processing process of the feature extraction module 703 is as follows.
[0160] First, the Superpoint feature points of the retrieved image and the Superpoint feature points of the key image are input into the Superglue model.
[0161] Then, the Superglue model infers the Superpoint feature points of the input retrieval image and the Superpoint feature points of the key image to obtain a score matrix of the feature point matching relationship, and then determines the matching relationship of the feature points and the corresponding matching scores based on the score matrix.
[0162] Finally, the homography matrix is used to further filter the feature point matching pairs to obtain the feature point matching relationship between the retrieval image and the key image. This process is to iteratively select random samples through the RANSAC algorithm to fit the homography matrix, and iterate continuously until the internal point ratio meets the requirements.
[0163] 4) Posture positioning module 704
[0164] Based on the 2D-2D feature point matching relationship between the retrieval image and the key image and the map database, the 2D-3D feature point matching relationship between the retrieval image and the key image is further calculated, and the accurate pose of the camera that collects the retrieval image is located according to the pose of the camera that collects the key image. Among them, the map database contains a series of key images, each of which contains the MixVPR descriptor, the 2D feature points on the key image, and the 3D feature points in the three-dimensional space corresponding to these feature points. The processing process of the pose positioning module 704 is as follows.
[0165] First, the pose of the camera that captures the key image is determined as the preliminary pose of the camera that captures the retrieval image (ie, the above-mentioned initial pose).
[0166] Then, the coverage ratio of the field of view of the feature points in the retrieved image is used to determine whether to perform pose optimization. The calculation process is shown in formula (4).
[0167]
[0168] Among them, u max and u min They represent the maximum and minimum values of the feature points of the retrieved image in the u direction of the pixel coordinate system. Similarly, v max and v min They respectively represent the maximum and minimum values of the feature points of the retrieved image in the v direction of the pixel coordinate system. and They represent the upper and lower limits of the camera pixel coordinate system in the u direction, respectively. and They represent the upper and lower limits of the v direction of the camera pixel coordinate system respectively.
[0169] If the coverage ratio of the feature points is less than or equal to the set threshold, it can be determined that the feature points of the retrieved image are concentrated in the local area. At this time, the pose obtained may have greater inaccuracy due to local error fluctuations. FOV When it is less than or equal to the set threshold, no pose optimization is performed.
[0170] Next, a portion of 2D-2D feature point pairs with higher matching scores (eg, greater than a matching score threshold) in the feature point matching relationship are selected, and the PNP solver is used to roughly optimize the preliminary pose of the camera that collects the retrieval image.
[0171] Based on a part of 2D-2D feature point pairs with higher matching scores in the feature point matching relationship, the coordinates of the 3D feature points corresponding to each 2D feature point in the key image are retrieved in the map database, where the coordinates of the 3D feature points are the coordinates in the world coordinate system, thereby obtaining a series of 2D-3D correspondence relationships, which can be expressed by formula (5).
[0172]
[0173] in, It is the homogeneous form of the two-dimensional pixel coordinates (i.e., 2D feature points) projected from a three-dimensional space point to the image coordinate system of the camera. K represents the camera intrinsic parameters, and R and t are the camera extrinsics to be optimized, that is, the initial pose of the camera that collects the retrieval image. is the homogeneous form of the coordinates of the three-dimensional space point (i.e., 3D feature point). Due to the existence of errors, when the 3D space point is projected to the current camera image coordinate system, it may not completely correspond to the 2D feature point of the image. The reprojection error formula is shown in formula (6).
[0174]
[0175] The PNP solver is used to roughly optimize the pose of the camera that collects the retrieval image. The Levenberg-Marquardt (LM) iterative algorithm is used in the optimization process, and the optimization process is shown in formula (7).
[0176]
[0177] Here we hope to minimize the reprojection error of all feature points by optimizing the value of T = [R t]. First, calculate the Jacobian matrix of the error with respect to the pose Then, the optimization variables are updated according to the LM algorithm to obtain the roughly optimized posture T, and the calculation formula is as shown in formula (8).
[0178] (J T J+λI)ΔT=-JT e (8)
[0179] Among them, λ is the damping factor, which can be set empirically. Each time the current pose (such as the initial pose or the pose update) is input, the Jacobian matrix and the pose update are repeatedly calculated, and the pose update is used to update the pose until the pose update converges to a certain value. The converged pose update is determined as the initial pose after rough optimization.
[0180] Finally, all matching feature point pairs in the feature point matching relationship are selected, and the PNP solver is used to fine-optimize the roughly optimized pose of the retrieval image to obtain the repositioned pose of the camera that collected the retrieval image.
[0181] Here, the coarse optimization and fine optimization use the same mathematical method, but the calculation data are different.
[0182] In summary, the visual relocalization method provided in the embodiment of the present application introduces semantic information to reduce the impact of repeated scenes on image retrieval, and introduces semantic information to reduce the impact of dynamic objects on pose calculation, thereby using semantic information to improve the visual relocalization performance; uses the coverage field range ratio of feature points to filter the image to be relocated to avoid solving pose jumps; uses a two-stage pose optimization algorithm to reduce the situation where the optimization process falls into a local optimal solution.
[0183] So far, the visual repositioning method provided by the embodiment of the present application has been described in combination with the exemplary application and implementation of the electronic device provided by the embodiment of the present application. The following will continue to describe the cooperation of various modules in the visual repositioning device 555 provided by the embodiment of the present application to implement the visual repositioning solution.
[0184] The image retrieval module 5551 is used to perform image retrieval processing on the retrieval database based on the image to be relocated, and obtain multiple candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera; the first screening module 5552 is used to screen out the key image of the image to be relocated from the multiple candidate images based on the semantic objects included in the image to be relocated; the feature extraction module 5553 is used to perform feature extraction processing on the image to be relocated to obtain first feature points, and perform feature extraction processing on the key image to obtain second feature points; the second screening module 5554 is used to screen out first feature points to be matched from the first feature points based on the semantic objects included in the image to be relocated, and screen out second feature points to be matched from the second feature points based on the semantic objects included in the key image; the feature matching module 5555 is used to perform feature matching processing on the first feature points to be matched and the second feature points to be matched; the posture positioning module 5556 is used to perform posture positioning processing on the camera based on the obtained feature point matching relationship to obtain the relocated posture of the camera.
[0185] In some embodiments, the image retrieval module 5551 is also used to perform descriptor extraction processing on the image to be relocated through a first neural network model to obtain a first descriptor of the image to be relocated; perform descriptor extraction processing on multiple images included in the retrieval database through the first neural network model to obtain a second descriptor for each of the images; and screen out the multiple candidate images from the multiple images based on the similarity between the first descriptor and the second descriptor.
[0186] In some embodiments, the image retrieval module 5551 is also used to perform the following processing through the first neural network model: perform visual feature extraction processing on the image to be relocated to obtain the visual features of the image to be relocated; perform semantic feature extraction processing on the image to be relocated to obtain the semantic features of the image to be relocated; and fuse the visual features and the semantic features to obtain the first descriptor of the image to be relocated.
[0187] In some embodiments, before filtering out the key image of the image to be relocated from the multiple candidate images based on the semantic objects included in the image to be relocated, the device also includes: a semantic recognition module 5557, which is used to perform semantic object recognition processing on the image to be relocated to obtain the semantic objects included in the image to be relocated; perform semantic object recognition processing on each of the candidate images to obtain the semantic objects included in each of the candidate images; the first screening module 5552 is also used to determine the static semantic objects included in the image to be relocated from the semantic objects included in the image to be relocated, and determine the static semantic objects included in each of the candidate images from the semantic objects included in each of the candidate images; based on the static semantic objects included in the image to be relocated and the static semantic objects included in each of the candidate images, determine the static semantic coincidence between the image to be relocated and each of the candidate images; based on the static semantic coincidence between the image to be relocated and each of the candidate images, filter out the key image of the image to be relocated from the multiple candidate images.
[0188] In some embodiments, the first screening module 5552 is also used to perform the following processing for each of the candidate images: determining, from the candidate images, a target static semantic object that is identical to the static semantic object included in the image to be relocated, wherein the static semantic object includes at least one of a completely static semantic object and a semi-static semantic object; determining a first number of semantic objects included in the image to be relocated; and determining a ratio of a second number of the target static semantic objects to the first number as a degree of static semantic overlap between the image to be relocated and the candidate image.
[0189] In some embodiments, the feature extraction module 5553 is also used to call a second neural network model, wherein the second neural network model includes an encoder and a decoder; the encoder performs feature encoding processing on the image to be relocated to obtain the encoded features of the image to be relocated; the decoder performs feature decoding processing on the encoded features of the image to be relocated to obtain the feature point probability of the image to be relocated, wherein the feature point probability is the probability that each pixel in the image to be relocated belongs to a feature point; based on the feature point probability of the image to be relocated, the first feature point is determined.
[0190] In some embodiments, the second screening module 5554 is further used to determine the dynamic semantic object included in the image to be relocated from the semantic objects included in the image to be relocated; when the first feature point is not a pixel point in the dynamic semantic object, the first feature point is determined as the first feature point to be matched.
[0191] In some embodiments, before the posture positioning processing of the camera is performed based on the obtained feature point matching relationship to obtain the repositioned posture of the camera, the posture positioning module 5556 is also used to determine the pixel coordinate system of the image to be repositioned, wherein the pixel coordinate system includes a first coordinate axis and a second coordinate axis; determine the first maximum value and the first minimum value of the first feature point to be matched on the first coordinate axis, determine the second maximum value and the second minimum value of the first feature point to be matched on the second coordinate axis, determine the first boundary upper limit and the first boundary lower limit of the first coordinate axis, and determine the second boundary upper limit and the second boundary lower limit of the second coordinate axis; based on the first maximum value, the first minimum value, the second maximum value, the second minimum value, the first boundary upper limit, the first boundary lower limit, the second boundary upper limit and the second boundary lower limit, determine the coverage field of view ratio of the first feature point to be matched; when the coverage field of view ratio of the first feature point to be matched is greater than the coverage field of view ratio threshold, determine to perform posture positioning processing on the camera.
[0192] In some embodiments, the posture positioning module 5556 is also used to determine a first sum of the inverse tangent value of the first minimum value and the inverse tangent value of the first minimum value, and determine a second sum of the inverse tangent value of the second minimum value and the inverse tangent value of the second minimum value; determine a third sum of the inverse tangent value of the first boundary upper limit and the inverse tangent value of the first boundary lower limit, and determine a fourth sum of the inverse tangent value of the second boundary upper limit and the inverse tangent value of the second boundary lower limit; determine a first ratio of the first sum to the third sum, determine a second ratio of the second sum to the fourth sum, and determine the product of the first ratio and the second ratio as the coverage field of view ratio of the first feature point to be matched.
[0193] In some embodiments, the feature point matching relationship includes multiple feature point pairs, each of which includes a first feature point to be matched and a second feature point to be matched; the posture positioning module 5556 is also used to obtain the initial posture of the camera; based on some of the feature point pairs, the initial posture of the camera is posture optimized to obtain the optimized posture of the camera; based on the multiple feature point pairs, the optimized posture of the camera is posture optimized to obtain the repositioned posture of the camera.
[0194] In some embodiments, the image retrieval processing, the feature extraction processing, the feature matching processing, and the posture positioning processing are implemented through different functional modules, and the different functional modules are decoupled from each other; the device also includes: an optimization module 5558, which is used to perform error evaluation on the different functional modules respectively to obtain the error of each functional module; when the error of the functional module is greater than the error threshold of the first module, the algorithm built into the functional module is replaced with a new algorithm until the error of the functional module with the new algorithm built in is less than the error threshold of the second module, wherein the error threshold of the second module is less than the error threshold of the first module.
[0195] In some embodiments, the image retrieval processing, the feature extraction processing, the feature matching processing, and the posture positioning processing are implemented through different functional modules, and the different functional modules are decoupled from each other; the device also includes: an optimization module 5558, which is used to replace the algorithm built into at least one of the functional modules with a new algorithm when the error between the actual posture of the camera and the repositioning posture is greater than a first error threshold, until the error between the repositioning posture obtained according to the visual repositioning method with the new algorithm built in and the actual posture is less than a second error threshold, wherein the second error threshold is less than the first error threshold.
[0196] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or the computer executable instruction from the computer-readable storage medium, and the processor executes the computer program or the computer executable instruction, so that the electronic device performs the visual relocation method described in the embodiment of the present application.
[0197] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the visual relocalization method provided by the present application embodiment, for example, Figure 3-6 The visual relocalization method is shown.
[0198] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0199] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0200] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0201] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0202] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of the relevant regions.
[0203] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A visual relocalization method, characterized in that: The method comprises: Based on the image to be relocated, performing image retrieval processing on a retrieval database to obtain a plurality of candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera; Based on the semantic objects included in the image to be relocated, screening out a key image of the image to be relocated from the multiple candidate images; Performing feature extraction processing on the image to be relocated to obtain a first feature point, and performing feature extraction processing on the key image to obtain a second feature point; Based on the semantic object included in the image to be relocated, a first feature point to be matched is selected from the first feature points, and based on the semantic object included in the key image, a second feature point to be matched is selected from the second feature points; Feature matching processing is performed on the first feature point to be matched and the second feature point to be matched, and posture positioning processing is performed on the camera based on the obtained feature point matching relationship to obtain a repositioned posture of the camera.
2. The method according to claim 1, characterized in that The method of performing image retrieval processing on a retrieval database based on the image to be relocated to obtain a plurality of candidate images of the image to be relocated includes: Performing a descriptor extraction process on the image to be relocated by using a first neural network model to obtain a first descriptor of the image to be relocated; Performing descriptor extraction processing on a plurality of images included in the retrieval database by using the first neural network model to obtain a second descriptor for each of the images; Based on the similarity between the first descriptor and the second descriptor, the plurality of candidate images are screened out from the plurality of images.
3. The method according to claim 2, characterized in that The step of performing a descriptor extraction process on the image to be relocated by using a first neural network model to obtain a first descriptor of the image to be relocated includes: The following processing is performed by the first neural network model: Performing visual feature extraction processing on the image to be relocated to obtain visual features of the image to be relocated; Performing semantic feature extraction processing on the image to be relocated to obtain semantic features of the image to be relocated; The visual features and the semantic features are integrated to obtain a first descriptor of the image to be relocated.
4. The method according to claim 1, characterized in that: Before selecting the key image of the image to be relocated from the plurality of candidate images based on the semantic objects included in the image to be relocated, the method further includes: Performing semantic object recognition processing on the image to be relocated to obtain the semantic object included in the image to be relocated; Performing semantic object recognition processing on each of the candidate images to obtain the semantic objects included in each of the candidate images; The step of selecting a key image of the image to be relocated from the plurality of candidate images based on the semantic objects included in the image to be relocated comprises: Determine, from the semantic objects included in the image to be relocated, a static semantic object included in the image to be relocated, and, from the semantic objects included in each of the candidate images, determine the static semantic object included in each of the candidate images; Based on the static semantic objects included in the image to be relocated and the static semantic objects included in each of the candidate images, determining the static semantic coincidence degree between the image to be relocated and each of the candidate images; Based on the static semantic coincidence between the image to be relocated and each of the candidate images, a key image of the image to be relocated is screened out from the multiple candidate images.
5. The method according to claim 4, characterized in that The determining, based on the static semantic objects included in the image to be relocated and the static semantic objects included in each of the candidate images, the static semantic coincidence degree between the image to be relocated and each of the candidate images comprises: The following processing is performed for each candidate image: Determine, from the candidate images, a target static semantic object that is the same as the static semantic object included in the image to be relocated, wherein the static semantic object includes at least one of a completely static semantic object and a semi-static semantic object; Determining a first number of semantic objects included in the image to be relocated; The ratio of the second number of the target static semantic objects to the first number is determined as the static semantic coincidence degree between the image to be relocated and the candidate image.
6. The method according to any one of claims 1 to 5, characterized in that: The step of performing feature extraction processing on the image to be relocated to obtain a first feature point includes: Calling a second neural network model, wherein the second neural network model includes an encoder and a decoder; Performing feature encoding processing on the image to be relocated by the encoder to obtain encoding features of the image to be relocated; Performing feature decoding processing on the coded features of the image to be relocated by the decoder to obtain the feature point probability of the image to be relocated, wherein the feature point probability is the probability that each pixel in the image to be relocated belongs to a feature point; Based on the probability of feature points of the image to be relocated, a first feature point is determined.
7. The method according to any one of claims 1 to 5, characterized in that: The step of selecting first feature points to be matched from the first feature points based on the semantic objects included in the image to be relocated comprises: Determining, from the semantic objects included in the image to be relocated, a dynamic semantic object included in the image to be relocated; When the first feature point is not a pixel point in the dynamic semantic object, the first feature point is determined as the first feature point to be matched.
8. The method according to any one of claims 1 to 5, characterized in that: Before performing posture positioning processing on the camera based on the obtained feature point matching relationship to obtain the repositioned posture of the camera, the method further includes: Determine a pixel coordinate system where the image to be relocated is located, wherein the pixel coordinate system includes a first coordinate axis and a second coordinate axis; Determine a first maximum value and a first minimum value of the first feature point to be matched on the first coordinate axis, determine a second maximum value and a second minimum value of the first feature point to be matched on the second coordinate axis, determine a first boundary upper limit and a first boundary lower limit of the first coordinate axis, and determine a second boundary upper limit and a second boundary lower limit of the second coordinate axis; Determine a coverage field of view ratio of the first feature point to be matched based on the first maximum value, the first minimum value, the second maximum value, the second minimum value, the first boundary upper limit, the first boundary lower limit, the second boundary upper limit, and the second boundary lower limit; When the coverage field ratio of the first feature point to be matched is greater than the coverage field ratio threshold, it is determined to perform posture positioning processing on the camera.
9. The method according to claim 8, characterized in that The determining, based on the first maximum value, the first minimum value, the second maximum value, the second minimum value, the first boundary upper limit, the first boundary lower limit, the second boundary upper limit, and the second boundary lower limit, the coverage field of view ratio of the first feature point to be matched includes: Determine a first sum of the inverse tangent value of the first minimum value and the inverse tangent value of the first minimum value, and determine a second sum of the inverse tangent value of the second minimum value and the inverse tangent value of the second minimum value; Determine a third sum of the inverse tangent value of the first upper boundary limit and the inverse tangent value of the first lower boundary limit, and determine a fourth sum of the inverse tangent value of the second upper boundary limit and the inverse tangent value of the second lower boundary limit; A first ratio of the first sum to the third sum is determined, a second ratio of the second sum to the fourth sum is determined, and a product of the first ratio and the second ratio is determined as a coverage field of view ratio of the first feature point to be matched.
10. The method according to any one of claims 1 to 5, characterized in that: The feature point matching relationship includes a plurality of feature point pairs, each of which includes one first feature point to be matched and one second feature point to be matched; The performing posture positioning processing on the camera based on the obtained feature point matching relationship to obtain the repositioned posture of the camera includes: Obtaining the initial position of the camera; Based on some of the feature point pairs, optimizing the initial pose of the camera to obtain an optimized pose of the camera; Based on the multiple feature point pairs, the optimized posture of the camera is optimized to obtain a repositioned posture of the camera.
11. The method according to any one of claims 1 to 5, characterized in that: The image retrieval process, the feature extraction process, the feature matching process, and the posture positioning process are implemented by different functional modules, and the different functional modules are decoupled from each other; The method further comprises: Performing error evaluation on the different functional modules respectively to obtain the error of each functional module; When the error of the functional module is greater than a first module error threshold, the algorithm built into the functional module is replaced with a new algorithm until the error of the functional module with the new algorithm built in is less than a second module error threshold, wherein the second module error threshold is less than the first module error threshold.
12. The method according to any one of claims 1 to 5, characterized in that: The image retrieval process, the feature extraction process, the feature matching process, and the posture positioning process are implemented by different functional modules, and the different functional modules are decoupled from each other; The method further comprises: When the error between the actual posture of the camera and the repositioning posture is greater than a first error threshold, the algorithm built into at least one of the functional modules is replaced with a new algorithm until the error between the repositioning posture obtained according to the visual repositioning method with the new algorithm built in and the actual posture is less than a second error threshold, wherein the second error threshold is less than the first error threshold.
13. A visual repositioning device, characterized in that: The device comprises: An image retrieval module is used to perform image retrieval processing on a retrieval database based on an image to be relocated, so as to obtain a plurality of candidate images of the image to be relocated, wherein the image to be relocated is collected by a camera; A first screening module, configured to screen out a key image of the image to be relocated from the plurality of candidate images based on the semantic objects included in the image to be relocated; A feature extraction module, used to perform feature extraction processing on the image to be relocated to obtain a first feature point, and perform feature extraction processing on the key image to obtain a second feature point; A second screening module, configured to screen out first feature points to be matched from the first feature points based on the semantic objects included in the image to be relocated, and to screen out second feature points to be matched from the second feature points based on the semantic objects included in the key image; A feature matching module, used for performing feature matching processing on the first feature point to be matched and the second feature point to be matched; The posture positioning module is used to perform posture positioning processing on the camera based on the obtained feature point matching relationship to obtain the repositioned posture of the camera.
14. An electronic device, characterized in that: The electronic device comprises: Memory for storing computer programs or computer executable instructions; A processor, configured to implement the visual repositioning method according to any one of claims 1 to 12 when executing the computer program or computer executable instructions stored in the memory.
15. A computer-readable storage medium, characterized in that: A computer program or a computer executable instruction is stored, and when the computer program or the computer executable instruction is executed by a processor, the visual repositioning method according to any one of claims 1 to 12 is implemented.
16. A computer program product comprising a computer program or computer executable instructions, characterized in that When the computer program or computer executable instructions are executed by a processor, the visual relocation method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Map relocation method and device combined with semantic information
CN117830625A
Visual localization method and apparatus based on semantic error image
US11321937B1
Visual Localization Method and Apparatus
US20230089845A1
Methods and systems for retrieving images based on semantic plane features
WO2023091131A1
Relocalization method and apparatus
WO2024066980A1
Cited By
Visual repositioning method and electronic equipment
CN120163877A
A method for visual relocalization and an electronic device
CN120163877B
Visual relocalization method and apparatus, computer-readable storage medium, and robot
WO2026102883A1
