docstr: Assigns an object to each prediction based on the closest ground truth
  objectness_label: 1 if pred object center is within NEAR_THRESHOLD of any GT object
  objectness_mask: 0 if pred object center is in gray zone (DONOTCARE), 1 otherwise
  object_assignment: Tensor with long int within [0,num_gt_object-1]
  
  Parameters
  ----------
  gt_center : torch.Tensor
      center of ground truth objects [B,K,3]
  near_threshold: float
  far_threshold: float
docstr_tok: ["Assigns","an","object","to","each","prediction","based","on","the","closest","ground","truth","objectness_label",":","1","if","pred","object","center","is","within","NEAR_THRESHOLD","of","any","GT","object","objectness_mask",":","0","if","pred","object","center","is","in","gray","zone","(","DONOTCARE",")",",","1","otherwise","object_assignment",":","Tensor","with","long","int","within","[","0",",","num_gt_object-1","]","Parameters","--","--","--","--","--","gt_center",":","torch.Tensor","center","of","ground","truth","objects","[","B",",","K,3","]","near_threshold",":","float","far_threshold",":","float"]
code: def assign_objects(
      self,
      gt_center: torch.Tensor,
      gt_object_mask: torch.Tensor,
      near_threshold: float,
      far_threshold: float,
  ):
      """Assigns an object to each prediction based on the closest ground truth
      objectness_label: 1 if pred object center is within NEAR_THRESHOLD of any GT object
      objectness_mask: 0 if pred object center is in gray zone (DONOTCARE), 1 otherwise
      object_assignment: Tensor with long int within [0,num_gt_object-1]
  
      Parameters
      ----------
      gt_center : torch.Tensor
          center of ground truth objects [B,K,3]
      near_threshold: float
      far_threshold: float
      """
  
      B = gt_center.shape[0]
      K = self.sampled_votes.shape[1]
      gt_center.shape[1]
      dist1, ind1, _, _ = nn_distance(
          self.sampled_votes, gt_center
      )  # dist1: BxK, dist2: BxK2 TODO Optimise this nn_distance function, does a lot of useless stuff
      # TODO Why computing the closest GT using the vote instead of the corrected center
  
      euclidean_dist1 = torch.sqrt(dist1 + 1e-6)
      gt_mask = torch.gather(gt_object_mask, 1, ind1)
      self.objectness_label = torch.zeros((B, K), dtype=torch.long).to(
          self.sampled_votes.device
      )
      self.objectness_mask = torch.zeros((B, K)).to(
          self.sampled_votes.device
      )
      self.objectness_label[euclidean_dist1 < near_threshold] = 1
      self.objectness_label *= gt_mask
      self.objectness_mask[euclidean_dist1 < near_threshold] = 1
      self.objectness_mask[euclidean_dist1 > far_threshold] = 1
      self.objectness_mask *= gt_mask
  
      self.object_assignment = ind1
  
file_path: torch-points3d/torch_points3d/modules/VoteNet/votenet_results.py
imports: import torch
  from torch_geometric.data import Data
  import numpy
  from typing import List
  from torch_points3d.core.losses.huber_loss import nn_distance
  from torch_points3d.utils.box_utils import box_corners_from_param, nms_samecls
  from torch_points3d.datasets.object_detection.box_data import BoxData
label_desc: Use image node_id 2 for calling the VoteNetResults obj's underlying member method code with example usage: obj.assign_objects(gt_center, gt_object_mask, near_threshold, far_threshold) without return types