def ComputeMetrics(self, include_metrics_per_category=False, all_metrics_per_category=False):
    "Computes detection/keypoint metrics.\n\n    Args:\n      include_metrics_per_category: If True, will include metrics per category.\n      all_metrics_per_category: If true, include all the summery metrics for\n        each category in per_category_ap. Be careful with setting it to true if\n        you have more than handful of categories, because it will pollute\n        your mldash.\n\n    Returns:\n      1. summary_metrics: a dictionary holding:\n        'Precision/mAP': mean average precision over classes averaged over IOU\n          thresholds ranging from .5 to .95 with .05 increments\n        'Precision/mAP@.50IOU': mean average precision at 50% IOU\n        'Precision/mAP@.75IOU': mean average precision at 75% IOU\n        'Precision/mAP (small)': mean average precision for small objects\n                        (area < 32^2 pixels). NOTE: not present for 'keypoints'\n        'Precision/mAP (medium)': mean average precision for medium sized\n                        objects (32^2 pixels < area < 96^2 pixels)\n        'Precision/mAP (large)': mean average precision for large objects\n                        (96^2 pixels < area < 10000^2 pixels)\n        'Recall/AR@1': average recall with 1 detection\n        'Recall/AR@10': average recall with 10 detections\n        'Recall/AR@100': average recall with 100 detections\n        'Recall/AR@100 (small)': average recall for small objects with 100\n          detections. NOTE: not present for 'keypoints'\n        'Recall/AR@100 (medium)': average recall for medium objects with 100\n          detections\n        'Recall/AR@100 (large)': average recall for large objects with 100\n          detections\n      2. per_category_ap: a dictionary holding category specific results with\n        keys of the form: 'Precision mAP ByCategory/category'\n        (without the supercategory part if no supercategories exist).\n        For backward compatibility 'PerformanceByCategory' is included in the\n        output regardless of all_metrics_per_category.\n        If evaluating class-agnostic mode, per_category_ap is an empty\n        dictionary.\n\n    Raises:\n      ValueError: If category_stats does not exist.\n    "
    self.evaluate()
    self.accumulate()
    self.summarize()
    summary_metrics = {}
    if (self._iou_type in ['bbox', 'segm']):
        summary_metrics = OrderedDict([('Precision/mAP', self.stats[0]), ('Precision/mAP@.50IOU', self.stats[1]), ('Precision/mAP@.75IOU', self.stats[2]), ('Precision/mAP (small)', self.stats[3]), ('Precision/mAP (medium)', self.stats[4]), ('Precision/mAP (large)', self.stats[5]), ('Recall/AR@1', self.stats[6]), ('Recall/AR@10', self.stats[7]), ('Recall/AR@100', self.stats[8]), ('Recall/AR@100 (small)', self.stats[9]), ('Recall/AR@100 (medium)', self.stats[10]), ('Recall/AR@100 (large)', self.stats[11])])
    elif (self._iou_type == 'keypoints'):
        category_id = self.GetCategoryIdList()[0]
        category_name = self.GetCategory(category_id)['name']
        summary_metrics = OrderedDict([])
        summary_metrics['Precision/mAP ByCategory/{}'.format(category_name)] = self.stats[0]
        summary_metrics['Precision/mAP@.50IOU ByCategory/{}'.format(category_name)] = self.stats[1]
        summary_metrics['Precision/mAP@.75IOU ByCategory/{}'.format(category_name)] = self.stats[2]
        summary_metrics['Precision/mAP (medium) ByCategory/{}'.format(category_name)] = self.stats[3]
        summary_metrics['Precision/mAP (large) ByCategory/{}'.format(category_name)] = self.stats[4]
        summary_metrics['Recall/AR@1 ByCategory/{}'.format(category_name)] = self.stats[5]
        summary_metrics['Recall/AR@10 ByCategory/{}'.format(category_name)] = self.stats[6]
        summary_metrics['Recall/AR@100 ByCategory/{}'.format(category_name)] = self.stats[7]
        summary_metrics['Recall/AR@100 (medium) ByCategory/{}'.format(category_name)] = self.stats[8]
        summary_metrics['Recall/AR@100 (large) ByCategory/{}'.format(category_name)] = self.stats[9]
    if (not include_metrics_per_category):
        return (summary_metrics, {})
    if (not hasattr(self, 'category_stats')):
        raise ValueError('Category stats do not exist')
    per_category_ap = OrderedDict([])
    if self.GetAgnosticMode():
        return (summary_metrics, per_category_ap)
    for (category_index, category_id) in enumerate(self.GetCategoryIdList()):
        category = self.GetCategory(category_id)['name']
        per_category_ap['PerformanceByCategory/mAP/{}'.format(category)] = self.category_stats[0][category_index]
        if all_metrics_per_category:
            per_category_ap['Precision mAP ByCategory/{}'.format(category)] = self.category_stats[0][category_index]
            per_category_ap['Precision mAP@.50IOU ByCategory/{}'.format(category)] = self.category_stats[1][category_index]
            per_category_ap['Precision mAP@.75IOU ByCategory/{}'.format(category)] = self.category_stats[2][category_index]
            per_category_ap['Precision mAP (small) ByCategory/{}'.format(category)] = self.category_stats[3][category_index]
            per_category_ap['Precision mAP (medium) ByCategory/{}'.format(category)] = self.category_stats[4][category_index]
            per_category_ap['Precision mAP (large) ByCategory/{}'.format(category)] = self.category_stats[5][category_index]
            per_category_ap['Recall AR@1 ByCategory/{}'.format(category)] = self.category_stats[6][category_index]
            per_category_ap['Recall AR@10 ByCategory/{}'.format(category)] = self.category_stats[7][category_index]
            per_category_ap['Recall AR@100 ByCategory/{}'.format(category)] = self.category_stats[8][category_index]
            per_category_ap['Recall AR@100 (small) ByCategory/{}'.format(category)] = self.category_stats[9][category_index]
            per_category_ap['Recall AR@100 (medium) ByCategory/{}'.format(category)] = self.category_stats[10][category_index]
            per_category_ap['Recall AR@100 (large) ByCategory/{}'.format(category)] = self.category_stats[11][category_index]
    return (summary_metrics, per_category_ap)
