zju3dv / LoFTR

Code for "LoFTR: Detector-Free Local Feature Matching with Transformers", CVPR 2021, T-PAMI 2022
https://zju3dv.github.io/loftr/
Apache License 2.0
2.32k stars 362 forks source link

gradient of confidence #241

Open weitong8591 opened 1 year ago

weitong8591 commented 1 year ago

May I ask if the gradients can pass through the confidence? Because when I train it, the gradients can not propagate through the confidence, instead, only the confidence matrix can work for the propagation. So, it is wired that the indice selection of confidence matrix get out of the computation graph. Is there any way I can build the loss from confidence scores? Thanks!

zehongs commented 1 year ago

could you provide a code sample for the "indice selection of confidence matrix"?

weitong8591 commented 1 year ago

Sure, I mean for data['mconf'], no gradient can propagate through it, right? I think it is wired because it is slicing the confidence matrix, is there anything I misunderstood? Thanks for your reply! https://github.com/zju3dv/LoFTR/blob/b4ee7eb0359d0062e794c99f73e27639d7c7ac9f/src/loftr/utils/coarse_matching.py#L196

yash0307 commented 1 year ago

To be more specific, how to backprop through mconf? As of now, it does not seem feasible.

yash0307 commented 1 year ago

never mind, this issue has be resolved. Feel free to close this.