fcjian / AeDet

AeDet: Azimuth-invariant Multi-view 3D Object Detection, CVPR2023
MIT License
72 stars 5 forks source link

ida和bda矩阵的意义是什么? #10

Open ww249 opened 1 year ago

ww249 commented 1 year ago

..\AeDet\layers\backbones\lss_fpn.py中有这样一段代码:

def get_geometry(self, sensor2ego_mat, intrin_mat, ida_mat, bda_mat):
    """Transfer points from camera coord to ego coord.

    Args:
        rots(Tensor): Rotation matrix from camera to ego.
        trans(Tensor): Translation matrix from camera to ego.
        intrins(Tensor): Intrinsic matrix.
        post_rots_ida(Tensor): Rotation matrix for ida.
        post_trans_ida(Tensor): Translation matrix for ida
        post_rot_bda(Tensor): Rotation matrix for bda.

    Returns:
        Tensors: points ego coord.
    """
    batch_size, num_cams, _, _ = sensor2ego_mat.shape

    # undo post-transformation
    # B x N x D x H x W x 3
    points = self.frustum
    ida_mat = ida_mat.view(batch_size, num_cams, 1, 1, 1, 4, 4)
    points = ida_mat.inverse().matmul(points.unsqueeze(-1))
    # cam_to_ego
    points = torch.cat(
        (points[:, :, :, :, :, :2] * points[:, :, :, :, :, 2:3],
         points[:, :, :, :, :, 2:]), 5)

    combine = sensor2ego_mat.matmul(torch.inverse(intrin_mat))
    points = combine.view(batch_size, num_cams, 1, 1, 1, 4,
                          4).matmul(points)
    if bda_mat is not None:
        bda_mat = bda_mat.unsqueeze(1).repeat(1, num_cams, 1, 1).view(
            batch_size, num_cams, 1, 1, 1, 4, 4)
        points = (bda_mat @ points).squeeze(-1)
    else:
        points = points.squeeze(-1)
    return points[..., :3]

any apply is appreciated!!

qq1361096516 commented 9 months ago

ida是指在图像上做的数据增强得到的数据增强矩阵,只会影响图像内参 bda是指在BEV空间下对GT进行数据增强得到的数据增强矩阵,只会影响到相机到激光雷达的外参