cvg / LightGlue

LightGlue: Local Feature Matching at Light Speed (ICCV 2023)
Apache License 2.0
3.15k stars 291 forks source link

Performance advice #89

Open ducha-aiki opened 7 months ago

ducha-aiki commented 7 months ago

Although the adaptive stuff is very cool for per-image pair evaluation, I have found that batching together in 32 offers order of magnitude better speed-up. So if you do 3D reconstruction, just write some batching script and enjoy the speed-up.

sarlinpe commented 7 months ago

The adaptive mechanisms indeed don't yet support batching well. We could however conservatively exit when all pairs in the batch are ready and prune to the large number of keypoints retained across the batch.

udit7395 commented 4 months ago

@ducha-aiki Sorry to ask this but would it possible to share a snippet of the batching code? If not possible, some intuition how would one go about it? I am using SuperPoint + LightGlue and these are things I have tried up till now,

ducha-aiki commented 4 months ago

@udit7395 your version 2 is correct:

Ran Superpoint for batch_image size individually in a for loop and tried creating a dictionary

What you also should do, is to reduce threshold to zero and reduce nms. Finally, consider padding with random descriptors for those, which are still less than needed.