cvtools.evaluation package

Module contents

cvtools.evaluation.voc_classes()[源代码]
cvtools.evaluation.imagenet_det_classes()[源代码]
cvtools.evaluation.imagenet_vid_classes()[源代码]
cvtools.evaluation.coco_classes()[源代码]
cvtools.evaluation.get_classes(dataset)[源代码]

Get class names of a dataset.

cvtools.evaluation.coco_eval(result_files, result_types, coco, max_dets=(100, 300, 1000))[源代码]
cvtools.evaluation.fast_eval_recall(results, coco, max_dets, iou_thrs=array([0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95]))[源代码]
cvtools.evaluation.results2json(dataset, results, out_file)[源代码]
cvtools.evaluation.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.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.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.eval_recalls(gts, proposals, proposal_nums=None, iou_thrs=None, print_summary=True)[源代码]

Calculate recalls.

参数:
  • gts (list or ndarray) -- a list of arrays of shape (n, 4)
  • proposals (list or ndarray) -- a list of arrays of shape (k, 4) or (k, 5)
  • proposal_nums (int or list of int or ndarray) -- top N proposals
  • thrs (float or list or ndarray) -- iou thresholds
返回:

recalls of different ious and proposal nums

返回类型:

ndarray

cvtools.evaluation.print_recall_summary(recalls, proposal_nums, iou_thrs, row_idxs=None, col_idxs=None)[源代码]

Print recalls in a table.

参数:
  • recalls (ndarray) -- calculated from bbox_recalls
  • proposal_nums (ndarray or list) -- top N proposals
  • iou_thrs (ndarray or list) -- iou thresholds
  • row_idxs (ndarray) -- which rows(proposal nums) to print
  • col_idxs (ndarray) -- which cols(iou thresholds) to print
cvtools.evaluation.plot_num_recall(recalls, proposal_nums)[源代码]

Plot Proposal_num-Recalls curve.

参数:
  • recalls (ndarray or list) -- shape (k,)
  • proposal_nums (ndarray or list) -- same shape as recalls
cvtools.evaluation.plot_iou_recall(recalls, iou_thrs)[源代码]

Plot IoU-Recalls curve.

参数:
  • recalls (ndarray or list) -- shape (k,)
  • iou_thrs (ndarray or list) -- same shape as recalls
class cvtools.evaluation.MergeCropDetResults(gts, results, num_coors=4)[源代码]

基类:object

crop_bbox_map_back(bb, crop_start)[源代码]

子图检测坐标转换为相对于整图的坐标

img_results_to_cat_results(img_results)[源代码]
match_part_img_results(results)[源代码]

结合子图的结果,映射回原图,应用nms, 生成一张整图的结果

merge(nms_method=<function py_cpu_nms>, nms_th=0.15)[源代码]
参数:
  • nms_method -- nms方法必须与bbox表示方式对应, 默认是左上角右下角表示的水平矩形框
  • nms_th -- nms阈值
Returns: 合并后的检测结果
{
filename: [bboxes, labels, scores], filename: [bboxes, labels, scores], ...

}

save_dota_det_format(save_path)[源代码]
class cvtools.evaluation.EvalCropQuality(ann_file, crop_ann_file, results=None, num_coors=4)[源代码]

基类:object

此类设计目前不够完善,convert_crop_gt应隐藏在内部

eval()[源代码]
handel_ann(ann)[源代码]