Unverified Commit 893c4108 authored by Kai Chen's avatar Kai Chen Committed by GitHub
Browse files

Merge pull request #302 from tjsongzw/master

minor fix, print_map_summary
parents 554e20a2 e7a61063
import mmcv
import numpy as np import numpy as np
from terminaltables import AsciiTable from terminaltables import AsciiTable
...@@ -234,8 +235,9 @@ def eval_map(det_results, ...@@ -234,8 +235,9 @@ def eval_map(det_results,
gt_ignore (list): gt ignore indicators 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), ...] scale_ranges (list, optional): [(min1, max1), (min2, max2), ...]
iou_thr (float): IoU threshold iou_thr (float): IoU threshold
dataset (None or str): dataset name, there are minor differences in dataset (None or str or list): dataset name or dataset classes, there
metrics for different datsets, e.g. "voc07", "imagenet_det", etc. are minor differences in metrics for different datsets, e.g.
"voc07", "imagenet_det", etc.
print_summary (bool): whether to print the mAP summary print_summary (bool): whether to print the mAP summary
Returns: Returns:
...@@ -333,7 +335,7 @@ def print_map_summary(mean_ap, results, dataset=None): ...@@ -333,7 +335,7 @@ def print_map_summary(mean_ap, results, dataset=None):
Args: Args:
mean_ap(float): calculated from `eval_map` mean_ap(float): calculated from `eval_map`
results(list): calculated from `eval_map` results(list): calculated from `eval_map`
dataset(None or str or list): dataset name. dataset(None or str or list): dataset name or dataset classes.
""" """
num_scales = len(results[0]['ap']) if isinstance(results[0]['ap'], num_scales = len(results[0]['ap']) if isinstance(results[0]['ap'],
np.ndarray) else 1 np.ndarray) else 1
...@@ -353,8 +355,10 @@ def print_map_summary(mean_ap, results, dataset=None): ...@@ -353,8 +355,10 @@ def print_map_summary(mean_ap, results, dataset=None):
if dataset is None: if dataset is None:
label_names = [str(i) for i in range(1, num_classes + 1)] label_names = [str(i) for i in range(1, num_classes + 1)]
else: elif mmcv.is_str(dataset):
label_names = get_classes(dataset) label_names = get_classes(dataset)
else:
label_names = dataset
if not isinstance(mean_ap, list): if not isinstance(mean_ap, list):
mean_ap = [mean_ap] mean_ap = [mean_ap]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment