pascal_voc_tools.Evaluater package

Submodules

pascal_voc_tools.Evaluater.tools module

@File : tools.py @Time : 2019/03/04 08:35:46 @Author : wangtf @Version : 1.0 @Desc : None

pascal_voc_tools.Evaluater.tools.compute_overlaps(boxes, one_box)

iou = compute_overlaps(boxes, one_box)

compute intersection over union of ndarray. The format of one_box is [xmin, ymin, xmax, ymax].

Parameters:
  • boxes – the (n, 4) shape ndarray, ground truth boundboxes;
  • bb – the (4,) shape ndarray, detected boundboxes;
Returns:

a (n, ) shape ndarray.

pascal_voc_tools.Evaluater.tools.voc_ap(recall, precision, use_07_metric=False)

ap = voc_ap(recall, precision, [use_07_metric])

Compute VOC AP given precision and recall. If use_07_metric is true, uses the VOC 07 11 point method (default: False). Please make shure that recall and precison are sorted by scores.

Parameters:
  • recall – the shape of (n,) ndarray;
  • precision – the shape of (n,) ndarray;
  • use_07_metric – if true, the 11 points method will be used.
Returns:

the float number result of average precision.

pascal_voc_tools.Evaluater.tools.voc_eval(class_recs: dict, detect: dict, iou_thresh: float = 0.5, use_07_metric: bool = False)
recall, precision, ap = voc_eval(class_recs, detection,
[iou_thresh], [use_07_metric])

Top level function that does the PASCAL VOC evaluation. Please make sure that the class_recs only have one class annotations.

precision = tp / (tp + fp) recall = tp / (tp + fn)

Parameters:
  • class_recalls – recalls dict of a class class_recs[image_name]={‘bbox’: []}.
  • detection – Path to annotations detection={‘image_ids’:[], bbox’: [], ‘confidence’:[]}.
  • [iou_thresh] – Overlap threshold (default = 0.5)
  • [use_07_metric] – Whether to use VOC07’s 11 point AP computation (default False)
Returns:

a dict of result including true_positive_number, false_positive_number, recall, precision and average_precision.

Raises:

TypeError – the data format is not np.ndarray.

pascal_voc_tools.Evaluater.tools.voc_eval_files(class_recs_dir, detect_file, label_id, iou_thresh=0.5, use_07_metric=False)
recall, precision, ap = voc_eval(class_recs, detection,
[iou_thresh], [use_07_metric])

Top level function that does the PASCAL VOC evaluation. Please make sure that the class_recs only have one class annotations.

precision = tp / (tp + fp) recall = tp / (tp + fn)

Parameters:
  • class_recalls – recalls dict of a class class_recs[image_name]={‘bbox’: []}.
  • detection – Path to annotations detection={‘image_ids’:[], bbox’: [], ‘confidence’:[]}.
  • [iou_thresh] – Overlap threshold (default = 0.5)
  • [use_07_metric] – Whether to use VOC07’s 11 point AP computation (default False)
Returns:

a dict of result including true_positive_number, false_positive_number, recall, precision and average_precision.

Raises:

IOError – can not find the path.

Module contents