amdegroot / ssd.pytorch

A PyTorch Implementation of Single Shot MultiBox Detector
MIT License
5.14k stars 1.75k forks source link

Bug in augmentations - RandomSampleCrop #68

Open ahmadh84 opened 7 years ago

ahmadh84 commented 7 years ago

I wanted to point out that the line 269 in augmentations.py is incorrect:

if overlap.min() < min_iou and max_iou < overlap.max():

This line in RandomSampleCrop will always be false because for all cases max_iou is inf. The effect of this is that it doesn't matter what value of min_iou is randomly sampled. The loop will always sample a patch which fulfills the aspect ratio condition, and if it has at least one object whose center falls inside the sampled patch.

I know I am pointing a glitch, but I really appreciate the code! Its extremely well commented. Hats off!

david2021 commented 7 years ago

How much does it affect the performance?

yossibiton commented 7 years ago

This is a good point i have noticed also. The paper describes this technique as: "Sample a patch so that the minimum jaccard overlap with the objects is 0.1, 0.3, 0.5, 0.7, or 0.9.".

maybe line 269 should be (the use of max_iou doesn't make any sense): if overlap.max() < min_iou:

gurkirt commented 6 years ago

I have a question in the same place. slightly different though! Should overlap be intersection only not IoU? IoU will eliminate very small boxes wouldn't it?

zhepengfei commented 5 years ago

I think that "if overlap.max() < min_iou:" would be a good choice.