code: def test_poison_image(
      art_warning, image_batch, percent_poison, channels_first
  ):
      x, y = image_batch
  
      file_path = os.path.join(
          os.getcwd(), "utils/data/backdoors/alert.png"
      )
  
      def perturbation(x):
          return insert_image(
              x,
              backdoor_path=file_path,
              channels_first=False,
              size=(2, 2),
              mode="RGB",
          )
  
      backdoor = PoisoningAttackBackdoor(perturbation)
  
      try:
          attack = BadDetGlobalMisclassificationAttack(
              backdoor=backdoor,
              class_target=1,
              percent_poison=percent_poison,
              channels_first=channels_first,
          )
          poison_data, poison_labels = attack.poison(x, y)
  
          np.testing.assert_equal(poison_data.shape, x.shape)
          np.testing.assert_equal(
              poison_labels[0]["boxes"].shape, y[0]["boxes"].shape
          )
          np.testing.assert_equal(
              poison_labels[0]["labels"].shape, y[0]["labels"].shape
          )
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/attacks/poison/bad_det/test_bad_det_gma.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  import numpy
  import pytest
  from art.attacks.poisoning import BadDetGlobalMisclassificationAttack, PoisoningAttackBackdoor
  from art.attacks.poisoning.perturbations import add_single_bd, add_pattern_bd, insert_image
  from tests.utils import ARTTestException
label_desc: Use image node_id 3 for calling a global function with example usage: test_poison_image(art_warning, image_batch, percent_poison, channels_first) and returns: insert_image