facebookresearch / detr

End-to-End Object Detection with Transformers
Apache License 2.0
13.08k stars 2.37k forks source link

Question about object queries. #604

Open AjibolaPy opened 9 months ago

AjibolaPy commented 9 months ago

I've gone through the code. I learned that object queries are nn.Embedding weights and zeros matrixes are added if you wish to add positional Embedding.

My confusion/question is are the embeddings trainable since it is a weight of the embedding layer?

quamernasim commented 8 months ago

I had the same confusion. I checked, embedding weights are not being updated

EDIT: I rechecked and embedding weights are indeed changing

MLDeS commented 7 months ago

In the Colab notebook, it is initialized as nn.parameter. Also, this should be learnable, right? That's the point of the paper, that they use learnable queries. How did you verify that they are not updated?

AjibolaPy commented 7 months ago

In the Colab notebook, it is initialized as nn.parameter. Also, this should be learnable, right? That's the point of the paper, that they use learnable queries. How did you verify that they are not updated?

Since the weight are learnt weight. Then they should will be updated every step. You said nn.parameter, they didn't use Embedding layer?

quamernasim commented 7 months ago

sorry about the confusion guys. Someday later after posting this comment, I revisited the detr and saw that indeed the query weights are changing and hence learnt. In the colab they used this nn.parameter but in the actual implementation they have used nn.Embeddings