def create_random_suppressed(nms_thresh=.4, shape=(64, 65, 67), noise=.1, n_rays=32): prob, dist, rays = create_random_data(shape, noise, n_rays) points, probi, disti = non_maximum_suppression_3d(dist, prob, rays, prob_thresh=0.9, nms_thresh=nms_thresh, verbose=True) return points, probi, disti, rays
def test_nms_kdtree(nms_thresh=0.1, shape=(33, 44, 55), noise=.1, n_rays=32): prob, dist, rays = create_random_data(shape, noise, n_rays) points1, probi1, disti1 = non_maximum_suppression_3d(dist, prob, rays, prob_thresh=0.9, nms_thresh=nms_thresh, use_kdtree=False, verbose=True) points2, probi2, disti2 = non_maximum_suppression_3d(dist, prob, rays, prob_thresh=0.9, nms_thresh=nms_thresh, use_kdtree=True, verbose=True) assert np.allclose(points1, points2) assert np.allclose(probi1, probi2) assert np.allclose(disti1, disti2) return (points1, probi1, disti1), (points2, probi2, disti2)
def test_nms(): dist = 10 * np.ones((33, 44, 55, 32)) prob = np.random.uniform(0, 1, dist.shape[:3]) rays = Rays_GoldenSpiral(dist.shape[-1]) points, probi, disti = non_maximum_suppression_3d(dist, prob, rays, prob_thresh=0.8, nms_thresh=0, verbose=True) return points, rays, disti