class_docstr: Test train utilities.
class_docstr_tok: ["Test","train","utilities","."]
docstr: Test coco_global_metrics_function correctness on a single box.
docstr_tok: ["Test","coco_global_metrics_function","correctness","on","a","single","box","."]
code: def test_coco_global_val_metrics_function_results(self):
      """Test coco_global_metrics_function correctness on a single box."""
      data_dir = os.path.join(
          os.path.normpath(os.path.dirname(__file__) + "/../../../../"),
          "dataset_lib",
          "coco_dataset",
          "data",
      )
      test_annotations_path = os.path.join(
          data_dir, "instances_val2017_unittest.json"
      )
      outputs, targets = _get_fake_detection_example()
  
      global_metrics_evaluator = detr_train_utils.DetrGlobalEvaluator(
          "coco_detr_detection", annotations_loc=test_annotations_path
      )
      global_metrics_evaluator.add_example(
          prediction=outputs, target=targets
      )
      metrics = global_metrics_evaluator.compute_metrics()
  
      self.assertAlmostEqual(metrics["AP"], 1.0, 5)
      self.assertAlmostEqual(metrics["AP_50"], 1.0, 5)
      self.assertAlmostEqual(metrics["AP_75"], 1.0, 5)
      self.assertAlmostEqual(metrics["AP_small"], -1.0, 5)
      self.assertAlmostEqual(metrics["AP_medium"], 1.0, 5)
      self.assertAlmostEqual(metrics["AP_large"], -1.0, 5)
      self.assertAlmostEqual(metrics["AR_max_1"], 1.0, 5)
      self.assertAlmostEqual(metrics["AR_max_10"], 1.0, 5)
      self.assertAlmostEqual(metrics["AR_max_100"], 1.0, 5)
      self.assertAlmostEqual(metrics["AR_small"], -1.0, 5)
      self.assertAlmostEqual(metrics["AR_medium"], 1.0, 5)
      self.assertAlmostEqual(metrics["AR_large"], -1.0, 5)
  
file_path: scenic/scenic/projects/baselines/detr/tests/test_train_utils.py
imports: import collections
  import os
  from absl.testing import absltest
  from absl.testing import parameterized
  import jax
  import jax.numpy
  import numpy
  from scenic.projects.baselines.detr import train_utils
label_desc: Use image node_id 2 for calling the TrainUtilsTest obj's underlying member method code with example usage: obj.test_coco_global_val_metrics_function_results() without return types