class_docstr: This tests the object detection metrics.
  
  Results provided from COCOAPI: AP with all IoUs causes overflow of memory,
  thus we do not check it here, but check the single value instead and the
  average of two IoUs.
  Average Precision @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.533
  Average Precision @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.916
  Average Precision @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.416
  Average Precision @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.500
  Average Precision @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.303
  Average Precision @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.701
  Average Recall @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.375
  Average Recall @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.533
  Average Recall @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.533
  Average Recall @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.500
  Average Recall @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.300
  Average Recall @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.700
code: def testMetricValuesWithSplittedData(
      self, eval_config, name_list, expected_results
  ):
      extracts = [
          {
              "features": {
                  "labels": {
                      "xmin": np.array([[272.1, 181.23, 174.74]]),
                      "ymin": np.array([[200.23, 86.28, 0.0]]),
                      "xmax": np.array([[424.07, 208.67, 435.78]]),
                      "ymax": np.array([[480.0, 159.81, 220.79]]),
                      "class_id": np.array([[2.0, 2.0, 2.0]]),
                  },
                  "predictions": {
                      "bbox": np.array(
                          [
                              [
                                  [271.2, 178.86, 429.52, 459.57],
                                  [178.53, 92.57, 206.39, 159.71],
                                  [167.96, 9.97, 442.79, 235.07],
                              ]
                          ]
                      ),
                      "class_id": np.array([[2.0, 2.0, 2.0]]),
                      "scores": np.array([[0.64, 0.38, 0.95]]),
                  },
              }
          },
          {
              "features": {
                  "labels": {
                      "xmin": np.array(
                          [[473.07, 204.01, 0.43, 204.42]]
                      ),
                      "ymin": np.array(
                          [[395.93, 235.08, 499.79, 304.1]]
                      ),
                      "xmax": np.array(
                          [[503.07, 264.85, 340.22, 256.93]]
                      ),
                      "ymax": np.array(
                          [[424.6, 412.44, 606.24, 456.86]]
                      ),
                      "class_id": np.array([[1.0, 2.0, 2.0, 2.0]]),
                  },
                  "predictions": {
                      "bbox": np.array(
                          [
                              [
                                  [471.15, 398.57, 502.29, 428.26],
                                  [198.53, 242.14, 263.93, 427.51],
                                  [-32.86, 505.75, 338.82, 619.66],
                                  [201.59, 299.39, 258.4, 452.88],
                              ]
                          ]
                      ),
                      "class_id": np.array([[1.0, 2.0, 2.0, 1.0]]),
                      "scores": np.array([[0.54, 0.95, 0.17, 0.05]]),
                  },
              }
          },
      ]
  
      evaluators = tfma.default_evaluators(eval_config=eval_config)
      extractors = tfma.default_extractors(
          eval_shared_model=None, eval_config=eval_config
      )
  
      with beam.Pipeline() as p:
          result = (
              p
              | "LoadData" >> beam.Create(extracts)
              | "ExtractEval"
              >> tfma.ExtractAndEvaluate(
                  extractors=extractors, evaluators=evaluators
              )
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  self.assertLen(got_metrics, len(name_list))
                  for name, expected_result in zip(
                      name_list, expected_results
                  ):
                      key = metric_types.MetricKey(name=name)
                      self.assertIn(key, got_metrics)
                      got_metric = got_metrics[key]
                      np.testing.assert_allclose(
                          expected_result,
                          got_metric,
                          rtol=1e-3,
                          err_msg=f"This {name} metric fails.",
                      )
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          self.assertIn("metrics", result)
          util.assert_that(
              result["metrics"], check_result, label="result"
          )
  
file_path: model-analysis/tensorflow_model_analysis/metrics/object_detection_metrics_test.py
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow_model_analysis
  from tensorflow_model_analysis.metrics import metric_types
  from google.protobuf import text_format
label_desc: Use image node_id 2 for calling the ObjectDetectionMetricsTest obj's underlying member method code with example usage: obj.testMetricValuesWithSplittedData(eval_config, name_list, expected_results) without return types