Computes detection/keypoint metrics.

Args:
  include_metrics_per_category: If True, will include metrics per category.
  all_metrics_per_category: If true, include all the summery metrics for
    each category in per_category_ap. Be careful with setting it to true if
    you have more than handful of categories, because it will pollute
    your mldash.

Returns:
  1. summary_metrics: a dictionary holding:
    'Precision/mAP': mean average precision over classes averaged over IOU
      thresholds ranging from .5 to .95 with .05 increments
    'Precision/mAP@.50IOU': mean average precision at 50% IOU
    'Precision/mAP@.75IOU': mean average precision at 75% IOU
    'Precision/mAP (small)': mean average precision for small objects
                    (area < 32^2 pixels). NOTE: not present for 'keypoints'
    'Precision/mAP (medium)': mean average precision for medium sized
                    objects (32^2 pixels < area < 96^2 pixels)
    'Precision/mAP (large)': mean average precision for large objects
                    (96^2 pixels < area < 10000^2 pixels)
    'Recall/AR@1': average recall with 1 detection
    'Recall/AR@10': average recall with 10 detections
    'Recall/AR@100': average recall with 100 detections
    'Recall/AR@100 (small)': average recall for small objects with 100
      detections. NOTE: not present for 'keypoints'
    'Recall/AR@100 (medium)': average recall for medium objects with 100
      detections
    'Recall/AR@100 (large)': average recall for large objects with 100
      detections
  2. per_category_ap: a dictionary holding category specific results with
    keys of the form: 'Precision mAP ByCategory/category'
    (without the supercategory part if no supercategories exist).
    For backward compatibility 'PerformanceByCategory' is included in the
    output regardless of all_metrics_per_category.
    If evaluating class-agnostic mode, per_category_ap is an empty
    dictionary.

Raises:
  ValueError: If category_stats does not exist.
