class_docstr: Dense pose relative annotations that can be applied to any bounding box:
      x - normalized X coordinates [0, 255] of annotated points
      y - normalized Y coordinates [0, 255] of annotated points
      i - body part labels 0,...,24 for annotated points
      u - body part U coordinates [0, 1] for annotated points
      v - body part V coordinates [0, 1] for annotated points
      segm - 256x256 segmentation mask with values 0,...,14
  To obtain absolute x and y data wrt some bounding box one needs to first
  divide the data by 256, multiply by the respective bounding box size
  and add bounding box offset:
      x_img = x0 + x_norm * w / 256.0
      y_img = y0 + y_norm * h / 256.0
  Segmentation masks are typically sampled to get image-based masks.
class_docstr_tok: ["Dense","pose","relative","annotations","that","can","be","applied","to","any","bounding","box",":","x","-","normalized","X","coordinates","[","0",",","255","]","of","annotated","points","y","-","normalized","Y","coordinates","[","0",",","255","]","of","annotated","points","i","-","body","part","labels","0",",","...",",24","for","annotated","points","u","-","body","part","U","coordinates","[","0",",","1","]","for","annotated","points","v","-","body","part","V","coordinates","[","0",",","1","]","for","annotated","points","segm","-","256x256","segmentation","mask","with","values","0",",","...",",14","To","obtain","absolute","x","and","y","data","wrt","some","bounding","box","one","needs","to","first","divide","the","data","by","256",",","multiply","by","the","respective","bounding","box","size","and","add","bounding","box","offset",":","x_img","=","x0","+","x_norm","*","w","\/","256.0","y_img","=","y0","+","y_norm","*","h","\/","256.0","Segmentation","masks","are","typically","sampled","to","get","image-based","masks","."]
code: def _transform_pts(self, transforms, dp_transform_data):
      import detectron2.data.transforms as T
  
      # NOTE: This assumes that HorizFlipTransform is the only one that does flip
      do_hflip = (
          sum(
              isinstance(t, T.HFlipTransform)
              for t in transforms.transforms
          )
          % 2
          == 1
      )
      if do_hflip:
          self.x = self.MASK_SIZE - self.x
          if hasattr(self, "i"):
              self._flip_iuv_semantics(dp_transform_data)
          if hasattr(self, "vertex_ids"):
              self._flip_vertices()
  
      for t in transforms.transforms:
          if isinstance(t, T.RotationTransform):
              xy_scale = (
                  np.array((t.w, t.h)) / DensePoseDataRelative.MASK_SIZE
              )
              xy = t.apply_coords(
                  np.stack((self.x, self.y), axis=1) * xy_scale
              )
              self.x, self.y = torch.tensor(
                  xy / xy_scale, dtype=self.x.dtype
              ).T
  
file_path: detectron2/projects/DensePose/densepose/structures/data_relative.py
imports: import numpy
  import torch
  from torch.nn import functional
  from densepose.data.meshes.catalog import MeshCatalog
  from densepose.structures.mesh import load_mesh_symmetry
  from densepose.structures.transform_data import DensePoseTransformData
label_desc: Use image node_id 7 for calling the DensePoseDataRelative obj's underlying member method code with example usage: obj._transform_pts(transforms, dp_transform_data) without return types