You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get this error when setting RandomScale to a large number like 0.5、0.8
transforms = Sequence([RandomHorizontalFlip(1), RandomScale((0.8,0.9), diff = True), RandomRotate(10)])
Sequence([RandomHorizontalFlip(1), RandomScale((0.8,0.9), diff = True), RandomRotate(10)]) will do these three augmentation transformations one by one, so after RandomScale, maybe some of the bounding boxes have already been outside of the image, then for the input of RandomeRotate, the input box would be empty (or say size 0), then you will get this error. I suggest doing these augmentation transformations one by one, and check the output boxes after each transformation.
I get this error when setting RandomScale to a large number like 0.5、0.8
transforms = Sequence([RandomHorizontalFlip(1), RandomScale((0.8,0.9), diff = True), RandomRotate(10)])
IndexError Traceback (most recent call last)
in
34 transforms = Sequence([RandomHorizontalFlip(1), RandomScale((0.8,0.9), diff = True), RandomRotate(10)])
35
---> 36 img, bboxes = transforms(img, bboxes)
37 cv2.imwrite(os.path.join('JPEGImages2',file), img)
38 plt.imshow(draw_rect(img, bboxes))
~/card/DataAugmentationForObjectDetection/data_aug/data_aug.py in call(self, images, bboxes)
853
854 if random.random() < prob:
--> 855 images, bboxes = augmentation(images, bboxes)
856 return images, bboxes
~/card/DataAugmentationForObjectDetection/data_aug/data_aug.py in call(self, img, bboxes)
456
457
--> 458 corners[:,:8] = rotate_box(corners[:,:8], angle, cx, cy, h, w)
459
460 new_bbox = get_enclosing_box(corners)
~/card/DataAugmentationForObjectDetection/data_aug/bbox_util.py in rotate_box(corners, angle, cx, cy, h, w)
214
215 corners = corners.reshape(-1,2)
--> 216 corners = np.hstack((corners, np.ones((corners.shape[0],1), dtype = type(corners[0][0]))))
217
218 M = cv2.getRotationMatrix2D((cx, cy), angle, 1.0)
IndexError: index 0 is out of bounds for axis 0 with size 0
The text was updated successfully, but these errors were encountered: