SuperGlue-pytorch icon indicating copy to clipboard operation
SuperGlue-pytorch copied to clipboard

RuntimeError: Expected object of scalar type Double but got scalar type Float for sequence element 1 in sequence argument at position #1 'tensors'

Open artiumb opened this issue 4 years ago • 4 comments

Hi i run the train.py code as is just using the coco validation 2014 (all images are jpg) instead of the original dataset, i allways get this error:

File "..\SuperGlue-pytorch\models\superglue.py", line 83, in forward return self.encoder(torch.cat(inputs, dim=1)) RuntimeError: Expected object of scalar type Double but got scalar type Float for sequence element 1 in sequence argument at position #1 'tensors'

can you please help me understand what is the problem here?

thanks

artiumb avatar Oct 29 '20 17:10 artiumb

@artiumb Hi, I missed the same issue with yours. Did you figured out any solution to solve this problem?

BruceWANGDi avatar Dec 27 '20 12:12 BruceWANGDi

i added cast of (float) and( int) in some parts of the data that is passed to the forwart() of superglue, dont really remember wich one. but it was something related to indexing issue where one of the indexes was float instead of int, i would verify that everything you place in the data list has right indexes and theyre of type int, just run the fields in debug console.

artiumb avatar Dec 27 '20 15:12 artiumb

Thank you for your reply. Could you send your project folder to my email? [email protected]

BruceWANGDi avatar Dec 28 '20 02:12 BruceWANGDi

it is simple, change the code in this way def forward(self, kpts, scores): inputs = [kpts.transpose(1, 2).double(), scores.unsqueeze(1).double()] return self.encoder(torch.cat(inputs, dim=1))

reality167 avatar Dec 20 '21 07:12 reality167