yhenon / pytorch-retinanet

Pytorch implementation of RetinaNet object detection.
Apache License 2.0
2.14k stars 665 forks source link

question of the setting anchors #182

Open hzy-caiji opened 4 years ago

hzy-caiji commented 4 years ago

Hi, thank you for your great work. I have a question about the format of the setting anchors. why in "shift_x = (np.arange(0, shape[1]) + 0.5) * stride" use shape[1] but not shape[0], If I want get anchors shape [3,5],use shape[1], we will get [5,3].

wvalcke commented 3 years ago

The code is correct, shift_x must be seen as the horizontal axis in the image. Remember that the tensor of a feature of the pyramid level is (H, W) (this is the shape parameter of the shift method). To calculate the center positions horizontally for each anchor we need to use the width, which is at index 1, taking index 0 would take the height, which is wrong.