From b9a4b3a5c19bc51d2dbdcbf864b5e61d02dfec7c Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 19:09:43 +0530 Subject: [PATCH 01/22] Add image_ops in Addons --- tensorflow_addons/image/solarize_ops.py | 30 +++++++++++++++++++ tensorflow_addons/image/solarize_ops_test.py | 31 ++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 tensorflow_addons/image/solarize_ops.py create mode 100644 tensorflow_addons/image/solarize_ops_test.py diff --git a/tensorflow_addons/image/solarize_ops.py b/tensorflow_addons/image/solarize_ops.py new file mode 100644 index 0000000000..6b390b5940 --- /dev/null +++ b/tensorflow_addons/image/solarize_ops.py @@ -0,0 +1,30 @@ +""" This module is used to invert all pixel values above a threshold + which simply means segmentation. """ + +import tensorflow as tf + + +def solarize(image, threshold=128): + """Method to solarize the image + image: input image + threshold: threshold value to solarize the image + """ + # For each pixel in the image, select the pixel + # if the value is less than the threshold. + # Otherwise, subtract 255 from the pixel. + return tf.where(image < threshold, image, 255 - image) + + +def solarize_add(image, addition=0, threshold=128): + """Method to add solarize to the image + image: input image + addition: addition amount to add in image + threshold: threshold value to solarize the image + """ + # For each pixel in the image less than threshold + # we add 'addition' amount to it and then clip the + # pixel value to be between 0 and 255. The value + # of 'addition' is between -128 and 128. + added_image = tf.cast(image, tf.int64) + addition + added_image = tf.cast(tf.clip_by_value(added_image, 0, 255), tf.uint8) + return tf.where(image < threshold, added_image, image) diff --git a/tensorflow_addons/image/solarize_ops_test.py b/tensorflow_addons/image/solarize_ops_test.py new file mode 100644 index 0000000000..e3fac45b00 --- /dev/null +++ b/tensorflow_addons/image/solarize_ops_test.py @@ -0,0 +1,31 @@ +"""Test of solarize_ops""" +import sys +import pytest +import tensorflow as tf +from tensorflow_addons.image import solarize_ops +from tensorflow_addons.utils import test_utils +from absl.testing import parameterized + + +@test_utils.run_all_in_graph_and_eager_modes +class SolarizeOPSTest(tf.test.TestCase, parameterized.TestCase): + """SolarizeOPSTest class to test the solarize images""" + + def test_solarize(self): + if tf.executing_eagerly(): + image2 = tf.constant( + [ + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + ], + dtype=tf.uint8, + ) + threshold = 10 + solarize_img = solarize_ops.solarize(image2, threshold) + self.assertAllEqual(tf.shape(solarize_img), tf.shape(image2)) + + +if __name__ == "__main__": + sys.exit(pytest.main([__file__])) From 7fa047d0b4aa6102ed60e30c35f52956587c51f7 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 19:17:17 +0530 Subject: [PATCH 02/22] updates --- tensorflow_addons/image/BUILD | 13 +++++++++++++ tensorflow_addons/image/__init__.py | 2 ++ 2 files changed, 15 insertions(+) diff --git a/tensorflow_addons/image/BUILD b/tensorflow_addons/image/BUILD index a1a09d66bf..0b50f4fca5 100644 --- a/tensorflow_addons/image/BUILD +++ b/tensorflow_addons/image/BUILD @@ -18,6 +18,7 @@ py_library( "connected_components.py", "resampler_ops.py", "compose_ops.py", + "solarize_ops.py", ]), data = [ ":sparse_image_warp_test_data", @@ -177,3 +178,15 @@ py_test( ":image", ], ) + +py_test( + name = "solarize_ops_test", + size = "medium", + srcs = [ + "solarize_ops_test.py", + ], + main = "solarize_ops_test.py", + deps = [ + ":image", + ], +) diff --git a/tensorflow_addons/image/__init__.py b/tensorflow_addons/image/__init__.py index fbd5cda029..6a5ce522c7 100644 --- a/tensorflow_addons/image/__init__.py +++ b/tensorflow_addons/image/__init__.py @@ -29,3 +29,5 @@ from tensorflow_addons.image.transform_ops import transform from tensorflow_addons.image.translate_ops import translate from tensorflow_addons.image.compose_ops import blend +from tensorflow_addons.image.solarize_ops import solarize +from tensorflow_addons.image.solarize_ops import solarize_add From db6381d9ebf5c545c6b5e7bcff0eb2c0e6e28be8 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 21:36:17 +0530 Subject: [PATCH 03/22] Update solarize_ops.py --- tensorflow_addons/image/solarize_ops.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tensorflow_addons/image/solarize_ops.py b/tensorflow_addons/image/solarize_ops.py index 6b390b5940..d2d3276124 100644 --- a/tensorflow_addons/image/solarize_ops.py +++ b/tensorflow_addons/image/solarize_ops.py @@ -8,6 +8,9 @@ def solarize(image, threshold=128): """Method to solarize the image image: input image threshold: threshold value to solarize the image + + Returns: + A solarized image """ # For each pixel in the image, select the pixel # if the value is less than the threshold. @@ -20,6 +23,9 @@ def solarize_add(image, addition=0, threshold=128): image: input image addition: addition amount to add in image threshold: threshold value to solarize the image + + Returns: + Solarized image with addition values """ # For each pixel in the image less than threshold # we add 'addition' amount to it and then clip the From 336afe7cf395834fe476221baf8ef648eb1a7c12 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 21:40:57 +0530 Subject: [PATCH 04/22] Update solarize_ops_test.py --- tensorflow_addons/image/solarize_ops_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow_addons/image/solarize_ops_test.py b/tensorflow_addons/image/solarize_ops_test.py index e3fac45b00..77c6feaf5a 100644 --- a/tensorflow_addons/image/solarize_ops_test.py +++ b/tensorflow_addons/image/solarize_ops_test.py @@ -1,4 +1,5 @@ """Test of solarize_ops""" + import sys import pytest import tensorflow as tf From b82b065f261930e66723d8ab987bdfc711364518 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 21:47:50 +0530 Subject: [PATCH 05/22] Update solarize_ops.py --- tensorflow_addons/image/solarize_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow_addons/image/solarize_ops.py b/tensorflow_addons/image/solarize_ops.py index d2d3276124..8c9cff2b6c 100644 --- a/tensorflow_addons/image/solarize_ops.py +++ b/tensorflow_addons/image/solarize_ops.py @@ -8,7 +8,7 @@ def solarize(image, threshold=128): """Method to solarize the image image: input image threshold: threshold value to solarize the image - + Returns: A solarized image """ @@ -23,7 +23,7 @@ def solarize_add(image, addition=0, threshold=128): image: input image addition: addition amount to add in image threshold: threshold value to solarize the image - + Returns: Solarized image with addition values """ From 5b89a6f756a149b48fc6455416bc092c1bf2d713 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 22:11:04 +0530 Subject: [PATCH 06/22] Update solarize_ops.py --- tensorflow_addons/image/solarize_ops.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow_addons/image/solarize_ops.py b/tensorflow_addons/image/solarize_ops.py index 8c9cff2b6c..e80b561a62 100644 --- a/tensorflow_addons/image/solarize_ops.py +++ b/tensorflow_addons/image/solarize_ops.py @@ -2,9 +2,10 @@ which simply means segmentation. """ import tensorflow as tf +from tensorflow_addons.utils.types import TensorLike +def solarize(image: TensorLike, threshold: float = 128) -> TensorLike: -def solarize(image, threshold=128): """Method to solarize the image image: input image threshold: threshold value to solarize the image @@ -18,7 +19,7 @@ def solarize(image, threshold=128): return tf.where(image < threshold, image, 255 - image) -def solarize_add(image, addition=0, threshold=128): +def solarize_add(image: TensorLike, addition: int = 0, threshold: float = 128) -> TensorLike: """Method to add solarize to the image image: input image addition: addition amount to add in image From bfb3470f3408b12577a8ed4baac1fc47fde255f4 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 22:17:15 +0530 Subject: [PATCH 07/22] Update solarize_ops.py --- tensorflow_addons/image/solarize_ops.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tensorflow_addons/image/solarize_ops.py b/tensorflow_addons/image/solarize_ops.py index e80b561a62..237e18d08b 100644 --- a/tensorflow_addons/image/solarize_ops.py +++ b/tensorflow_addons/image/solarize_ops.py @@ -4,6 +4,7 @@ import tensorflow as tf from tensorflow_addons.utils.types import TensorLike + def solarize(image: TensorLike, threshold: float = 128) -> TensorLike: """Method to solarize the image @@ -19,7 +20,9 @@ def solarize(image: TensorLike, threshold: float = 128) -> TensorLike: return tf.where(image < threshold, image, 255 - image) -def solarize_add(image: TensorLike, addition: int = 0, threshold: float = 128) -> TensorLike: +def solarize_add( + image: TensorLike, addition: int = 0, threshold: float = 128 +) -> TensorLike: """Method to add solarize to the image image: input image addition: addition amount to add in image From bd00e26f739efa33e0180b95a74c206052997b02 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 23:05:42 +0530 Subject: [PATCH 08/22] License added --- tensorflow_addons/image/solarize_ops.py | 14 ++++++++++++++ tensorflow_addons/image/solarize_ops_test.py | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tensorflow_addons/image/solarize_ops.py b/tensorflow_addons/image/solarize_ops.py index 237e18d08b..7eaec699d6 100644 --- a/tensorflow_addons/image/solarize_ops.py +++ b/tensorflow_addons/image/solarize_ops.py @@ -1,3 +1,17 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== """ This module is used to invert all pixel values above a threshold which simply means segmentation. """ diff --git a/tensorflow_addons/image/solarize_ops_test.py b/tensorflow_addons/image/solarize_ops_test.py index 77c6feaf5a..824945ffae 100644 --- a/tensorflow_addons/image/solarize_ops_test.py +++ b/tensorflow_addons/image/solarize_ops_test.py @@ -1,3 +1,17 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== """Test of solarize_ops""" import sys From dad7c706e7d835d66ca69b88d45d6c91a123626f Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Thu, 19 Mar 2020 23:57:50 +0530 Subject: [PATCH 09/22] Add Posterize_ops and Posterize__ops_test script to Tensorflow_addons --- tensorflow_addons/image/posterize_ops.py | 32 +++++++++++++ tensorflow_addons/image/posterize_ops_test.py | 46 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 tensorflow_addons/image/posterize_ops.py create mode 100644 tensorflow_addons/image/posterize_ops_test.py diff --git a/tensorflow_addons/image/posterize_ops.py b/tensorflow_addons/image/posterize_ops.py new file mode 100644 index 0000000000..0b83df757f --- /dev/null +++ b/tensorflow_addons/image/posterize_ops.py @@ -0,0 +1,32 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +""" Posterize method used to reduce the + number of bits foreach color channel""" + +import tensorflow as tf +from tensorflow_addons.utils.types import TensorLike + + +def posterize(image: TensorLike, bits: int) -> TensorLike: + """Reduce the number of bits for each color channel. + Args: + image: The image to posterize + bits: The number of bits to keep for each channel(1-8) + + Returns: + An image + """ + shift = 8 - bits + return tf.bitwise.left_shift(tf.bitwise.right_shift(image, shift), shift) diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py new file mode 100644 index 0000000000..e1cea14caf --- /dev/null +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -0,0 +1,46 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Test of solarize_ops""" + +import sys +import absl +import tensorflow as tf +from tensorflow_addons.image import posterize_ops +from tensorflow_addons.utils import test_utils + + +@test_utils.run_all_in_graph_and_eager_modes +class PosterizeOpsTest(tf.test.TestCase, absl.testing.parameterized.TestCase): + """PosterizeOpsTest class to test the working of + methods images""" + + def test_posterize(self): + """ Method to test the posterize technique on images """ + if tf.executing_eagerly(): + orig_image = tf.io.read_file("test_data/Yellow_Smiley_Face.png") + orig_image = tf.io.decode_image(orig_image, dtype=tf.uint8) + bits = 2 + posterize_image = posterize_ops.posterize(orig_image, bits) + self.assertAllEqual(tf.shape(orig_image), tf.shape(posterize_image)) + + +def main(_): + """ main method to run the test_posterize method """ + test = PosterizeOpsTest() + test.test_posterize() + + +if __name__ == "__main__": + sys.exit(absl.app.run(main)) From a62c86b03d352e5cfa147e7042556ee4003f4fad Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 00:38:58 +0530 Subject: [PATCH 10/22] updates --- tensorflow_addons/image/BUILD | 13 +++++++++++++ tensorflow_addons/image/__init__.py | 1 + tensorflow_addons/image/posterize_ops_test.py | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tensorflow_addons/image/BUILD b/tensorflow_addons/image/BUILD index 0b50f4fca5..55a8fc10d8 100644 --- a/tensorflow_addons/image/BUILD +++ b/tensorflow_addons/image/BUILD @@ -19,6 +19,7 @@ py_library( "resampler_ops.py", "compose_ops.py", "solarize_ops.py", + "posterize_ops.py", ]), data = [ ":sparse_image_warp_test_data", @@ -190,3 +191,15 @@ py_test( ":image", ], ) + +py_test( + name = "posterize_ops_test", + size = "medium", + srcs = [ + "posterize_ops_test.py", + ], + main = "posterize_ops_test.py", + deps = [ + ":image", + ], +) \ No newline at end of file diff --git a/tensorflow_addons/image/__init__.py b/tensorflow_addons/image/__init__.py index 6a5ce522c7..d674e93269 100644 --- a/tensorflow_addons/image/__init__.py +++ b/tensorflow_addons/image/__init__.py @@ -31,3 +31,4 @@ from tensorflow_addons.image.compose_ops import blend from tensorflow_addons.image.solarize_ops import solarize from tensorflow_addons.image.solarize_ops import solarize_add +from tensorflow_addons.image.posterize_ops import posterize diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py index e1cea14caf..da62d14e39 100644 --- a/tensorflow_addons/image/posterize_ops_test.py +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -37,7 +37,7 @@ def test_posterize(self): def main(_): - """ main method to run the test_posterize method """ + """ main to to run test_posterize method """ test = PosterizeOpsTest() test.test_posterize() From 0269f3ee8f50b2c13efc717902b9b6f0ae1d5a61 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 00:47:09 +0530 Subject: [PATCH 11/22] Update BUILD --- tensorflow_addons/image/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_addons/image/BUILD b/tensorflow_addons/image/BUILD index 55a8fc10d8..aa52e27de8 100644 --- a/tensorflow_addons/image/BUILD +++ b/tensorflow_addons/image/BUILD @@ -202,4 +202,4 @@ py_test( deps = [ ":image", ], -) \ No newline at end of file +) From 7fe5447a49d3d6ef5615f4543892d17fe9736fc9 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 01:00:16 +0530 Subject: [PATCH 12/22] Update posterize_ops_test.py --- tensorflow_addons/image/posterize_ops_test.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py index da62d14e39..9903eb87ca 100644 --- a/tensorflow_addons/image/posterize_ops_test.py +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -15,7 +15,7 @@ """Test of solarize_ops""" import sys -import absl +import pytest import tensorflow as tf from tensorflow_addons.image import posterize_ops from tensorflow_addons.utils import test_utils @@ -36,11 +36,5 @@ def test_posterize(self): self.assertAllEqual(tf.shape(orig_image), tf.shape(posterize_image)) -def main(_): - """ main to to run test_posterize method """ - test = PosterizeOpsTest() - test.test_posterize() - - if __name__ == "__main__": - sys.exit(absl.app.run(main)) + sys.exit(pytest.main([__file__])) From 1f7b9b5fae3ec8ae6697b0e17838fef7aede3175 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 01:03:08 +0530 Subject: [PATCH 13/22] Update posterize_ops_test.py --- tensorflow_addons/image/posterize_ops_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py index 9903eb87ca..82f40430e0 100644 --- a/tensorflow_addons/image/posterize_ops_test.py +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -19,10 +19,11 @@ import tensorflow as tf from tensorflow_addons.image import posterize_ops from tensorflow_addons.utils import test_utils +from absl.testing import parameterized @test_utils.run_all_in_graph_and_eager_modes -class PosterizeOpsTest(tf.test.TestCase, absl.testing.parameterized.TestCase): +class PosterizeOpsTest(tf.test.TestCase, parameterized.TestCase): """PosterizeOpsTest class to test the working of methods images""" From 0bcb38b5d6c0c2551172c46df92c0fdbe83ea3d1 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 01:35:39 +0530 Subject: [PATCH 14/22] Update posterize_ops_test.py --- tensorflow_addons/image/posterize_ops_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py index 82f40430e0..6e4980b1aa 100644 --- a/tensorflow_addons/image/posterize_ops_test.py +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -31,7 +31,7 @@ def test_posterize(self): """ Method to test the posterize technique on images """ if tf.executing_eagerly(): orig_image = tf.io.read_file("test_data/Yellow_Smiley_Face.png") - orig_image = tf.io.decode_image(orig_image, dtype=tf.uint8) + orig_image = tf.io.decode_image(orig_image, dtype=tf.dtypes.uint8) bits = 2 posterize_image = posterize_ops.posterize(orig_image, bits) self.assertAllEqual(tf.shape(orig_image), tf.shape(posterize_image)) From 9f4bc15fd444b4f7041c077f98b64a0c5848f519 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 01:48:21 +0530 Subject: [PATCH 15/22] Update posterize_ops_test.py --- tensorflow_addons/image/posterize_ops_test.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py index 6e4980b1aa..b30af07a21 100644 --- a/tensorflow_addons/image/posterize_ops_test.py +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -30,11 +30,18 @@ class PosterizeOpsTest(tf.test.TestCase, parameterized.TestCase): def test_posterize(self): """ Method to test the posterize technique on images """ if tf.executing_eagerly(): - orig_image = tf.io.read_file("test_data/Yellow_Smiley_Face.png") - orig_image = tf.io.decode_image(orig_image, dtype=tf.dtypes.uint8) + image = tf.constant( + [ + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + ], + dtype=tf.uint8, + ) bits = 2 - posterize_image = posterize_ops.posterize(orig_image, bits) - self.assertAllEqual(tf.shape(orig_image), tf.shape(posterize_image)) + posterize_image = posterize_ops.posterize(image, bits) + self.assertAllEqual(tf.shape(image), tf.shape(posterize_image)) if __name__ == "__main__": From e7422c6ca1ed3a0427cb417e9c7fb8c381240775 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 09:50:37 +0530 Subject: [PATCH 16/22] Update posterize and solarize test scripts --- tensorflow_addons/image/posterize_ops_test.py | 10 +--------- tensorflow_addons/image/solarize_ops_test.py | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/tensorflow_addons/image/posterize_ops_test.py b/tensorflow_addons/image/posterize_ops_test.py index b30af07a21..18c9de62f4 100644 --- a/tensorflow_addons/image/posterize_ops_test.py +++ b/tensorflow_addons/image/posterize_ops_test.py @@ -30,15 +30,7 @@ class PosterizeOpsTest(tf.test.TestCase, parameterized.TestCase): def test_posterize(self): """ Method to test the posterize technique on images """ if tf.executing_eagerly(): - image = tf.constant( - [ - [255, 255, 255, 255], - [255, 255, 255, 255], - [255, 255, 255, 255], - [255, 255, 255, 255], - ], - dtype=tf.uint8, - ) + image = tf.constant(tf.ones([4, 4], dtype=tf.dtypes.uint8)) * 255 bits = 2 posterize_image = posterize_ops.posterize(image, bits) self.assertAllEqual(tf.shape(image), tf.shape(posterize_image)) diff --git a/tensorflow_addons/image/solarize_ops_test.py b/tensorflow_addons/image/solarize_ops_test.py index 824945ffae..1c3c9ed230 100644 --- a/tensorflow_addons/image/solarize_ops_test.py +++ b/tensorflow_addons/image/solarize_ops_test.py @@ -28,15 +28,7 @@ class SolarizeOPSTest(tf.test.TestCase, parameterized.TestCase): def test_solarize(self): if tf.executing_eagerly(): - image2 = tf.constant( - [ - [255, 255, 255, 255], - [255, 255, 255, 255], - [255, 255, 255, 255], - [255, 255, 255, 255], - ], - dtype=tf.uint8, - ) + image2 = tf.constant(tf.ones([4, 4], dtype=tf.uint8)) * 255 threshold = 10 solarize_img = solarize_ops.solarize(image2, threshold) self.assertAllEqual(tf.shape(solarize_img), tf.shape(image2)) From 9b87f2391704b3ef0cd6272ef491bf49b445b6dd Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 14:18:32 +0530 Subject: [PATCH 17/22] Added auto_contrast_ops to Tensorflow-addons --- tensorflow_addons/image/BUILD | 13 ++++ tensorflow_addons/image/__init__.py | 1 + tensorflow_addons/image/auto_contrast_ops.py | 60 +++++++++++++++++++ .../image/auto_contrast_ops_test.py | 39 ++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 tensorflow_addons/image/auto_contrast_ops.py create mode 100644 tensorflow_addons/image/auto_contrast_ops_test.py diff --git a/tensorflow_addons/image/BUILD b/tensorflow_addons/image/BUILD index aa52e27de8..7325ce4b5d 100644 --- a/tensorflow_addons/image/BUILD +++ b/tensorflow_addons/image/BUILD @@ -20,6 +20,7 @@ py_library( "compose_ops.py", "solarize_ops.py", "posterize_ops.py", + "auto_contrast_ops.py", ]), data = [ ":sparse_image_warp_test_data", @@ -203,3 +204,15 @@ py_test( ":image", ], ) + +py_test( + name = "auto_contrast_ops_test", + size = "medium", + srcs = [ + "auto_contrast_ops_test.py", + ], + main = "auto_contrast_ops_test.py", + deps = [ + ":image", + ], +) diff --git a/tensorflow_addons/image/__init__.py b/tensorflow_addons/image/__init__.py index d674e93269..be6464edee 100644 --- a/tensorflow_addons/image/__init__.py +++ b/tensorflow_addons/image/__init__.py @@ -32,3 +32,4 @@ from tensorflow_addons.image.solarize_ops import solarize from tensorflow_addons.image.solarize_ops import solarize_add from tensorflow_addons.image.posterize_ops import posterize +from tensorflow_addons.image.auto_contrast_ops import autocontrast diff --git a/tensorflow_addons/image/auto_contrast_ops.py b/tensorflow_addons/image/auto_contrast_ops.py new file mode 100644 index 0000000000..674d02e5a8 --- /dev/null +++ b/tensorflow_addons/image/auto_contrast_ops.py @@ -0,0 +1,60 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +""" Maximize (normalize) image contrast. +This function calculates a histogram of the input image, +removes cutoff percent of the lightest and darkest pixels + from the histogram, and remaps the image so +that the darkest pixel becomes black (0), +and the lightest becomes white (255). """ + +import tensorflow as tf +from tensorflow_addons.utils.types import TensorLike + + +def autocontrast(image: TensorLike) -> TensorLike: + """Implements Autocontrast function from PIL using TF ops. + Args: + image: A 3D uint8 tensor. + Returns: + The image after it has had autocontrast applied to it and will be of type + uint8. + """ + + def scale_channel(image: TensorLike) -> TensorLike: + """Scale the 2D image using the autocontrast rule.""" + # A possibly cheaper version can be done using cumsum/unique_with_counts + # over the histogram values, rather than iterating over the entire image. + # to compute mins and maxes. + lo = tf.cast(tf.reduce_min(image), dtype=tf.float32) + hi = tf.cast(tf.reduce_max(image), dtype=tf.float32) + + # Scale the image, making the lowest value 0 and the highest value 255. + def scale_values(im: TensorLike) -> TensorLike: + scale = 255.0 / (hi - lo) + offset = -lo * scale + im = tf.cast(im, dtype=tf.float32) * scale + offset + im = tf.clip_by_value(im, 0.0, 255.0) + return tf.cast(im, tf.uint8) + + result = tf.cond(hi > lo, lambda: scale_values(image), lambda: image) + return result + + # Assumes RGB for now. Scales each channel independently + # and then stacks the result. + s1 = scale_channel(image[:, :, 0]) + s2 = scale_channel(image[:, :, 1]) + s3 = scale_channel(image[:, :, 2]) + image = tf.stack([s1, s2, s3], 2) + return image diff --git a/tensorflow_addons/image/auto_contrast_ops_test.py b/tensorflow_addons/image/auto_contrast_ops_test.py new file mode 100644 index 0000000000..20851d1833 --- /dev/null +++ b/tensorflow_addons/image/auto_contrast_ops_test.py @@ -0,0 +1,39 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +""" Test auto_contrast_ops """ +import sys +import pytest +import tensorflow as tf +from tensorflow_addons.image import auto_contrast_ops +from tensorflow_addons.utils import test_utils +from absl.testing import parameterized + + +@test_utils.run_all_in_graph_and_eager_modes +class AutoContrastTest(tf.test.TestCase, parameterized.TestCase): + """AutoContrastTest class to test the working of + methods images""" + + def test_contrast(self): + """ Method to test the auto_contrast technique on images """ + if tf.executing_eagerly(): + image = tf.constant([[1, 2], [3, 4]]) + stacked_img = tf.stack([image] * 3, 2) + contrast_image = auto_contrast_ops.autocontrast(stacked_img) + self.assertAllEqual(tf.shape(contrast_image), tf.shape(image)) + + +if __name__ == "__main__": + sys.exit(pytest.main([__file__])) From 3bebd38bc9698224c4faf68266700c6edd3f7da3 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 14:31:28 +0530 Subject: [PATCH 18/22] Update auto_contrast_ops_test.py --- tensorflow_addons/image/auto_contrast_ops_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_addons/image/auto_contrast_ops_test.py b/tensorflow_addons/image/auto_contrast_ops_test.py index 20851d1833..abecda2402 100644 --- a/tensorflow_addons/image/auto_contrast_ops_test.py +++ b/tensorflow_addons/image/auto_contrast_ops_test.py @@ -29,7 +29,7 @@ class AutoContrastTest(tf.test.TestCase, parameterized.TestCase): def test_contrast(self): """ Method to test the auto_contrast technique on images """ if tf.executing_eagerly(): - image = tf.constant([[1, 2], [3, 4]]) + image = tf.constant([[1, 1], [1, 1]], dtype=tf.uint8) stacked_img = tf.stack([image] * 3, 2) contrast_image = auto_contrast_ops.autocontrast(stacked_img) self.assertAllEqual(tf.shape(contrast_image), tf.shape(image)) From dbc375bddaecfdca6dff40794b62d821c5027bcb Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 14:57:30 +0530 Subject: [PATCH 19/22] Update auto_contrast_ops_test.py --- tensorflow_addons/image/auto_contrast_ops_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_addons/image/auto_contrast_ops_test.py b/tensorflow_addons/image/auto_contrast_ops_test.py index abecda2402..6ac2ec2f8f 100644 --- a/tensorflow_addons/image/auto_contrast_ops_test.py +++ b/tensorflow_addons/image/auto_contrast_ops_test.py @@ -32,7 +32,7 @@ def test_contrast(self): image = tf.constant([[1, 1], [1, 1]], dtype=tf.uint8) stacked_img = tf.stack([image] * 3, 2) contrast_image = auto_contrast_ops.autocontrast(stacked_img) - self.assertAllEqual(tf.shape(contrast_image), tf.shape(image)) + self.assertAllEqual(tf.shape(contrast_image), tf.shape(stacked_img)) if __name__ == "__main__": From f33bec702b7046dcc406c54f2f2ada38bdea281f Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 18:50:04 +0530 Subject: [PATCH 20/22] Added to_grayscale operation in Tensorflow-Addons --- tensorflow_addons/image/BUILD | 13 +++++++ tensorflow_addons/image/__init__.py | 1 + tensorflow_addons/image/to_grayscale_ops.py | 33 ++++++++++++++++ .../image/to_grayscale_ops_test.py | 39 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 tensorflow_addons/image/to_grayscale_ops.py create mode 100644 tensorflow_addons/image/to_grayscale_ops_test.py diff --git a/tensorflow_addons/image/BUILD b/tensorflow_addons/image/BUILD index 7325ce4b5d..642ee94ac0 100644 --- a/tensorflow_addons/image/BUILD +++ b/tensorflow_addons/image/BUILD @@ -21,6 +21,7 @@ py_library( "solarize_ops.py", "posterize_ops.py", "auto_contrast_ops.py", + "to_grayscale_ops.py", ]), data = [ ":sparse_image_warp_test_data", @@ -216,3 +217,15 @@ py_test( ":image", ], ) + +py_test( + name = "to_grayscale_ops_test", + size = "medium", + srcs = [ + "to_grayscale_ops_test.py", + ], + main = "to_grayscale_ops_test.py", + deps = [ + ":image", + ], +) diff --git a/tensorflow_addons/image/__init__.py b/tensorflow_addons/image/__init__.py index be6464edee..736e077989 100644 --- a/tensorflow_addons/image/__init__.py +++ b/tensorflow_addons/image/__init__.py @@ -33,3 +33,4 @@ from tensorflow_addons.image.solarize_ops import solarize_add from tensorflow_addons.image.posterize_ops import posterize from tensorflow_addons.image.auto_contrast_ops import autocontrast +from tensorflow_addons.image.to_grayscale_ops import to_grayscale diff --git a/tensorflow_addons/image/to_grayscale_ops.py b/tensorflow_addons/image/to_grayscale_ops.py new file mode 100644 index 0000000000..cd70612dea --- /dev/null +++ b/tensorflow_addons/image/to_grayscale_ops.py @@ -0,0 +1,33 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +""" method to convert the color images into grayscale +by keeping the channel same""" +import tensorflow as tf +from tensorflow_addons.utils.types import TensorLike + + +def to_grayscale(image: TensorLike, keep_channels: bool = True) -> TensorLike: + """ Method to convert the color image into grayscale + by keeping the channels same. + + Args: + image: color image to convert into grayscale + keep_channels: boolean parameter for channels + Returns: + Image""" + image = tf.image.rgb_to_grayscale(image) + if keep_channels: + image = tf.tile(image, [1, 1, 3]) + return image diff --git a/tensorflow_addons/image/to_grayscale_ops_test.py b/tensorflow_addons/image/to_grayscale_ops_test.py new file mode 100644 index 0000000000..a82a3f71e2 --- /dev/null +++ b/tensorflow_addons/image/to_grayscale_ops_test.py @@ -0,0 +1,39 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Test of grayscale method""" + +import sys +import pytest +import tensorflow as tf +from tensorflow_addons.image import to_grayscale_ops +from tensorflow_addons.utils import test_utils +from absl.testing import parameterized + + +@test_utils.run_all_in_graph_and_eager_modes +class ToGrayScaleOpsTest(tf.test.TestCase, parameterized.TestCase): + """ToGrayScaleOpsTest class to test the grayscale image operation""" + + def test_grayscale(self): + """ Method to test the grayscale technique on images """ + if tf.executing_eagerly(): + image = tf.constant([[1, 2], [5, 3]], dtype=tf.uint8) + stacked_img = tf.stack([image] * 3, 2) + grayscale_image = to_grayscale_ops.to_grayscale(stacked_img) + self.assertAllEqual(tf.shape(grayscale_image), tf.shape(stacked_img)) + + +if __name__ == "__main__": + sys.exit(pytest.main([__file__])) From 79e7be9af0998f8a16b592b36e6c07d7ca5cee67 Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 22:40:11 +0530 Subject: [PATCH 21/22] Add color_jitter ops --- tensorflow_addons/image/BUILD | 13 ++ tensorflow_addons/image/__init__.py | 1 + tensorflow_addons/image/color_jitter_ops.py | 142 ++++++++++++++++++ .../image/color_jitter_ops_test.py | 42 ++++++ 4 files changed, 198 insertions(+) create mode 100644 tensorflow_addons/image/color_jitter_ops.py create mode 100644 tensorflow_addons/image/color_jitter_ops_test.py diff --git a/tensorflow_addons/image/BUILD b/tensorflow_addons/image/BUILD index 642ee94ac0..fd5577e213 100644 --- a/tensorflow_addons/image/BUILD +++ b/tensorflow_addons/image/BUILD @@ -22,6 +22,7 @@ py_library( "posterize_ops.py", "auto_contrast_ops.py", "to_grayscale_ops.py", + "color_jitter_ops.py", ]), data = [ ":sparse_image_warp_test_data", @@ -229,3 +230,15 @@ py_test( ":image", ], ) + +py_test( + name = "color_jitter_ops", + size = "medium", + srcs = [ + "color_jitter_ops.py", + ], + main = "color_jitter_ops.py", + deps = [ + ":image", + ], +) diff --git a/tensorflow_addons/image/__init__.py b/tensorflow_addons/image/__init__.py index 736e077989..efa01bde3c 100644 --- a/tensorflow_addons/image/__init__.py +++ b/tensorflow_addons/image/__init__.py @@ -34,3 +34,4 @@ from tensorflow_addons.image.posterize_ops import posterize from tensorflow_addons.image.auto_contrast_ops import autocontrast from tensorflow_addons.image.to_grayscale_ops import to_grayscale +from tensorflow_addons.image.color_jitter_ops import color_jitter diff --git a/tensorflow_addons/image/color_jitter_ops.py b/tensorflow_addons/image/color_jitter_ops.py new file mode 100644 index 0000000000..9b4e67df7e --- /dev/null +++ b/tensorflow_addons/image/color_jitter_ops.py @@ -0,0 +1,142 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +""" This method is used to distorts the color of the image """ +import tensorflow as tf +from tensorflow_addons.utils.types import TensorLike + + +def color_jitter( + image: TensorLike, strength: float, random_order: bool = True +) -> TensorLike: + """Distorts the color of the image. + Args: + image: The input image tensor. + strength: the floating number for the strength of the color augmentation <= 2.0. + random_order: A bool, specifying whether to randomize the jittering order. + Returns: + The distorted image tensor. + """ + image = tf.cast(image, dtype=tf.dtypes.float32) + brightness = 0.8 * strength + contrast = 0.8 * strength + saturation = 0.8 * strength + hue = 0.2 * strength + if random_order: + return color_jitter_rand(image, brightness, contrast, saturation, hue) + else: + return color_jitter_nonrand(image, brightness, contrast, saturation, hue) + + +def color_jitter_nonrand( + image: TensorLike, + brightness: float = 0, + contrast: float = 0, + saturation: float = 0, + hue: float = 0, +) -> TensorLike: + """Distorts the color of the image (jittering order is fixed). + Args: + image: The input image tensor. + brightness: A float, specifying the brightness for color jitter. + contrast: A float, specifying the contrast for color jitter. + saturation: A float, specifying the saturation for color jitter. + hue: A float, specifying the hue for color jitter. + Returns: + The distorted image tensor. + """ + with tf.name_scope("distort_color"): + + def apply_transform(i, x, brightness, contrast, saturation, hue): + """Apply the i-th transformation.""" + if brightness != 0 and i == 0: + x = tf.image.random_brightness(x, max_delta=brightness) + elif contrast != 0 and i == 1: + x = tf.image.random_contrast(x, lower=1 - contrast, upper=1 + contrast) + elif saturation != 0 and i == 2: + x = tf.image.random_saturation( + x, lower=1 - saturation, upper=1 + saturation + ) + elif hue != 0: + x = tf.image.random_hue(x, max_delta=hue) + return x + + for i in range(4): + image = apply_transform(i, image, brightness, contrast, saturation, hue) + image = tf.clip_by_value(image, 0.0, 1.0) + return image + + +def color_jitter_rand( + image: TensorLike, + brightness: float = 0, + contrast: float = 0, + saturation: float = 0, + hue: float = 0, +) -> TensorLike: + """Distorts the color of the image (jittering order is random). + Args: + image: The input image tensor. + brightness: A float, specifying the brightness for color jitter. + contrast: A float, specifying the contrast for color jitter. + saturation: A float, specifying the saturation for color jitter. + hue: A float, specifying the hue for color jitter. + Returns: + The distorted image tensor. + """ + with tf.name_scope("distort_color"): + + def apply_transform(i, x): + """Apply the i-th transformation.""" + + def brightness_foo(): + if brightness == 0: + return x + else: + return tf.image.random_brightness(x, max_delta=brightness) + + def contrast_foo(): + if contrast == 0: + return x + else: + return tf.image.random_contrast( + x, lower=tf.math.abs(1 - contrast), upper=1 + contrast + ) + + def saturation_foo(): + if saturation == 0: + return x + else: + return tf.image.random_saturation( + x, lower=tf.math.abs(1 - saturation), upper=1 + saturation + ) + + def hue_foo(): + if hue == 0: + return x + else: + return tf.image.random_hue(x, max_delta=hue) + + x = tf.cond( + tf.less(i, 2), + lambda: tf.cond(tf.less(i, 1), brightness_foo, contrast_foo), + lambda: tf.cond(tf.less(i, 3), saturation_foo, hue_foo), + ) + return x + + perm = tf.random.shuffle(tf.range(4)) + for i in range(4): + image = apply_transform(perm[i], image) + image = tf.clip_by_value(image, 0.0, 1.0) + return tf.cast(image, dtype=tf.uint8) diff --git a/tensorflow_addons/image/color_jitter_ops_test.py b/tensorflow_addons/image/color_jitter_ops_test.py new file mode 100644 index 0000000000..91bbf61d46 --- /dev/null +++ b/tensorflow_addons/image/color_jitter_ops_test.py @@ -0,0 +1,42 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +"""Test of color_jitter method""" + +import sys +import pytest +import tensorflow as tf +from tensorflow_addons.image import color_jitter_ops +from tensorflow_addons.utils import test_utils +from absl.testing import parameterized + + +@test_utils.run_all_in_graph_and_eager_modes +class ColorJitterTest(tf.test.TestCase, parameterized.TestCase): + """ColorJitterTest class to test the color distortion image operation""" + + def test_color_jitter(self): + """ Method to test the color distortion technique on images """ + if tf.executing_eagerly(): + image = tf.constant([[1, 2], [5, 3]], dtype=tf.uint8) + stacked_img = tf.stack([image] * 3, 2) + strength = 0.3 + jitter_image = color_jitter_ops.color_jitter(stacked_img, strength) + self.assertAllEqual(tf.shape(jitter_image), tf.shape(stacked_img)) + + +if __name__ == "__main__": + sys.exit(pytest.main([__file__])) + From a7b8681f13351e43a63ec3c31bd70dd51ff7f9de Mon Sep 17 00:00:00 2001 From: vinayvr11 Date: Fri, 20 Mar 2020 22:44:58 +0530 Subject: [PATCH 22/22] Update color_jitter_ops_test.py --- tensorflow_addons/image/color_jitter_ops_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tensorflow_addons/image/color_jitter_ops_test.py b/tensorflow_addons/image/color_jitter_ops_test.py index 91bbf61d46..68d6c77c31 100644 --- a/tensorflow_addons/image/color_jitter_ops_test.py +++ b/tensorflow_addons/image/color_jitter_ops_test.py @@ -39,4 +39,3 @@ def test_color_jitter(self): if __name__ == "__main__": sys.exit(pytest.main([__file__])) -