Megvii-BaseDetection / BEVDepth

Official code for BEVDepth.
MIT License
688 stars 96 forks source link

是否使用了多帧的内外参矩阵 #104

Closed Isaac-xie closed 1 year ago

Isaac-xie commented 1 year ago

使用代码:bev_depth_lss_r50_256x704_128x128_24e_2key

在网络的backbone:base_lss_fpn.py中的forword函数 可以看到将两帧图像先后投入_forward_single_sweep函数

`

    key_frame_res = self._forward_single_sweep(0,
        sweep_imgs[:, 0:1, ...],
        mats_dict,
        is_return_depth=is_return_depth)
    if num_sweeps == 1:
        return key_frame_res

    key_frame_feature = key_frame_res[0] if is_return_depth else key_frame_res

    ret_feature_list = [key_frame_feature]
    for sweep_index in range(1, num_sweeps):
        with torch.no_grad():
            feature_map = self._forward_single_sweep(
                sweep_index,
                sweep_imgs[:, sweep_index:sweep_index + 1, ...],
                mats_dict,
                is_return_depth=False)
            ret_feature_list.append(feature_map)`

但是mats_dict仍然是两帧的相机参数相关值 随后一直到在depth_net类中的forward,我没有看到对mats_dict取哪一帧的操作,都是取第一帧。这是否存在bug

`

    intrins = mats_dict['intrin_mats'][:, 0:1, ..., :3, :3]
    batch_size = intrins.shape[0]
    num_cams = intrins.shape[2]
    ida = mats_dict['ida_mats'][:, 0:1, ...]
    sensor2ego = mats_dict['sensor2ego_mats'][:, 0:1, ..., :3, :]
    bda = mats_dict['bda_mat'].view(batch_size, 1, 1, 4,
                                    4).repeat(1, 1, num_cams, 1, 1)

`

yinchimaoliang commented 1 year ago

前后两帧的bda, intrin_mat和sensor2ego是一致的,因此不需要额外取第二帧

Isaac-xie commented 1 year ago

debug时,mats_dict['sensor2ego_mats']前后两帧似乎不是一致的

Isaac-xie commented 1 year ago

按照 https://github.com/Megvii-BaseDetection/BEVDepth/issues/103 中所示,sensor2ego_mats应该是非关键帧sensors到关键帧ego的之间的外参矩阵。是否是生成深度图时,需要的是非关键帧sensors到非关键帧ego的之间的外参矩阵。

yinchimaoliang commented 1 year ago

sweepsensor2sweepego是一样的,sweepsensor2keyego是不一样的