def compute_iou(bbox1, bbox2):
top_1, left_1, bottom_1, right_1 = bbox1<EOL>top_2, left_2, bottom_2, right_2 = bbox2<EOL>if doOverlap(<EOL>(top_1, left_1, bottom_1, right_1), (top_2, left_2, bottom_2, right_2)<EOL>):<EOL><INDENT>intersection = (min(bottom_1, bottom_2) - max(top_1, top_2)) * (<EOL>min(right_1, right_2) - max(left_1, left_2)<EOL>)<EOL>union = (<EOL>(bottom_1 - top_1) * (right_1 - left_1)<EOL>+ (bottom_2 - top_2) * (right_2 - left_2)<EOL>- intersection<EOL>)<EOL>return float(intersection) / float(union)<EOL><DEDENT>return <NUM_LIT:0.0><EOL>
:param bbox1: (page, width, height, top, left, bottom, right)
:param bbox2: (page, width, height, top, left, bottom, right)
:return: intersection over union if bboxes are in the same page and intersect