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

对于代码有一些疑惑 #15

Open
heiheihei-ops opened this issue Nov 1, 2020 · 4 comments
Open

对于代码有一些疑惑 #15

heiheihei-ops opened this issue Nov 1, 2020 · 4 comments

Comments

@heiheihei-ops
Copy link

您好,请问以下代码段是什么意思呢?它的作用是什么?

if dimension_T == False:
for i in range(
self.deformable_groups * self.kernel_size[0] * self.kernel_size[1] * self.kernel_size[2]):
offset[:, i * 3, :, :, :] = 0 # T
offset[:, i * 3 + 1, :, :, :] = temp[:, i * 2, :, :, :]
offset[:, i * 3 + 2, :, :, :] = temp[:, i * 2 + 1, :, :, :]
if dimension_H == False:
for i in range(
self.deformable_groups * self.kernel_size[0] * self.kernel_size[1] * self.kernel_size[2]):
offset[:, i * 3, :, :, :] = temp[:, i * 2, :, :, :]
offset[:, i * 3 + 1, :, :, :] = 0 # H
offset[:, i * 3 + 2, :, :, :] = temp[:, i * 2 + 1, :, :, :]
if dimension_W == False:
for i in range(
self.deformable_groups * self.kernel_size[0] * self.kernel_size[1] * self.kernel_size[2]):
offset[:, i * 3, :, :, :] = temp[:, i * 2, :, :, :]
offset[:, i * 3 + 1, :, :, :] = temp[:, i * 2 + 1, :, :, :]
offset[:, i * 3 + 2, :, :, :] = 0 # W

@XinyiYing
Copy link
Owner

XinyiYing commented Nov 1, 2020

这段代码的目的是降低网络的参数量,即当在三维卷积的空域进行变形,只需要生成通道维度为2N的offset(其中N为卷积核的尺寸)。然而,在可变形三维卷积的底层C和cuda代码中,输入的offset的通道维数需要为3N。因此,需要将通道维度为2N的offset补零成通道维度为3N,再进行运算。
This code aims to reduce the number of parameters. That is, when only perform deformation in the spatial domain, only an offset with 2N channels is generated (N is the size of the convolution kernel). However, the basic D3Dnet codes on “C” and “cuda” require that the input offset should have 3N channels. Therefore, we first pad the 2N channels offset to 3N channels offset, and then perform the subsequent operations.

@heiheihei-ops
Copy link
Author

谢谢您的答复,请问您这边的dcn的底层C代码是在DCNv2的基础上改动的吗?

@XinyiYing
Copy link
Owner

是的,代码是基于[DCNv2]进行改进的。

@heiheihei-ops
Copy link
Author

好的 谢谢您的答复

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