WeijingShi / Point-GNN

Point-GNN: Graph Neural Network for 3D Object Detection in a Point Cloud, CVPR 2020.
MIT License
524 stars 114 forks source link

the output data coordinates #27

Closed Juuustin closed 4 years ago

Juuustin commented 4 years ago

Recently I tested the algorithm on my own Lidar point cloud, and get some awesome prediction seen from the open3D. When I open the .txt output, I am a little bit confused.

The benchmark of 3D object from kitti use dimensions and locations in camera coordinates, so I guess our output is in camera coordinates as well. I'd like to have the output box in Lidar coordinates, so according to the equation _x = P2 R0_rect Tr_velo_tocam * y I use _Tr_velo_to_cam^-1 R0_rect ^-1P2^-1_ to obtain prediction result in Lidar coordinates, but the output looks like a line instead of a box.

I am wondering if I understand it correctly, and thank you for any advice or suggestion.

WeijingShi commented 4 years ago

Hi @Juuustin, the equation you used is projecting velo points to the image instead of the camera coordinates. kitti_dataset.py contains some projection functions which might help: https://github.com/WeijingShi/Point-GNN/blob/2baf24f9556907f23e2e4018f1b756dac3f6c497/dataset/kitti_dataset.py#L1008

Edit: The projection matrices are computed in the same file as well: https://github.com/WeijingShi/Point-GNN/blob/2baf24f9556907f23e2e4018f1b756dac3f6c497/dataset/kitti_dataset.py#L483

Juuustin commented 4 years ago

Hi @Juuustin, the equation you used is projecting velo points to the image instead of the camera coordinates. kitti_dataset.py contains some projection functions which might help:

https://github.com/WeijingShi/Point-GNN/blob/2baf24f9556907f23e2e4018f1b756dac3f6c497/dataset/kitti_dataset.py#L1008

Edit: The projection matrices are computed in the same file as well: https://github.com/WeijingShi/Point-GNN/blob/2baf24f9556907f23e2e4018f1b756dac3f6c497/dataset/kitti_dataset.py#L483

Hi @WeijingShi , thank you for your reply and it is very helpful. Now I can obtain the 3d box in Lidar coordinates, but it seems there is a drift between the Lidar points and 3d box, I am wondering if it is possible to obtain the coordinate of predicted box from the open3D directly to compare it with my calculated result, looking forward to hearing from you soon~

WeijingShi commented 4 years ago

Hi @Juuustin, the box corner coordinates are computed in the following line before visualization:

https://github.com/WeijingShi/Point-GNN/blob/2baf24f9556907f23e2e4018f1b756dac3f6c497/run.py#L454

They are in the camera coordinates. The cam_to_velo() function should be able to convert them to velo coordinates.

Juuustin commented 4 years ago

Hi, @WeijingShi , thank you for your help, finally I find that the reason for my drift is because of the wrong calibration of Lidar point cloud, the output from Point GNN is very accurate, thank you for your good job.