code: def nms_samecls(boxes, classes, scores, overlap_threshold=0.25):
      """Returns the list of boxes that are kept after nms.
      A box is suppressed only if it overlaps with
      another box of the same class that has a higher score
  
      Parameters
      ----------
      boxes : [num_boxes, 6]
          xmin, ymin, zmin, xmax, ymax, zmax
      classes : [num_shapes]
          Class of each box
      scores : [num_shapes,]
          score of each box
      overlap_threshold : float, optional
          [description], by default 0.25
      """
      if torch.is_tensor(boxes):
          boxes = boxes.cpu().numpy()
      if torch.is_tensor(scores):
          scores = scores.cpu().numpy()
      if torch.is_tensor(classes):
          classes = classes.cpu().numpy()
  
      x1 = boxes[:, 0]
      y1 = boxes[:, 1]
      z1 = boxes[:, 2]
      x2 = boxes[:, 3]
      y2 = boxes[:, 4]
      z2 = boxes[:, 5]
      area = (x2 - x1) * (y2 - y1) * (z2 - z1)
  
      I = np.argsort(scores)
      pick = []
      while I.size != 0:
          last = I.size
          i = I[-1]
          pick.append(i)
  
          xx1 = np.maximum(x1[i], x1[I[: last - 1]])
          yy1 = np.maximum(y1[i], y1[I[: last - 1]])
          zz1 = np.maximum(z1[i], z1[I[: last - 1]])
          xx2 = np.minimum(x2[i], x2[I[: last - 1]])
          yy2 = np.minimum(y2[i], y2[I[: last - 1]])
          zz2 = np.minimum(z2[i], z2[I[: last - 1]])
          cls1 = classes[i]
          cls2 = classes[I[: last - 1]]
  
          l = np.maximum(0, xx2 - xx1)
          w = np.maximum(0, yy2 - yy1)
          h = np.maximum(0, zz2 - zz1)
  
          inter = l * w * h
          o = inter / (area[i] + area[I[: last - 1]] - inter)
          o = o * (cls1 == cls2)
  
          I = np.delete(
              I,
              np.concatenate(
                  ([last - 1], np.where(o > overlap_threshold)[0])
              ),
          )
  
      return pick
  
file_path: torch-points3d/torch_points3d/utils/box_utils.py
imports: import torch
  import numpy
  from scipy.spatial import ConvexHull
  from .geometry import euler_angles_to_rotation_matrix
label_desc: Use image node_id 2 for calling a global function with example usage: nms_samecls(boxes, classes, scores, overlap_threshold) and returns: pick