docstr: Adds extra labels for the instance and object segmentation tasks
  instance_box_corners: (MAX_NUM_OBJ, 8, 3) corners of the bounding boxes in this room
  center_label: (MAX_NUM_OBJ,3) for GT box center XYZ
  sem_cls_label: (MAX_NUM_OBJ,) semantic class index
  angle_residual_label: (MAX_NUM_OBJ,)
  size_residual_label: (MAX_NUM_OBJ,3)
  box_label_mask: (MAX_NUM_OBJ) as 0/1 with 1 indicating a unique box
  vote_label: (N,3) with votes XYZ
  vote_label_mask: (N,) with 0/1 with 1 indicating the point is in one of the object's OBB.
docstr_tok: ["Adds","extra","labels","for","the","instance","and","object","segmentation","tasks","instance_box_corners",":","(","MAX_NUM_OBJ",",","8",",","3",")","corners","of","the","bounding","boxes","in","this","room","center_label",":","(","MAX_NUM_OBJ,3",")","for","GT","box","center","XYZ","sem_cls_label",":","(","MAX_NUM_OBJ",",",")","semantic","class","index","angle_residual_label",":","(","MAX_NUM_OBJ",",",")","size_residual_label",":","(","MAX_NUM_OBJ,3",")","box_label_mask",":","(","MAX_NUM_OBJ",")","as","0\/1","with","1","indicating","a","unique","box","vote_label",":","(","N,3",")","with","votes","XYZ","vote_label_mask",":","(","N",",",")","with","0\/1","with","1","indicating","the","point","is","in","one","of","the","object","'s","OBB","."]
code: def _set_extra_labels(self, data):
      """Adds extra labels for the instance and object segmentation tasks
      instance_box_corners: (MAX_NUM_OBJ, 8, 3) corners of the bounding boxes in this room
      center_label: (MAX_NUM_OBJ,3) for GT box center XYZ
      sem_cls_label: (MAX_NUM_OBJ,) semantic class index
      angle_residual_label: (MAX_NUM_OBJ,)
      size_residual_label: (MAX_NUM_OBJ,3)
      box_label_mask: (MAX_NUM_OBJ) as 0/1 with 1 indicating a unique box
      vote_label: (N,3) with votes XYZ
      vote_label_mask: (N,) with 0/1 with 1 indicating the point is in one of the object's OBB.
      """
      # Initaliase variables
      num_points = data.pos.shape[0]
      semantic_labels = data.y
      instance_labels = data.instance_labels
  
      center_label = torch.zeros((self.MAX_NUM_OBJ, 3))
      target_bboxes_mask = torch.zeros(
          (self.MAX_NUM_OBJ), dtype=torch.bool
      )
      angle_residuals = torch.zeros((self.MAX_NUM_OBJ,))
      size_classes = torch.zeros((self.MAX_NUM_OBJ,))
      size_residuals = torch.zeros((self.MAX_NUM_OBJ, 3))
  
      # compute votes *AFTER* augmentation
      # generate votes
      # Note: since there's no map between bbox instance labels and
      # pc instance_labels (it had been filtered
      # in the data preparation step) we'll compute the instance bbox
      # from the points sharing the same instance label.
      point_votes = torch.zeros([num_points, 3])
      point_votes_mask = torch.zeros(num_points, dtype=torch.bool)
      instance_box_corners = []
      box_sizes = []
      centers = []
      instance_classes = []
      for i_instance in np.unique(instance_labels):
          # find all points belong to that instance
          ind = np.where(instance_labels == i_instance)[0]
          # find the semantic label
          instance_class = semantic_labels[ind[0]].item()
          if instance_class in self.NYU40IDS:
              pos = data.pos[ind, :3]
              max_pox = pos.max(0)[0]
              min_pos = pos.min(0)[0]
              center = 0.5 * (min_pos + max_pox)
              point_votes[ind, :] = center - pos
              point_votes_mask[ind] = True
              box_size = max_pox - min_pos
              instance_box_corners.append(
                  box_corners_from_param(box_size, 0, center)
              )
              box_sizes.append(box_size)
              centers.append(center)
              instance_classes.append(
                  self.NYU40ID2CLASS[instance_class]
              )
      point_votes = point_votes.repeat((1, 3))  # make 3 votes identical
      instance_classes = torch.tensor(instance_classes)
  
      # Keep only boxes with valid ids
      num_instances = len(instance_classes)
      target_bboxes_mask[0:num_instances] = True
  
      # Set box semantic label
      target_bboxes_semcls = np.zeros((self.MAX_NUM_OBJ))
      target_bboxes_semcls[0:num_instances] = instance_classes
  
      # Set size residual and box centres
      size_classes[0:num_instances] = instance_classes
      if num_instances > 0:
          box_sizes = torch.stack(box_sizes)
          centers = torch.stack(centers)
          size_residuals[
              0:num_instances, :
          ] = box_sizes - torch.from_numpy(
              self.MEAN_SIZE_ARR[instance_classes, :]
          )
          center_label[0:num_instances, :] = centers
  
      data.center_label = center_label
      data.heading_class_label = torch.zeros((self.MAX_NUM_OBJ,))
      data.heading_residual_label = angle_residuals.float()
      data.size_class_label = size_classes
      data.size_residual_label = size_residuals.float()
      data.sem_cls_label = torch.from_numpy(target_bboxes_semcls).int()
      data.box_label_mask = target_bboxes_mask
      data.vote_label = point_votes.float()
      data.vote_label_mask = point_votes_mask
      data.instance_box_corners = torch.zeros((self.MAX_NUM_OBJ, 8, 3))
      if len(instance_box_corners):
          data.instance_box_corners[
              : len(instance_box_corners), :, :
          ] = torch.stack(instance_box_corners)
  
      delattr(data, "instance_bboxes")
      delattr(data, "instance_labels")
  
      # Remap labels
      data.y = super()._remap_labels(data.y)
      return data
  
imports: import os
  import numpy
  import torch
  import logging
  from torch_geometric.data import InMemoryDataset
  from torch_points3d.datasets.segmentation.scannet import Scannet, NUM_CLASSES, IGNORE_LABEL
  from torch_points3d.metrics.object_detection_tracker import ObjectDetectionTracker
  from torch_points3d.datasets.base_dataset import BaseDataset, save_used_properties
  from torch_points3d.utils.box_utils import box_corners_from_param
label_desc: Use image node_id 3 for calling the ScannetObjectDetection obj's underlying member method code with example usage: obj._set_extra_labels(data) and returns: data