Closed jasam-sheja closed 11 months ago
Hi, you are making two mistakes here:
See how it works here : https://github.com/ClementPinard/Pytorch-Correlation-extension/blob/master/Correlation_Module/correlation_cuda_kernel.cu#L51 we compute the radius of patch to get patchRad
and then remove this from the sample coordinates of input2
If you actually want the cross product, you will have to a patch size twice the size of you inputs, and then crop the output with the right value for every output pixel, which is arguably wasteful.
Thank you for the detailed explanation! It cleared up my confusion about the patch_size parameter. I used the cross-product initially to help me understand the parameter behavior. With your explanation, I now have a much better understanding of how everything works. Thank you!
I'm attempting to calculate the correlation between all pixels of one input and all pixels of the second input. Given two HxW single-channel inputs, the expected behavior is that for a patch size of 1 (a one-pixel neighbourhood), the correlation should be the product of each pixel from the first input with each pixel from the second. Essentially, this should result in the cross-product of the flattened inputs, which can be visualized as an HWxHW matrix.
However, the result is not as expected when adapting the example provided in the readme file. Specifically, the outcome appears to be the diagonal of the expected cross-product, replicated across rows.
Code
Output:
Would appreciate any guidance or corrections to achieve the intended result.