Skip to content

Instantly share code, notes, and snippets.

@daisenryaku
daisenryaku / download_google_drive.md
Last active October 29, 2017 06:58
download_google_drive
@daisenryaku
daisenryaku / 3DNMS.py
Last active April 25, 2021 04:01
3D NMS(Non-Maximum Suppression)
# [Non-Maximum Suppression](https://www.pyimagesearch.com/2014/11/17/non-maximum-suppression-object-detection-python/)
import numpy as np
# [IoU](https://gist.github.com/daisenryaku/91e6f6d78f49f67602d21dc57d494c60)
def nms(x, nms_th):
# x:[p, z, w, h, d]
if len(x) == 0:
return x
x = x[np.argsort(-x[:, 0])]
bboxes = [x[0]]
@daisenryaku
daisenryaku / 3DIoU.py
Last active June 6, 2020 08:36
3D IoU (Intersection over Union)
# 3D IoU python Implementation
# [IoU](https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/)
def IoU(box0, box1):
# box0: [x, y, z, d]
r0 = box0[3] / 2
s0 = box0[:3] - r0
e0 = box0[:3] + r0
r1 = box1[3] / 2
s1 = box1[:3] - r1