-
Notifications
You must be signed in to change notification settings - Fork 650
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
refactor(perception_utils): add test in object_classification #2083
refactor(perception_utils): add test in object_classification #2083
Conversation
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
common/perception_utils/test/src/test_object_classification.cpp
Outdated
Show resolved
Hide resolved
@YoshiRi Thanks for your PR. |
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
6806a6b
to
8e74090
Compare
classification.push_back(createObjectClassification(ObjectClassification::MOTORCYCLE, 0.8)); | ||
classification.push_back(createObjectClassification(ObjectClassification::BICYCLE, 0.8)); |
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.
How about adding a test to see what will happen if the object classification includes car-like vehicle and not car-like vehicle with the same probability.
This will be the edge case for isCarLikeVehicle function.
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.
That makes sense. I'll do 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.
This edge case depends following function getHighestProbLabel
, which extract highest-scored label from classification.
- This function do not considering multiple highest probability
- It returns an earlier label with maximum probability. (It depends labels order!)
- For example, if an objects has CAR and MOTORCYCLE label with the same probability,
isCarLikeVehicle
returntrue
when CAR label is added first- else it returns
false
inline std::uint8_t getHighestProbLabel(
const std::vector<ObjectClassification> & object_classifications)
{
std::uint8_t label = ObjectClassification::UNKNOWN;
float highest_prob = 0.0;
// TODO(Satoshi Tanaka): It might be simple if you use STL or range-v3.
for (const auto & object_classification : object_classifications) {
if (highest_prob < object_classification.probability) {
highest_prob = object_classification.probability;
label = object_classification.label;
}
}
return label;
}
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.
Got it. Even if the current implementation is not good, in order to show how it works with the edge case in the current implementation, adding this edge-case test seems useful.
What do you think?
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.
Frankly, I think it is a rare situation that the label probabilities become the same since it is float value.
But adding edge case seems to be not harmful and it is easy to implement, I added some edge cases to this PR.
Thanks for your help.
@@ -61,3 +61,114 @@ TEST(object_classification, test_getHighestProbLabel) | |||
EXPECT_EQ(label, ObjectClassification::CAR); |
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.
It seems to be due to unnecessary line break in the code.
I fixed it in local and push later.
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 meant there is an auto-fix command in both github browser and local command.
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.
Sorry, I forgot pre-commit run -a
command before git push.
(But I still had to fix some error manually)
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.
Got it.
pre-commit install
which enables running pre-commit every time we run git commit is also useful.
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
aa8d873
to
7bdb3a3
Compare
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
e372c33
to
c1182c2
Compare
Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp>
Codecov ReportBase: 10.75% // Head: 10.37% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2083 +/- ##
==========================================
- Coverage 10.75% 10.37% -0.39%
==========================================
Files 1184 1171 -13
Lines 84694 84223 -471
Branches 19833 19652 -181
==========================================
- Hits 9110 8738 -372
+ Misses 65958 65916 -42
+ Partials 9626 9569 -57
*This pull request uses carry forward flags. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@YoshiRi Could you resolve the conflict. Then this PR is ready to merge, right? |
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.
LGTM
@YoshiRi Have you forgotten to merge? |
…refoundation#2083) * add test for isVehicle Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * add isCarLikeVehicle test Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * add isLargeVehicle test Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * fix namespace range Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * ci(pre-commit): autofix * remove unnecessary forloop Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * fix cpplint message Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * added edge case to iscarlikevehicle Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * run precommit Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * add possibe edge cases with comment Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
…refoundation#2083) * add test for isVehicle Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * add isCarLikeVehicle test Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * add isLargeVehicle test Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * fix namespace range Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * ci(pre-commit): autofix * remove unnecessary forloop Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * fix cpplint message Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * added edge case to iscarlikevehicle Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * run precommit Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> * add possibe edge cases with comment Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> Signed-off-by: Yoshi Ri <yoshi.ri@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>
Description
add test function for
object_classification.hpp
incommon/perception_util
.Here is test coverage.
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.