code: def main():
      # Create ART object detector
      frcnn = PyTorchFasterRCNN(
          clip_values=(0, 255),
          attack_losses=[
              "loss_classifier",
              "loss_box_reg",
              "loss_objectness",
              "loss_rpn_box_reg",
          ],
      )
  
      # Load image 1
      image_0 = cv2.imread("./10best-cars-group-cropped-1542126037.jpg")
      image_0 = cv2.cvtColor(
          image_0, cv2.COLOR_BGR2RGB
      )  # Convert to RGB
      print("image_0.shape:", image_0.shape)
  
      # Load image 2
      image_1 = cv2.imread("./banner-diverse-group-of-people-2.jpg")
      image_1 = cv2.cvtColor(
          image_1, cv2.COLOR_BGR2RGB
      )  # Convert to RGB
      image_1 = cv2.resize(
          image_1,
          dsize=(image_0.shape[1], image_0.shape[0]),
          interpolation=cv2.INTER_CUBIC,
      )
      print("image_1.shape:", image_1.shape)
  
      # Stack images
      image = np.stack([image_0, image_1], axis=0).astype(np.float32)
      print("image.shape:", image.shape)
  
      for i in range(image.shape[0]):
          plt.axis("off")
          plt.title("image {}".format(i))
          plt.imshow(image[i].astype(np.uint8), interpolation="nearest")
          plt.show()
  
      # Make prediction on benign samples
      predictions = frcnn.predict(x=image)
  
      for i in range(image.shape[0]):
          print("\nPredictions image {}:".format(i))
  
          # Process predictions
          (
              predictions_class,
              predictions_boxes,
              predictions_class,
          ) = extract_predictions(predictions[i])
  
          # Plot predictions
          plot_image_with_boxes(
              img=image[i].copy(),
              boxes=predictions_boxes,
              pred_cls=predictions_class,
          )
  
      # Create and run attack
      eps = 32
      attack = ProjectedGradientDescent(
          estimator=frcnn, eps=eps, eps_step=2, max_iter=10
      )
      image_adv = attack.generate(x=image, y=None)
  
      print("\nThe attack budget eps is {}".format(eps))
      print(
          "The resulting maximal difference in pixel values is {}.".format(
              np.amax(np.abs(image - image_adv))
          )
      )
  
      for i in range(image_adv.shape[0]):
          plt.axis("off")
          plt.title("image_adv {}".format(i))
          plt.imshow(
              image_adv[i].astype(np.uint8), interpolation="nearest"
          )
          plt.show()
  
      predictions_adv = frcnn.predict(x=image_adv)
  
      for i in range(image.shape[0]):
          print("\nPredictions adversarial image {}:".format(i))
  
          # Process predictions
          (
              predictions_adv_class,
              predictions_adv_boxes,
              predictions_adv_class,
          ) = extract_predictions(predictions_adv[i])
  
          # Plot predictions
          plot_image_with_boxes(
              img=image_adv[i].copy(),
              boxes=predictions_adv_boxes,
              pred_cls=predictions_adv_class,
          )
  
file_path: adversarial-robustness-toolbox/examples/application_object_detection.py
imports: import cv2
  import numpy
  import matplotlib.pyplot
  from art.estimators.object_detection import PyTorchFasterRCNN
  from art.attacks.evasion import ProjectedGradientDescent
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types