code: def transform_instance_annotations(
      annotation, transforms, image_size, *, keypoint_hflip_indices=None
  ):
      """
      Apply transforms to box, and point annotations of a single instance.
      It will use `transforms.apply_box` for the box, and
      `transforms.apply_coords` for points.
      Args:
          annotation (dict): dict of instance annotations for a single instance.
              It will be modified in-place.
          transforms (TransformList or list[Transform]):
          image_size (tuple): the height, width of the transformed image
          keypoint_hflip_indices (ndarray[int]): see `create_keypoint_hflip_indices`.
      Returns:
          dict:
              the same input dict with fields "bbox", "point_coords", "point_labels"
              transformed according to `transforms`.
              The "bbox_mode" field will be set to XYXY_ABS.
      """
      annotation = base_transform_instance_annotations(
          annotation, transforms, image_size, keypoint_hflip_indices
      )
  
      assert ("point_coords" in annotation) == (
          "point_labels" in annotation
      )
      if "point_coords" in annotation and "point_labels" in annotation:
          point_coords = annotation["point_coords"]
          point_labels = np.array(annotation["point_labels"]).astype(
              float
          )
          point_coords = transforms.apply_coords(point_coords)
  
          # Set all out-of-boundary points to "unlabeled"
          inside = (point_coords >= np.array([0, 0])) & (
              point_coords <= np.array(image_size[::-1])
          )
          inside = inside.all(axis=1)
          point_labels[~inside] = -1
  
          annotation["point_coords"] = point_coords
          annotation["point_labels"] = point_labels
  
      return annotation
  
imports: import numpy
  import torch
  from detectron2.data.detection_utils import annotations_to_instances
  from detectron2.data.detection_utils import transform_instance_annotations
label_desc: Use image node_id 2 for calling a global function with example usage: transform_instance_annotations(annotation, transforms, image_size) and returns: annotation