code: def run_evaluation(
      categories, groundtruth, detections, excluded_keys, verbose=True
  ):
      """AVA evaluation main logic."""
  
      pascal_evaluator = (
          object_detection_evaluation.PascalDetectionEvaluator(
              categories
          )
      )
  
      boxes, labels, _ = groundtruth
  
      gt_keys = []
      pred_keys = []
  
      for image_key in boxes:
          if image_key in excluded_keys:
              logging.info(
                  (
                      "Found excluded timestamp in ground truth: %s. "
                      "It will be ignored."
                  ),
                  image_key,
              )
              continue
          pascal_evaluator.add_single_ground_truth_image_info(
              image_key,
              {
                  standard_fields.InputDataFields.groundtruth_boxes: np.array(
                      boxes[image_key], dtype=float
                  ),
                  standard_fields.InputDataFields.groundtruth_classes: np.array(
                      labels[image_key], dtype=int
                  ),
                  standard_fields.InputDataFields.groundtruth_difficult: np.zeros(
                      len(boxes[image_key]), dtype=bool
                  ),
              },
          )
  
          gt_keys.append(image_key)
  
      boxes, labels, scores = detections
  
      for image_key in boxes:
          if image_key in excluded_keys:
              logging.info(
                  (
                      "Found excluded timestamp in detections: %s. "
                      "It will be ignored."
                  ),
                  image_key,
              )
              continue
          pascal_evaluator.add_single_detected_image_info(
              image_key,
              {
                  standard_fields.DetectionResultFields.detection_boxes: np.array(
                      boxes[image_key], dtype=float
                  ),
                  standard_fields.DetectionResultFields.detection_classes: np.array(
                      labels[image_key], dtype=int
                  ),
                  standard_fields.DetectionResultFields.detection_scores: np.array(
                      scores[image_key], dtype=float
                  ),
              },
          )
  
          pred_keys.append(image_key)
  
      metrics = pascal_evaluator.evaluate()
  
      if du.is_master_proc():
          pprint.pprint(metrics, indent=2)
      return metrics
  
file_path: SlowFast/slowfast/utils/ava_eval_helper.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import csv
  import logging
  import pprint
  import time
  from collections import defaultdict
  import numpy
  import slowfast.utils.distributed
  from ava_evaluation import object_detection_evaluation, standard_fields
  from slowfast.utils.env import pathmgr
label_desc: Use image node_id 7 for calling a global function with example usage: run_evaluation(categories, groundtruth, detections, excluded_keys, verbose) and returns: metrics