diff options
author | 2018-06-05 16:39:47 -0700 | |
---|---|---|
committer | 2018-06-05 16:39:47 -0700 | |
commit | 7edb417cd05fe438d587372fcf07e7c45e1dd8f8 (patch) | |
tree | ba257cbcbb24d9da0d0559160ffd898da0cc04e9 /tensorflow/python/ops/image_ops_impl.py | |
parent | 7eaef86f7766e7c0577614e646dc8d6a972b91f9 (diff) |
Fix lint errors
Diffstat (limited to 'tensorflow/python/ops/image_ops_impl.py')
-rw-r--r-- | tensorflow/python/ops/image_ops_impl.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py index f3f9a02f01..231b49fbf5 100644 --- a/tensorflow/python/ops/image_ops_impl.py +++ b/tensorflow/python/ops/image_ops_impl.py @@ -971,7 +971,7 @@ def resize_images(images, @tf_export('image.resize_image_with_pad') def resize_image_with_pad(image, target_height, target_width, - method=ResizeMethod.BILINEAR): + method=ResizeMethod.BILINEAR): """ Resizes and pads an image to a target width and height. @@ -1038,17 +1038,21 @@ def resize_image_with_pad(image, target_height, target_width, ratio = max_(f_width / f_target_width, f_height / f_target_height) resized_height_float = f_height / ratio resized_width_float = f_width / ratio - resized_height = math_ops.cast(math_ops.floor(resized_height_float), dtype=dtypes.int32) - resized_width = math_ops.cast(math_ops.floor(resized_width_float), dtype=dtypes.int32) - - f_padding_height = math_ops.floor((f_target_height - resized_height_float) / 2) - f_padding_width = math_ops.floor((f_target_width - resized_width_float) / 2) + resized_height = math_ops.cast(math_ops.floor(resized_height_float), + dtype=dtypes.int32) + resized_width = math_ops.cast(math_ops.floor(resized_width_float), + dtype=dtypes.int32) + + padding_height = (f_target_height - resized_height_float) / 2 + padding_width = (f_target_width - resized_width_float) / 2 + f_padding_height = math_ops.floor(padding_height) + f_padding_width = math_ops.floor(padding_width) p_height = max_(0, math_ops.cast(f_padding_height, dtype=dtypes.int32)) p_width = max_(0, math_ops.cast(f_padding_width, dtype=dtypes.int32)) # Resize first, then pad to meet requested dimensions resized = resize_images(image, [resized_height, resized_width], method) - + padded = pad_to_bounding_box(resized, p_height, p_width, target_height, target_width) |