Closed ducha-aiki closed 1 year ago
torch.multinomial(certainty, num_samples = min(expansion_factor*num, len(certainty)), replacement=False)
Seems like a good option
I think the main issue with np.random.choice missing in Pytorch is that you have to pipeline multinomial -> indexing instead of having it as a single function. However, as I'm just using it for indexes here anyway I think there is no major issue.
Could you please check if that works? And, btw, DKM is very welcomed in the shortly upcoming Image Matching Challenge 2023 (CVPR & Kaggle)
Sure, I'll check, and we'll provide a DKM baseline kernel to run for IMC. By the way @ducha-aiki, is Kaggle python 3.7 only? e.g. PyTorch 2.0 doesn't seem to have any binaries for cp37?
@Parskatt well, I more meant to take part and win the challenge :) Regarding Python 3.7 - kaggle kernel is 3.7 only now, but given the EOL soon, we can safely bet they will upgrade in month or two.
Multinomial seems fine, should be in here https://github.com/Parskatt/DKM/pull/22 .
Hi,
I have quickly checked the possibility to strip out training code and integrate the bare DKM into kornia. It seems that the main blocker is
numpy.random.choice
https://github.com/Parskatt/DKM/blob/b3311e203038d117bf288fdfa0e3144d8effe95a/dkm/models/dkm.py#L585
And the Pytorch doesn't have it https://github.com/pytorch/pytorch/issues/16897
Is there a way we can use existing pytorch functionality to get a similar thing?