Skip to content

Commit

Permalink
- FIx Image Shape to 512, 512 default which will not break other test…
Browse files Browse the repository at this point in the history
… cases
  • Loading branch information
sineeli committed Aug 16, 2024
1 parent 58178c6 commit 1c6125b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion keras_cv/src/models/object_detection/__test_utils__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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"])

Expand Down

0 comments on commit 1c6125b

Please sign in to comment.