fcjian / AeDet

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

ae_offset计算相关 #14

Open qq1361096516 opened 9 months ago

qq1361096516 commented 9 months ago

文件:AeDet-main\mmdetection3d\mmdet3d\ops\aeconv\aeconv.py 中 计算方位角偏差 ae_offset = torch.bmm(rot_matrix, conv_offset.transpose(1, 2)).transpose(1, 2) - conv_offset 想问下,最后的 - conv_offset 的含义是什么

fcjian commented 9 months ago

'- conv_offset' is used for adapting to the 'deform_conv2d' function.

The 'deform_conv2d' function carries out the offset based on the sampling grid of the typical convolution. On the other hand, 'torch.bmm(rot_matrix, conv_offset.transpose(1, 2)).transpose(1, 2)' denotes the offset of AeConv based on the center point of the convolution. Thus, 'torch.bmm(rot_matrix, conv_offset.transpose(1, 2)).transpose(1, 2) - conv_offset' signifies the offset of AeConv based on the sampling grid of the typical convolution, which aligns with the 'deform_conv2d' function.

qq1361096516 commented 8 months ago

感谢解答

qq1361096516 commented 8 months ago

文件:AeDet-main\mmdetection3d\mmdet3d\ops\aeconv\aeconv.py 中 def get_offset(self, size):

compute the rotation matrix of AeConv

    h, w = size
    out_h, out_w = h // self.stride[0], w // self.stride[1]

此处计算 out_h, out_w 和 https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html 中计算卷积的方法不太一样 image 某些情况下会导致两者计算出来的结果不一样,比如 h_in=7,kernel_size=3,stride=2,padding=1,dilation=1时两者不一样(一个计算出来是3,另一个计算出来是4)。

另外:想问下下方使用 shift_h 和 shift_w 的考虑是什么

align the sampled grid with the feature

shift_h = (h - self.weight.shape[2]) % self.stride[0] shift_w = (w - self.weight.shape[3]) % self.stride[1] ae_offset[:, :, 0] += shift_w / 2.0 ae_offset[:, :, 1] += shift_h / 2.0