From 6dfe3598f5999284ef82ae6cc6ec98fceedf652b Mon Sep 17 00:00:00 2001 From: djkmarchetto <136718101+djkmarchetto@users.noreply.github.com> Date: Wed, 29 May 2024 09:28:24 +0200 Subject: [PATCH] Update anchor_generator.py Enhance compatibility with SymbolicTensor using ops instead of math --- keras_cv/src/layers/object_detection/anchor_generator.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/keras_cv/src/layers/object_detection/anchor_generator.py b/keras_cv/src/layers/object_detection/anchor_generator.py index 18bf2389c1..e564512775 100644 --- a/keras_cv/src/layers/object_detection/anchor_generator.py +++ b/keras_cv/src/layers/object_detection/anchor_generator.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math - from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras @@ -262,7 +260,7 @@ def __call__(self, image_size): # [W] cx = ops.cast( ops.arange( - 0.5 * stride, math.ceil(image_width / stride) * stride, stride + 0.5 * stride, ops.ceil(image_width / stride) * stride, stride ), "float32", ) @@ -271,7 +269,7 @@ def __call__(self, image_size): # [H] cy = ops.cast( ops.arange( - 0.5 * stride, math.ceil(image_height / stride) * stride, stride + 0.5 * stride, ops.ceil(image_height / stride) * stride, stride ), "float32", )