Hi! First of all thanks for your great job and contribution!
I was checking the code of the data augmentation transforms, specifically the _crop function. But, I have found that in some images it is almost impossible to find a valid crop (according to what I understand), when the image has more than 3 or 4 bboxes.
According to what I see in the code, you decide a minimum and maxium IoU randomly in this list:
Later on you compute the crop (roi variable) and the IoU of the bboxes with the full crop:
roi = np.array((l, t, l + w, t + h))
iou = matrix_iou(boxes, roi[np.newaxis])
and finally you check if all the bboxes have a minimum IoU with the whole crop bigger the randomly selected one:
if not (min_iou <= iou.min() and iou.max() <= max_iou):
continue
and if they are not, you try again until you reach 50 trials.
However, I think its almost impossible to find a valid crop for images with a couple of bboxes. So, they are never cropped unless we fall in the (None, None) case.
E.g. https://cocodataset.org/#explore?id=363917.
The reasons I find are:
The IoU is computed against the whole crop area, so it is difficult to get high IoU values unless the crop is tight around the BBox.
The minimum IoU is required for all the BBoxes. That is, it is always required that the crop takes all the BBoxes of the image.
Hi! First of all thanks for your great job and contribution!
I was checking the code of the data augmentation transforms, specifically the
_crop
function. But, I have found that in some images it is almost impossible to find a valid crop (according to what I understand), when the image has more than 3 or 4 bboxes.According to what I see in the code, you decide a minimum and maxium IoU randomly in this list:
Later on you compute the crop (
roi
variable) and the IoU of the bboxes with the full crop:and finally you check if all the bboxes have a minimum IoU with the whole crop bigger the randomly selected one:
and if they are not, you try again until you reach 50 trials.
However, I think its almost impossible to find a valid crop for images with a couple of bboxes. So, they are never cropped unless we fall in the
(None, None)
case. E.g. https://cocodataset.org/#explore?id=363917.The reasons I find are:
Am I right? Was this intended somehow?
Thank you so much in advance!