Skip to content

Commit

Permalink
Fixed failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-sz committed Mar 18, 2023
1 parent 72cca98 commit 0be4811
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion keras_cv/layers/preprocessing/aug_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,18 @@ def _shear_x(self, image):
def _shear_y(self, image):
y = tf.cast(self.severity_factor() * 0.3, tf.float32)
y *= preprocessing.random_inversion(self._random_generator)
transform_x = layers.RandomShear._format_transform(
transform_x = self._format_random_shear_transform(
[1.0, 0.0, 0.0, y, 1.0, 0.0, 0.0, 0.0]
)
return preprocessing.transform(
images=tf.expand_dims(image, 0), transforms=transform_x
)[0]

@staticmethod
def _format_random_shear_transform(transform):
transform = tf.convert_to_tensor(transform, dtype=tf.float32)
return transform[tf.newaxis]

def _translate_x(self, image):
shape = tf.cast(tf.shape(image), tf.float32)
x = tf.cast(self.severity_factor() * shape[1] / 3, tf.float32)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/ragged_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
layers.RandomSharpness,
{"factor": 0.5, "value_range": (0, 255)},
),
("RandomShear", layers.RandomShear, {"x_factor": 0.3, "x_factor": 0.3}),
("RandomShear", layers.RandomShear, {"x_factor": 0.3, "y_factor": 0.3}),
(
"RandomTranslation",
layers.RandomTranslation,
Expand Down

0 comments on commit 0be4811

Please sign in to comment.