def ComputeMetrics(self, include_metrics_per_category=False, all_metrics_per_category=False):
    "Computes detection/keypoint metrics.\n\n    Args:\n      include_metrics_per_category: If True, will include metrics per category.\n      all_metrics_per_category: If true, include all the summery metrics for\n        each category in per_category_ap. Be careful with setting it to true if\n        you have more than handful of categories, because it will pollute\n        your mldash.\n\n    Returns:\n      1. summary_metrics: a dictionary holding:\n        'Precision/mAP': mean average precision over classes averaged over IOU\n          thresholds ranging from .5 to .95 with .05 increments\n        'Precision/mAP@.50IOU': mean average precision at 50% IOU\n        'Precision/mAP@.75IOU': mean average precision at 75% IOU\n        'Precision/mAP (small)': mean average precision for small objects\n                        (area < 32^2 pixels). NOTE: not present for 'keypoints'\n        'Precision/mAP (medium)': mean average precision for medium sized\n                        objects (32^2 pixels < area < 96^2 pixels)\n        'Precision/mAP (large)': mean average precision for large objects\n                        (96^2 pixels < area < 10000^2 pixels)\n        'Recall/AR@1': average recall with 1 detection\n        'Recall/AR@10': average recall with 10 detections\n        'Recall/AR@100': average recall with 100 detections\n        'Recall/AR@100 (small)': average recall for small objects with 100\n          detections. NOTE: not present for 'keypoints'\n        'Recall/AR@100 (medium)': average recall for medium objects with 100\n          detections\n        'Recall/AR@100 (large)': average recall for large objects with 100\n          detections\n      2. per_category_ap: a dictionary holding category specific results with\n        keys of the form: 'Precision mAP ByCategory/category'\n        (without the supercategory part if no supercategories exist).\n        For backward compatibility 'PerformanceByCategory' is included in the\n        output regardless of all_metrics_per_category.\n        If evaluating class-agnostic mode, per_category_ap is an empty\n        dictionary.\n\n    Raises:\n      ValueError: If category_stats does not exist.\n    "
    self.evaluate()
    self.accumulate()
    self.summarize()
    summary_metrics = {}
    if (self._iou_type in ['bbox', 'segm']):
        summary_metrics = OrderedDict([('Precision/mAP', self.stats[0]), ('Precision/mAP@.50IOU', self.stats[1]), ('Precision/mAP@.75IOU', self.stats[2]), ('Precision/mAP (small)', self.stats[3]), ('Precision/mAP (medium)', self.stats[4]), ('Precision/mAP (large)', self.stats[5]), ('Recall/AR@1', self.stats[6]), ('Recall/AR@10', self.stats[7]), ('Recall/AR@100', self.stats[8]), ('Recall/AR@100 (small)', self.stats[9]), ('Recall/AR@100 (medium)', self.stats[10]), ('Recall/AR@100 (large)', self.stats[11])])
    elif (self._iou_type == 'keypoints'):
        category_id = self.GetCategoryIdList()[0]
        category_name = self.GetCategory(category_id)['name']
        summary_metrics = OrderedDict([])
        summary_metrics['Precision/mAP ByCategory/{}'.format(category_name)] = self.stats[0]
        summary_metrics['Precision/mAP@.50IOU ByCategory/{}'.format(category_name)] = self.stats[1]
        summary_metrics['Precision/mAP@.75IOU ByCategory/{}'.format(category_name)] = self.stats[2]
        summary_metrics['Precision/mAP (medium) ByCategory/{}'.format(category_name)] = self.stats[3]
        summary_metrics['Precision/mAP (large) ByCategory/{}'.format(category_name)] = self.stats[4]
        summary_metrics['Recall/AR@1 ByCategory/{}'.format(category_name)] = self.stats[5]
        summary_metrics['Recall/AR@10 ByCategory/{}'.format(category_name)] = self.stats[6]
        summary_metrics['Recall/AR@100 ByCategory/{}'.format(category_name)] = self.stats[7]
        summary_metrics['Recall/AR@100 (medium) ByCategory/{}'.format(category_name)] = self.stats[8]
        summary_metrics['Recall/AR@100 (large) ByCategory/{}'.format(category_name)] = self.stats[9]
    if (not include_metrics_per_category):
        return (summary_metrics, {})
    if (not hasattr(self, 'category_stats')):
        raise ValueError('Category stats do not exist')
    per_category_ap = OrderedDict([])
    if self.GetAgnosticMode():
        return (summary_metrics, per_category_ap)
    for (category_index, category_id) in enumerate(self.GetCategoryIdList()):
        category = self.GetCategory(category_id)['name']
        per_category_ap['PerformanceByCategory/mAP/{}'.format(category)] = self.category_stats[0][category_index]
        if all_metrics_per_category:
            per_category_ap['Precision mAP ByCategory/{}'.format(category)] = self.category_stats[0][category_index]
            per_category_ap['Precision mAP@.50IOU ByCategory/{}'.format(category)] = self.category_stats[1][category_index]
            per_category_ap['Precision mAP@.75IOU ByCategory/{}'.format(category)] = self.category_stats[2][category_index]
            per_category_ap['Precision mAP (small) ByCategory/{}'.format(category)] = self.category_stats[3][category_index]
            per_category_ap['Precision mAP (medium) ByCategory/{}'.format(category)] = self.category_stats[4][category_index]
            per_category_ap['Precision mAP (large) ByCategory/{}'.format(category)] = self.category_stats[5][category_index]
            per_category_ap['Recall AR@1 ByCategory/{}'.format(category)] = self.category_stats[6][category_index]
            per_category_ap['Recall AR@10 ByCategory/{}'.format(category)] = self.category_stats[7][category_index]
            per_category_ap['Recall AR@100 ByCategory/{}'.format(category)] = self.category_stats[8][category_index]
            per_category_ap['Recall AR@100 (small) ByCategory/{}'.format(category)] = self.category_stats[9][category_index]
            per_category_ap['Recall AR@100 (medium) ByCategory/{}'.format(category)] = self.category_stats[10][category_index]
            per_category_ap['Recall AR@100 (large) ByCategory/{}'.format(category)] = self.category_stats[11][category_index]
    return (summary_metrics, per_category_ap)