| 189 | |
| 190 | template <typename PointT> |
| 191 | void calculate_precision_recall(const pcl::PointCloud<PointT> &pc_curr, |
| 192 | pcl::PointCloud<PointT> &ground_estimated, |
| 193 | double &precision, |
| 194 | double &recall, |
| 195 | bool consider_outliers = true) { |
| 196 | // Ensure that PointT is PointT because this function only works in the |
| 197 | // SemanticKITTI |
| 198 | if (!std::is_same<PointT, PointXYZILID>::value) { |
| 199 | throw invalid_argument( |
| 200 | "This function only supports `PointT`. Not " |
| 201 | "implemented for this point type."); |
| 202 | } |
| 203 | |
| 204 | int num_ground_est = ground_estimated.points.size(); |
| 205 | int num_ground_gt = count_num_ground(pc_curr); |
| 206 | int num_TP = count_num_ground(ground_estimated); |
| 207 | if (consider_outliers) { |
| 208 | int num_outliers_est = count_num_outliers(ground_estimated); |
| 209 | precision = static_cast<double>(num_TP) / (num_ground_est - num_outliers_est) * 100; |
| 210 | recall = static_cast<double>(num_TP) / num_ground_gt * 100; |
| 211 | } else { |
| 212 | precision = static_cast<double>(num_TP) / num_ground_est * 100; |
| 213 | recall = static_cast<double>(num_TP) / num_ground_gt * 100; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | template <typename PointT> |
| 218 | void save_all_labels(const pcl::PointCloud<PointT> &pc, string ABS_DIR, string seq, int count) { |
no test coverage detected