fundamentalvision / Deformable-DETR

Deformable DETR: Deformable Transformers for End-to-End Object Detection.
Apache License 2.0
3.14k stars 513 forks source link

Question about sampling_offest, sampling_locations normalize for F.grid_sample #227

Open SnaKey0u0 opened 5 months ago

SnaKey0u0 commented 5 months ago

Thank you for the great work!

I have a question, when query pass through the linear layer of sampling_offest, I found out that its value is between +-4 at the first epoch, and then normalized by offset_normalizer, which stands for feature map size like 32, 16, etc.

After the above steps, the sampling_locations will not keep in the range [0,1], and then the sampling_grids = 2 * sampling_locations - 1 for F.grid_sample (I am using the pytorch version) will not follow the rule of range (-1, 1).

Could you help me figure out this problem?