NVIDIA DeepStream SDK API Reference

9.2 Release
sources/gst-plugins/gst-nvinfereval/nvds_eval_ap.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #include "nvds_eval_gt_loader.h"
21 
22 #include <string>
23 #include <vector>
24 #include <utility>
25 #include <cstdint>
26 
31 float compute_iou (float ax1, float ay1, float ax2, float ay2,
32  float bx1, float by1, float bx2, float by2);
33 
44 void match_preds_to_gt (const std::vector<std::string> &preds_label,
45  const std::vector<float> &preds_conf,
46  const std::vector<float> &preds_x1,
47  const std::vector<float> &preds_y1,
48  const std::vector<float> &preds_x2,
49  const std::vector<float> &preds_y2,
50  const std::vector<GTBox> &gt_boxes,
51  std::vector<float> &out_best_iou,
52  uint32_t &fn_count_out);
53 
62 float compute_ap (const std::vector<std::pair<float,float>> &preds_scored,
63  uint32_t total_gt, float iou_thresh);
64 
66 float compute_ap50 (const std::vector<std::pair<float,float>> &preds_scored,
67  uint32_t total_gt);
68 
70 float compute_ap50_95 (const std::vector<std::pair<float,float>> &preds_scored,
71  uint32_t total_gt);
compute_ap50
float compute_ap50(const std::vector< std::pair< float, float >> &preds_scored, uint32_t total_gt)
AP@0.5 shorthand.
compute_ap
float compute_ap(const std::vector< std::pair< float, float >> &preds_scored, uint32_t total_gt, float iou_thresh)
compute_ap: 101-point COCO-style interpolated AP at a single IoU threshold.
match_preds_to_gt
void match_preds_to_gt(const std::vector< std::string > &preds_label, const std::vector< float > &preds_conf, const std::vector< float > &preds_x1, const std::vector< float > &preds_y1, const std::vector< float > &preds_x2, const std::vector< float > &preds_y2, const std::vector< GTBox > &gt_boxes, std::vector< float > &out_best_iou, uint32_t &fn_count_out)
match_preds_to_gt: Full greedy IoU matching with explicit bbox coordinate arrays.
compute_iou
float compute_iou(float ax1, float ay1, float ax2, float ay2, float bx1, float by1, float bx2, float by2)
compute_iou: Standard intersection-over-union for axis-aligned boxes.
compute_ap50_95
float compute_ap50_95(const std::vector< std::pair< float, float >> &preds_scored, uint32_t total_gt)
AP@0.5:0.95 (mean over 10 thresholds, COCO standard)
nvds_eval_gt_loader.h