ChanWoo25 / SuperPoint2CPP

The C++ implementation of SuperPoint
73 stars 16 forks source link

How to generate the superpoint.pt? #2

Open liubamboo opened 3 years ago

liubamboo commented 3 years ago

Hello, your project is great. But I have a question. The superpoint.pt is from pytorch project or c++ project? Could you tell me how to generate it?

ChanWoo25 commented 3 years ago

Thanks for your attention! :)

"superpoint.pt" is not much different from the "superpoint_v1.pth" provided by Magicleap. I think it would be helpful if you refer to this LINK.

Simply put, you can read it using pytorch and save it with the pt extension. It's not much about C++.

liubamboo commented 3 years ago

@ChanWoo25 Thank you! I solve it by using torch.jit.trace to transfer the "superpoint_v1.pth" provided by Magicleap to a new model. And it can work.But now I has a question. I run the CreateVoca to generate the DBoW Vocabulary(yml format)and put the DBoW Vocabulary into superpoint_slam. It doesn't work. It stop in ComputeBoW(). I use the Vocabulary from superpoint_slam and It can work. So I think my DBoW Vocabulary have some bugs. Have you try to replace the DBoW Vocabulary in SuperPoint_SLAM?

And my DBoW yml file is like vocabulary: k: 10 L: 5 scoringType: 0 weightingType: 0 nodes:

And the DBoW yml file in superpoint_slam is like: vocabulary: k: 10 L: 5 scoringType: 0 weightingType: 0 nodes:

I notice the DBoW yml file of superpoint_slam has dbw3 5 256 but my DBoW yml file doesn't. And the DBoW yml file of superpoint_slam is generated by DBoW3 but my DBoW yml file is generated by DBoW2.

Could you help me?

ChanWoo25 commented 3 years ago

I think your problem is issued by SuperPoint-SLAM Repository. If Then, You should open the issue at that repos.

To answer, I have not yet released DBoW yml file for SuperPoint-SLAM. If you want to use your own, then Use DBoW2 yml file. In the first place, DBoW2 yml file and that of DBoW3 are not very different. This function code may help you understand.

liubamboo commented 3 years ago

@ChanWoo25 Thanks a lot. And In main_CreateVoca.cpp you use voc.saveToTextFile() to save txt format vocabulary. Can I use voc.save() to save yml format vocabulary?

Y-pandaman commented 3 years ago

@ChanWoo25 Thank you! I solve it by using torch.jit.trace to transfer the "superpoint_v1.pth" provided by Magicleap to a new model. And it can work.But now I has a question. I run the CreateVoca to generate the DBoW Vocabulary(yml format)and put the DBoW Vocabulary into superpoint_slam. It doesn't work. It stop in ComputeBoW(). I use the Vocabulary from superpoint_slam and It can work. So I think my DBoW Vocabulary have some bugs. Have you try to replace the DBoW Vocabulary in SuperPoint_SLAM?

can you teach me how to convert the .pth files generated by pytorch into .pt files that libtorch can use? I teied torch.jit.trace, but it did not work.

weiningwei commented 3 years ago

@ChanWoo25 Thank you! I solve it by using torch.jit.trace to transfer the "superpoint_v1.pth" provided by Magicleap to a new model. And it can work.But now I has a question. I run the CreateVoca to generate the DBoW Vocabulary(yml format)and put the DBoW Vocabulary into superpoint_slam. It doesn't work. It stop in ComputeBoW(). I use the Vocabulary from superpoint_slam and It can work. So I think my DBoW Vocabulary have some bugs. Have you try to replace the DBoW Vocabulary in SuperPoint_SLAM?

can you teach me how to convert the .pth files generated by pytorch into .pt files that libtorch can use? I teied torch.jit.trace, but it did not work.

Hello, can you convert the .pth convert the .pth files generated by pytorch into .pt files that libtorch can use? If you can ,could you please tell me how to do it? I get the .pt file, but when I use it, for the same input image, it got the different outputs. This problem bothers me very much!