def add_eval_dict(self, eval_dict):
    """Observes an evaluation result dict for a single example.

    When executing eagerly, once all observations have been observed by this
    method you can use `.evaluate()` to get the final metrics.

    When using `tf.estimator.Estimator` for evaluation this function is used by
    `get_estimator_eval_metric_ops()` to construct the metric update op.

    Args:
      eval_dict: A dictionary that holds tensors for evaluating an object
        detection model, returned from
        eval_util.result_dict_for_single_example().

    Returns:
      None when executing eagerly, or an update_op that can be used to update
      the eval metrics in `tf.estimator.EstimatorSpec`.
    """
    # remove unexpected fields
    eval_dict_filtered = dict()
    for key, value in eval_dict.items():
      if key in self._expected_keys:
        eval_dict_filtered[key] = value

    eval_dict_keys = list(eval_dict_filtered.keys())

    def update_op(image_id, *eval_dict_batched_as_list):
      """Update operation that adds batch of images to ObjectDetectionEvaluator.

      Args:
        image_id: image id (single id or an array)
        *eval_dict_batched_as_list: the values of the dictionary of tensors.
      """
      if np.isscalar(image_id):
        single_example_dict = dict(
            zip(eval_dict_keys, eval_dict_batched_as_list))
        self.add_single_ground_truth_image_info(image_id, single_example_dict)
        self.add_single_detected_image_info(image_id, single_example_dict)
      else:
        for unzipped_tuple in zip(*eval_dict_batched_as_list):
          single_example_dict = dict(zip(eval_dict_keys, unzipped_tuple))
          image_id = single_example_dict[standard_fields.InputDataFields.key]
          self.add_single_ground_truth_image_info(image_id, single_example_dict)
          self.add_single_detected_image_info(image_id, single_example_dict)

    args = [eval_dict_filtered[standard_fields.InputDataFields.key]]
    args.extend(six.itervalues(eval_dict_filtered))
    return tf.py_func(update_op, args, [])
Observes an evaluation result dict for a single example.

    When executing eagerly, once all observations have been observed by this
    method you can use `.evaluate()` to get the final metrics.

    When using `tf.estimator.Estimator` for evaluation this function is used by
    `get_estimator_eval_metric_ops()` to construct the metric update op.

    Args:
      eval_dict: A dictionary that holds tensors for evaluating an object
        detection model, returned from
        eval_util.result_dict_for_single_example().

    Returns:
      None when executing eagerly, or an update_op that can be used to update
      the eval metrics in `tf.estimator.EstimatorSpec`.
    
inference_api/src/main/object_detection/utils/object_detection_evaluation.py