OceanPang / Libra_R-CNN

Code for CVPR 2019 paper "Libra R-CNN: Towards Balanced Learning for Object Detection"
Apache License 2.0
367 stars 49 forks source link

Why the default setting of floor_thr is -1 in IoUBalancedNegSampler? #13

Closed jimmy15923 closed 4 years ago

jimmy15923 commented 5 years ago

Hi @OceanPang ! Thanks for sharing the code. In the IOU balanced class, I found that floor_thr is -1 by default. But this will cause the start IOU starts from negative value.

Code here Suppose the max_iou is 0.8 and num_bins=3, the start_iou and end_iou for each loop is (-1, -0.4), (-0.4, 0.2), (0.2, 0.8), which is unreasonable since there can't exist negative IOU proposals? Or I misunderstand anything?

OceanPang commented 5 years ago

Hi @jimmy15923 , it means that the IoU starts from and includes 0. If you set the number to 0, some proposals will be excluded.

jimmy15923 commented 5 years ago

Hi @OceanPang! Thanks for the quick response. But in the first loop, start_iou and end_iou is (-1, -0.4). There are no proposals in this interval right? Why choose the interval with all negative value?

laycoding commented 5 years ago

Hello @jimmy15923 Have you found the reason why the lowest IoU count from -1? It seems the real procedure does a random sampling in inverse proportion to the number of neg anchors in [0, 0.2) [0.2, max_iou), after this random sampling from the others anchors which do not be picked to fill the expected num.

laycoding commented 5 years ago

Hello @jimmy15923 Have you found the reason why the lowest IoU count from -1? It seems the real procedure does a random sampling in inverse proportion to the number of neg anchors in [0, 0.2) [0.2, max_iou), after this random sampling from the other anchors which do not be picked to fill the expected num.

Ohh, I see, Because they assign the anchors -1 if their overlaps between the neg_thres and pos_thres

littletomatodonkey commented 4 years ago

Hello @jimmy15923 Have you found the reason why the lowest IoU count from -1? It seems the real procedure does a random sampling in inverse proportion to the number of neg anchors in [0, 0.2) [0.2, max_iou), after this random sampling from the other anchors which do not be picked to fill the expected num.

Ohh, I see, Because they assign the anchors -1 if their overlaps between the neg_thres and pos_thres

Excuse me, I have the same question. Could you please explain in detail why it starts from -1? It seems that the overlaps can not be less or equal than 0 and the first inerval contain no anchor in all steps.

OceanPang commented 4 years ago

Sorry for the confusion. I recheck the code and found that's indeed a bug that caused during the code re-implementation for the release. We didn't observe the difference in the final performance that ignore the bug. I apologize for the negligence and the previous answer. Sorry about that!

Actually the code is somewhat different between the descriptions in the paper for more convenience. For example, we add the term floor_thr and floor_fraction to make a fore flexible sampling. For example, we originally want to use floor_thr=0 to use IoU sampling for the proposals that have overlaps with gts , and use floor_thr=-1 to use IoU sampling for all proposals I have updated the code and it should work.

Thanks!