From 9387cefe7a0260a1c4a6402f43beb624d5772661 Mon Sep 17 00:00:00 2001 From: ariG23498 Date: Mon, 26 Apr 2021 15:37:44 +0530 Subject: [PATCH] use of tf.slice to crop images --- tf2/data_util.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tf2/data_util.py b/tf2/data_util.py index e451a87..eccd450 100644 --- a/tf2/data_util.py +++ b/tf2/data_util.py @@ -290,10 +290,7 @@ def distorted_bounding_box_crop(image, bbox_begin, bbox_size, _ = sample_distorted_bounding_box # Crop the image to the specified bounding box. - offset_y, offset_x, _ = tf.unstack(bbox_begin) - target_height, target_width, _ = tf.unstack(bbox_size) - image = tf.image.crop_to_bounding_box( - image, offset_y, offset_x, target_height, target_width) + image = tf.slice(image, bbox_begin, bbox_begin) return image