|
|
|
@ -178,13 +178,15 @@ def test_random_crop_with_bbox_op_edge_c(plot_vis=False):
|
|
|
|
|
dataVoc1 = dataVoc1.map(input_columns=["image", "annotation"],
|
|
|
|
|
output_columns=["image", "annotation"],
|
|
|
|
|
columns_order=["image", "annotation"],
|
|
|
|
|
operations=[lambda img, bboxes: (img, np.array([[0, 0, img.shape[1], img.shape[0]]]).astype(bboxes.dtype))])
|
|
|
|
|
operations=[lambda img, bboxes: (
|
|
|
|
|
img, np.array([[0, 0, img.shape[1], img.shape[0]]]).astype(bboxes.dtype))])
|
|
|
|
|
|
|
|
|
|
# Test Op added to list of Operations here
|
|
|
|
|
dataVoc2 = dataVoc2.map(input_columns=["image", "annotation"],
|
|
|
|
|
output_columns=["image", "annotation"],
|
|
|
|
|
columns_order=["image", "annotation"],
|
|
|
|
|
operations=[lambda img, bboxes: (img, np.array([[0, 0, img.shape[1], img.shape[0]]]).astype(bboxes.dtype)), test_op])
|
|
|
|
|
operations=[lambda img, bboxes: (
|
|
|
|
|
img, np.array([[0, 0, img.shape[1], img.shape[0]]]).astype(bboxes.dtype)), test_op])
|
|
|
|
|
|
|
|
|
|
unaugSamp, augSamp = [], []
|
|
|
|
|
|
|
|
|
@ -239,6 +241,29 @@ def test_random_crop_with_bbox_op_bad_c():
|
|
|
|
|
check_bad_bbox(data_voc2, test_op, InvalidBBoxType.WrongShape, "4 features")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_random_crop_with_bbox_op_negative_padding():
|
|
|
|
|
"""
|
|
|
|
|
Test RandomCropWithBBox Op on invalid constructor parameters, expected to raise ValueError
|
|
|
|
|
"""
|
|
|
|
|
logger.info("test_random_crop_with_bbox_op_invalid_c")
|
|
|
|
|
|
|
|
|
|
dataVoc2 = ds.VOCDataset(DATA_DIR_VOC, task="Detection", mode="train", decode=True, shuffle=False)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
test_op = c_vision.RandomCropWithBBox([512, 512], padding=-1)
|
|
|
|
|
|
|
|
|
|
dataVoc2 = dataVoc2.map(input_columns=["image", "annotation"],
|
|
|
|
|
output_columns=["image", "annotation"],
|
|
|
|
|
columns_order=["image", "annotation"],
|
|
|
|
|
operations=[test_op])
|
|
|
|
|
|
|
|
|
|
for _ in dataVoc2.create_dict_iterator():
|
|
|
|
|
break
|
|
|
|
|
except ValueError as err:
|
|
|
|
|
logger.info("Got an exception in DE: {}".format(str(err)))
|
|
|
|
|
assert "Input padding is not within the required interval of (0 to 2147483647)." in str(err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
test_random_crop_with_bbox_op_c(plot_vis=True)
|
|
|
|
|
test_random_crop_with_bbox_op_coco_c(plot_vis=True)
|
|
|
|
@ -247,3 +272,4 @@ if __name__ == "__main__":
|
|
|
|
|
test_random_crop_with_bbox_op_edge_c(plot_vis=True)
|
|
|
|
|
test_random_crop_with_bbox_op_invalid_c()
|
|
|
|
|
test_random_crop_with_bbox_op_bad_c()
|
|
|
|
|
test_random_crop_with_bbox_op_negative_padding()
|
|
|
|
|