OpenDriveLab / OpenLane

[ECCV 2022 Oral] OpenLane: Large-scale Realistic 3D Lane Dataset
Apache License 2.0
494 stars 46 forks source link

questions about lane annotation #13

Closed anm-Yi closed 2 years ago

anm-Yi commented 2 years ago

thanks for your great job.I have some questions about lane annotaion as follow: (1) what "attribute:0" means? And I found that most of time it equals 0 (2) how to project 3D points under xyz camera coordinate to uv image coordinate? I tried [x,y,1]^T=K[X,Y,Z,1],which XYZ came from 3D points ["xyz"] in json and K came from ["intrinsic"], but points generated seemed wrong.

k1 = np.c_[np.array(json["intrinsic"]),np.zeros(3)] t = np.array(XYZ.reshape(-1,1)) xyz = np.matmul(k1,t)

dyfcalid commented 2 years ago

Thank you for your issue. 1) We only annotate the four most important lanes near the ego-vehicle to the number 1-4 (the left-left lane is 1, the left lane is 2, the right lane is 3 and the right-right lane is 4), and the other lanes or road edges to 0. 2) The 3D lane points are under the coordinate system which has the x-axis pointing forward, the y-axis left, and the z-axis up. So before multiplying by the camera intrinsic matrix, it needs to be converted to the standard camera coordinate system (x-axis right, y-axis down, z-axis forward). Here is a simple example:

lane = np.array(lane_line['xyz'])
lane = np.vstack((lane, np.ones((1, lane.shape[1]))))
cam_representation = np.array([[0, -1, 0, 0],
                              [0, 0, -1, 0],
                              [1, 0, 0, 0],
                              [0, 0, 0, 1]], dtype=float)
lane = np.matmul(cam_representation, lane)
lane = lane[0:3, :]
lane = np.matmul(json["intrinsics"], lane)
x_2d = lane[0,:] / lane[2,:]
y_2d = lane[1,:] / lane[2,:]
anm-Yi commented 2 years ago

Thanks for your reply!

  1. I've known the meaning of number 1-4,but some labels made me confused, such as labels for the folder "segment- 9907794657177651763_1126_570_1146_570_with_camera_labels",all of which are 0.
  2. Nice code! I missed the conversion and now your code works.

So for 1. I wanna to confirm if I havn't miss other information, which means annotation has some mistakes, then I will close the issue.

dyfcalid commented 2 years ago

I've known the meaning of number 1-4,but some labels made me confused, such as labels for the folder "segment- 9907794657177651763_1126_570_1146_570_with_camera_labels",all of which are 0.

We have checked the annotations and there is indeed such a problem, and we will fix it later. Thanks.

anm-Yi commented 2 years ago

Please mention it here if you have done this work. Thanks!

nikhil-nakhate commented 2 years ago

Hi @dyfcalid , Thanks for explanation about the transformation of the camera frames. I had a related question. Why are the extrinsics re computed? What are the original extrinsics with respect to? The following is the piece of code that I am referring to:

                cam_extrinsics = np.array(info_dict['extrinsic'])
                # Re-calculate extrinsic matrix based on ground coordinate
                R_vg = np.array([[0, 1, 0],
                                    [-1, 0, 0],
                                    [0, 0, 1]], dtype=float)
                R_gc = np.array([[1, 0, 0],
                                    [0, 0, 1],
                                    [0, -1, 0]], dtype=float)
                cam_extrinsics[:3, :3] = np.matmul(np.matmul(
                                            np.matmul(np.linalg.inv(R_vg), cam_extrinsics[:3, :3]),
                                                R_vg), R_gc)
                cam_extrinsics[0:2, 3] = 0.0