-
Notifications
You must be signed in to change notification settings - Fork 696
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
fix(multi_object_tracker): make sure smallest unknown footprint is 0.3 #6618
fix(multi_object_tracker): make sure smallest unknown footprint is 0.3 #6618
Conversation
@@ -386,6 +386,15 @@ void MultiObjectTracker::sanitizeTracker( | |||
continue; | |||
} | |||
|
|||
if ( | |||
object1.shape.type == autoware_auto_perception_msgs::msg::Shape::POLYGON && | |||
tier4_autoware_utils::getArea(object1.shape) == 0 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not very desirable to make equal comparisons between floating-point types and direct numbers. 🙏
In this case, it is 0, so it is OK, but it may cause unintended bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yukkysaito can we use the following directly directly:
Lines 106 to 122 in 52b2fd6
/** | |
* @brief | |
* https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ | |
* @pre rel_eps >= 0 | |
* @return True iff 'a' and 'b' are within relative 'rel_eps' of each other. | |
*/ | |
template <typename T> | |
bool rel_eq(const T & a, const T & b, const T & rel_eps) | |
{ | |
static_assert( | |
std::is_floating_point<T>::value, "Float comparisons only support floating point types."); | |
const auto delta = std::abs(a - b); | |
const auto larger = std::max(std::abs(a), std::abs(b)); | |
const auto max_rel_delta = (larger * rel_eps); | |
return delta <= max_rel_delta; | |
} |
Or do we have these float comparisons somewhere else?
Thanks for your PR 👍 |
35ea36d
to
831d01a
Compare
831d01a
to
156b114
Compare
/ask rate this PR quality, from 1 to 10. explain why |
Question: rate this pr quality, from 1 to 10. explain why Answer: The author has provided a clear and concise description of the problem and the solution. The PR addresses a specific issue (#6617) and the author has tested the changes in a logging simulator. The code changes are straightforward and easy to understand. The author has added checks to ensure that when an unknown object polygon has only one point which is 0,0,0, it doesn't cause the node to die. Instead, it sets the x, y, and z values of the point to 0.3. However, there are a few areas where the PR could be improved:
Overall, the PR is of good quality but there's room for improvement. ✨ Ask tool usage guide:Overview:
Note that the tool does not have "memory" of previous questions, and answers each question independently.
See the ask usage page for a comprehensive guide on using this tool. |
/review |
PR Review
Code feedback:
✨ Review tool usage guide:Overview:
With a configuration file, use the following template:
See the review usage page for a comprehensive guide on using this tool. |
/improve --extended |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
With a configuration file, use the following template:
See the improve usage page for a more comprehensive guide on using this tool. |
/ask At line 391 of multi_object_tracker_core.cpp, I'm comparing a float against an integer |
Question: at line 391 of multi_object_tracker_core.cpp, i'm comparing a float against an integer Answer: Instead of const float epsilon = 1e-9; // or any other small value that suits your precision needs
if (std::abs(tier4_autoware_utils::getArea(object1.shape)) < epsilon) {
// ...
} This way, you're checking if the area is "close enough" to zero, taking into account the precision of floating point numbers. ✨ Ask tool usage guide:Overview:
Note that the tool does not have "memory" of previous questions, and answers each question independently.
See the ask usage page for a comprehensive guide on using this tool. |
@@ -207,6 +207,13 @@ Eigen::MatrixXd DataAssociation::calcScoreMatrix( | |||
if (passed_gate) { | |||
const double min_iou = min_iou_matrix_(tracker_label, measurement_label); | |||
const double min_union_iou_area = 1e-2; | |||
if ( | |||
measurement_object.shape.type == autoware_auto_perception_msgs::msg::Shape::POLYGON && | |||
area == 0 && measurement_object.shape.footprint.points.size() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
area == 0 && measurement_object.shape.footprint.points.size() == 1) { | |
area == 0 && measurement_object.shape.footprint.points.size() == 1) { |
Same as here https://github.com/autowarefoundation/autoware.universe/pull/6618/files#r1525002210
if ( | ||
measurement_object.shape.type == autoware_auto_perception_msgs::msg::Shape::POLYGON && | ||
area == 0 && measurement_object.shape.footprint.points.size() == 1) { | ||
measurement_object.shape.footprint.points.front().x = 0.3; | ||
measurement_object.shape.footprint.points.front().y = 0.3; | ||
measurement_object.shape.footprint.points.front().z = 0.3; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To set it to 0.3 would embed an unintended bug.In fact.
It sometimes results in strange behavior when there are actually objects with smaller values.
I think a better way to handle this issue is to have the getIntersectionArea function return 0 if the polygon does not have 3 or more points in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this issue should be solved with fixing IoU caluculate function, so I do not want to apply this PR.
See #6617 (comment) .
694ea7e
to
959bfe6
Compare
Hello everyone, thank you for the feedback. I have pushed a commit for The other approach was checking points size in What do you think about applying the patch to |
959bfe6
to
7bbe740
Compare
@mebasoglu As you say, changing const double intersection_area = getIntersectionArea(source_polygon, target_polygon);
if (intersection_area == 0.0) return 0.0; // you can escape here But it seems const double intersection_area = getIntersectionArea(source_polygon, target_polygon); // no escape
const double union_area = getUnionArea(source_polygon, target_polygon); // this part may cause error
const double convex_shape_area = getConvexShapeArea(source_polygon, target_polygon); // this will cause error It would be helpful if you could change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your bug report and your effort for the solution.
I agree to add checkers insures that the two inputs are valid.
The boost documentation of intersection mentioned as following.
"Check the Polygon Concept for the rules that polygon input for this algorithm should fulfill"
Having at least 3 footprint points is a necessary condition, not the sufficient condition. to have an area, the sufficient condition is to have the rank of 2.
I would like to suggest to add checkers of the validity of the polygon, as following.
static const double MIN_AREA = 1e-9;
if (boost::geometry::area(source_polygon) < MIN_AREA) return 0.0;
if (boost::geometry::area(target_polygon) < MIN_AREA) return 0.0;
In the official documentation of the area function,
"
Behavior
pointlike (e.g. point) Returns 0
linear (e.g. linestring) Returns 0
areal (e.g. polygon) Returns the area
"
Additionally, the checker makes to avoid division by a small number.
The checkers may implied in the necessary functions, such as get2dIoU
, get2dGeneralizedIoU
, get2dPrecision
, and get2dRecall
.
My suggestion is as following. I did not test with the issue data.
https://github.com/technolojin/autoware.universe/blob/f22408ad23c79d92bc7dba3cd48e407358ff2f8e/common/object_recognition_utils/include/object_recognition_utils/matching.hpp
Signed-off-by: Mehmet Emin BAŞOĞLU <mehmeteminbasoglu@hotmail.com>
7bbe740
to
ac5c65a
Compare
Signed-off-by: Mehmet Emin BAŞOĞLU <mehmeteminbasoglu@hotmail.com>
Hello @YoshiRi @technolojin , thank you very much for the feedback. I have created a new function The Tested on logging simulator. |
@mebasoglu Thank you for your update.
I would like to request an efficient solution. Even it becomes a bit complicate, I think it worth. |
Closing due to #6701 was merged. |
Description
Related issue:
When unknown object polygon has only one point which is 0,0,0 , the node dies.
Related links
Fixes: #6617
Tests performed
Confirmed on logging simulator.
Notes for reviewers
There are two places where this error occurs, on
data_association.cpp
andmulti_object_tracker_core.cpp
. The fix was added those.Interface changes
Effects on system behavior
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.