export function nms()

in omniparser-node/detector.js [36:48]


export function nms(detections, iouThreshold) {
  const result = [];
  while (detections.length > 0) {
    const best = detections.reduce((acc, detection) =>
      detection.score > acc.score ? detection : acc,
    );
    result.push(best);
    detections = detections.filter(
      (detection) => iou(detection, best) < iouThreshold,
    );
  }
  return result;
}