From 1c6125b571a95082f8cff67de22f66de7553d3b2 Mon Sep 17 00:00:00 2001 From: Sravana Neeli Date: Fri, 16 Aug 2024 15:41:34 -0700 Subject: [PATCH] - FIx Image Shape to 512, 512 default which will not break other test cases --- .../models/object_detection/__test_utils__.py | 2 +- .../faster_rcnn/faster_rcnn_test.py | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/keras_cv/src/models/object_detection/__test_utils__.py b/keras_cv/src/models/object_detection/__test_utils__.py index a14baa7ab1..d0b0bdd0b4 100644 --- a/keras_cv/src/models/object_detection/__test_utils__.py +++ b/keras_cv/src/models/object_detection/__test_utils__.py @@ -20,7 +20,7 @@ def _create_bounding_box_dataset( bounding_box_format, - image_shape=(256, 256, 3), + image_shape=(512, 512, 3), use_dictionary_box_format=False, ): # Just about the easiest dataset you can have, all classes are 0, all boxes diff --git a/keras_cv/src/models/object_detection/faster_rcnn/faster_rcnn_test.py b/keras_cv/src/models/object_detection/faster_rcnn/faster_rcnn_test.py index 6d2c1a8348..f20d65ccdb 100644 --- a/keras_cv/src/models/object_detection/faster_rcnn/faster_rcnn_test.py +++ b/keras_cv/src/models/object_detection/faster_rcnn/faster_rcnn_test.py @@ -113,7 +113,9 @@ def test_weights_contained_in_trainable_variables(self): rpn_box_loss="Huber", rpn_classification_loss="BinaryCrossentropy", ) - xs, ys = _create_bounding_box_dataset(bounding_box_format) + xs, ys = _create_bounding_box_dataset( + bounding_box_format, image_shape=(256, 256, 3) + ) # call once _ = faster_rcnn(xs) @@ -152,7 +154,7 @@ def test_no_nans(self): for weight in weights: self.assertFalse(ops.any(ops.isnan(weight))) - @pytest.mark.large # Fit is slow, so mark these large. + @pytest.mark.extra_large # Fit is slow, so mark these large. @pytest.mark.skipif(not keras_3(), reason="disabling test for Keras 2") def test_weights_change(self): faster_rcnn = FasterRCNN( @@ -170,7 +172,9 @@ def test_weights_change(self): rpn_classification_loss="BinaryCrossentropy", ) - images, boxes = _create_bounding_box_dataset("xyxy") + images, boxes = _create_bounding_box_dataset( + "xyxy", image_shape=(256, 256, 3) + ) ds = tf.data.Dataset.from_tensor_slices( {"images": images, "bounding_boxes": boxes} ).batch(5, drop_remainder=True) @@ -299,7 +303,7 @@ def test_invalid_compile(self): ), ) - @pytest.mark.large # Fit is slow, so mark these large. + @pytest.mark.extra_large # Fit is slow, so mark these large. @pytest.mark.skipif(not keras_3(), reason="disabling test for Keras 2") def test_faster_rcnn_with_dictionary_input_format(self): faster_rcnn = FasterRCNN( @@ -310,7 +314,9 @@ def test_faster_rcnn_with_dictionary_input_format(self): ), ) - images, boxes = _create_bounding_box_dataset("xywh") + images, boxes = _create_bounding_box_dataset( + "xywh", image_shape=(256, 256, 3) + ) dataset = tf.data.Dataset.from_tensor_slices( {"images": images, "bounding_boxes": boxes} ).batch(5, drop_remainder=True) @@ -345,7 +351,9 @@ def test_fit_with_no_valid_gt_bbox(self): rpn_box_loss="Huber", rpn_classification_loss="BinaryCrossentropy", ) - xs, ys = _create_bounding_box_dataset(bounding_box_format) + xs, ys = _create_bounding_box_dataset( + bounding_box_format, image_shape=(256, 256, 3) + ) # Make all bounding_boxes invalid and filter out them ys["classes"] = -np.ones_like(ys["classes"])