yezhen17 / 3DIoUMatch

[CVPR 2021] PyTorch implementation of 3DIoUMatch: Leveraging IoU Prediction for Semi-Supervised 3D Object Detection.
155 stars 16 forks source link

IoU question #7

Closed monster-ghost closed 3 years ago

monster-ghost commented 3 years ago

Hi , I have a question in lhs_3d_faster_samecls when I run your code.

Is the process of calculating the IOU in 3D so simple? No need to consider the rotation angle?

` xx1 = np.maximum(x1[i], x1[I[:last-1]])
zz1 = np.maximum(z1[i], z1[I[:last-1]]) xx2 = np.minimum(x2[i], x2[I[:last-1]]) yy2 = np.minimum(y2[i], y2[I[:last-1]]) zz2 = np.minimum(z2[i], z2[I[:last-1]]) cls1 = cls[i] cls2 = cls[I[:last-1]]

    l = np.maximum(0, xx2-xx1)
    w = np.maximum(0, yy2-yy1)
    h = np.maximum(0, zz2-zz1)

    if old_type:
        o = (l*w*h)/area[I[:last-1]]
    else:
        inter = l*w*h
        o = inter / (area[i] + area[I[:last-1]] - inter)`

code process: Input 8 corners of Box1 and Box2,find the maximum and minimum values on x,y,z in each of the 8 corners. Then for the x-minimum of the two boxes, take the largest one. y and z are the same.
Then for the x-maximum of the two boxes, take the smallest one. y and z are the same. Then calculate l,w,h, and multiply them to get the intersection.

Can you explain the process? It feels like the IOU calculated this way is not correct?

yezhen17 commented 3 years ago

Hi @monster-ghost ,

I had the same confusion when I read the code of VoteNet. This is NMS without considering the effect of rotation. VoteNet probably did this for efficiency, since their implementation of rotation-aware 3D IoU calculation is quite slow. Though OpenPCDet has an efficient gpu implementation of rotation-aware 3D IoU calculation, we kept the VoteNet implementation for fair comparison. Actually we tried to use the rotation-aware version, but the results are almost the same (since this is like altering the threshold of NMS).

monster-ghost commented 3 years ago

OK, thanks!