Apollo  v5.5.0
Open source self driving car software
detection_evaluation.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 #include <algorithm>
18 #include <iostream>
19 #include <memory>
20 #include <string>
21 #include <utility>
22 #include <vector>
27 
28 namespace apollo {
29 namespace perception {
30 namespace benchmark {
31 
32 struct FrameMetrics {
33  std::string frame_name;
34  std::vector<double> detection_recall_2017;
35  std::vector<double> detection_precision_2017;
36  std::vector<double> detection_visible_recall_2017;
37  std::vector<double> aad_2017;
39 
40  bool operator<(const FrameMetrics& rhs) const {
41  double score = std::accumulate(detection_recall_2017.begin(),
42  detection_recall_2017.end(), 0.0);
43  double score_right = std::accumulate(rhs.detection_recall_2017.begin(),
44  rhs.detection_recall_2017.end(), 0.0);
45  return score < score_right;
46  }
47 };
48 
50  public:
51  DetectionEvaluation() = default;
52  ~DetectionEvaluation() = default;
53  DetectionEvaluation(const DetectionEvaluation& rhs) = delete;
54 
55  bool init(const std::string& clouds, const std::string& results,
56  const std::string& groundtruths, bool is_folder,
57  unsigned int loader_thread_num, unsigned int eval_thread_num,
58  unsigned int eval_parrallel_num, const std::string& reserve);
59  void run_evaluation();
60 
61  friend std::ostream& operator<<(std::ostream& out,
62  const DetectionEvaluation& rhs);
63 
64  private:
65  bool _initialized = false;
66  std::unique_ptr<ctpl::thread_pool> _thread_pool;
68 
69  MetaStatistics _meta_stat;
70  unsigned int _eval_parrallel_num = 0;
71 
73 
74  private:
75  // detection evaluation metrics
76  // per frame
77  std::vector<FrameMetrics> _frame_metrics;
78  // OrientationSimilarityMetric _similarity_metric;
79  // whole dataset
80  std::vector<double> _detection_precision_2017;
81  std::vector<double> _detection_recall_2017;
82  std::vector<double> _detection_visible_recall_2017;
83  std::vector<double> _detection_precision_2016;
84  std::vector<double> _detection_recall_2016;
85  double _detection_ap;
86  double _detection_aos;
87  std::vector<SPRCTuple> _detection_curve_samples;
88  std::vector<double> _detection_ap_per_type;
89  std::vector<std::vector<SPRCTuple>> _detection_curve_samples_per_type;
90  // orientation
91  std::vector<double> _aad_2017;
92 
93  std::vector<std::vector<double>> _classification_accuracy_2016;
94  std::vector<std::vector<double>> _classification_accuracy_2017;
95  std::vector<std::vector<double>> _classification_confusion_matrix_gt_major;
96  std::vector<std::vector<double>> _classification_confusion_matrix_det_major;
97  std::vector<std::vector<double>>
98  _classification_confusion_matrix_det_major_with_fp;
99  // self-evaluation
100  std::vector<std::vector<double>> _classification_change_rate_per_class;
101  double _classification_change_rate;
102  // option
103  LidarOption _lidar_option;
104 };
105 
106 } // namespace benchmark
107 } // namespace perception
108 } // namespace apollo
Definition: lidar_option.h:24
std::vector< double > detection_recall_2017
Definition: detection_evaluation.h:34
Definition: detection_evaluation.h:49
Definition: blob.h:72
Definition: meta_statistics.h:62
std::vector< double > detection_precision_2017
Definition: detection_evaluation.h:35
double jaccard_index_percentile
Definition: detection_evaluation.h:38
std::string frame_name
Definition: detection_evaluation.h:33
Definition: async_sequence_data_loader.h:42
Definition: detection_evaluation.h:32
std::vector< double > detection_visible_recall_2017
Definition: detection_evaluation.h:36
std::vector< double > aad_2017
Definition: detection_evaluation.h:37
std::ostream & operator<<(std::ostream &o, const Polynomial &p)
bool operator<(const FrameMetrics &rhs) const
Definition: detection_evaluation.h:40