cvg / glue-factory

Training library for local feature detection and matching
Apache License 2.0
756 stars 98 forks source link

About training LightGlue in two stages #36

Open EATMustard opened 1 year ago

EATMustard commented 1 year ago

Hello, thanks for your work! In the LightGlue paper, it is mentioned, 'we first train it to predict correspondences and only after train the confidence classifier. The latter thus does not impact the accuracy at the final layer or the convergence of the training.' However, in the actual code, it seems that they are trained together, and there is no distinction between the two stages.

sarlinpe commented 1 year ago

We figured out later that we could simplify the implementation by training the confidence classifier at the same time as the rest of the model but detaching its inputs. This only adds a marginal computational overhead and the end results are strictly identical.

https://github.com/cvg/glue-factory/blob/4a8283517fb77e7527e278e233df502f8b7a3266/gluefactory/models/matchers/lightglue.py#L590-L595

https://github.com/cvg/glue-factory/blob/4a8283517fb77e7527e278e233df502f8b7a3266/gluefactory/models/matchers/lightglue.py#L75-L88