A SLAM method based on improved semantic optical flow method in dynamic environment
By combining optical flow and semantic information in the SLAM method, using a lightweight semantic segmentation network and epipolar geometric constraints to detect dynamic points, the problem of low accuracy and robustness of the SLAM method in dynamic environments is solved, and more efficient positioning is achieved. and mapping effects.
Patent Information
- Application Number
- CN202011360869.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-27
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-11-27
AI Technical Summary
Existing SLAM methods have low detection accuracy and robustness in dynamic environments, resulting in initialization failure, large positioning errors and mapping failures, and cannot effectively handle dynamic scenes.
The improved semantic optical flow method is used to remove dynamic points through the combination of optical flow and semantic information to improve the accuracy and robustness of the SLAM system in dynamic environments. The lightweight semantic segmentation network LEDNet is used for semantic segmentation of dynamic objects, combined with LK Optical flow method and epipolar geometric constraints are used to detect dynamic points and optimize poses and point cloud maps.
It improves the accuracy and robustness of the visual SLAM system in dynamic environments, maintains efficiency and real-time performance, and improves the accuracy of positioning and mapping by removing dynamic points.
Smart Images

Figure CN112446885B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vision-based positioning and navigation in autonomous inspection of unmanned aerial vehicles, and more specifically, to a SLAM method based on an improved semantic optical flow method in a dynamic environment. Background Art
[0002] The process of UAV intelligent inspection requires the UAV to autonomously determine the next operation based on the real-time information of the current environment. Therefore, real-time positioning of the UAV and mapping of the working environment are important links in the process of UAV intelligent inspection. Especially in the collaborative work of multiple UAVs arranged in a grid, the environment detected by each UAV is a dynamic scene (including moving objects that appear and disappear from time to time), so special algorithms need to be developed for dynamic scenes during positioning and environmental mapping.
[0003] Simultaneous Localization and Mapping (SLAM) is a technology that can estimate the current position and posture through sensors and corresponding motion estimation algorithms without any prior information about the environment, and build a three-dimensional map of the environment. With the development of computer vision and deep learning technology, as well as the improvement of hardware computing power, vision-based SLAM research has continued to deepen and is widely used in autonomous driving, mobile robots, drones and other fields.
[0004] The Chinese patent application document with the publication number "CN110322511A" and the publication date of October 11, 2019 discloses a semantic SLAM method and system based on object and plane features, which obtains the RGB-D image stream of the scene, and uses the RGB-D image stream to track frame by frame to obtain key frame images; uses the key frame images to build a local map of the scene, performs plane segmentation on the depth map of the key frame image to obtain the current plane, uses the current plane to build a global plane map, performs object detection on the key frame image, obtains the detection frame and confidence, uses the detection frame and confidence to reconstruct the point cloud of the object, merges the feature points in the detection frame into the object, and obtains the global object map; uses the key frame image to perform loop detection to obtain the loop frame, and uses the loop frame to perform loop correction to optimize the plane constraints and object constraints, and obtains the plane map and object map of the scene. The present invention can improve the SLAM optimization performance and enhance the semantic description of the environment.
[0005] However, in the above methods, the application scenarios are basically static, while the dynamic information in the environment cannot be ignored in actual application. The above SLAM methods lack a mechanism to handle dynamic scenes, which may cause a series of problems such as initialization failure, excessive positioning error, and map construction failure, resulting in low accuracy and poor robustness of the SLAM system in dynamic scenes. Summary of the invention
[0006] In order to overcome the problems of low detection accuracy and robustness of SLAM methods in dynamic scenes in the above-mentioned prior art, the present invention provides a SLAM method based on an improved semantic optical flow method in a dynamic environment, which improves the accuracy and robustness of the visual SLAM system in a dynamic environment by removing dynamic points through combining optical flow and semantic information.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is: a SLAM method based on an improved semantic optical flow method in a dynamic environment, comprising the following steps:
[0008] Step 1: Calibrate the camera, remove image distortion, and obtain image sequence;
[0009] Step 2: Extract ORB feature points from the input image and then calculate the descriptor;
[0010] Step 3: Segment the input image through the semantic segmentation network to obtain the masks of each object; temporarily delete the feature points in the dynamic object mask;
[0011] Step 4: Use the optical flow method to track the remaining feature points and obtain feature point matching pairs;
[0012] Step 5: Use epipolar geometry constraints to re-judge dynamic points of all feature points;
[0013] Step 6: Obtain the camera pose by tracking the thread;
[0014] Step 7: Process the point cloud through the local mapping thread to obtain a sparse point cloud map;
[0015] Step 8: Use loop closure detection to optimize the pose and correct the drift error.
[0016] Preferably, in step 1, the specific steps of calibrating the camera and removing image distortion are:
[0017] S1.1: First, obtain the camera internal parameters, including f x ,f y ,c x ,c y , normalize the three-dimensional coordinates (X, Y, Z) to homogeneous coordinates (x, y);
[0018] S1.2: Remove the influence of distortion on the image, where [k1, k2, k3, p1, p2] is the distortion coefficient of the lens, and r is the distance from the point to the origin of the coordinate system:
[0019]
[0020] S1.3: Convert the coordinates in the camera coordinate system to the pixel coordinate system:
[0021]
[0022] Among them, c x and c y is the correction value of the pixel coordinate system.
[0023] Preferably, in the step 2, two initial frames in the image that can be used as the starting two frames are selected to initialize the input image; if the grayscale value I(x) of more than N points around a certain point P in the initialized image differs from the grayscale value I(p) of the point P by more than a threshold ε, the point is considered to be a target corner point, which is expressed as:
[0024]
[0025] Preferably, the condition for selecting the initial frame is that the number of feature points in consecutive frames is greater than 100.
[0026] Preferably, the semantic segmentation network is a lightweight semantic segmentation network LEDNet, which performs semantic segmentation of dynamic objects. The lightweight semantic segmentation network LEDNet adopts an asymmetric decoder architecture to complete the task of real-time semantic segmentation. The network parameters are less than 1M and can run at a speed of more than 71FPS in a single GTX 1080 GPU. The network is used to semantically segment objects (people, chairs, screens, cars, etc.) in the image, and the feature points in the mask of the dynamic object are temporarily removed, retaining the remaining static points.
[0027] Preferably, in step 4, the optical flow method is the LK optical flow method, which is mainly based on two assumptions: the grayscale remains unchanged and the target position does not change too drastically within a small time period. The specific steps are:
[0028] S4.1: Based on the grayscale invariance assumption, the basic constraint equation of optical flow can be obtained:
[0029]
[0030] S4.2: Since objects do not move violently in a short period of time, we can obtain:
[0031]
[0032] S4.3: Set the matrix form as follows, where I x , I y Represents the grayscale gradient of the point on x and y, I t Indicates the change of image grayscale over time, v x , v y Indicates the speed of pixels on x, y
[0033] [I x I y ][v x v y ] T =-I t
[0034] S4.4: The final LK optical flow uses weighted least squares to estimate the optical flow, and its error function is:
[0035]
[0036] Among them, I x , I y Represents the grayscale gradient of the point on x and y, I t Indicates the change of image grayscale over time, v x , v y Indicates the speed of pixels on x,y.
[0037] Preferably, in step 5, dynamic points are detected by epipolar geometry constraints, and the distance between the feature points of two adjacent frames reprojected to the epipolar line is calculated to determine whether it is a dynamic point; if the matching point of the object's static feature point reprojected on the reference frame falls on the intersection of the reference frame and the epipolar plane, then the point is a static point. The specific steps are:
[0038] S4.1: p1, p2 are the homogeneous coordinates of the matching points in the current frame and the reference frame, where u, v are the values in the image frame, specifically:
[0039] p1=[u1,v1,1],p2=[u2,v2,1]
[0040] S4.2: Calculate the epipolar lines, where the basic matrix F can be calculated by eight pairs of feature points, specifically:
[0041]
[0042] Where [XYZ] T represents the epipolar vector;
[0043] S4.3: Calculate the distance from the matching point to its corresponding epipolar line. If it is static, D is close to 0. When D is greater than the threshold ε, the feature point is dynamic. Specifically:
[0044]
[0045] Preferably, in step six, the tracking thread specifically: estimates the current frame pose according to the motion model of step five, tracks the map points of the previous frame according to the uniform motion model, and determines the pose.
[0046] Preferably, point cloud processing is performed through a local mapping thread, and a sparse point cloud map is obtained through local BA optimization.
[0047] Preferably, in step eight, a bag-of-words model is used to determine whether a loop occurs. If so, the pose is optimized by correcting the accumulated error through the loop.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] 1) The present invention improves the accuracy and robustness of the visual SLAM system in a highly dynamic environment by combining the optical flow method with semantic information to remove dynamic points.
[0050] 2) A lightweight semantic segmentation network combined with the optical flow method is used to detect and remove dynamic points. The optical flow method does not require a descriptor to maintain the efficiency of feature point matching. At the same time, the semantic segmentation network segments the image semantic information and reduces the time overhead of image segmentation, thereby maintaining high real-time performance while ensuring accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flow chart of a SLAM method based on an improved semantic optical flow method in a dynamic environment of the present invention. DETAILED DESCRIPTION
[0052] The drawings are only for illustrative purposes and cannot be construed as limiting the present invention. To better illustrate the present embodiment, some parts of the drawings may be omitted, enlarged, or reduced, and do not represent the size of the actual product. For those skilled in the art, it is understandable that some well-known structures and their descriptions may be omitted in the drawings. The positional relationships described in the drawings are only for illustrative purposes and cannot be construed as limiting the present invention.
[0053] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "long", "short" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and cannot be understood as limitations on this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0054] The technical solution of the present invention is further described in detail below through specific embodiments and in conjunction with the accompanying drawings:
[0055] Example
[0056] like Figure 1 An embodiment of a SLAM method based on an improved semantic optical flow method in a dynamic environment is shown, comprising the following steps:
[0057] Step 1: Calibrate the camera, remove image distortion, and obtain an image sequence; The specific steps for calibrating the camera and removing image distortion are as follows:
[0058] S1.1: First, obtain the camera internal parameters, including f x ,f y ,c x ,c y , normalize the three-dimensional coordinates (X, Y, Z) to homogeneous coordinates (x, y);
[0059] S1.2: Remove the influence of distortion on the image, where [k1, k2, k3, p1, p2] is the distortion coefficient of the lens, and r is the distance from the point to the origin of the coordinate system:
[0060]
[0061] S1.3: Convert the coordinates in the camera coordinate system to the pixel coordinate system:
[0062]
[0063] Step 2: Extract ORB feature points from the input image and then calculate the descriptor; select two initial frames in the image that can be used as the starting two frames to initialize the input image; if the grayscale value I(x) of more than N points around a certain point P in the initialized image differs from the grayscale value I(p) of the point P by more than the threshold ε, the point is considered to be a target corner point, expressed as:
[0064]
[0065] The selection condition of the initial frame is: the number of feature points in the continuous frames is greater than 100.
[0066] Step 3: Segment the input image through the semantic segmentation network to obtain the masks of each object; temporarily delete the feature points in the mask of the dynamic object; the semantic segmentation network is a lightweight semantic segmentation network LEDNet, which performs semantic segmentation of dynamic objects. The lightweight semantic segmentation network LEDNet uses an asymmetric decoder architecture to complete the task of real-time semantic segmentation. The network parameters are less than 1M and can run at a speed of more than 71FPS in a single GTX 1080 GPU. Use this network to semantically segment objects in the image (people, chairs, screens, cars, etc.), temporarily remove the feature points in the mask of the dynamic object, and retain the remaining static points.
[0067] Step 4: Use the optical flow method to track the remaining feature points and obtain feature point matching pairs;
[0068] The optical flow method is the LK optical flow method, which is mainly based on two assumptions: the grayscale remains unchanged and the target position does not change too drastically within a small time period. The specific steps are:
[0069] S4.1: Based on the grayscale invariance assumption, the basic constraint equation of optical flow can be obtained:
[0070]
[0071] S4.2: Since objects do not move violently in a short period of time, we can obtain:
[0072]
[0073] S4.3: Set the matrix form as follows, where I x , I y Represents the grayscale gradient of the point on x and y, I t Indicates the change of image grayscale over time, v x , v y Indicates the speed of pixels on x, y
[0074] [I x I y ][v x v y ] T =-I t
[0075] S4.4: The final LK optical flow uses weighted least squares to estimate the optical flow, and its error function is:
[0076]
[0077] Among them, I x , I y Represents the grayscale gradient of the point on x and y, I t Indicates the change of image grayscale over time, v x , v y Indicates the speed of pixels on x,y.
[0078] Step 5: Use epipolar geometry constraints to re-judge all feature points as dynamic points; detect dynamic points through epipolar geometry constraints, calculate the distance between the feature points of two adjacent frames reprojected to the epipolar line, and determine whether it is a dynamic point; if the matching point of the object's static feature point reprojected on the reference frame falls on the intersection of the reference frame and the epipolar plane, then the point is a static point. The specific steps are:
[0079] S4.1: p1, p2 are the homogeneous coordinates of the matching points in the current frame and the reference frame, where u, v are the values in the image frame, specifically:
[0080] p1=[u1,v1,1],p2=[u2,v2,1]
[0081] S4.2: Calculate the epipolar lines, where the basic matrix F can be calculated by eight pairs of feature points, specifically:
[0082]
[0083] Where [XYZ] T represents the epipolar vector;
[0084] S4.3: Calculate the distance from the matching point to its corresponding epipolar line. If it is static, D is close to 0. When D is greater than the threshold ε, the feature point is dynamic. Specifically:
[0085]
[0086] Step 6: Obtain the camera pose through the tracking thread, estimate the pose of the current frame according to the motion model in step 5, track the map points of the previous frame according to the uniform motion model, and determine the pose;
[0087] Step 7: Process the point cloud through the local mapping thread and obtain a sparse point cloud map through local BA optimization;
[0088] Step 8: Use loop detection to optimize the posture and correct the drift error. Use the bag-of-words model to determine whether a loop occurs. If so, correct the accumulated error through loop closure to optimize the posture.
[0089] The beneficial effects of this example are as follows: 1) The present invention improves the accuracy and robustness of the visual SLAM system in a highly dynamic environment by removing dynamic points through the combination of optical flow and semantic information. 2) Dynamic points are detected and removed by using a lightweight semantic segmentation network combined with the optical flow method. The optical flow method does not require a descriptor to maintain the high efficiency of feature point matching. At the same time, the semantic segmentation network segments the image semantic information and reduces the time overhead of image segmentation, thus ensuring accuracy while maintaining high real-time performance.
[0090] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A SLAM method based on an improved semantic optical flow method in a dynamic environment, characterized in that: The following steps are involved: Step 1: Calibrate the camera, remove image distortion, and obtain image sequence; Step 2: Extract ORB feature points from the input image and then calculate the descriptor; Step 3: Segment the input image through a semantic segmentation network to obtain masks of various objects; temporarily delete the feature points in the dynamic object mask; the semantic segmentation network is a lightweight semantic segmentation network LEDNet; Step 4: Use the optical flow method to track the remaining feature points to obtain feature point matching pairs; the optical flow method is the LK optical flow method, and the weighted least squares method is used for optical flow estimation, where the error function is: Among them, I x , I y Represents the grayscale gradient of the feature point on x and y, I t Indicates the change of image grayscale over time, v x , v y Indicates the speed of pixels on x, y; Step 5: Use epipolar geometry constraints to re-judge all feature points as dynamic points; detect dynamic points through epipolar geometry constraints, calculate the distance between the feature points of two adjacent frames reprojected to the epipolar line, and determine whether it is a dynamic point; if the matching point of the object's static feature point reprojected on the reference frame falls on the intersection of the reference frame and the epipolar plane, then the point is a static point; the specific steps are: S5.1: p1, p2 are the homogeneous coordinates of the matching points in the current frame and the reference frame, where u, v are the values in the image frame, specifically: p1=[u1,v1,1],p2=[u2,v2,1] S5.2: Calculate the epipolar lines, where F is the basic matrix, calculated through eight pairs of feature points, specifically: Where [XYZ] T represents the epipolar vector; S5.3: Calculate the distance from the matching point to its corresponding epipolar line. If the feature point is static, D approaches 0; when D is greater than the threshold ε, the feature point is dynamic, specifically: Where p1, p2 are the homogeneous coordinates of the matching points in the current frame and the reference frame; F is the basis matrix; X and Y are the epipolar vectors; Step 6: Obtain the camera pose by tracking the thread; Step 7: Process the point cloud through the local mapping thread to obtain a sparse point cloud map; Step 8: Use loop closure detection to optimize the pose and correct the drift error.
2. The SLAM method based on the improved semantic optical flow method in a dynamic environment according to claim 1, characterized in that: In the step 2, two initial frames in the image that can be used as the starting two frames are selected to initialize the input image; if the grayscale value I(x) of more than N points around a point P in the initialized image differs from the grayscale value I(p) of the point P by more than a threshold ε, the point P is considered to be a target corner point.
3. The SLAM method based on the improved semantic optical flow method in a dynamic environment according to claim 2, characterized in that: The selection condition of the initial frame is: the number of feature points in consecutive frames is greater than 100.
4. The SLAM method based on the improved semantic optical flow method in a dynamic environment according to claim 1, characterized in that: In step six, the tracking thread specifically estimates the current frame pose according to the motion model in step five, tracks the map points of the previous frame according to the uniform motion model, and determines the pose.
5. The SLAM method based on the improved semantic optical flow method in a dynamic environment according to claim 1, characterized in that: Point cloud processing is performed through the local mapping thread, and a sparse point cloud map is obtained through local BA optimization.
6. The SLAM method based on the improved semantic optical flow method in a dynamic environment according to claim 1, characterized in that: In step eight, the bag-of-words model is used to determine whether a loop occurs. If so, the accumulated error is corrected through the loop to optimize the posture.
