def METHOD_NAME(  # pylint: disable=W0221
    self,
    x: Union[np.ndarray, List[np.ndarray]],
    y: List[Dict[str, np.ndarray]],
    **kwargs,
) -> Tuple[Union[np.ndarray, List[np.ndarray]], List[Dict[str, np.ndarray]]]:
    """
    Generate poisoning examples by inserting the backdoor onto the input `x` and changing the classification
    for labels `y`.
    :param x: Sample images of shape `NCHW` or `NHWC` or a list of sample images of any size.
    :param y: True labels of type `List[Dict[np.ndarray]]`, one dictionary per input image. The keys and values
              of the dictionary are:
              - boxes [N, 4]: the boxes in [x1, y1, x2, y2] format, with 0 <= x1 < x2 <= W and 0 <= y1 < y2 <= H.
              - labels [N]: the labels for each image.
    :return: An tuple holding the `(poisoning_examples, poisoning_labels)`.
    """
    if isinstance(x, np.ndarray):
        x_ndim = len(x.shape)
    else:
        x_ndim = len(x[0].shape) + 1
    if x_ndim != 4:
        raise ValueError("Unrecognized input dimension. BadDet OGA can only be applied to image data.")
    # copy images
    x_poison: Union[np.ndarray, List[np.ndarray]]
    if isinstance(x, np.ndarray):
        x_poison = x.copy()
    else:
        x_poison = [x_i.copy() for x_i in x]
    # copy labels
    y_poison: List[Dict[str, np.ndarray]] = []
    for y_i in y:
        target_dict = {k: v.copy() for k, v in y_i.items()}
        y_poison.append(target_dict)
    # select indices of samples to poison
    all_indices = np.arange(len(x))
    num_poison = int(self.percent_poison * len(all_indices))
    selected_indices = np.random.choice(all_indices, num_poison, replace=False)
    for i in tqdm(selected_indices, desc="BadDet OGA iteration", disable=not self.verbose):
        image = x_poison[i]
        boxes = y_poison[i]["boxes"]
        labels = y_poison[i]["labels"]
        if self.channels_first:
            image = np.transpose(image, (1, 2, 0))
        height, width, _ = image.shape
        # generate the fake bounding box
        y_1 = np.random.randint(0, height - self.bbox_height)
        x_1 = np.random.randint(0, width - self.bbox_width)
        y_2 = y_1 + self.bbox_height
        x_2 = x_1 + self.bbox_width
        # extract the bounding box from the image
        bounding_box = image[y_1:y_2, x_1:x_2, :]
        # insert backdoor into the bounding box
        # add an additional dimension to create a batch of size 1
        poisoned_input, _ = self.backdoor.METHOD_NAME(bounding_box[np.newaxis], labels)
        image[y_1:y_2, x_1:x_2, :] = poisoned_input[0]
        # replace the original image with the poisoned image
        if self.channels_first:
            image = np.transpose(image, (2, 0, 1))
        x_poison[i] = image
        # insert the fake bounding box and label
        y_poison[i]["boxes"] = np.concatenate((boxes, [[x_1, y_1, x_2, y_2]]))
        y_poison[i]["labels"] = np.concatenate((labels, [self.class_target]))
        if "scores" in y_poison[i]:
            y_poison[i]["scores"] = np.concatenate((y_poison[i]["scores"], [1.0]))
        if "masks" in y_poison[i]:
            mask = np.zeros_like(image)
            mask[y_1:y_2, x_1:x_2, :] = 1
            y_poison[i]["masks"] = np.concatenate((y_poison[i]["masks"], [mask]))
    return x_poison, y_poison