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 to(self, device):
      if self.device == device:
          return self
      new_data = DensePoseDataRelative.__new__(DensePoseDataRelative)
      new_data.x = self.x.to(device)
      new_data.y = self.y.to(device)
      for attr in ["i", "u", "v", "vertex_ids", "segm"]:
          if hasattr(self, attr):
              setattr(new_data, attr, getattr(self, attr).to(device))
      if hasattr(self, "mesh_id"):
          new_data.mesh_id = self.mesh_id
      new_data.device = device
      return new_data
  
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 2 for calling the DensePoseDataRelative obj's underlying member method code with example usage: obj.to(device) and returns: new_data, self