def __init__(self,
               categories,
               matching_iou_threshold=0.5,
               recall_lower_bound=0.0,
               recall_upper_bound=1.0,
               evaluate_corlocs=False,
               evaluate_precision_recall=False,
               metric_prefix=None,
               use_weighted_mean_ap=False,
               evaluate_masks=False,
               group_of_weight=0.0):
    """Constructor.

    Args:
      categories: A list of dicts, each of which has the following keys -
        'id': (required) an integer id uniquely identifying this category.
        'name': (required) string representing category name e.g., 'cat', 'dog'.
      matching_iou_threshold: IOU threshold to use for matching groundtruth
        boxes to detection boxes.
      recall_lower_bound: lower bound of recall operating area.
      recall_upper_bound: upper bound of recall operating area.
      evaluate_corlocs: (optional) boolean which determines if corloc scores are
        to be returned or not.
      evaluate_precision_recall: (optional) boolean which determines if
        precision and recall values are to be returned or not.
      metric_prefix: (optional) string prefix for metric name; if None, no
        prefix is used.
      use_weighted_mean_ap: (optional) boolean which determines if the mean
        average precision is computed directly from the scores and tp_fp_labels
        of all classes.
      evaluate_masks: If False, evaluation will be performed based on boxes. If
        True, mask evaluation will be performed instead.
      group_of_weight: Weight of group-of boxes.If set to 0, detections of the
        correct class within a group-of box are ignored. If weight is > 0, then
        if at least one detection falls within a group-of box with
        matching_iou_threshold, weight group_of_weight is added to true
        positives. Consequently, if no detection falls within a group-of box,
        weight group_of_weight is added to false negatives.

    Raises:
      ValueError: If the category ids are not 1-indexed.
    """
    super(ObjectDetectionEvaluator, self).__init__(categories)
    self._num_classes = max([cat['id'] for cat in categories])
    if min(cat['id'] for cat in categories) < 1:
      raise ValueError('Classes should be 1-indexed.')
    self._matching_iou_threshold = matching_iou_threshold
    self._recall_lower_bound = recall_lower_bound
    self._recall_upper_bound = recall_upper_bound
    self._use_weighted_mean_ap = use_weighted_mean_ap
    self._label_id_offset = 1
    self._evaluate_masks = evaluate_masks
    self._group_of_weight = group_of_weight
    self._evaluation = ObjectDetectionEvaluation(
        num_groundtruth_classes=self._num_classes,
        matching_iou_threshold=self._matching_iou_threshold,
        recall_lower_bound=self._recall_lower_bound,
        recall_upper_bound=self._recall_upper_bound,
        use_weighted_mean_ap=self._use_weighted_mean_ap,
        label_id_offset=self._label_id_offset,
        group_of_weight=self._group_of_weight)
    self._image_ids = set([])
    self._evaluate_corlocs = evaluate_corlocs
    self._evaluate_precision_recall = evaluate_precision_recall
    self._metric_prefix = (metric_prefix + '_') if metric_prefix else ''
    self._expected_keys = set([
        standard_fields.InputDataFields.key,
        standard_fields.InputDataFields.groundtruth_boxes,
        standard_fields.InputDataFields.groundtruth_classes,
        standard_fields.InputDataFields.groundtruth_difficult,
        standard_fields.InputDataFields.groundtruth_instance_masks,
        standard_fields.DetectionResultFields.detection_boxes,
        standard_fields.DetectionResultFields.detection_scores,
        standard_fields.DetectionResultFields.detection_classes,
        standard_fields.DetectionResultFields.detection_masks
    ])
    self._build_metric_names()
Constructor.

    Args:
      categories: A list of dicts, each of which has the following keys -
        'id': (required) an integer id uniquely identifying this category.
        'name': (required) string representing category name e.g., 'cat', 'dog'.
      matching_iou_threshold: IOU threshold to use for matching groundtruth
        boxes to detection boxes.
      recall_lower_bound: lower bound of recall operating area.
      recall_upper_bound: upper bound of recall operating area.
      evaluate_corlocs: (optional) boolean which determines if corloc scores are
        to be returned or not.
      evaluate_precision_recall: (optional) boolean which determines if
        precision and recall values are to be returned or not.
      metric_prefix: (optional) string prefix for metric name; if None, no
        prefix is used.
      use_weighted_mean_ap: (optional) boolean which determines if the mean
        average precision is computed directly from the scores and tp_fp_labels
        of all classes.
      evaluate_masks: If False, evaluation will be performed based on boxes. If
        True, mask evaluation will be performed instead.
      group_of_weight: Weight of group-of boxes.If set to 0, detections of the
        correct class within a group-of box are ignored. If weight is > 0, then
        if at least one detection falls within a group-of box with
        matching_iou_threshold, weight group_of_weight is added to true
        positives. Consequently, if no detection falls within a group-of box,
        weight group_of_weight is added to false negatives.

    Raises:
      ValueError: If the category ids are not 1-indexed.
    
inference_api/src/main/object_detection/utils/object_detection_evaluation.py