-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve shape estimator performance for vehicles #1019
Comments
@VRichardJP Thank you for the good proposal! |
@yukkysaito I am sorry, I cannot easily share such data. |
@VRichardJP This looks like a good improvement. Would you be able to create a PR for the proposal (maybe after @yukkysaito confirmed the feature)? |
No problem, I will wait for @yukkysaito to confirm the change does not impact detection quality |
@angry-crab has volunteered to do the further investigation. |
After a brief investigation about Brent's method and other numerical optimization algorithms, one concern is that Brent's method is not guaranteed to converge, which means there might be some potential issues undetected. I think we could add a parameter to |
I think being able to chose between multiple implementation would be great. According to boost documentation and wikipedia, Brent's method should at least converge to a local minima. It would be interesting to plot |
OpenCV has this: https://theailearner.com/2020/11/03/opencv-minimum-area-rectangle/ (Just for minimum area rectangle criteria) |
Due to the issue of broken docker image, testing of this issue will be postponed. CUDA |
I feel a bit stupid, but I just realized the performance reported in #1019 (comment) has been retrieved from a debug build... Using optimizations from release and the same test environment than before, I get around ~4 ms for the current implementation (or ~1 ms per box), and ~1 ms with the brent's method (with That said, their is no real performance issue in the first place. Even in a crowded parking area it would still be negligible. I would understand if you don't want to introduce some convoluted algorithm just for a few ms... |
@VRichardJP Thank you very much for your efforts. I think 4 times faster is a great improvement. |
I think we can still include this improvement in Autoware.Universe to give more options to the users. |
I've created a draft PR regarding this issue. Please feel free to make any comment. |
…ndation#1019) Signed-off-by: tomoya.kimura <tomoya.kimura@tier4.jp>
Checklist
Description
As I have reported in some other discussion, I face important performance issue with my setup. I have identified a couple nodes that are unexpectedly slow on my machine. The
shape_estimator
is one of them.I use the following test environment: my vehicle is parked and surrounded by a 3~4 other vehicles.
With this environment, the
ShapeEstimationNode::callback()
takes around 120ms to process eachapollo/labeled_clusters
message:For just a couple vehicles, it seems way to slow.
The
shape_estimator
node implements the algorithm from paper "Efficient L-Shape Fitting for Vehicle Detection Using Laser Scanners". Interestingly, the "Algorithm 2" that is reproduced from the original paper is actually a very naive and inefficient minima finder:autoware.universe/perception/shape_estimation/lib/model/bounding_box.cpp
Lines 84 to 109 in a128844
In order to find the maximum of the
calcClosenessCriterion
function, the algorithm actually tries all the possible values betweenmin_angle
andmax_angle
(with fixed stepangle_precision
). With the current implementation, the function is evaluated 90 times (from 0 to 90 degrees with 1 degree step). A way better approach would be to use an actual minima finder algorithm instead, especially if we consider how continuous the closeness function looks like (in red below):Note: this would make autowarefoundation/autoware#384 obsolete
Purpose
Improve
shape_estimator
performance for vehicle obstaclesPossible approaches
As explained, a first step would be to use a minima finder function.
For example, I tested
brent_find_minima
from boost library. There are maybe better options, I am no expert, I just picked what looked the simplest to use with no extra dependencies.I modified the Algo.2 section like so:
With
bits = 6
, processing time went down to ~40ms:And with
bits = 4
, processing time went down to ~30ms:Even with
bits = 4
, I think the precision should be better than the current one (angle_resolution
is 0.01745 rad), yet it is 4 times faster on my machine.From the Rviz view, bounding boxes don't look any worse than with the default algorithm.
Definition of done
shape_estimator
can perform in "real-time" in an environment with several vehicle obstacles around the ego vehicle.The text was updated successfully, but these errors were encountered: