From 231ba78ab47f24bf468ade9b31c2b736ce5a4747 Mon Sep 17 00:00:00 2001 From: ariG23498 Date: Wed, 6 Dec 2023 09:18:29 +0530 Subject: [PATCH 1/2] chore: copy the original boxes and apply convert format --- keras_cv/bounding_box/converters.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keras_cv/bounding_box/converters.py b/keras_cv/bounding_box/converters.py index 8923527cbf..b623e5fde6 100644 --- a/keras_cv/bounding_box/converters.py +++ b/keras_cv/bounding_box/converters.py @@ -370,7 +370,8 @@ def convert_format( `"float32"`. """ if isinstance(boxes, dict): - boxes["boxes"] = convert_format( + duplicate_boxes = boxes.copy() + duplicate_boxes["boxes"] = convert_format( boxes["boxes"], source=source, target=target, @@ -378,7 +379,7 @@ def convert_format( image_shape=image_shape, dtype=dtype, ) - return boxes + return duplicate_boxes if boxes.shape[-1] is not None and boxes.shape[-1] != 4: raise ValueError( From 09e660b5a3c8ec5db80d9f7c6b19d334e3ab9ef2 Mon Sep 17 00:00:00 2001 From: ariG23498 Date: Sun, 17 Dec 2023 19:45:43 +0530 Subject: [PATCH 2/2] chore: renaming variable --- keras_cv/bounding_box/converters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keras_cv/bounding_box/converters.py b/keras_cv/bounding_box/converters.py index b623e5fde6..b671b6ff22 100644 --- a/keras_cv/bounding_box/converters.py +++ b/keras_cv/bounding_box/converters.py @@ -370,8 +370,8 @@ def convert_format( `"float32"`. """ if isinstance(boxes, dict): - duplicate_boxes = boxes.copy() - duplicate_boxes["boxes"] = convert_format( + converted_boxes = boxes.copy() + converted_boxes["boxes"] = convert_format( boxes["boxes"], source=source, target=target, @@ -379,7 +379,7 @@ def convert_format( image_shape=image_shape, dtype=dtype, ) - return duplicate_boxes + return converted_boxes if boxes.shape[-1] is not None and boxes.shape[-1] != 4: raise ValueError(