当前位置:   article > 正文

从零理解轻量化隐式bev transformer网络WidthFormer原理和源码1-极坐标的3D位置编码

从零理解轻量化隐式bev transformer网络WidthFormer原理和源码1-极坐标的3D位置编码

目录

  • 简介
  • PETR类型的极坐标位置编码
    • 视锥生成
  • 3D视锥点坐标转换
    • 极坐标编码
      • 可视化
        • ego_coor归一化前的可视化

简介

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-holbgr9I-1721496039065)(https://i-blog.csdnimg.cn/direct/2d211eaddcc147bb8ba92956eaf4a0ad.png#pic_center =800x)]
WidthFormer是一种轻量级且易于部署的BEV变换方法,它使用单层transformer解码器来计算BEV表示。除此之外,还提出了参考位置编码(RefPE),这是一种新的用于3D对象检测的位置编码机制,以辅助WidthFormer的视图转换,重点来啦!它还可以用于以即插即用的方式提高稀疏3D检测器的性能。

PETR类型的极坐标位置编码

视锥生成

函数源码和原理解析

    def create_frustum(self):
        # make grid in image plane
        ogfH, ogfW = self.data_config['input_size']#原始图像的高度和宽度 (256,704)
        fH, fW = ogfH // self.downsample, ogfW // self.downsample# feature图高度和宽度 (16,44)

        if not self.LID: #均匀分布
            ds = torch.arange(*self.grid_config['dbound'], dtype=torch.float).view(-1, 1, 1).expand(-1, fH, fW) # dp in 3d grid:(59,16,44) 59 depths in gridsize(16,44)
        else:#深度值不是均匀分布
            # reference: PETR
            depth_start, depth_end, depth_step = self.grid_config['dbound']
            depth_num = (depth_end - depth_start) // depth_step
            index = torch.arange(start=0, end=depth_num, step=1).float()
            index_1 = index + 1
            bin_size = (depth_end + 1 - depth_start) / (depth_num * (1. + depth_num))
            ds = depth_start + bin_size * index * index_1
            ds = ds.view(-1, 1, 1).expand(-1, fH, fW)
        D, _, _ = ds.shape
        xs = torch.linspace(0, ogfW - 1, fW, dtype=torch.float).view(1, 1, fW).expand(D, fH, fW)# pixel_x in 3d grid
        ys = torch.linspace(0, ogfH - 1, fH, dtype=torch.float).view(1, fH, 1).expand(D, fH, fW)# pixel_y in 3d grid

        # 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/861447
推荐阅读
相关标签
  

闽ICP备14008679号