PersFormer_3DLane icon indicating copy to clipboard operation
PersFormer_3DLane copied to clipboard

question about init_dataset_openlane_beta

Open fuzzypants123 opened this issue 2 years ago • 1 comments

hi, thank you for the excellent work! I have a question about Load_Data.py in line 1270 and below, that you "Re-calculate extrinsic matrix based on ground coordinate", I don't understand what "R_vq" and "R_gc" stand for , besides ,how come "cam_representation" in line 1309, could you please give me more details about this?

` 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 cam_extrinsics_all.append(cam_extrinsics)

                # gt_cam_height = info_dict['cam_height']
                gt_cam_height = cam_extrinsics[2, 3]
                gt_cam_height_all.append(gt_cam_height)
                if 'cam_pitch' in info_dict:
                    gt_cam_pitch = info_dict['cam_pitch']
                    gt_cam_pitch_all.append(gt_cam_pitch)
                else:
                    gt_cam_pitch_all.append(0)

                if 'intrinsic' in info_dict:
                    cam_intrinsics = info_dict['intrinsic']
                    cam_intrinsics = np.array(cam_intrinsics)
                    cam_intrinsics_all.append(cam_intrinsics)
                else:
                    cam_intrinsics_all.append(self.K)

            gt_lanes_packed = info_dict['lane_lines']
            gt_lane_pts, gt_lane_visibility, gt_laneline_category = [], [], []
            for i, gt_lane_packed in enumerate(gt_lanes_packed):
                # A GT lane can be either 2D or 3D
                # if a GT lane is 3D, the height is intact from 3D GT, so keep it intact here too
                lane = np.array(gt_lane_packed['xyz'])
                lane_visibility = np.array(gt_lane_packed['visibility'])

                # Coordinate convertion for openlane_300 data
                lane = np.vstack((lane, np.ones((1, lane.shape[1]))))
                cam_representation = np.linalg.inv(
                                        np.array([[0, 0, 1, 0],
                                                  [-1, 0, 0, 0],
                                                  [0, -1, 0, 0],
                                                  [0, 0, 0, 1]], dtype=float))  # transformation from apollo camera to openlane camera
                lane = np.matmul(cam_extrinsics, np.matmul(cam_representation, lane))`

fuzzypants123 avatar Oct 13 '22 09:10 fuzzypants123

Hi, refer to issue that may help you.

RicardLee avatar Oct 13 '22 19:10 RicardLee

Hi, refer to issue that may help you.

helps a lot, thanks!

fuzzypants123 avatar Oct 19 '22 06:10 fuzzypants123