This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import argparse | |
import time | |
import hashlib | |
import tarfile | |
import urllib.request | |
from functools import partial | |
from multiprocessing import Pool | |
import cv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bb_intersection_over_union(box_a, box_b): | |
# determine the (x, y)-coordinates of the intersection rectangle | |
x_a = max(box_a[0], box_b[0]) | |
y_a = max(box_a[1], box_b[1]) | |
x_b = min(box_a[2], box_b[2]) | |
y_b = min(box_a[3], box_b[3]) | |
# compute the area of intersection rectangle | |
inter_area = max(0, x_b - x_a + 1) * max(0, y_b - y_a + 1) |