@@ -26,7 +26,7 @@ namespace perception_diagnostics
26
26
using object_recognition_utils::convertLabelToString;
27
27
using tier4_autoware_utils::inverseTransformPoint;
28
28
29
- std::optional<MetricStatMap > MetricsCalculator::calculate (const Metric & metric) const
29
+ std::optional<MetricsMap > MetricsCalculator::calculate (const Metric & metric) const
30
30
{
31
31
// clang-format off
32
32
const bool use_past_objects = metric == Metric::lateral_deviation ||
@@ -455,15 +455,14 @@ MetricStatMap MetricsCalculator::calcYawRateMetrics(const ClassObjectsMap & clas
455
455
return metric_stat_map;
456
456
}
457
457
458
- MetricStatMap MetricsCalculator::calcObjectsCountMetrics () const
458
+ MetricValueMap MetricsCalculator::calcObjectsCountMetrics () const
459
459
{
460
- MetricStatMap metric_stat_map;
460
+ MetricValueMap metric_stat_map;
461
461
// calculate the average number of objects in the detection area in all past frames
462
462
const auto overall_average_count = detection_counter_.getOverallAverageCount ();
463
463
for (const auto & [label, range_and_count] : overall_average_count) {
464
464
for (const auto & [range, count] : range_and_count) {
465
- metric_stat_map[" average_objects_count_" + convertLabelToString (label) + " _" + range].add (
466
- count);
465
+ metric_stat_map[" average_objects_count_" + convertLabelToString (label) + " _" + range] = count;
467
466
}
468
467
}
469
468
// calculate the average number of objects in the detection area in the past
@@ -472,17 +471,16 @@ MetricStatMap MetricsCalculator::calcObjectsCountMetrics() const
472
471
detection_counter_.getAverageCount (parameters_->objects_count_window_seconds );
473
472
for (const auto & [label, range_and_count] : average_count) {
474
473
for (const auto & [range, count] : range_and_count) {
475
- metric_stat_map[ " interval_average_objects_count_ " + convertLabelToString (label) + " _ " + range]
476
- . add (count) ;
474
+ metric_stat_map
475
+ [ " interval_average_objects_count_ " + convertLabelToString (label) + " _ " + range] = count ;
477
476
}
478
477
}
479
478
480
479
// calculate the total number of objects in the detection area
481
480
const auto total_count = detection_counter_.getTotalCount ();
482
481
for (const auto & [label, range_and_count] : total_count) {
483
482
for (const auto & [range, count] : range_and_count) {
484
- metric_stat_map[" total_objects_count_" + convertLabelToString (label) + " _" + range].add (
485
- count);
483
+ metric_stat_map[" total_objects_count_" + convertLabelToString (label) + " _" + range] = count;
486
484
}
487
485
}
488
486
0 commit comments