code: def iou_score(box1, box2):
      """Returns the Intersection-over-Union score, defined as the area of
      the intersection divided by the intersection over the union of
      the two bounding boxes. This measure is symmetric.
  
      Args:
          box1: The coordinates for box 1 as a list of (x, y) coordinates
          box2: The coordinates for box 2 in same format as box1.
      """
      if len(box1) == 2:
          x1, y1 = box1[0]
          x2, y2 = box1[1]
          box1 = np.array([[x1, y1], [x2, y1], [x2, y2], [x1, y2]])
      if len(box2) == 2:
          x1, y1 = box2[0]
          x2, y2 = box2[1]
          box2 = np.array([[x1, y1], [x2, y1], [x2, y2], [x1, y2]])
      if any(
          cv2.contourArea(
              np.array(box, dtype="int32")[:, np.newaxis, :]
          )
          == 0
          for box in [box1, box2]
      ):
          warnings.warn("A box with zero area was detected.")
          return 0
      pc = pyclipper.Pyclipper()
      pc.AddPath(
          np.array(box1, dtype="int32"),
          pyclipper.PT_SUBJECT,
          closed=True,
      )
      pc.AddPath(
          np.array(box2, dtype="int32"), pyclipper.PT_CLIP, closed=True
      )
      intersection_solutions = pc.Execute(
          pyclipper.CT_INTERSECTION,
          pyclipper.PFT_EVENODD,
          pyclipper.PFT_EVENODD,
      )
      union_solutions = pc.Execute(
          pyclipper.CT_UNION,
          pyclipper.PFT_EVENODD,
          pyclipper.PFT_EVENODD,
      )
      union = sum(
          cv2.contourArea(
              np.array(points, dtype="int32")[:, np.newaxis, :]
          )
          for points in union_solutions
      )
      intersection = sum(
          cv2.contourArea(
              np.array(points, dtype="int32")[:, np.newaxis, :]
          )
          for points in intersection_solutions
      )
      return intersection / union
  
file_path: keras-ocr/keras_ocr/evaluation.py
imports: import copy
  import typing
  import warnings
  import editdistance
  import numpy
  import pyclipper
  import cv2
label_desc: Use image node_id 1 for calling a global function with example usage: iou_score(box1, box2) and returns: unknown, int