Paperspace/DataAugmentationForObjectDetection

Error while using sequence

aymenmir94 opened this issue · 1 comments

I am using a sequence of transforms - randomHSV, randomscale, randomsheer, randomrotate and at the end I get a strange error

I am not sure what the problem is
corners = np.hstack((corners, np.ones((corners.shape[0],1), dtype = type(corners[0][0])))) IndexError: index 0 is out of bounds for axis 0 with size 0

I think the error is due to the fact that previous transformations have produced an image that as no bounding boxes in it (the object is now out of the image or truncated at the point the bbox has been deleted). So the get_corners function returns an empty array and in the rotate_box function there is no check for an empty set of bboxes.

A solution I found avoiding to edit the code is to put RandomRotate as the first transformation in the sequence.