LightGlue icon indicating copy to clipboard operation
LightGlue copied to clipboard

About Inference time

Open qazzombie opened this issue 1 year ago • 8 comments

I tested lightglue and superglue using both CPU and GPU ,In both cases, superglue takes less time,but in paper,lightglue is faster。I want to know why there is such a contradiction,and my CPU:Intel(R) Xeon(R) Gold 6242 CPU @ 2.80GHz ,GPU: RTX 2080Ti

qazzombie avatar Jul 20 '23 12:07 qazzombie

How many keypoints are there in the two images? if less than 1k, can you compare the runtimes with point pruning turned off? We indeed need to add some checks in the model.

sarlinpe avatar Jul 20 '23 12:07 sarlinpe

I tested lightglue and superglue using both CPU and GPU ,In both cases, superglue takes less time,but in paper,lightglue is faster。I want to know why there is such a contradiction,and my CPU:Intel(R) Xeon(R) Gold 6242 CPU @ 2.80GHz ,GPU: RTX 2080Ti

How much inference time?

kvnptl avatar Jul 20 '23 17:07 kvnptl

@Skydes Two images have 274 and 265 keypoints respectively 。 point pruning turned off or not, lightglue takes more time

qazzombie avatar Jul 21 '23 03:07 qazzombie

@kvnptl Two images have 274 and 265 keypoints respectively 。 Superglue took 0.024 seconds, while lightglue took 0.0339 seconds 。

qazzombie avatar Jul 21 '23 03:07 qazzombie

Hi @qazzombie @kvnptl

We realized that run time overhead limited the inference speed of LightGlue with few keypoints. We pushed some improvements in PR #37. Could you maybe checkout the corresponding branch and run the benchmark script:

python benchmark.py --compile --add_superglue

To add SuperGlue in the benchmark you also need hloc.

Phil26AT avatar Jul 31 '23 16:07 Phil26AT

I meet similar problem. For the image DSC_0410.JPG and DSC_0411.JPG, it seems that in the case of closing the "flash-attention", Lightglue can be only ~30% faster than superglue? I do this evaluation on rtx2070. (I have excluded the time comsumed by superpoint)

xuanlanxingkongxia avatar Aug 25 '23 15:08 xuanlanxingkongxia

LightGlue_benchmark_(cuda) Oh, I find my problem. But with benchmark code, it still seems something wrong? Without falsh-attention and compile, the speed will be similar to superglue?Am I still do something wrong?

xuanlanxingkongxia avatar Aug 25 '23 18:08 xuanlanxingkongxia

Hi @xuanlanxingkongxia

This looks good to me. Note that in the plot above we benchmark against SuperGlue-fast, with fewer sinkhorn iterations. To compare against the original SuperGlue, you should uncomment the line here.

The main run time improvements of LightGlue are its adaptiveness, and this is clearly visible in your benchmark.

Phil26AT avatar Aug 31 '23 08:08 Phil26AT