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

some questions about kernel transform #35

Closed
cs123951 opened this issue Sep 10, 2020 · 4 comments
Closed

some questions about kernel transform #35

cs123951 opened this issue Sep 10, 2020 · 4 comments

Comments

@cs123951
Copy link

Hi,

Thank you so much for sharing such brilliant code! 
But I am confused about the implementation of kernel transform. The exact code is shown as below.

`
def _compute_flow_3d(self):

    # compute dense displacement
    displacement = F.conv_transpose3d(self.trans_parameters, self._kernel,
                                      padding=self._padding, stride=self._stride, groups=3)

    # crop displacement
    return th.squeeze(displacement[:, :, self._stride[0] + self._crop_start[0]:-self._stride[0] - self._crop_end[0],
                              self._stride[1] + self._crop_start[1]:-self._stride[1] - self._crop_end[1],
                              self._stride[2] + self._crop_start[2]:-self._stride[2] - self._crop_end[2]
                              ].transpose_(1,4).transpose_(1,3).transpose_(1,2))

`
I found on the Internet that transposed convolution doesn’t reverse the standard convolution by values, rather by dimensions only.
And I have also read other bspline implementations like https://github.com/C4IR/FAIR.m/blob/master/kernel/transformations/splineTransformation2D.m.
They get spline coefficients and then compute the displacement.
I am wondering if your implementation has some theories behind.
Thank you very much if you could answer my questions!

@RobinSandkuehler
Copy link
Collaborator

Hi,

we used the transposed convolution in this way:

https://i.stack.imgur.com/f2RiP.gif

The stride is the distance between the control points (blue). We then use a kernel to interpolate the values between those control points to obtain a dense transformation by using the transposed convolution. I hope this could answer your question.

@cs123951
Copy link
Author

@RobinSandkuehler
Thanks for your quick reply. I know the transposed convolution.
"We then use a kernel to interpolate the values between those control points to obtain a dense transformation by using the transposed convolution."
——we know that the displacement A is convolved with the kernel to get the control points C. And the control points C are changed into a displacement B using the transposed convolution. The issue is that displacement A does not equal to displacement B.

@RobinSandkuehler
Copy link
Collaborator

Hi,

the control points are the parameter that are optimized and not generated by a convolution with a displacement. The transposed convolution is used to generate the dense transformation field out of the control points. So we have only one direction C->B.

@cs123951
Copy link
Author

@RobinSandkuehler Thank you again for your kind answers. I understand.

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