zhulf0804 / PointPillars

A Simple PointPillars PyTorch Implementation for 3D LiDAR(KITTI) Detection.
MIT License
454 stars 112 forks source link

Potential mistake in anchors2bboxes function #47

Closed jonasdieker closed 1 year ago

jonasdieker commented 1 year ago

Hi there,

I was looking at the above named function and I realised that the mapping from the delta -> bbox is not the inverse of bbox -> delta from the original point pillars paper (Section 3.2). The function in question is shown below:

https://github.com/zhulf0804/PointPillars/blob/b9948e73505c8d6bfa631ffdf76c7148e82c5942/model/anchors.py#L72-L92

For example, to recover z should you not simply insert this after h has been defined: z = deltas[:, 2] * h + anchors[:, 2]?

Also for theta no arcsin is used.

Here the a screenshot of the relevant section in the paper: image

Is this intentional, and if so, why?

Thank you!

zhulf0804 commented 1 year ago

Hello @jonasdieker, Thank you for your good question. And the code is reasonable.

For the first one, anchors[:, 2] is the bottom center, so half height anchors[:, 5] / 2 is added. Maybe the following line is more clear.

z = deltas[:, 2] * anchors[:, 5] + (anchors[:, 2] + anchors[:, 5] / 2)

For the second question, angle offset is predicted as shown in https://github.com/zhulf0804/PointPillars/blob/b9948e73505c8d6bfa631ffdf76c7148e82c5942/model/anchors.py#L113 and loss function is the sin function as shown in https://github.com/zhulf0804/PointPillars/blob/b9948e73505c8d6bfa631ffdf76c7148e82c5942/train.py#L102-L104 So, we get the predicted angle as the following line

theta = anchors[:, 6] + deltas[:, 6] 

Best.

jonasdieker commented 1 year ago

Hello @zhulf0804,

I appreciate you taking the time to respond to my question. It all makes sense now, thank you!