Skip to content

Instantly share code, notes, and snippets.

@ohadlights
ohadlights / bb_intersection_over_union.py
Created April 29, 2019 07:03
Intersection over union for bounding boxes
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)
@ohadlights
ohadlights / landmarks_recognition_2019_download_train.py
Last active May 1, 2019 06:35
Landmarks Recognition 2019: Download and resize train images
import os
import argparse
import time
import hashlib
import tarfile
import urllib.request
from functools import partial
from multiprocessing import Pool
import cv2