Skip to content

Commit ba4367d

Browse files
authored
Merge branch 'main' into chore/stop_ignore_perception_spell_check
2 parents 8005605 + e2aee50 commit ba4367d

File tree

41 files changed

+971
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+971
-289
lines changed

.github/CODEOWNERS

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ evaluator/kinematic_evaluator/** dominik.jargot@robotec.ai fumiya.watanabe@tier4
7777
evaluator/localization_evaluator/** dominik.jargot@robotec.ai koji.minoda@tier4.jp
7878
evaluator/perception_online_evaluator/** fumiya.watanabe@tier4.jp kosuke.takeuchi@tier4.jp kotaro.uetake@tier4.jp kyoichi.sugahara@tier4.jp shunsuke.miura@tier4.jp yoshi.ri@tier4.jp
7979
evaluator/planning_evaluator/** kyoichi.sugahara@tier4.jp maxime.clement@tier4.jp
80-
evaluator/tier4_metrics_rviz_plugin/** kyoichi.sugahara@tier4.jp maxime.clement@tier4.jp satoshi.ota@tier4.jp
80+
evaluator/tier4_metrics_rviz_plugin/** fumiya.watanabe@tier4.jp kosuke.takeuchi@tier4.jp kyoichi.sugahara@tier4.jp maxime.clement@tier4.jp satoshi.ota@tier4.jp
8181
launch/tier4_autoware_api_launch/** isamu.takagi@tier4.jp ryohsuke.mitsudome@tier4.jp
8282
launch/tier4_control_launch/** takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
8383
launch/tier4_localization_launch/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp koji.minoda@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
@@ -121,7 +121,7 @@ perception/detected_object_feature_remover/** tomoya.kimura@tier4.jp
121121
perception/detected_object_validation/** dai.nguyen@tier4.jp shintaro.tomie@tier4.jp shunsuke.miura@tier4.jp yukihiro.saito@tier4.jp
122122
perception/detection_by_tracker/** taekjin.lee@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
123123
perception/elevation_map_loader/** kosuke.takeuchi@tier4.jp shintaro.tomie@tier4.jp taichi.higashide@tier4.jp
124-
perception/euclidean_cluster/** yukihiro.saito@tier4.jp
124+
perception/euclidean_cluster/** dai.nguyen@tier4.jp yukihiro.saito@tier4.jp
125125
perception/ground_segmentation/** abrahammonrroy@yahoo.com dai.nguyen@tier4.jp shunsuke.miura@tier4.jp yukihiro.saito@tier4.jp
126126
perception/image_projection_based_fusion/** dai.nguyen@tier4.jp koji.minoda@tier4.jp kotaro.uetake@tier4.jp shunsuke.miura@tier4.jp tao.zhong@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
127127
perception/lidar_apollo_instance_segmentation/** yukihiro.saito@tier4.jp
@@ -212,7 +212,7 @@ sensing/image_diagnostics/** dai.nguyen@tier4.jp
212212
sensing/image_transport_decompressor/** yukihiro.saito@tier4.jp
213213
sensing/imu_corrector/** koji.minoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
214214
sensing/livox/livox_tag_filter/** ryohsuke.mitsudome@tier4.jp
215-
sensing/pointcloud_preprocessor/** abrahammonrroy@yahoo.com kyoichi.sugahara@tier4.jp shunsuke.miura@tier4.jp yukihiro.saito@tier4.jp
215+
sensing/pointcloud_preprocessor/** abrahammonrroy@yahoo.com dai.nguyen@tier4.jp kyoichi.sugahara@tier4.jp shunsuke.miura@tier4.jp yukihiro.saito@tier4.jp
216216
sensing/radar_scan_to_pointcloud2/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp taekjin.lee@tier4.jp yoshi.ri@tier4.jp
217217
sensing/radar_static_pointcloud_filter/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp taekjin.lee@tier4.jp yoshi.ri@tier4.jp
218218
sensing/radar_threshold_filter/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp taekjin.lee@tier4.jp yoshi.ri@tier4.jp

evaluator/perception_online_evaluator/include/perception_online_evaluator/metrics_calculator.hpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "perception_online_evaluator/metrics/metric.hpp"
2020
#include "perception_online_evaluator/parameters.hpp"
2121
#include "perception_online_evaluator/stat.hpp"
22+
#include "perception_online_evaluator/utils/objects_filtering.hpp"
2223

2324
#include <rclcpp/time.hpp>
2425

@@ -118,9 +119,9 @@ class MetricsCalculator
118119
void deleteOldObjects(const rclcpp::Time stamp);
119120

120121
// Calculate metrics
121-
MetricStatMap calcLateralDeviationMetrics(const PredictedObjects & objects) const;
122-
MetricStatMap calcYawDeviationMetrics(const PredictedObjects & objects) const;
123-
MetricStatMap calcPredictedPathDeviationMetrics(const PredictedObjects & objects) const;
122+
MetricStatMap calcLateralDeviationMetrics(const ClassObjectsMap & class_objects_map) const;
123+
MetricStatMap calcYawDeviationMetrics(const ClassObjectsMap & class_objects_map) const;
124+
MetricStatMap calcPredictedPathDeviationMetrics(const ClassObjectsMap & class_objects_map) const;
124125
Stat<double> calcPredictedPathDeviationMetrics(
125126
const PredictedObjects & objects, const double time_horizon) const;
126127

evaluator/perception_online_evaluator/include/perception_online_evaluator/utils/objects_filtering.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ using autoware_auto_perception_msgs::msg::ObjectClassification;
3737
using autoware_auto_perception_msgs::msg::PredictedObject;
3838
using autoware_auto_perception_msgs::msg::PredictedObjects;
3939

40+
using ClassObjectsMap = std::unordered_map<uint8_t, PredictedObjects>;
41+
4042
std::uint8_t getHighestProbLabel(const std::vector<ObjectClassification> & classification);
4143

4244
/**
@@ -105,6 +107,14 @@ void filterObjects(PredictedObjects & objects, Func filter)
105107
filterObjects(objects, removed_objects, filter);
106108
}
107109

110+
/**
111+
* @brief Separates the provided objects based on their classification.
112+
*
113+
* @param objects The predicted objects to be separated.
114+
* @return A map of objects separated by their classification.
115+
*/
116+
ClassObjectsMap separateObjectsByClass(const PredictedObjects & objects);
117+
108118
/**
109119
* @brief Filters the provided objects based on their classification.
110120
*

evaluator/perception_online_evaluator/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<depend>libgoogle-glog-dev</depend>
2525
<depend>motion_utils</depend>
2626
<depend>nav_msgs</depend>
27+
<depend>object_recognition_utils</depend>
2728
<depend>pluginlib</depend>
2829
<depend>rclcpp</depend>
2930
<depend>rclcpp_components</depend>

evaluator/perception_online_evaluator/src/metrics_calculator.cpp

+54-47
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
#include "perception_online_evaluator/metrics_calculator.hpp"
1616

1717
#include "motion_utils/trajectory/trajectory.hpp"
18-
#include "perception_online_evaluator/utils/objects_filtering.hpp"
18+
#include "object_recognition_utils/object_recognition_utils.hpp"
1919
#include "tier4_autoware_utils/geometry/geometry.hpp"
2020

2121
#include <tier4_autoware_utils/ros/uuid_helper.hpp>
2222

2323
namespace perception_diagnostics
2424
{
25+
using object_recognition_utils::convertLabelToString;
26+
2527
std::optional<MetricStatMap> MetricsCalculator::calculate(const Metric & metric) const
2628
{
2729
if (object_map_.empty()) {
@@ -35,14 +37,14 @@ std::optional<MetricStatMap> MetricsCalculator::calculate(const Metric & metric)
3537
return {};
3638
}
3739
const auto target_objects = getObjectsByStamp(target_stamp);
38-
40+
const ClassObjectsMap class_objects_map = separateObjectsByClass(target_objects);
3941
switch (metric) {
4042
case Metric::lateral_deviation:
41-
return calcLateralDeviationMetrics(target_objects);
43+
return calcLateralDeviationMetrics(class_objects_map);
4244
case Metric::yaw_deviation:
43-
return calcYawDeviationMetrics(target_objects);
45+
return calcYawDeviationMetrics(class_objects_map);
4446
case Metric::predicted_path_deviation:
45-
return calcPredictedPathDeviationMetrics(target_objects);
47+
return calcPredictedPathDeviationMetrics(class_objects_map);
4648
default:
4749
return {};
4850
}
@@ -155,65 +157,70 @@ PredictedObjects MetricsCalculator::getObjectsByStamp(const rclcpp::Time stamp)
155157
return objects;
156158
}
157159

158-
MetricStatMap MetricsCalculator::calcLateralDeviationMetrics(const PredictedObjects & objects) const
160+
MetricStatMap MetricsCalculator::calcLateralDeviationMetrics(
161+
const ClassObjectsMap & class_objects_map) const
159162
{
160-
Stat<double> stat{};
161-
const auto stamp = rclcpp::Time(objects.header.stamp);
162-
163-
for (const auto & object : objects.objects) {
164-
const auto uuid = tier4_autoware_utils::toHexString(object.object_id);
165-
if (!hasPassedTime(uuid, stamp)) {
166-
continue;
167-
}
168-
const auto object_pose = object.kinematics.initial_pose_with_covariance.pose;
169-
const auto history_path = history_path_map_.at(uuid).second;
170-
if (history_path.empty()) {
171-
continue;
163+
MetricStatMap metric_stat_map{};
164+
for (const auto & [label, objects] : class_objects_map) {
165+
Stat<double> stat{};
166+
const auto stamp = rclcpp::Time(objects.header.stamp);
167+
for (const auto & object : objects.objects) {
168+
const auto uuid = tier4_autoware_utils::toHexString(object.object_id);
169+
if (!hasPassedTime(uuid, stamp)) {
170+
continue;
171+
}
172+
const auto object_pose = object.kinematics.initial_pose_with_covariance.pose;
173+
const auto history_path = history_path_map_.at(uuid).second;
174+
if (history_path.empty()) {
175+
continue;
176+
}
177+
stat.add(metrics::calcLateralDeviation(history_path, object_pose));
172178
}
173-
stat.add(metrics::calcLateralDeviation(history_path, object_pose));
179+
metric_stat_map["lateral_deviation_" + convertLabelToString(label)] = stat;
174180
}
175-
176-
MetricStatMap metric_stat_map;
177-
metric_stat_map["lateral_deviation"] = stat;
178181
return metric_stat_map;
179182
}
180183

181-
MetricStatMap MetricsCalculator::calcYawDeviationMetrics(const PredictedObjects & objects) const
184+
MetricStatMap MetricsCalculator::calcYawDeviationMetrics(
185+
const ClassObjectsMap & class_objects_map) const
182186
{
183-
Stat<double> stat{};
184-
const auto stamp = rclcpp::Time(objects.header.stamp);
185-
for (const auto & object : objects.objects) {
186-
const auto uuid = tier4_autoware_utils::toHexString(object.object_id);
187-
if (!hasPassedTime(uuid, stamp)) {
188-
continue;
189-
}
190-
const auto object_pose = object.kinematics.initial_pose_with_covariance.pose;
191-
const auto history_path = history_path_map_.at(uuid).second;
192-
if (history_path.empty()) {
193-
continue;
187+
MetricStatMap metric_stat_map{};
188+
for (const auto & [label, objects] : class_objects_map) {
189+
Stat<double> stat{};
190+
const auto stamp = rclcpp::Time(objects.header.stamp);
191+
for (const auto & object : objects.objects) {
192+
const auto uuid = tier4_autoware_utils::toHexString(object.object_id);
193+
if (!hasPassedTime(uuid, stamp)) {
194+
continue;
195+
}
196+
const auto object_pose = object.kinematics.initial_pose_with_covariance.pose;
197+
const auto history_path = history_path_map_.at(uuid).second;
198+
if (history_path.empty()) {
199+
continue;
200+
}
201+
stat.add(metrics::calcYawDeviation(history_path, object_pose));
194202
}
195-
stat.add(metrics::calcYawDeviation(history_path, object_pose));
203+
metric_stat_map["yaw_deviation_" + convertLabelToString(label)] = stat;
196204
}
197-
198-
MetricStatMap metric_stat_map;
199-
metric_stat_map["yaw_deviation"] = stat;
200205
return metric_stat_map;
201206
}
202207

203208
MetricStatMap MetricsCalculator::calcPredictedPathDeviationMetrics(
204-
const PredictedObjects & objects) const
209+
const ClassObjectsMap & class_objects_map) const
205210
{
206211
const auto time_horizons = parameters_->prediction_time_horizons;
207212

208-
MetricStatMap metric_stat_map;
209-
for (const double time_horizon : time_horizons) {
210-
const auto stat = calcPredictedPathDeviationMetrics(objects, time_horizon);
211-
std::ostringstream stream;
212-
stream << std::fixed << std::setprecision(2) << time_horizon;
213-
std::string time_horizon_str = stream.str();
214-
metric_stat_map["predicted_path_deviation_" + time_horizon_str] = stat;
213+
MetricStatMap metric_stat_map{};
214+
for (const auto & [label, objects] : class_objects_map) {
215+
for (const double time_horizon : time_horizons) {
216+
const auto stat = calcPredictedPathDeviationMetrics(objects, time_horizon);
217+
std::ostringstream stream;
218+
stream << std::fixed << std::setprecision(2) << time_horizon;
219+
std::string time_horizon_str = stream.str();
220+
metric_stat_map
221+
["predicted_path_deviation_" + convertLabelToString(label) + "_" + time_horizon_str] = stat;
222+
}
215223
}
216-
217224
return metric_stat_map;
218225
}
219226

evaluator/perception_online_evaluator/src/utils/objects_filtering.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ bool isTargetObjectType(
8383
(t == ObjectClassification::PEDESTRIAN && target_object_types.check_pedestrian));
8484
}
8585

86+
ClassObjectsMap separateObjectsByClass(const PredictedObjects & objects)
87+
{
88+
ClassObjectsMap separated_objects;
89+
for (const auto & object : objects.objects) {
90+
const auto label = getHighestProbLabel(object.classification);
91+
separated_objects[label].objects.push_back(object);
92+
separated_objects[label].header = objects.header;
93+
}
94+
return separated_objects;
95+
}
96+
8697
void filterObjectsByClass(
8798
PredictedObjects & objects, const ObjectTypesToCheck & target_object_types)
8899
{

0 commit comments

Comments
 (0)