File size: 881 Bytes
56bd2b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import torch
from pytorch3d.ops import box3d_overlap

corners1 = torch.tensor([[
            [ 0.2411, -0.1752,  1.2247],
            [ 0.1951, -0.4194,  1.7741],
            [ 0.2036,  0.4826,  2.1757],
            [ 0.2495,  0.7267,  1.6263],
            [-0.2920, -0.1549,  1.1903],
            [-0.3380, -0.3991,  1.7396],
            [-0.3295,  0.5029,  2.1412],
            [-0.2835,  0.7471,  1.5919]]], device='cuda')

corners2 = torch.tensor([[
            [ 0.2390, -0.1764,  1.2246],
            [ 0.1930, -0.4205,  1.7740],
            [ 0.2055,  0.4813,  2.1759],
            [ 0.2515,  0.7254,  1.6265],
            [-0.2940, -0.1536,  1.1901],
            [-0.3400, -0.3978,  1.7395],
            [-0.3274,  0.5040,  2.1414],
            [-0.2815,  0.7482,  1.5920]]], device='cuda')

vol, iou = box3d_overlap(corners1, corners2)

print(iou[0][0])
# should be 0.9944