Disclosure of Invention
The invention provides a roadway obstacle detection method based on three-dimensional point cloud, which aims to solve the technical problem that the unmanned scene is easy to misjudge or miss in a complex environment, and comprises the steps of acquiring a three-dimensional point cloud image, acquiring a plurality of point cloud sets in the three-dimensional point cloud image, processing any point cloud set by using a constructed obstacle detection model, identifying category information of an obstacle to which the point cloud set belongs, and removing the point cloud of the pseudo obstacle from the three-dimensional point cloud image when the point cloud set belongs to the pseudo obstacle;
The obstacle detection model comprises a motion characteristic classification layer and is used for acquiring the types of obstacles in point cloud collection points and outputting the speeds and the motion directions of the point cloud collection points, wherein the method comprises the steps of acquiring the point cloud collection points, calculating the speeds of the point cloud collection points, judging that the point cloud collection points belong to fast motion obstacles when the speeds of the point cloud collection points are above a speed threshold, otherwise, judging that the point cloud collection points are suspected obstacles, calculating the motion directions of the point points of the suspected obstacles, and judging that the point cloud collection points belong to pseudo obstacles when the motion directions of the point cloud collection points of the suspected obstacles are inconsistent with the motion directions of other points in the suspected obstacles.
In the motion characteristic classification layer, the types of the obstacles are primarily identified through the speed threshold, and different types of obstacles such as vehicles running at high speed, pedestrians moving at low speed, wind, sand, rain, snow and the like are distinguished in a complex environment. Then, the difference of the obstacles such as sand, rain, snow, pedestrians and the like is captured by analyzing the movement direction, the false obstacle is identified, the false obstacle is effectively prevented from being misjudged as a real obstacle, and the false detection rate is reduced. Finally, the false obstacle is eliminated from the image, so that the final detection result is more reliable.
The method comprises the steps of obtaining position information of the current moment of the point cloud collection points, predicting position information of the next moment of the point cloud collection points through Kalman filtering, and calculating the speed of the point cloud collection points based on the position information of the current moment and the position information of the next moment.
The Kalman filtering algorithm can effectively integrate historical data with current observation, has good robustness to noise, and can accurately predict the position, speed and the like of a point in a complex environment, such as when the light in a roadway is poor and electromagnetic interference exists to cause noise of measured data, so that a reliable basis is provided for subsequent detection.
As a still further improvement of the method, the method for calculating the movement direction of the suspected obstacle midpoint comprises the steps of obtaining a speed vector based on the position information of the suspected obstacle midpoint, calculating the movement direction vector of the point according to the speed vector, and calculating the azimuth angle and the pitch angle of the suspected obstacle midpoint based on the movement direction vector.
The motion direction of the midpoint of the suspected obstacle can be described in an omnibearing and high-precision manner by acquiring a speed vector from the position information, deriving a motion direction vector based on the speed vector and finally calculating an azimuth angle and a pitch angle. In a complex roadway or unmanned scene, the movement direction characteristics of the real obstacle and the false obstacle are slightly different, and the refined calculation mode can effectively capture the differences, so that a key basis is provided for the subsequent false obstacle identification.
As a further improvement of the method of the invention, the obstacle detection model also comprises a loss calculation, wherein the loss calculation comprises the steps of respectively calculating the classification loss of the obstacleLoss of positioning of obstacleMotion vector loss of obstacleCalculating the total loss of the obstacle, wherein,AndIs a preset weighting coefficient.
By calculating the classification loss, the positioning loss and the motion vector loss, the classification accuracy is improved, the positioning accuracy is enhanced, and the motion vector estimation is optimized. The total loss function can flexibly adjust the proportion of classification loss, positioning loss and motion vector loss in the total loss through presetting a weighting coefficient, so that the adaptability and performance of the model under various complex scenes are improved.
As a further improvement of the method, the obstacle detection model further comprises an input layer, wherein the input layer comprises the steps of obtaining coordinate data of any point in the point cloud set, constructing a coordinate data matrix of the point cloud set according to the coordinate data, and constructing a point cloud data set of all points in the point cloud set according to the coordinate data matrix.
The obstacle detection model further comprises a feature extraction layer, wherein the feature extraction layer comprises a motion feature of a point cloud set output by a motion feature classification layer, the motion feature comprises a speed and a motion direction, and the motion feature is subjected to three-layer convolution to obtain a feature map of the three-layer convolution.
The obstacle detection model further comprises a dense classification layer, the dense classification layer comprises a feature map output by the feature extraction layer, the probability of an obstacle category which the feature map belongs to is calculated through an activation function, the obstacle category comprises a fast moving obstacle, a slow moving obstacle and a pseudo obstacle, the nonlinear relation between the motion feature and the obstacle category is extracted through a multi-layer perceptron MLP, the motion state probability of a suspected obstacle midpoint is calculated, and the motion state probability and the probability of the obstacle category are subjected to weighted fusion to obtain the category information of the obstacle of the suspected obstacle midpoint.
The dense classification layer can quickly convert the data in the feature map into the probability distribution of each obstacle category. Meanwhile, the multi-layer perceptron MLP deeply digs a nonlinear relation between the motion characteristics and the obstacle categories, and calculates the motion state probability of the points of the suspected obstacle. The two are cooperated to carry out deep analysis on the feature map from a plurality of angles, hidden information in the data is fully utilized, the expression capability of the obstacle features is enhanced, the fine differences of different types of obstacles can be captured more accurately, and a foundation is laid for accurate classification.
As a further improvement of the method, the three-dimensional point cloud image acquisition method comprises the steps of acquiring the three-dimensional point cloud image and denoising the three-dimensional point cloud image.
As a further improvement of the method, the method for acquiring the plurality of point cloud sets in the three-dimensional point cloud image comprises the step of adopting mean shift clustering to the point cloud in the three-dimensional point cloud image to acquire the plurality of point cloud sets in the three-dimensional point cloud image.
As a further improvement of the method of the present invention, when the movement direction of the point of the suspected obstacle is inconsistent with the movement direction of other points in the suspected obstacle, the difference between the angles of the point and any other point is greater than a preset difference threshold.
The method has the advantages that the motion characteristic classification layer initially distinguishes different types of obstacles according to the speed threshold, reduces the subsequent analysis range, improves the detection efficiency, then analyzes the motion direction to identify the false obstacle, reduces the false detection rate, and eliminates the false obstacle to ensure that the detection result is more reliable. The Kalman filtering algorithm fuses the history and the current data, accurately predicts the position and the speed of the point in a complex environment, and provides a basis for detection. By calculating classification, positioning and motion vector loss, classification accuracy, positioning accuracy and motion vector estimation are improved. The total loss function can flexibly adjust the proportion of each loss through a preset weighting coefficient, and the adaptability and performance of the complex scene of the model are enhanced.
Detailed Description
The embodiment provides a roadway obstacle detection method based on three-dimensional point cloud, as shown in fig. 1, the method comprises the steps of S100-S300:
And step S100, acquiring a three-dimensional point cloud image, and acquiring a plurality of point cloud sets in the three-dimensional point cloud image.
For deployment, three-dimensional point cloud images may be acquired by a three-dimensional laser scanner or depth camera.
After the three-dimensional point cloud image is obtained, the point cloud is required to be clustered, and a plurality of clusters can be obtained after the clustering, wherein each cluster is a point cloud set, the points have certain similarity in space positions, and each cluster can be regarded as a point cloud representation of an obstacle or an area with similar characteristics. For example, in an autopilot scenario, one cluster may represent a vehicle, another cluster may represent a pedestrian, and some clusters represent sand, rain, snow.
The clustering of the point cloud may be achieved by a clustering algorithm, such as a mean shift clustering algorithm, a K-means clustering algorithm, a gaussian mixture model clustering algorithm, and the like.
In addition, the three-dimensional point cloud image is required to be subjected to denoising processing, and Gaussian filtering can be adopted to remove noise points in the point cloud and enhance data.
And step 200, processing the point cloud set by using the constructed obstacle detection model, and identifying category information of the obstacle to which the point cloud set belongs.
In the development, as shown in fig. 2, the obstacle detection model refers to a model for detecting a fast obstacle and a pseudo obstacle in the present invention. The model is constructed based on the existing PointNet, and comprises four layers in total, namely an input layer, a motion feature classification layer, a feature extraction layer and a dense classification layer. The model mainly comprises a motion characteristic classification layer which is used for identifying category information of the obstacle. How these four layers are built up is described one by one.
Step S210, an input layer is constructed.
The input layer is used as an inlet of the model and is used for receiving three-dimensional point cloud collection data and converting the data so as to facilitate the subsequent motion characteristic layer to process. The method comprises the steps of receiving point cloud sets and obtaining coordinate data of any point in the point cloud sets, constructing a coordinate data matrix of the point cloud sets according to the coordinate data, and constructing point cloud data sets of all points in the point cloud sets according to the coordinate data matrix.
Specifically, in general, each point in the three-dimensional point cloud set has coordinates, and since the obstacle is moving, the coordinates of each point at different times are different, so each point in the point cloud set forms a point cloud coordinate matrix at each time:
;
Wherein, the Represent the firstAt a point ofA point cloud coordinate data matrix of time,Is the firstAnd at the firstCoordinates corresponding to the time.
After obtaining point cloud coordinate matrixes of all points in the point cloud set at different moments, constructing the point cloud coordinate matrixes of all points at the same moment into a point cloud data set:
;
Wherein, the A set of point cloud data is represented,Represent the firstAt a point ofA point cloud coordinate data matrix of time.
For example, a point cloud set contains two points, the coordinates of which are respectively,The point cloud coordinate matrixes corresponding to the kth moment are respectively as follows:
;
;
The corresponding point cloud data set is:
。
and after the input layer completes the construction of the point cloud data, outputting the point cloud data to the motion characteristic classification layer.
And S220, constructing a motion feature classification layer.
In a development, the motion feature classification layer is used for acquiring the categories of the obstacles in the point cloud set, and comprises the steps of classifying the point cloud set as a fast motion obstacle or a slow motion obstacle or a pseudo obstacle according to motion detection, and outputting the motion features such as speed and motion direction of the point cloud set to the dense classification layer.
As shown in fig. 3, the motion detection classification includes steps S221 to S224:
step S221, acquiring a point cloud set, and calculating the speed of points in the point cloud set.
In a development, the motion feature classification layer first receives a point cloud data set output by the input layer. The method comprises the steps of predicting the position at the next moment, namely coordinate information, through a Kalman filter, then calculating the speed of points in the point cloud collection, judging that the point cloud collection belongs to a fast moving obstacle when the speed of the points in the point cloud collection is above a speed threshold, otherwise, calculating the movement direction of the points in the suspected obstacle, and judging that the point cloud collection belongs to a pseudo obstacle when the movement direction of the points in the suspected obstacle is inconsistent with the movement direction of other points in the suspected obstacle.
It should be noted that, in the point cloud data set output by the input layer, each point has only coordinate information and no speed information, so that it is necessary to reconstruct the point cloud coordinate matrix of each point, and add the speed coordinates, and the speed value can be initialized to 0 when only one moment is needed. The reconstructed point cloud speed coordinate matrix is as follows:
;
Wherein, the Represent the firstAt a point ofA point cloud coordinate data matrix of time,Is the firstAnd at the firstThe coordinates corresponding to the time of day,Represent the firstThe point is atSpeed in the time coordinate direction.
After the point cloud speed coordinate matrix of each point is constructed, the movement speed of the points in the point cloud set is calculated.
Specifically, the first point of the point cloud set is obtainedPredicting the point in the point cloud set by Kalman filteringTime-based location informationTime position information and the firstThe position information of the moment calculates the velocity and velocity vector of the movement of the points in the point cloud.
Step S222, judging that the point cloud set belongs to a fast moving obstacle or a suspected obstacle.
Specifically, when the speed of the points in the point cloud set is above a speed threshold value of 30km/h, judging that the point cloud set belongs to a fast movement obstacle, and otherwise, judging that the point cloud set is a suspected obstacle.
The types of the obstacles can be quickly and efficiently distinguished by primarily identifying the types of the obstacles through the speed threshold. The speed threshold is set as an intelligent screener, and can rapidly distinguish fast moving objects from slow or static objects. The preliminary screening greatly reduces the range of subsequent further analysis, reduces unnecessary calculation amount and processing time, and improves the operation efficiency of the whole detection system.
For selection of the speed threshold, in an unmanned scenario, an obstacle may generally be considered a fast moving obstacle when its speed reaches 30km/h and above relative to an autonomous car. For example, on a highway, vehicles can be considered as fast moving obstacles if they approach from behind at a significantly higher speed than the vehicle, or if they suddenly cut into the front of the vehicle from a side lane at a high speed.
Step S223, calculating the movement direction of the midpoint of the suspected obstacle.
Specifically, if it is determined that the point cloud set belongs to a suspected obstacle, the next identification is required. This determination is identified by the direction of movement. The method comprises the steps of obtaining a speed vector based on position information of a suspected obstacle midpoint, calculating a motion direction vector of the point according to the speed vector, and calculating an azimuth angle and a pitch angle of the suspected obstacle midpoint based on the motion direction vector to serve as a motion direction of the suspected obstacle midpoint. The calculation of the direction of motion for the position information is prior art and will not be described here.
Step S224, judging that the suspected obstacle point cloud set belongs to a pseudo obstacle or a slow movement obstacle.
The specific judgment logic is that when the movement direction of the point is inconsistent with the movement directions of other points in the suspected obstacle, the point cloud set is judged to belong to the pseudo obstacle, otherwise, the slow movement obstacle is judged. And when the movement directions are inconsistent, the angle difference between the point and any other point is larger than a preset difference threshold.
After the suspected obstacle is initially screened, the false obstacle is further judged and identified according to the movement direction to be a key bright point of the method. In a practical environment, the pseudo-obstacle is often caused by various interference factors, such as rain and snow, sand lifting, and the like. The motion direction of the pseudo obstacles has obvious irregularity and randomness, and is quite different from the motion direction characteristics of the real obstacles. By analyzing the direction of motion, the system is able to accurately capture this discrepancy. For example, debris that occasionally flies through a roadway may have a direction of movement that is affected by a variety of factors such as airflow that is significantly inconsistent with the direction of movement of the surrounding real obstacles. At this time, the motion feature classification layer can accurately identify the motion feature classification layer as a false obstacle, and avoid misjudging the motion feature classification layer as a true obstacle, so that the false detection rate of detection is obviously reduced.
In addition, considering that the directions of the arms and legs are generally not uniform when the pedestrian moves, and thus, the movement directions of all the corresponding points cannot be completely uniform, erroneous judgment can be prevented by setting a threshold for judging whether the movement directions are uniform.
For example, setting the threshold value as 10, if 15 points in the point cloud set are inconsistent with the movement direction of the point, judging that the movement direction of the point is inconsistent with the movement directions of other points, and if the point cloud set to which the point belongs is a pseudo obstacle. If 5 points in the point cloud set are inconsistent with the movement direction of the point, judging that the movement direction of the point is consistent with the movement direction of other points, and if the point cloud set to which the point belongs is a slow movement obstacle.
Finally, in order for the feature extraction layer to process data, the input layer needs to output the speed and the movement direction of the point cloud set.
And step S230, constructing a feature extraction layer.
For development, the feature extraction layer needs to receive the motion features obtained by the motion feature classification layer, namely the speed and the motion direction, then three-layer convolution is carried out on the motion features, the three-layer convolution is identical to PointNet in specific operation, for example, the first-layer convolution is used for extracting the features output by the feature extraction layer to extract local features, the second-layer convolution is used for carrying out feature enhancement on the output of the first layer to extract mesoscale features, the third-layer convolution is used for carrying out global feature extraction on the output of the second layer to extract global features, and finally the feature map of the three-layer convolution is obtained.
In addition, since the PointNet model has a function of identifying the static obstacle, the static obstacle in the three-dimensional point cloud image can be acquired in the step.
And step S240, constructing a dense classification layer.
The method comprises the steps of receiving a feature map output by a feature extraction layer, calculating the probability of an obstacle category to which the feature map belongs through an activation function, wherein the obstacle category comprises a fast moving obstacle, a slow moving obstacle and a pseudo obstacle, extracting a nonlinear relation between a motion feature and the obstacle category by using a multi-layer perceptron MLP, calculating the motion state probability of a point, and carrying out weighted fusion on the motion state probability and the probability of the obstacle category to obtain the category information of the obstacle of the point.
In particular, a dense classification layer typically applies an activation function, such as a softmax function. The feature map output by the feature extraction layer is first converted into a probability distribution, in this invention the probability of the obstacle class, by a softmax function. I.e. the probability of categories such as fast moving obstacles, slow moving obstacles, static obstacles, pseudo-obstacles, etc.
The multi-layer perceptron MLP has strong nonlinear fitting capability, and can automatically learn the complex nonlinear relation through the combination of multi-layer neurons and the action of an activation function, so that the obstacles with different movement characteristics can be more accurately classified and understood. Then, extracting a nonlinear relation between the motion characteristics and the obstacle categories through a multi-layer perceptron MLP, and calculating the motion state probability of the points;
and finally, carrying out weighted fusion on the motion state probability and the probability of the obstacle category to obtain the category information of the obstacle of the point.
The category information of the obstacle refers to a composite score including the obstacle classification result and the movement state result.
For example, the obstacle classification result is one of a static obstacle, a fast moving obstacle, a slow moving obstacle and a pseudo obstacle, and the corresponding movement state result can be respectively that the speed is 0, the speed is more than 30km/h, the speed is 5m/s inconsistent with the movement direction, and the movement direction is consistent between 5 km/h and 30 km/h.
In conclusion, the method is a construction process of four layers of the obstacle detection model. Based on this, it is also necessary to perform loss judgment and optimization processing on the result after the model detection.
The loss function is used for measuring the difference between the model prediction result and the real result, so that the model optimization parameters are guided to realize obstacle classification and three-dimensional point cloud reconstruction. The loss function may be calculated using a mean square error loss, an average absolute error loss, and a cross entropy loss. The loss of the model comprises three parts of classification loss, positioning loss and motion loss.
The classification loss is the difference between the predicted probability of the model for the obstacle class and the true class. The positioning loss is the difference between the predicted positions of the model to the actual positions of the obstacles. The motion loss is a measure of the difference between the predicted probability of the obstacle's direction of motion and the true direction of motion.
Finally, calculating the total loss of the obstacle:
;
Wherein, the AndFor the preset weighting coefficient to be used,Represents the classification loss of the obstacle,Indicating the positioning loss of the obstacle,Motion vector loss of the obstacle;
With respect to AndIs critical for unmanned decision, such as distinguishing between different types of obstacles such as pedestrians, vehicles and traffic signs, so that the vehicles respond differently, then the size of the obstacle can be increased appropriatelyThe weight of the classification task is enhanced. If the accurate positioning of the obstacle is more critical during the driving of the vehicle, for example, the position of the obstacle needs to be accurately determined to avoid collision, thenMay need to be relatively large. For example, in urban roads, vehicles need to frequently avoid pedestrians and other vehicles, and the importance of positioning tasks is high at this time, and the method can be provided=0.4,=0.6. In some specific situations, such as parking lots, it may be more important to accurately identify parking space marks and obstacle types=0.6,=0.4。
In the PointNet model, optimization algorithms are also involved, and random gradient descent (SGD) and its variants, such as Adagrad, adadelta, RMSProp, adam, adamW, are typically used to update the parameters of the model. The algorithm can adaptively adjust the learning rate according to the gradient information of the loss function so as to accelerate the convergence rate of the model and avoid sinking into a local optimal solution. This part is prior art and is not described in detail here.
And step S300, removing the point cloud of the pseudo obstacle from the three-dimensional point cloud image when the point cloud set belongs to the pseudo obstacle.
As shown in fig. 4, through the operations of the above steps, the obstacle category information of the pseudo obstacle, the fast moving obstacle, the slow moving obstacle, the static obstacle, and the like in the three-dimensional point cloud image can be identified. As shown in fig. 4, static obstacles such as a building 31, pseudo obstacles such as a sand lifting 32, and a ground 33 are mainly given. The point cloud set belonging to the pseudo obstacle needs to be counted into the sand lifting 32 to be removed from the three-dimensional point cloud image, so that measures such as braking or automatic diversion and danger avoidance of the unmanned vehicle due to the fact that the obstacle is misidentified can be prevented. The three-dimensional point cloud image after sand lifting is removed, as shown in fig. 5, the ground 33 is not shown, and the ground 33 is generally removed after the three-dimensional image is acquired, so that the detection of subsequent obstacles is prevented from being influenced.
While various embodiments of the present invention have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Many modifications, changes, and substitutions will now occur to those skilled in the art without departing from the spirit and scope of the invention. It should be understood that various alternatives to the embodiments of the invention described herein may be employed in practicing the invention.