code: def do_nms(boxes, nms_thresh):
      if len(boxes) > 0:
          nb_class = len(boxes[0].classes)
      else:
          return
  
      for c in range(nb_class):
          sorted_indices = np.argsort(
              [-box.classes[c] for box in boxes]
          )
  
          for i in range(len(sorted_indices)):
              index_i = sorted_indices[i]
  
              if boxes[index_i].classes[c] == 0:
                  continue
  
              for j in range(i + 1, len(sorted_indices)):
                  index_j = sorted_indices[j]
  
                  if (
                      bbox_iou(boxes[index_i], boxes[index_j])
                      >= nms_thresh
                  ):
                      boxes[index_j].classes[c] = 0
  
file_path: ImageAI/imageai_tf_deprecated/Detection/Custom/utils/utils.py
imports: import cv2
  import numpy
  import os
  from .bbox import BoundBox, bbox_iou
  from scipy.special import expit
label_desc: Use image node_id 5 for calling a global function with example usage: do_nms(boxes, nms_thresh) without return types