code: def _extract_image_targets(
      self, flat_sample: List[Any]
  ) -> Tuple[
      List[Union[torch.Tensor, tv_tensors.Image]], List[Dict[str, Any]]
  ]:
      # fetch all images, bboxes, masks and labels from unstructured input
      # with List[image], List[BoundingBoxes], List[Mask], List[Label]
      images, bboxes, masks, labels = [], [], [], []
      for obj in flat_sample:
          if isinstance(obj, tv_tensors.Image) or is_pure_tensor(obj):
              images.append(obj)
          elif isinstance(obj, PIL.Image.Image):
              images.append(F.to_image(obj))
          elif isinstance(obj, tv_tensors.BoundingBoxes):
              bboxes.append(obj)
          elif isinstance(obj, tv_tensors.Mask):
              masks.append(obj)
          elif isinstance(
              obj,
              (proto_tv_tensors.Label, proto_tv_tensors.OneHotLabel),
          ):
              labels.append(obj)
  
      if not (len(images) == len(bboxes) == len(masks) == len(labels)):
          raise TypeError(
              f"{type(self).__name__}() requires input sample to contain equal sized list of Images, "
              "BoundingBoxeses, Masks and Labels or OneHotLabels."
          )
  
      targets = []
      for bbox, mask, label in zip(bboxes, masks, labels):
          targets.append(
              {"boxes": bbox, "masks": mask, "labels": label}
          )
  
      return images, targets
  
file_path: vision/torchvision/prototype/transforms/_augment.py
imports: from typing import Any, cast, Dict, List, Optional, Tuple, Union
  import PIL.Image
  import torch
  from torch.utils._pytree import tree_flatten, tree_unflatten
  from torchvision import tv_tensors
  from torchvision.ops import masks_to_boxes
  from torchvision.prototype import tv_tensors
  from torchvision.transforms.v2 import functional, InterpolationMode, Transform
  from torchvision.transforms.v2._utils import is_pure_tensor
  from torchvision.transforms.v2.functional._geometry import _check_interpolation
label_desc: Use image node_id 3 for calling the SimpleCopyPaste obj's underlying member method code with example usage: obj._extract_image_targets(flat_sample) and returns: images,  targets