def test_jaccard_index_3d_euler_angles(): a = BBox3D(3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, euler_angles=[0, 0, 1.59]) b = BBox3D(3.18, z=2.27, y=34.38, height=1.41, width=1.58, length=4.36, euler_angles=[0, 0, 1.58]) assert jaccard_index_3d(a, b) == 0.71636
def test_jaccard_index_3d(): a = BBox3D(x=3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, rw=0.7002847660410397, rx=-0, ry=-0, rz=-0.7138636049350369) b = BBox3D(x=3.18, z=2.27, y=34.38, height=1.41, width=1.58, length=4.36, rx=-0, ry=-0, rz=-0.7103532724176078, rw=0.7038453156522361) assert jaccard_index_3d(a, b) == 0.71232
def test_jaccard_index_3d_rotation_height(): a = BBox3D(3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, rw=0.7002847660410397, rx=-0, ry=-0, rz=-0.7138636049350369) b = BBox3D(3.163, z=1.468, y=34.677, height=1.529, width=1.587, length=3.948, rw=0.8253356149096783, rx=-0, ry=-0, rz=-0.5646424733950354) assert jaccard_index_3d(a, b) == 0.15428
def test_jaccard_index_3d_rotation_only(): """ Since we take the data from KITTI, we need to swap the Y and Z axes. """ a = BBox3D(3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, euler_angles=[0, 0, -1.59]) b = BBox3D(3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, euler_angles=[0, 0, -1.2]) assert jaccard_index_3d(a, b) == 0.62952
def test_jaccard_index_3d_identity(): bb = BBox3D(3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, rw=0.7002847660410397, rx=-0, ry=-0, rz=-0.7138636049350369) assert jaccard_index_3d(bb, bb) == 1
def test_invalid_jaccard_index_3d(): # H=0,W=0,L=0, so the IoU should be nan bb = BBox3D(3.163, z=2.468, y=34.677, height=0, width=0, length=0, rw=0.7002847660410397, rx=-0, ry=-0, rz=-0.7138636049350369) assert jaccard_index_3d(bb, bb) == 0
def test_jaccard_index_3d_polygon_collision(): # these two boxes should not overlap a = BBox3D(x=3.163, z=2.468, y=34.677, height=1.529, width=1.587, length=3.948, rw=0.7002847660410397, rx=-0, ry=-0, rz=-0.7138636049350369) b = BBox3D(x=30.18, z=20.27, y=90.38, height=1.41, width=1.58, length=4.36, rx=-0, ry=-0, rz=-0.7103532724176078, rw=0.7038453156522361) assert jaccard_index_3d(a, b) == 0