ashkamath / mdetr

Apache License 2.0
969 stars 125 forks source link

Meaning of 'tokens_positive' and 'positive_map' #51

Closed Flaick closed 2 years ago

Flaick commented 3 years ago

Hello, thank you for this great work, and I have a question about the meaning of 'tokens_positive' and 'positive_map' in finetune_lvis.json file. I am confused about why the positive_map generated from tokens_positive is a 256-length vector and how this can help the model to learn the text of category.

alcinos commented 3 years ago

Tokens_positive is a list of spans [beg,end] which indicate that the given box corresponds to the text between positions beg and end (ie in python text[beg:end]). The positive map is generated to a fixed length which is chosen to be an upper bound of the sequence length. This allows the model to always predict a distribution over the same number of tokens (256)