hull
0
Q:

install iou library python

def iou(box1, box2):    #Calculating (xi1,yi1,xi2,yi2) of the intersection of box1 and box2     xi1 = max(box1[0], box2[0])    yi1 = max(box1[1], box2[1])    xi2 = min(box1[2], box2[2])    yi2 = min(box1[3], box2[3])    #Calculating the area of intersection    inter_area = (yi2-yi1)*(xi2-xi1)    #Calculating the areas of box1 and box2 using the same formula    box1_area = (box1[3] - box1[1])*(box1[2] - box1[0])    box2_area = (box2[3] - box2[1])*(box2[2] - box2[0])    #Calculating the union area by using the formula: union(A,B) = A+B-Inter(A,B)    union_area = box1_area + box2_area - inter_area    #Calculating iou    iou = inter_area/union_area        return iou
0

New to Communities?

Join the community