code: def test_compute_losses(art_warning, get_mnist_dataset):
      try:
          from art.estimators.object_detection.tensorflow_faster_rcnn import (
              TensorFlowFasterRCNN,
          )
  
          images = tf.placeholder(tf.float32, shape=[2, 28, 28, 3])
  
          # Get test data
          (_, _), (x_test_mnist, y_test_mnist) = get_mnist_dataset
  
          frcnn = TensorFlowFasterRCNN(
              images=images,
              clip_values=(0, 1),
              attack_losses=(
                  "Loss/RPNLoss/localization_loss",
                  "Loss/RPNLoss/objectness_loss",
                  "Loss/BoxClassifierLoss/localization_loss",
                  "Loss/BoxClassifierLoss/classification_loss",
              ),
          )
  
          # Create labels
          result = frcnn.predict(
              np.repeat(
                  x_test_mnist[:2].astype(np.float32), repeats=3, axis=3
              )
          )
  
          y = [
              {
                  "boxes": result[0]["boxes"],
                  "labels": result[0]["labels"],
                  "scores": np.ones_like(result[0]["labels"]),
              },
              {
                  "boxes": result[1]["boxes"],
                  "labels": result[1]["labels"],
                  "scores": np.ones_like(result[1]["labels"]),
              },
          ]
  
          # Compute losses
          losses = frcnn.compute_losses(
              np.repeat(
                  x_test_mnist[:2].astype(np.float32), repeats=3, axis=3
              ),
              y,
          )
  
          assert len(losses) == 4
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/estimators/object_detection/test_tensorflow_faster_rcnn.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import numpy
  import pytest
  import tensorflow
  from tests.utils import ARTTestException, master_seed
label_desc: Use image node_id 4 for calling a global function with example usage: test_compute_losses(art_warning, get_mnist_dataset) without return types