Kornia SIFT Descriptor output size not consistent

I’m using the SIFT descriptor from Kornia.

I should get an output of size 1x128, but I get 1x200, and I’m unable to understand why.

img = torch.randn([1, 1, 10, 10])
sift = kornia.SIFTDescriptor(10, 8, 4)
sift(img).size() -> torch.Size([1, 200])

Can someone please explain?

I’m not sure, why you get this output shape, as the docs explain dim1 should be computed as:

 num_ang_bins * num_spatial_bins ** 2

which would be 8*4**2=128.

CC @edgarriba
It also seems that the inplace docs might not be up to date, as the input is given as:

Input: (B, 1, num_spatial_bins, num_spatial_bins)

while I would assume it should be:

Input: (B, 1, patch_size, patch_size)

Hi, @ajitkr1994

Sorry for so late response. The problem is that 10 patch size is too small for the even division into 4 spatial bins, therefore the requested descriptor cannot be created.

Addressed in https://github.com/kornia/kornia/pull/598, where kornia shows an error when requested parameters are not allowed.

1 Like