Stair modeling method, device, legged robot and medium based on point cloud data
Through the stair modeling method based on point cloud data, the point cloud classification loss and geometric constraint loss are used to train the model, and the pedal center point correction is performed, which solves the accuracy problem of machine vision in stair detection and improves the accuracy of stair modeling. and safety of legged robot navigation.
Patent Information
- Application Number
- CN202311698752.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-11
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-12-11
AI Technical Summary
In the existing technology, machine vision used for stair detection and modeling has problems such as low nighttime image quality, inaccurate depth prediction, and blurred images, which results in inaccurate stair modeling and increases the risk of legged robots going up and down stairs.
A stair modeling method based on point cloud data is used to train the stair recognition model through point cloud classification loss and geometric constraint loss, accurately identify the pedal point cloud, and correct the pedal center point through rotation transformation to generate a more accurate staircase model.
It improves the accuracy of stair modeling, reduces the risks of legged robots in stair navigation, and avoids the problems of inaccurate image quality and depth prediction of machine vision.
Smart Images

Figure CN117788693B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer modeling, and in particular to a stair modeling method, device, legged robot and medium based on point cloud data. Background Art
[0002] Stair modeling is widely used in the fields of blind navigation, autonomous obstacle avoidance robots, etc. Currently, stair detection and modeling are mainly performed based on captured images using machine vision.
[0003] However, machine vision still has the following problems: low quality of nighttime images, inaccurate depth prediction, and images taken while moving are easily blurred. These problems affect the accuracy of legged robots in detecting and identifying stairs, resulting in inaccurate stair modeling and increasing the risk of legged robots going up and down stairs.
[0004] Therefore, the prior art needs to be improved and enhanced. Summary of the invention
[0005] The main purpose of the present invention is to provide a stair modeling method, device, legged robot and computer-readable storage medium based on point cloud data, aiming to solve the problem of inaccurate stair modeling.
[0006] In order to achieve the above object, the present invention provides a stair modeling method based on point cloud data in a first aspect, the method comprising:
[0007] Inputting the point cloud data of the stairs into the stair recognition model to obtain a plurality of pedal point clouds, wherein the stair recognition model is trained using point cloud classification loss and geometric constraint loss, and each pedal point cloud is a set of point clouds corresponding to one pedal;
[0008] Based on the pedal point cloud, obtaining the center point of each pedal;
[0009] The center point of each pedal is corrected by using a rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device, and a corrected center point is obtained. According to the corrected center point, the depth and height of the step are obtained;
[0010] Generates a stair model based on the center points of all treads and the depth and height of the steps.
[0011] Optionally, training the stair recognition model includes:
[0012] Based on the classification results of the point cloud in the training data set by the stair recognition model, a cross entropy loss for characterizing the point cloud classification loss is calculated;
[0013] Calculating the distance between the true normal vector of each pedal and the normal vector predicted by the stair recognition model to obtain a curvature suppression loss for characterizing the geometric constraint loss;
[0014] A total loss value is calculated according to the cross entropy loss and the curvature suppression loss, and the stair recognition model is iteratively trained according to the total loss value.
[0015] Optionally, before inputting the training data set into the stair recognition model, point cloud data enhancement is performed on the training data set to simulate a scenario where point cloud data is missing due to light reflection.
[0016] Optionally, obtaining the depth and height of the step according to the corrected center point includes:
[0017] Based on the corrected center point, obtaining the center points of two adjacent pedals;
[0018] Calculate the depth and height of the step based on the center points of two adjacent treads.
[0019] Optionally, obtaining the center point of the target pedal based on the pedal point cloud includes:
[0020] Performing plane fitting on the pedal point cloud to obtain a fitting surface;
[0021] The coordinates and the normal vector of the center point of the target pedal are determined according to the fitting surface.
[0022] Optionally, the method of correcting the center point of each pedal by using a rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device to obtain the corrected center point includes:
[0023] Align the center point of each pedal with the target axis in the coordinate system of the point cloud acquisition device to obtain the rotation matrix of each pedal;
[0024] The center point of each pedal is corrected according to the rotation matrix to obtain the corrected center point.
[0025] Optionally, aligning the center point of each pedal with the target axis in the coordinate system of the point cloud acquisition device to obtain the rotation matrix of each pedal includes:
[0026] When there is a riser point cloud in the point cloud data of the stairs, align the normal vector of the riser point cloud with the negative direction of the Y axis in the coordinate system to obtain a first conversion coefficient, align the normal vector of the center point of each pedal with the negative direction of the Z axis in the coordinate system to obtain a second conversion coefficient, and the product of the first conversion coefficient and the second conversion coefficient is a rotation matrix for each pedal;
[0027] Otherwise, perform principal component analysis on the pedal point cloud of each pedal, align the second principal axis in the analysis result with the negative direction of the Z axis in the coordinate system to obtain the third conversion coefficient, align the third principal axis in the analysis result with the negative direction of the Y axis in the coordinate system to obtain the fourth conversion coefficient, and the product of the third conversion coefficient and the fourth conversion coefficient is the rotation matrix of each pedal.
[0028] A second aspect of the present invention provides a stair modeling device based on point cloud data, comprising:
[0029] A detection and recognition module, used to input the point cloud data of the stairs into a stair recognition model to obtain a plurality of pedal point clouds, wherein the stair recognition model is trained using point cloud classification loss and geometric constraint loss, and each pedal point cloud is a set of point clouds corresponding to one pedal;
[0030] A center point module, used for obtaining the center point of each pedal based on the pedal point cloud;
[0031] A step module, used to correct the center point of each step by using rotation transformation to eliminate the deviation between the center point of the step and the coordinate system of the point cloud acquisition device, obtain the corrected center point, and obtain the depth and height of the step according to the corrected center point;
[0032] The stair model generation module is used to generate a stair model according to the center point of the tread and the depth and height of the steps.
[0033] A third aspect of the present invention provides a legged robot, which includes a memory, a processor, and a stair modeling program based on point cloud data stored in the memory and executable on the processor. When the stair modeling program based on point cloud data is executed by the processor, the stair modeling program based on point cloud data implements any step of the stair modeling method based on point cloud data.
[0034] A fourth aspect of the present invention provides a computer-readable storage medium, on which a stair modeling program based on point cloud data is stored. When the stair modeling program based on point cloud data is executed by a processor, any step of the stair modeling method based on point cloud data is implemented.
[0035] As can be seen from the above, the present invention adopts point cloud classification loss and geometric constraint loss to train the stair recognition model based on the characteristics of stair point cloud data, so that the stair recognition model can accurately identify the tread point cloud of the stairs, and then obtain the center point of each tread based on the identified tread point cloud, and correct the center point of the tread to eliminate the deviation between the center point of the tread and the coordinate system of the point cloud acquisition device to obtain the corrected center point, and then obtain the depth and height of the step based on the corrected center point, so that the stair model modeled according to the center point of the tread and the depth and height of the step is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0037] Figure 1 A functional block diagram of a stair modeling method based on point cloud data provided by an embodiment of the present invention;
[0038] Figure 2 A schematic diagram of a flow chart of a stair modeling method based on point cloud data provided by an embodiment of the present invention;
[0039] Figure 3 Schematic diagram of the process of training the stair recognition model;
[0040] Figure 4 This is a schematic diagram of pedal center point correction;
[0041] Figure 5 A functional block diagram of a stair modeling device based on point cloud data provided by an embodiment of the present invention;
[0042] Figure 6 It is a block diagram of the internal structure principle of a legged robot provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0044] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0045] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0046] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0047] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0048] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0050] At present, the stair modeling method based on machine learning mainly relies on machine vision models to process image or video data for stair detection and modeling, rather than point cloud data. Due to the inherent limitations of machine vision, the accuracy of stair modeling is not high.
[0051] In response to the above problems, the present invention uses point cloud data to model stairs, which can avoid the inherent limitations of machine vision such as low image quality and inaccurate depth prediction. According to the characteristics of stair point cloud data, point cloud classification loss and geometric constraint loss are used to train the stair recognition model, so that the stair recognition model can accurately identify the stair tread point cloud and correct the center point of the stair tread. The generated stair model is more accurate, which is conducive to the navigation of the legged robot.
[0052] The embodiment of the present invention provides a stair modeling method based on point cloud data, which is deployed on the control chip of a legged robot (also called a legged robot or a wheeled legged robot). During the navigation process of the legged robot, when encountering stairs, the stairs are modeled, and the legged robot can automatically go up and down the stairs. Figure 1As shown in the figure, when stair modeling, the stair recognition model is trained first, and then the trained stair recognition model is used to model the stair. The specific steps of stair modeling are as follows: Figure 2 As shown, including:
[0053] Step S100: inputting the point cloud data of the stairs into the stair recognition model to obtain a number of pedal point clouds. The stair recognition model is trained using point cloud classification loss and geometric constraint loss. Each pedal point cloud is a collection of point clouds corresponding to one pedal.
[0054] The legged robot is equipped with a laser radar device. When the legged robot comes to the stairs, it first collects the point cloud data of the stairs through the laser radar device, and then inputs the point cloud data of the stairs into the stair recognition model. The stair recognition model will output a set of pedal point clouds in sequence, and each pedal point cloud is a collection of point clouds corresponding to a pedal. The backbone network of the stair recognition model is a deep learning model. The specific network architecture is not limited and can be any deep learning model that can detect and classify point cloud data (such as: PointNet, PointNet++, DGCNN, KPConv, PointCNN, etc.). The stair recognition model of this embodiment uses PointNet++ as the backbone network, which can achieve an effective balance between performance and efficiency.
[0055] For the point cloud data of the stairs, during the prediction process, the network model tends to make positive predictions, occasionally for point clouds located on vertical risers. This prediction behavior can be largely attributed to the inherent ambiguity in the manual annotation process, especially at the boundaries. Therefore, the distribution of prediction errors is mainly concentrated in the upper part of the point cloud and at the intersection between the bottom pedal and the vertical riser. Considering that the errors in the upper part are irrelevant to the current action of the legged robot, it is important to impose higher penalties on lower intersections or more obvious vertical risers. Therefore, in view of the above characteristics of the stair point cloud data, when training the stair recognition model, this embodiment uses a curvature-suppressed cross entropy loss function to enhance the prediction performance of the stair recognition model.
[0056] like Figure 3 As shown, the steps of training the stair recognition model include:
[0057] Step S110: Based on the classification results of the point cloud in the training data set by the stair recognition model, a cross entropy loss for characterizing the point cloud classification loss is calculated;
[0058] According to the point cloud classification results of each sample in the training data set (including pedal point clouds, riser point clouds, and other point clouds that are neither pedal point clouds nor riser point clouds), the multi-classification cross entropy loss is calculated. The calculation process of the multi-classification cross entropy loss is a conventional technical means in this field, which mainly performs weighted statistics on the classification value and the probability of belonging to a certain classification to obtain the cross entropy loss. The specific process will not be repeated here.
[0059] Step S120: calculating the distance between the actual normal vector of each step and the normal vector predicted by the stair recognition model, and obtaining a curvature suppression loss for characterizing the geometric constraint loss;
[0060] By comparing the actual normal vector of the pedal with the normal vector predicted by the stair recognition model, geometric constraints can be added during stair recognition model training to ensure that the predicted pedal orientation is accurate. The specific calculation formula for curvature suppression loss is:
[0061]
[0062] Among them, L cs is the curvature suppression loss, s represents the total number of steps of the stairs, p represents the number of step point clouds, N represents the normal vector, and N gt,i is the true normal vector of the pedal point cloud, N pred,j is the normal vector predicted by the pedal point cloud. If a pedal does not exist, k=0, otherwise, k=1.
[0063] Step S130: Calculate a total loss value according to the cross entropy loss and the curvature suppression loss, and iteratively train the stair recognition model according to the total loss value.
[0064] Specifically, the total loss value is calculated as:
[0065] L csce =(1-k)×L ce +k×(L cs +L ce ) (1)
[0066]
[0067] Among them, L cs is the curvature suppression loss, L ce is the cross entropy loss, n represents the total number of training times that trigger the curvature suppression loss (each round of training is called an epoch), and k is the adjustment coefficient.
[0068] By combining the cosine distance between the predicted normal vector and the average true normal vector of the stair treads with the classification cross entropy, the loss is calculated not only based on the classification error, but also based on the geometric constraints. In addition, when calculating the loss, the small boundary errors introduced in the manual annotation process are also averaged to reduce the impact of the annotation ambiguity. The constraints of the normal vector can be used to reduce the ambiguity of the manually annotated traversable area and the fuzzy classification of the boundaries in the prediction process, thereby enhancing the prediction accuracy of the stair recognition model.
[0069] Since there is no open source staircase dataset with sufficient diversity and completeness, the staircase recognition model is not fully trained and is prone to overfitting. Before the training dataset is input into the staircase recognition model, this embodiment also performs point cloud data enhancement on the training dataset to simulate the scenario where point cloud data is missing due to light reflection. This can improve overfitting caused by prediction errors caused by the diversity of the dataset and illumination.
[0070] Specifically, in order to deal with the situations where data is missing in the stair point cloud data and erroneous data appears in the stair treads and risers due to reasons such as light intensity, acquisition equipment, and acquisition environment, five enhancement operations, including random removal of treads (RRS), random removal of non-steps (RRNS), random ball sampling (RBS), random Gaussian perturbation (RGP), and random downsampling (RRPG), are used to enhance the stair point cloud data.
[0071] Among them, the RRS enhancement operation removes a random number of stair treads according to the point cloud labels. Specifically, the stair treads and the corresponding tread point clouds are determined by random values generated from a Gaussian distribution within the range of the number of stair treads. The retention of a particular tread depends on the probability of RRS and can be adjusted using a threshold. It can simulate the scene in the real world where sunlight causes mirror reflection and causes partial data loss. This enhancement operation tends to delete stair treads that are located at the median number of stair treads in the stair point cloud.
[0072] The RRNS enhancement operation removes non-tread point clouds (including riser point clouds and other point clouds that are neither tread point clouds nor riser point clouds) from a given stair point cloud with a certain probability. For example, a uniform distribution is used to determine the above probability. If RRNS is activated, the point cloud of the stair riser or other point clouds will be removed from the stair point cloud. It can simulate industrial metal sheet stairs with missing treads.
[0073] The RBS enhancement operation generates a spherical area of fixed size at the center of the stair point cloud, and the point cloud in this area will be deleted. Specifically, the distance between each point cloud and the center point of the spherical area is calculated, and the point cloud is retained only if the distance exceeds the radius. The RBS enhancement operation can simulate the loss of spherical point clouds caused by specific lighting angles.
[0074] The stair surface captured by an RGB-D camera may show obvious fluctuations or undulations at each point cloud location. To address this issue, the RGP augmentation operation applies a tiny Gaussian perturbation to each point cloud to introduce additional fluctuations in the point cloud.
[0075] The RRPG enhancement operation compresses the number of point clouds of different pedals in the point cloud by multiplying the point clouds of different pedals by the downsampling factor. For example, a high-variance Gaussian function is used to generate a random number of point clouds for each pedal.
[0076] Through the above data augmentation operations, the diversity and completeness of the training data set are improved, which can alleviate the overfitting caused by the diversity of the data set and improve the prediction performance of point cloud data that is partially damaged due to lighting interference.
[0077] Step S200: based on the pedal point cloud, obtaining the center point of each pedal;
[0078] After inputting the stair point cloud data into the stair recognition model, the stair recognition model outputs a set of tread point clouds in sequence, performs plane fitting on each tread point cloud, and extracts the normal vector and center point of each tread. The specific process is: plane fitting is performed on the tread point cloud of each stair tread, such as using RANSAC (Random Sample Consensus, a classic model fitting algorithm) to perform plane fitting, obtain fitting surfaces one by one, project the tread point cloud onto the fitting surface, calculate the coordinate mean of the tread point cloud on the fitting surface to determine the center point of the stair tread, and use the normal vector of the fitting surface as the normal vector of the center point of the current tread. The normal vector of the center point and the coordinates of the center point constitute a vector with the starting point as the coordinates of the center point and the direction as the normal vector.
[0079] The list of the center point and normal vector of each pedal constitutes the navigation information of the legged robot, and all the pedals form a traversable area.
[0080] Compared with the traditional plane segmentation method, the direction of the center point is determined by extracting the normal vector from a group of identified pedal point clouds, and the position of the center point is determined by plane fitting and calculating the mean, which reduces the calculation time and improves the modeling efficiency. In addition, it can also average the noise influence caused by outliers in the prediction process.
[0081] Step S300: Correct the center point of each pedal using a rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device, obtain the corrected center point, and obtain the depth and height of the step according to the corrected center point;
[0082] Whether the center point and normal vector of the pedal are accurate is crucial to the navigation of the legged robot. Although the stair recognition model can accurately determine the center point of the pedal, when the stair point cloud data is collected at some inclined angles, after being input into the stair recognition model, the predicted center point may deviate from the coordinate system of the point cloud acquisition device. Therefore, it is necessary to align the normal vector of the center point of the pedal with the target axis in the coordinate system of the point cloud acquisition device, generate a rotation matrix, and then correct the center point of the pedal according to the rotation matrix so that the plane formed by the Z-axis and Y-axis of the pedal and camera coordinate systems are parallel. For details, see Figure 4 When there is a riser point cloud in the point cloud data of the stairs, align the normal vector of the riser point cloud with the negative direction of the Y axis in the coordinate system of the point cloud acquisition device to obtain the first conversion coefficient, align the normal vector of the pedal point cloud with the negative direction of the Z axis in the coordinate system of the point cloud acquisition device to obtain the second conversion coefficient. The product of the first conversion coefficient and the second conversion coefficient is the rotation matrix; the formula for matrix transformation is:
[0083] R t =R t (a xyz , n pred )
[0084] P correct =R t P
[0085] Among them, a xyz Represents the coordinate axis of the coordinate system of the point cloud acquisition device, n pred Represents the normal vector, R t represents the rotation matrix, P represents the center point before correction, P correct Indicates the center point after correction.
[0086] Assuming that the normal vector of the pedal is Nriser, and the normal vector of the vertical plate is Ntread, the normal vector of the pedal is aligned to the Z axis of the coordinate system of the point cloud acquisition device, which can be expressed as: Rt1=Rt(negative Z axis of the coordinate system of the point cloud acquisition device, Nriser), the normal vector of the vertical plate is aligned to the Y axis of the coordinate system of the point cloud acquisition device, which can be expressed as: Rt2=Rt(negative Y axis of the coordinate system of the point cloud acquisition device, Ntread), and the rotation matrix=Rt2*Rt1.
[0087] When there is no riser point cloud in the point cloud data of the stairs, the principal component analysis (PCA) method is used to analyze the pedal point cloud. Since it is a three-dimensional space, the analysis results include three main axes. The first main axis is the width direction of the pedal, and the second and third main axes are the depth and height directions of the pedal. The second main axis in the analysis result is aligned with the negative direction of the Z axis in the coordinate system of the point cloud acquisition device to obtain the third conversion coefficient. The third main axis in the analysis result is aligned with the negative direction of the Y axis in the coordinate system of the point cloud acquisition device to obtain the fourth conversion coefficient. The product of the third conversion coefficient and the fourth conversion coefficient is the rotation matrix. The coordinates of the center point of the pedal are corrected according to the rotation matrix to obtain the corrected center point.
[0088] By correcting the center point of the tread, the accuracy of the stair model can be significantly improved, and its geometric parameters can be corrected before outputting the passable area based on the stair model.
[0089] After obtaining the corrected center point, the center points of two adjacent pedals can be found within the corrected center point according to the coordinates of the corrected center point, and then the depth and height of the step can be calculated based on the center points of the two adjacent pedals. The specific calculation formula is:
[0090]
[0091]
[0092] Among them, n represents the next pedal, p represents the previous pedal, CP z,n Indicates the Z-axis coordinate of the center point of the next pedal, CP z,p Indicates the Z-axis coordinate of the center point of the previous pedal, CP y,n Indicates the Y-axis coordinate of the center point of the next pedal, CP y,p Indicates the Y-axis coordinate of the center point of the previous pedal, N (n,p) represents the step length between pedal n and pedal p. If there is no missing pedal between pedal n and pedal p, then N (n,p) is 1, if there is a missing pedal between pedal n and pedal p, then N (n,p) is 2.
[0093] The depth and height of the step are determined by projecting the distance between nearby center points on the Z-axis and Y-axis of the coordinate system of the point cloud acquisition device. This is simple, convenient and has a fast calculation speed.
[0094] Step S400: Generate a stair model according to the center points of all treads and the depth and height of the steps.
[0095] Because the formula for calculating the depth and height of the stairs is only suitable for the situation of facing the stairs, it is necessary to make corrections to the center point to accurately calculate the height and depth of the steps. However, when generating the stair model, the position coordinates and normal vector information of the center point of the tread before correction are still used. According to the center point of the tread and the depth and height of the step, the size of each tread in the stair can be determined. See Figure 4 The depth of the pedal refers to the size of the pedal in the Z-axis direction, and the height of the pedal refers to the size difference between two adjacent pedals in the Y-axis direction. The width of the pedal usually does not need to be detected, and the standard pedal width can be used. Generally, the width of the pedal can ensure that it is sufficient for the legged robot to go up and down the stairs and will not affect the navigation of the legged robot. After obtaining the height, depth and center point of the pedal point cloud, the geometric model of each pedal can be generated, and the geometric models of all pedals constitute the entire stair model.
[0096] As described above, this embodiment introduces a series of data enhancement operations to deal with overfitting caused by prediction errors caused by the diversity of the data set and illumination, thereby improving the robustness of the stair recognition model; uses a curvature-suppressed cross-entropy loss function to reduce the ambiguity of boundary predictions between passable and impassable areas, thereby improving the accuracy of the stair recognition model predictions; and for parameter modeling errors, corrects the center point of the pedal based on the stair posture to calibrate the stair modeling affected by the tilted perspective, thereby obtaining a more accurate stair model.
[0097] The present invention also provides a stair modeling device based on point cloud data, such as Figure 5 As shown, the device comprises:
[0098] The detection and recognition module 600 is used to input the point cloud data of the stairs into the stair recognition model to obtain a plurality of pedal point clouds. The stair recognition model is trained using point cloud classification loss and geometric constraint loss. Each pedal point cloud is a set of point clouds corresponding to one pedal.
[0099] A center point module 610, for obtaining a center point of each pedal based on the pedal point cloud;
[0100] The step module 620 is used to correct the center point of each step by using rotation transformation to eliminate the deviation between the center point of the step and the coordinate system of the point cloud acquisition device, obtain the corrected center point, and obtain the depth and height of the step according to the corrected center point;
[0101] The stair model generating module 630 is used to generate a stair model according to the center points of all the treads and the depth and height of the steps.
[0102] Specifically, in this embodiment, the specific functions of the above-mentioned stair modeling device based on point cloud data can refer to the corresponding description in the above-mentioned stair modeling method based on point cloud data, and will not be repeated here.
[0103] Based on the above embodiments, the present invention further provides a legged robot, whose principle block diagram can be shown as follows: Figure 6 As shown. The legged robot comprises a processor, a memory and a network interface connected via a system bus. The processor of the legged robot is used to provide computing and control capabilities. The memory of the legged robot comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a stair modeling program based on point cloud data. The internal memory provides an environment for the operation of the operating system and the stair modeling program based on point cloud data in the non-volatile storage medium. The network interface of the legged robot is used to communicate with an external terminal via a network connection. When the stair modeling program based on point cloud data is executed by the processor, the steps of any one of the above-mentioned stair modeling methods based on point cloud data are implemented.
[0104] Those skilled in the art will understand that Figure 6 The principle block diagram shown is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation of the legged robot to which the scheme of the present invention is applied. The specific legged robot may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0105] In one embodiment, a legged robot is provided. The legged robot includes a memory, a processor, and a stair modeling program based on point cloud data stored in the memory and executable on the processor. When the stair modeling program based on point cloud data is executed by the processor, the following operation instructions are performed:
[0106] Inputting the point cloud data of the stairs into the stair recognition model to obtain a plurality of pedal point clouds, wherein the stair recognition model is trained using point cloud classification loss and geometric constraint loss, and each pedal point cloud is a set of point clouds corresponding to one pedal;
[0107] Based on the pedal point cloud, obtaining the center point of each pedal;
[0108] The center point of each pedal is corrected by using a rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device, and a corrected center point is obtained. According to the corrected center point, the depth and height of the step are obtained;
[0109] Generates a stair model based on the center points of all treads and the depth and height of the steps.
[0110] Optionally, training the stair recognition model includes:
[0111] Based on the classification results of the point cloud in the training data set by the stair recognition model, a cross entropy loss for characterizing the point cloud classification loss is calculated;
[0112] Calculating the distance between the true normal vector of each pedal and the normal vector predicted by the stair recognition model to obtain a curvature suppression loss for characterizing the geometric constraint loss;
[0113] A total loss value is calculated according to the cross entropy loss and the curvature suppression loss, and the stair recognition model is iteratively trained according to the total loss value.
[0114] Optionally, before inputting the training data set into the stair recognition model, point cloud data enhancement is performed on the training data set to simulate a scenario where point cloud data is missing due to light reflection.
[0115] Optionally, obtaining the depth and height of the step according to the corrected center point includes:
[0116] Based on the corrected center point, obtaining the center points of two adjacent pedals;
[0117] Calculate the depth and height of the step based on the center points of two adjacent treads.
[0118] Optionally, obtaining the center point of the target pedal based on the pedal point cloud includes:
[0119] Performing plane fitting on the pedal point cloud to obtain a fitting surface;
[0120] The coordinates and the normal vector of the center point of the target pedal are determined according to the fitting surface.
[0121] Optionally, the method of correcting the center point of each pedal by using a rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device to obtain the corrected center point includes:
[0122] Align the center point of each pedal with the target axis in the coordinate system of the point cloud acquisition device to obtain the rotation matrix of each pedal;
[0123] The center point of each pedal is corrected according to the rotation matrix to obtain the corrected center point.
[0124] Optionally, aligning the center point of each pedal with the target axis in the coordinate system of the point cloud acquisition device to obtain the rotation matrix of each pedal includes:
[0125] When there is a riser point cloud in the point cloud data of the stairs, align the normal vector of the riser point cloud with the negative direction of the Y axis in the coordinate system to obtain a first conversion coefficient, align the normal vector of the center point of each pedal with the negative direction of the Z axis in the coordinate system to obtain a second conversion coefficient, and the product of the first conversion coefficient and the second conversion coefficient is a rotation matrix for each pedal;
[0126] Otherwise, perform principal component analysis on the pedal point cloud of each pedal, align the second principal axis in the analysis result with the negative direction of the Z axis in the coordinate system to obtain the third conversion coefficient, align the third principal axis in the analysis result with the negative direction of the Y axis in the coordinate system to obtain the fourth conversion coefficient, and the product of the third conversion coefficient and the fourth conversion coefficient is the rotation matrix of each pedal.
[0127] An embodiment of the present invention also provides a computer-readable storage medium, on which a stair modeling program based on point cloud data is stored. When the stair modeling program based on point cloud data is executed by a processor, the steps of any one of the stair modeling methods based on point cloud data provided in an embodiment of the present invention are implemented.
[0128] It should be understood that the serial numbers of the steps in the above embodiments do not imply a sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0129] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0130] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0131] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0132] In the embodiments provided by the present invention, it should be understood that the disclosed apparatus / terminal equipment and method can be implemented in other ways. For example, the apparatus / terminal equipment embodiments described above are only illustrative, for example, the division of the above modules or units is only a logical function division, and in actual implementation, other division methods can be used, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0133] If the above-mentioned integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form. The above-mentioned computer-readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0134] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features therein may be replaced by equivalents. However, these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A stair modeling method based on point cloud data, characterized in that: The method comprises: Inputting the point cloud data of the stairs into the stair recognition model to obtain a plurality of pedal point clouds, wherein the stair recognition model is trained using point cloud classification loss and geometric constraint loss, and each pedal point cloud is a set of point clouds corresponding to one pedal; Based on the pedal point cloud, obtaining the center point of each pedal; The center point of each pedal is corrected by using a rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device, and a corrected center point is obtained. According to the corrected center point, the depth and height of the step are obtained; Generate a stair model based on the center points of all treads and the depth and height of the steps; Training the stair recognition model includes: Based on the classification results of the point cloud in the training data set by the stair recognition model, a cross entropy loss for characterizing the point cloud classification loss is calculated; Calculating the distance between the true normal vector of each pedal and the normal vector predicted by the stair recognition model to obtain a curvature suppression loss for characterizing the geometric constraint loss; A total loss value is calculated according to the cross entropy loss and the curvature suppression loss, and the stair recognition model is iteratively trained according to the total loss value.
2. The stair modeling method based on point cloud data according to claim 1, characterized in that: Before inputting the training data set into the stair recognition model, point cloud data enhancement is performed on the training data set to simulate a scenario where point cloud data is missing due to light reflection.
3. The stair modeling method based on point cloud data according to claim 1, characterized in that: The step of obtaining the depth and height of the step according to the corrected center point comprises: Based on the corrected center point, obtaining the center points of two adjacent pedals; Calculate the depth and height of the step based on the center points of two adjacent treads.
4. The stair modeling method based on point cloud data according to claim 1, characterized in that: Based on the pedal point cloud, the center point of the target pedal is obtained, including: Performing plane fitting on the pedal point cloud to obtain a fitting surface; The coordinates and the normal vector of the center point of the target pedal are determined according to the fitting surface.
5. The stair modeling method based on point cloud data according to claim 1, characterized in that: The method of correcting the center point of each pedal by using rotation transformation to eliminate the deviation between the center point of the pedal and the coordinate system of the point cloud acquisition device to obtain the corrected center point includes: Align the center point of each pedal with the target axis in the coordinate system of the point cloud acquisition device to obtain the rotation matrix of each pedal; The center point of each pedal is corrected according to the rotation matrix to obtain the corrected center point.
6. The stair modeling method based on point cloud data according to claim 5, characterized in that: The step of aligning the center point of each pedal with the target axis in the coordinate system of the point cloud acquisition device to obtain the rotation matrix of each pedal includes: When there is a riser point cloud in the point cloud data of the stairs, align the normal vector of the riser point cloud with the negative direction of the Y axis in the coordinate system to obtain a first conversion coefficient, align the normal vector of the center point of each pedal with the negative direction of the Z axis in the coordinate system to obtain a second conversion coefficient, and the product of the first conversion coefficient and the second conversion coefficient is a rotation matrix for each pedal; Otherwise, perform principal component analysis on the pedal point cloud of each pedal, align the second principal axis in the analysis result with the negative direction of the Z axis in the coordinate system to obtain the third conversion coefficient, align the third principal axis in the analysis result with the negative direction of the Y axis in the coordinate system to obtain the fourth conversion coefficient, and the product of the third conversion coefficient and the fourth conversion coefficient is the rotation matrix of each pedal.
7. A stair modeling device based on point cloud data, characterized in that: include: A detection and recognition module, used to input the point cloud data of the stairs into a stair recognition model to obtain a plurality of pedal point clouds, wherein the stair recognition model is trained using point cloud classification loss and geometric constraint loss, and each pedal point cloud is a set of point clouds corresponding to one pedal; A center point module, used for obtaining the center point of each pedal based on the pedal point cloud; A step module, used to correct the center point of each step by using rotation transformation to eliminate the deviation between the center point of the step and the coordinate system of the point cloud acquisition device, obtain the corrected center point, and obtain the depth and height of the step according to the corrected center point; A stair model generation module is used to generate a stair model according to the center points of all treads and the depth and height of the steps; Training the stair recognition model includes: Based on the classification results of the point cloud in the training data set by the stair recognition model, a cross entropy loss for characterizing the point cloud classification loss is calculated; Calculating the distance between the true normal vector of each pedal and the normal vector predicted by the stair recognition model to obtain a curvature suppression loss for characterizing the geometric constraint loss; A total loss value is calculated according to the cross entropy loss and the curvature suppression loss, and the stair recognition model is iteratively trained according to the total loss value.
8. A legged robot, characterized in that: The legged robot includes a memory, a processor, and a stair modeling program based on point cloud data stored in the memory and executable on the processor. When the stair modeling program based on point cloud data is executed by the processor, the steps of the stair modeling method based on point cloud data as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a stair modeling program based on point cloud data, and when the stair modeling program based on point cloud data is executed by a processor, the steps of the stair modeling method based on point cloud data as described in any one of claims 1 to 6 are implemented.
