parameters: (self, boxes, box_confidences)
return_statement: return keep
docstring: Apply the Non-Maximum Suppression (NMS) algorithm on the bounding boxes with their
          confidence scores and return an array with the indexes of the bounding boxes we want to
          keep (and display later).
  
          Keyword arguments:
          boxes -- a NumPy array containing N bounding-box coordinates that survived filtering,
          with shape (N,4); 4 for x,y,height,width coordinates of the boxes
          box_confidences -- a Numpy array containing the corresponding confidences with shape N
docstring_summary: Apply the Non-Maximum Suppression (NMS) algorithm on the bounding boxes with their
          confidence scores and return an array with the indexes of the bounding boxes we want to
          keep (and display later).
docstring_tokens: Apply the Non - Maximum Suppression ( NMS ) algorithm on the bounding boxes with their confidence scores and return an array with the indexes of the bounding boxes we want to keep ( and display later ) .
function: def _nms_boxes(self, boxes, box_confidences):
          """Apply the Non-Maximum Suppression (NMS) algorithm on the bounding boxes with their
          confidence scores and return an array with the indexes of the bounding boxes we want to
          keep (and display later).
  
          Keyword arguments:
          boxes -- a NumPy array containing N bounding-box coordinates that survived filtering,
          with shape (N,4); 4 for x,y,height,width coordinates of the boxes
          box_confidences -- a Numpy array containing the corresponding confidences with shape N
          """
          x_coord = boxes[:, 0]
          y_coord = boxes[:, 1]
          width = boxes[:, 2]
          height = boxes[:, 3]
  
          areas = width * height
          ordered = box_confidences.argsort()[::-1]
  
          keep = list()
          while ordered.size > 0:
              # Index of the current element:
              i = ordered[0]
              keep.append(i)
              xx1 = np.maximum(x_coord[i], x_coord[ordered[1:]])
              yy1 = np.maximum(y_coord[i], y_coord[ordered[1:]])
              xx2 = np.minimum(x_coord[i] + width[i], x_coord[ordered[1:]] + width[ordered[1:]])
              yy2 = np.minimum(y_coord[i] + height[i], y_coord[ordered[1:]] + height[ordered[1:]])
  
              width1 = np.maximum(0.0, xx2 - xx1 + 1)
              height1 = np.maximum(0.0, yy2 - yy1 + 1)
              intersection = width1 * height1
              union = (areas[i] + areas[ordered[1:]] - intersection)
  
              # Compute the Intersection over Union (IoU) score:
              iou = intersection / union
  
              # The goal of the NMS algorithm is to reduce the number of adjacent bounding-box
              # candidates to a minimum. In this step, we keep only those elements whose overlap
              # with the current bounding box is lower than the threshold:
              indexes = np.where(iou <= self.nms_threshold)[0]
              ordered = ordered[indexes + 1]
  
          keep = np.array(keep)
          return keep
function_tokens: def _nms_boxes ( self , boxes , box_confidences ) : x_coord = boxes [ : , 0 ] y_coord = boxes [ : , 1 ] width = boxes [ : , 2 ] height = boxes [ : , 3 ] areas = width * height ordered = box_confidences . argsort ( ) [ : : - 1 ] keep = list ( ) while ordered . size > 0 : # Index of the current element: i = ordered [ 0 ] keep . append ( i ) xx1 = np . maximum ( x_coord [ i ] , x_coord [ ordered [ 1 : ] ] ) yy1 = np . maximum ( y_coord [ i ] , y_coord [ ordered [ 1 : ] ] ) xx2 = np . minimum ( x_coord [ i ] + width [ i ] , x_coord [ ordered [ 1 : ] ] + width [ ordered [ 1 : ] ] ) yy2 = np . minimum ( y_coord [ i ] + height [ i ] , y_coord [ ordered [ 1 : ] ] + height [ ordered [ 1 : ] ] ) width1 = np . maximum ( 0.0 , xx2 - xx1 + 1 ) height1 = np . maximum ( 0.0 , yy2 - yy1 + 1 ) intersection = width1 * height1 union = ( areas [ i ] + areas [ ordered [ 1 : ] ] - intersection ) # Compute the Intersection over Union (IoU) score: iou = intersection / union # The goal of the NMS algorithm is to reduce the number of adjacent bounding-box # candidates to a minimum. In this step, we keep only those elements whose overlap # with the current bounding box is lower than the threshold: indexes = np . where ( iou <= self . nms_threshold ) [ 0 ] ordered = ordered [ indexes + 1 ] keep = np . array ( keep ) return keep