code: def nms(boxes, threshold, method):
      if boxes.size == 0:
          return np.empty((0, 3))
      x1 = boxes[:, 0]
      y1 = boxes[:, 1]
      x2 = boxes[:, 2]
      y2 = boxes[:, 3]
      s = boxes[:, 4]
      area = (x2 - x1 + 1) * (y2 - y1 + 1)
      I = np.argsort(s)
      pick = np.zeros_like(s, dtype=np.int16)
      counter = 0
      while I.size > 0:
          i = I[-1]
          pick[counter] = i
          counter += 1
          idx = I[0:-1]
          xx1 = np.maximum(x1[i], x1[idx])
          yy1 = np.maximum(y1[i], y1[idx])
          xx2 = np.minimum(x2[i], x2[idx])
          yy2 = np.minimum(y2[i], y2[idx])
          w = np.maximum(0.0, xx2 - xx1 + 1)
          h = np.maximum(0.0, yy2 - yy1 + 1)
          inter = w * h
          if method is "Min":
              o = inter / np.minimum(area[i], area[idx])
          else:
              o = inter / (area[i] + area[idx] - inter)
          I = I[np.where(o <= threshold)]
      pick = pick[0:counter]
      return pick
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import cv2
  import os
  import inspect
label_desc: Use image node_id 7 for calling a global function with example usage: nms(boxes, threshold, method) and returns: pick, np