code: def get_pytorch_object_detector_mask(get_default_mnist_subset):
      """
      This class tests the PyTorchObjectDetector object detector.
      """
      import torch
      import torchvision
  
      from art.estimators.object_detection.pytorch_object_detector import (
          PyTorchObjectDetector,
      )
  
      # Define object detector
      model = torchvision.models.detection.maskrcnn_resnet50_fpn(
          pretrained=True,
          progress=True,
          num_classes=91,
          pretrained_backbone=True,
      )
      params = [p for p in model.parameters() if p.requires_grad]
      optimizer = torch.optim.SGD(params, lr=0.01)
  
      object_detector = PyTorchObjectDetector(
          model=model,
          input_shape=(32, 32, 3),
          optimizer=optimizer,
          clip_values=(0, 1),
          channels_first=False,
          attack_losses=[
              "loss_classifier",
              "loss_box_reg",
              "loss_objectness",
              "loss_rpn_box_reg",
          ],
      )
  
      (_, _), (x_test_mnist, _) = get_default_mnist_subset
  
      x_test = np.transpose(x_test_mnist[:2], (0, 2, 3, 1))
      x_test = np.repeat(x_test.astype(np.float32), repeats=3, axis=3)
  
      # Create labels
      result = object_detector.predict(x=x_test)
  
      y_test = [
          {
              "boxes": result[0]["boxes"],
              "labels": result[0]["labels"],
              "scores": np.ones_like(result[0]["labels"]),
              "masks": result[0]["masks"],
          },
          {
              "boxes": result[1]["boxes"],
              "labels": result[1]["labels"],
              "scores": np.ones_like(result[1]["labels"]),
              "masks": result[0]["masks"],
          },
      ]
  
      yield object_detector, x_test, y_test
  
file_path: adversarial-robustness-toolbox/tests/estimators/object_detection/conftest.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import numpy
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: get_pytorch_object_detector_mask(get_default_mnist_subset) without return types