cvtools.evaluation.mean_ap module¶
-
cvtools.evaluation.mean_ap.
average_precision
(recalls, precisions, mode='area')[源代码]¶ Calculate average precision (for single or multiple scales).
参数: - recalls (ndarray) -- shape (num_scales, num_dets) or (num_dets, )
- precisions (ndarray) -- shape (num_scales, num_dets) or (num_dets, )
- mode (str) -- 'area' or '11points', 'area' means calculating the area under precision-recall curve, '11points' means calculating the average precision of recalls at [0, 0.1, ..., 1]
返回: calculated average precision
返回类型: float or ndarray
-
cvtools.evaluation.mean_ap.
eval_map
(det_results, gt_bboxes, gt_labels, gt_ignore=None, scale_ranges=None, iou_thr=0.5, dataset=None, print_summary=True, calc_ious=<function bbox_overlaps>)[源代码]¶ Evaluate mAP of a dataset.
参数: - det_results (list) -- a list of list, [[cls1_det, cls2_det, ...], ...] cls1_det为np.array,包含K*5,包含得分, x1y1x2y2形式
- gt_bboxes (list) -- ground truth bboxes of each image, a list of K*4 array. x1y1x2y2形式
- gt_labels (list) -- ground truth labels of each image, a list of K array
- gt_ignore (list) -- gt ignore indicators of each image, a list of K array
- scale_ranges (list, optional) -- [(min1, max1), (min2, max2), ...]
- iou_thr (float) -- IoU threshold,目前还不支持polyiou
- dataset (None or str or list) -- dataset name or dataset classes, there are minor differences in metrics for different datsets, e.g. "voc07", "imagenet_det", etc.
- print_summary (bool) -- whether to print the mAP summary
返回: (mAP, [dict, dict, ...])
返回类型: tuple
-
cvtools.evaluation.mean_ap.
get_cls_results
(det_results, gt_bboxes, gt_labels, gt_ignore, class_id)[源代码]¶ Get det results and gt information of a certain class.
-
cvtools.evaluation.mean_ap.
print_map_summary
(mean_ap, results, dataset=None)[源代码]¶ Print mAP and results of each class.
参数: - mean_ap (float) -- calculated from eval_map
- results (list) -- calculated from eval_map
- dataset (None or str or list) -- dataset name or dataset classes.
-
cvtools.evaluation.mean_ap.
tpfp_default
(det_bboxes, gt_bboxes, gt_ignore, iou_thr, area_ranges=None, calc_ious=<function bbox_overlaps>)[源代码]¶ Check if detected bboxes are true positive or false positive.
参数: - det_bbox (ndarray) -- the detected bbox
- gt_bboxes (ndarray) -- ground truth bboxes of this image
- gt_ignore (ndarray) -- indicate if gts are ignored for evaluation or not
- iou_thr (float) -- the iou thresholds
- calc_ious -- 自定义计算iou方法
返回: (tp, fp), two arrays whose elements are 0 and 1
返回类型: tuple
-
cvtools.evaluation.mean_ap.
tpfp_imagenet
(det_bboxes, gt_bboxes, gt_ignore, default_iou_thr, area_ranges=None, calc_ious=<function bbox_overlaps>)[源代码]¶ Check if detected bboxes are true positive or false positive.
参数: - det_bbox (ndarray) -- the detected bbox
- gt_bboxes (ndarray) -- ground truth bboxes of this image
- gt_ignore (ndarray) -- indicate if gts are ignored for evaluation or not
- default_iou_thr (float) -- the iou thresholds for medium and large bboxes
- area_ranges (list or None) -- gt bbox area ranges
返回: two arrays (tp, fp) whose elements are 0 and 1
返回类型: tuple