tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.26k stars 630 forks source link

Tiny bug in fcos/loss.py #106

Open zzzzzz0407 opened 4 years ago

zzzzzz0407 commented 4 years ago

Thanks for your wonderful job. However, when I check up your code, I find there is a bug may drop the performance(I donot test it), but at least, it fall short of the description in your paper. `max_reg_targets_per_im = reg_targets_per_im.max(dim=2)[0]

limit the regression range for each location

is_cared_in_the_level = \ (max_reg_targets_per_im >= object_sizes_of_interest[:, [0]]) & \ (max_reg_targets_per_im <= object_sizes_of_interest[:, [1]])` The purpose of "is_cared_in_the_level" is to select the box whose side satisfy the condition you pre-defined, i.e, [0, 64]...[512, inf] and so on. However, the "max_reg_targets_per_im" is merely the max value among [l, t, r, b], rather than the longest length. Therefore, suppose there are two "anchor", [256, 256, 500, 256]/[128, 256, 628, 256], and then although they are in the same shape, they will be assigned to different level, the previous will be sent to [256, 512], and another will be sent to [512, inf). It's a tiny bug, I hope it will boost the performance. There is also a slip error, "locations_to_min_aera" in line 108 --> "locations_to_min_area" . Hhh, best wishes.

tianzhi0549 commented 4 years ago

@zHanami Thank you for pointing it out. But it is not a bug. Although the two boxes have the same shape, they are in different locations of the object. Our design is to encourage a location on the features to only care about the boxes within a limited distance. The implementation is consistent with our paper.

As for the typo, it has been fixed in https://github.com/tianzhi0549/FCOS/pull/104.