code: def cal_iou(bbox1, bbox2):
      bbox1_poly = Polygon(bbox1).convex_hull
      bbox2_poly = Polygon(bbox2).convex_hull
      union_poly = np.concatenate((bbox1, bbox2))
  
      if not bbox1_poly.intersects(bbox2_poly):
          iou = 0
      else:
          inter_area = bbox1_poly.intersection(bbox2_poly).area
          union_area = MultiPoint(union_poly).convex_hull.area
          if union_area == 0:
              iou = 0
          else:
              iou = float(inter_area) / union_area
      return iou
  
imports: import os
  import re
  import cv2
  import glob
  import copy
  import math
  import pickle
  import numpy
  from shapely.geometry import Polygon, MultiPoint
label_desc: Use image node_id 6 for calling a global function with example usage: cal_iou(bbox1, bbox2) and returns: iou