diff --git a/tests/ut/python/dataset/test_bounding_box_augment.py b/tests/ut/python/dataset/test_bounding_box_augment.py index fcdfbe7928..fbcb56514f 100644 --- a/tests/ut/python/dataset/test_bounding_box_augment.py +++ b/tests/ut/python/dataset/test_bounding_box_augment.py @@ -34,12 +34,16 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for bbox in bboxes: - tmp = bbox[0] - bbox[0] = bbox[1] - bbox[1] = bbox[2] - bbox[2] = bbox[3] - bbox[3] = bbox[4] - bbox[4] = tmp + if bbox.size == 7: + tmp = bbox[0] + bbox[0] = bbox[1] + bbox[1] = bbox[2] + bbox[2] = bbox[3] + bbox[3] = bbox[4] + bbox[4] = tmp + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes diff --git a/tests/ut/python/dataset/test_random_crop_and_resize_with_bbox.py b/tests/ut/python/dataset/test_random_crop_and_resize_with_bbox.py index 359b527dd1..b13dc466f7 100644 --- a/tests/ut/python/dataset/test_random_crop_and_resize_with_bbox.py +++ b/tests/ut/python/dataset/test_random_crop_and_resize_with_bbox.py @@ -36,12 +36,16 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for bbox in bboxes: - tmp = bbox[0] - bbox[0] = bbox[1] - bbox[1] = bbox[2] - bbox[2] = bbox[3] - bbox[3] = bbox[4] - bbox[4] = tmp + if bbox.size == 7: + tmp = bbox[0] + bbox[0] = bbox[1] + bbox[1] = bbox[2] + bbox[2] = bbox[3] + bbox[3] = bbox[4] + bbox[4] = tmp + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes diff --git a/tests/ut/python/dataset/test_random_crop_with_bbox.py b/tests/ut/python/dataset/test_random_crop_with_bbox.py index 08233cb3bc..9262dfd65d 100644 --- a/tests/ut/python/dataset/test_random_crop_with_bbox.py +++ b/tests/ut/python/dataset/test_random_crop_with_bbox.py @@ -37,12 +37,16 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for bbox in bboxes: - tmp = bbox[0] - bbox[0] = bbox[1] - bbox[1] = bbox[2] - bbox[2] = bbox[3] - bbox[3] = bbox[4] - bbox[4] = tmp + if bbox.size == 7: + tmp = bbox[0] + bbox[0] = bbox[1] + bbox[1] = bbox[2] + bbox[2] = bbox[3] + bbox[3] = bbox[4] + bbox[4] = tmp + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes diff --git a/tests/ut/python/dataset/test_random_horizontal_flip_with_bbox.py b/tests/ut/python/dataset/test_random_horizontal_flip_with_bbox.py index 37e9fa710f..94ab843ce1 100644 --- a/tests/ut/python/dataset/test_random_horizontal_flip_with_bbox.py +++ b/tests/ut/python/dataset/test_random_horizontal_flip_with_bbox.py @@ -34,12 +34,16 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for bbox in bboxes: - tmp = bbox[0] - bbox[0] = bbox[1] - bbox[1] = bbox[2] - bbox[2] = bbox[3] - bbox[3] = bbox[4] - bbox[4] = tmp + if bbox.size == 7: + tmp = bbox[0] + bbox[0] = bbox[1] + bbox[1] = bbox[2] + bbox[2] = bbox[3] + bbox[3] = bbox[4] + bbox[4] = tmp + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes diff --git a/tests/ut/python/dataset/test_random_resize_with_bbox.py b/tests/ut/python/dataset/test_random_resize_with_bbox.py index b0c1c40a80..4aadf9ef01 100644 --- a/tests/ut/python/dataset/test_random_resize_with_bbox.py +++ b/tests/ut/python/dataset/test_random_resize_with_bbox.py @@ -35,7 +35,11 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for (i, box) in enumerate(bboxes): - bboxes[i] = np.roll(box, -1) + if box.size == 7: + bboxes[i] = np.roll(box, -1) + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes diff --git a/tests/ut/python/dataset/test_random_vertical_flip_with_bbox.py b/tests/ut/python/dataset/test_random_vertical_flip_with_bbox.py index 72c40c0cad..f746bd50b0 100644 --- a/tests/ut/python/dataset/test_random_vertical_flip_with_bbox.py +++ b/tests/ut/python/dataset/test_random_vertical_flip_with_bbox.py @@ -36,12 +36,16 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for bbox in bboxes: - tmp = bbox[0] - bbox[0] = bbox[1] - bbox[1] = bbox[2] - bbox[2] = bbox[3] - bbox[3] = bbox[4] - bbox[4] = tmp + if bbox.size == 7: + tmp = bbox[0] + bbox[0] = bbox[1] + bbox[1] = bbox[2] + bbox[2] = bbox[3] + bbox[3] = bbox[4] + bbox[4] = tmp + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes diff --git a/tests/ut/python/dataset/test_resize_with_bbox.py b/tests/ut/python/dataset/test_resize_with_bbox.py index 75500de653..06f3937958 100644 --- a/tests/ut/python/dataset/test_resize_with_bbox.py +++ b/tests/ut/python/dataset/test_resize_with_bbox.py @@ -35,7 +35,11 @@ def fix_annotate(bboxes): :return: annotation in [x_min, y_min, w, h, label, truncate, difficult] format """ for (i, box) in enumerate(bboxes): - bboxes[i] = np.roll(box, -1) + if box.size == 7: + bboxes[i] = np.roll(box, -1) + else: + print("ERROR: Invalid Bounding Box size provided") + break return bboxes