Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ae_offset计算相关 #14

Open
qq1361096516 opened this issue Jan 4, 2024 · 3 comments
Open

ae_offset计算相关 #14

qq1361096516 opened this issue Jan 4, 2024 · 3 comments

Comments

@qq1361096516
Copy link

文件: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
Copy link
Owner

fcjian commented Jan 8, 2024

'- 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
Copy link
Author

感谢解答

@qq1361096516
Copy link
Author

文件: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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants