def iou(a, b): 
    """ Computes intersection over union, which is high if two AABBs are similar and highly overlapping """ 
    a_xmax = a.x + a.w
    a_ymax = a.y + a.h
    b_xmax = b.x + b.w
    b_ymax = b.y + b.h
    
    xA = max(a.x, b.x)
    yA = max(a.y, b.y)
    xB = min(a_xmax, b_xmax)
    yB = min(a_ymax, b_ymax)
	
    interArea = (xB - xA) * (yB - yA)
	
    boxAArea = a.w*a.h
    boxBArea = b.w*b.h
	
    iou = interArea / float(boxAArea + boxBArea - interArea)
	
    return iou