@@ -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<MetricsMap > MetricsCalculator::calculate (const Metric & metric) const
29
+ std::optional<MetricStatMap > 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,14 +455,15 @@ MetricStatMap MetricsCalculator::calcYawRateMetrics(const ClassObjectsMap & clas
455
455
return metric_stat_map;
456
456
}
457
457
458
- MetricValueMap MetricsCalculator::calcObjectsCountMetrics () const
458
+ MetricStatMap MetricsCalculator::calcObjectsCountMetrics () const
459
459
{
460
- MetricValueMap metric_stat_map;
460
+ MetricStatMap 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] = count;
465
+ metric_stat_map[" average_objects_count_" + convertLabelToString (label) + " _" + range].add (
466
+ count);
466
467
}
467
468
}
468
469
// calculate the average number of objects in the detection area in the past
@@ -471,16 +472,17 @@ MetricValueMap MetricsCalculator::calcObjectsCountMetrics() const
471
472
detection_counter_.getAverageCount (parameters_->objects_count_window_seconds );
472
473
for (const auto & [label, range_and_count] : average_count) {
473
474
for (const auto & [range, count] : range_and_count) {
474
- metric_stat_map
475
- [ " interval_average_objects_count_ " + convertLabelToString (label) + " _ " + range] = count;
475
+ metric_stat_map[ " interval_average_objects_count_ " + convertLabelToString (label) + " _ " + range]
476
+ . add ( count) ;
476
477
}
477
478
}
478
479
479
480
// calculate the total number of objects in the detection area
480
481
const auto total_count = detection_counter_.getTotalCount ();
481
482
for (const auto & [label, range_and_count] : total_count) {
482
483
for (const auto & [range, count] : range_and_count) {
483
- metric_stat_map[" total_objects_count_" + convertLabelToString (label) + " _" + range] = count;
484
+ metric_stat_map[" total_objects_count_" + convertLabelToString (label) + " _" + range].add (
485
+ count);
484
486
}
485
487
}
486
488
0 commit comments