diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-01-25 21:57:50 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-01-25 22:01:22 -0800 |
commit | b6a4bc9d79cd4df561da3326ac921477e6fe301c (patch) | |
tree | dedb76e54cca868535d7636ad8ae241d2fe2d92d | |
parent | e35d8a1752538197a48ad34eb256371260d97e1c (diff) |
Clarified documentation on resize_images.align_corners parameter.
PiperOrigin-RevId: 183339087
11 files changed, 54 insertions, 65 deletions
diff --git a/tensorflow/core/api_def/base_api/api_def_FusedResizeAndPadConv2D.pbtxt b/tensorflow/core/api_def/base_api/api_def_FusedResizeAndPadConv2D.pbtxt index a72f2bfe5f..118d0e2178 100644 --- a/tensorflow/core/api_def/base_api/api_def_FusedResizeAndPadConv2D.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_FusedResizeAndPadConv2D.pbtxt @@ -30,9 +30,8 @@ END attr { name: "resize_align_corners" description: <<END -If true, rescale input by (new_height - 1) / (height - 1), -which exactly aligns the 4 corners of images and resized images. If false, rescale -by new_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and output tensors are +aligned, preserving the values at the corner pixels. Defaults to false. END } attr { diff --git a/tensorflow/core/api_def/base_api/api_def_QuantizedResizeBilinear.pbtxt b/tensorflow/core/api_def/base_api/api_def_QuantizedResizeBilinear.pbtxt index 6b3ba72e53..a08ed710b7 100644 --- a/tensorflow/core/api_def/base_api/api_def_QuantizedResizeBilinear.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_QuantizedResizeBilinear.pbtxt @@ -23,9 +23,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale input by (new_height - 1) / (height - 1), which -exactly aligns the 4 corners of images and resized images. If false, rescale -by new_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and output tensors are +aligned, preserving the values at the corner pixels. Defaults to false. END } summary: "Resize quantized `images` to `size` using quantized bilinear interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeArea.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeArea.pbtxt index 6dc321a544..317ad263cc 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeArea.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeArea.pbtxt @@ -23,9 +23,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale input by (new_height - 1) / (height - 1), which -exactly aligns the 4 corners of images and resized images. If false, rescale -by new_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and output tensors are +aligned, preserving the values at the corner pixels. Defaults to false. END } summary: "Resize `images` to `size` using area interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeBicubic.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeBicubic.pbtxt index 06e645e3ee..d4f8233d25 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeBicubic.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeBicubic.pbtxt @@ -23,9 +23,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale input by (new_height - 1) / (height - 1), which -exactly aligns the 4 corners of images and resized images. If false, rescale -by new_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and output tensors are +aligned, preserving the values at the corner pixels. Defaults to false. END } summary: "Resize `images` to `size` using bicubic interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeBicubicGrad.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeBicubicGrad.pbtxt index bf5201d82e..eeb0680ab8 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeBicubicGrad.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeBicubicGrad.pbtxt @@ -25,9 +25,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale grads by (orig_height - 1) / (height - 1), which -exactly aligns the 4 corners of grads and original_image. If false, rescale by -orig_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and grad tensors are +aligned. Defaults to false. END } summary: "Computes the gradient of bicubic interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeBilinear.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeBilinear.pbtxt index 0768e437fa..0673baa703 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeBilinear.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeBilinear.pbtxt @@ -23,9 +23,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale input by (new_height - 1) / (height - 1), which -exactly aligns the 4 corners of images and resized images. If false, rescale -by new_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and output tensors are +aligned, preserving the values at the corner pixels. Defaults to false. END } summary: "Resize `images` to `size` using bilinear interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeBilinearGrad.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeBilinearGrad.pbtxt index fba64203c2..9a1a5fb69a 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeBilinearGrad.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeBilinearGrad.pbtxt @@ -25,9 +25,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale grads by (orig_height - 1) / (height - 1), which -exactly aligns the 4 corners of grads and original_image. If false, rescale by -orig_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and grad tensors are +aligned. Defaults to false. END } summary: "Computes the gradient of bilinear interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighbor.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighbor.pbtxt index a74db4c9dc..e6f8dc1941 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighbor.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighbor.pbtxt @@ -23,9 +23,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale input by (new_height - 1) / (height - 1), which -exactly aligns the 4 corners of images and resized images. If false, rescale -by new_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and output tensors are +aligned, preserving the values at the corner pixels. Defaults to false. END } summary: "Resize `images` to `size` using nearest neighbor interpolation." diff --git a/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighborGrad.pbtxt b/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighborGrad.pbtxt index 4ef1547eb4..8d52ca8334 100644 --- a/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighborGrad.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ResizeNearestNeighborGrad.pbtxt @@ -24,9 +24,8 @@ END attr { name: "align_corners" description: <<END -If true, rescale grads by (orig_height - 1) / (height - 1), which -exactly aligns the 4 corners of grads and original_image. If false, rescale by -orig_height / height. Treat similarly the width dimension. +If true, the centers of the 4 corner pixels of the input and grad tensors are +aligned. Defaults to false. END } summary: "Computes the gradient of nearest neighbor interpolation." diff --git a/tensorflow/go/op/wrappers.go b/tensorflow/go/op/wrappers.go index 5b19c90238..6d54429186 100644 --- a/tensorflow/go/op/wrappers.go +++ b/tensorflow/go/op/wrappers.go @@ -2589,10 +2589,10 @@ type ResizeBicubicAttr func(optionalAttr) // ResizeBicubicAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale input by (new_height - 1) / (height - 1), which -// exactly aligns the 4 corners of images and resized images. If false, rescale -// by new_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the input and output images are +// aligned, preserving the values at the corner pixels. If false, rescale by +// new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeBicubicAlignCorners(value bool) ResizeBicubicAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -5817,10 +5817,9 @@ type ResizeBilinearGradAttr func(optionalAttr) // ResizeBilinearGradAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale grads by (orig_height - 1) / (height - 1), which -// exactly aligns the 4 corners of grads and original_image. If false, rescale by -// orig_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the grads and the original_image are +// aligned. If false, rescale by new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeBilinearGradAlignCorners(value bool) ResizeBilinearGradAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -6387,10 +6386,10 @@ type ResizeBilinearAttr func(optionalAttr) // ResizeBilinearAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale input by (new_height - 1) / (height - 1), which -// exactly aligns the 4 corners of images and resized images. If false, rescale -// by new_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the input and output images are +// aligned, preserving the values at the corner pixels. If false, rescale by +// new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeBilinearAlignCorners(value bool) ResizeBilinearAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -7382,10 +7381,10 @@ type ResizeAreaAttr func(optionalAttr) // ResizeAreaAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale input by (new_height - 1) / (height - 1), which -// exactly aligns the 4 corners of images and resized images. If false, rescale -// by new_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the input and output images are +// aligned, preserving the values at the corner pixels. If false, rescale by +// new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeAreaAlignCorners(value bool) ResizeAreaAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -13688,10 +13687,10 @@ type FusedResizeAndPadConv2DAttr func(optionalAttr) // FusedResizeAndPadConv2DResizeAlignCorners sets the optional resize_align_corners attribute to value. // -// value: If true, rescale input by (new_height - 1) / (height - 1), -// which exactly aligns the 4 corners of images and resized images. If false, rescale -// by new_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the input and output images are +// aligned, preserving the values at the corner pixels. If false, rescale by +// new_height / height, new_width / width. +// If not specified, defaults to false. func FusedResizeAndPadConv2DResizeAlignCorners(value bool) FusedResizeAndPadConv2DAttr { return func(m optionalAttr) { m["resize_align_corners"] = value @@ -13833,10 +13832,10 @@ type QuantizedResizeBilinearAttr func(optionalAttr) // QuantizedResizeBilinearAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale input by (new_height - 1) / (height - 1), which -// exactly aligns the 4 corners of images and resized images. If false, rescale -// by new_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the input and output images are +// aligned, preserving the values at the corner pixels. If false, rescale by +// new_height / height, new_width / width. +// If not specified, defaults to false. func QuantizedResizeBilinearAlignCorners(value bool) QuantizedResizeBilinearAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -18668,10 +18667,9 @@ type ResizeBicubicGradAttr func(optionalAttr) // ResizeBicubicGradAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale grads by (orig_height - 1) / (height - 1), which -// exactly aligns the 4 corners of grads and original_image. If false, rescale by -// orig_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the grads and the original_image are +// aligned. If false, rescale by new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeBicubicGradAlignCorners(value bool) ResizeBicubicGradAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -18712,10 +18710,10 @@ type ResizeNearestNeighborAttr func(optionalAttr) // ResizeNearestNeighborAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale input by (new_height - 1) / (height - 1), which -// exactly aligns the 4 corners of images and resized images. If false, rescale -// by new_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the input and output images are +// aligned, preserving the values at the corner pixels. If false, rescale by +// new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeNearestNeighborAlignCorners(value bool) ResizeNearestNeighborAttr { return func(m optionalAttr) { m["align_corners"] = value @@ -18755,10 +18753,9 @@ type ResizeNearestNeighborGradAttr func(optionalAttr) // ResizeNearestNeighborGradAlignCorners sets the optional align_corners attribute to value. // -// value: If true, rescale grads by (orig_height - 1) / (height - 1), which -// exactly aligns the 4 corners of grads and original_image. If false, rescale by -// orig_height / height. Treat similarly the width dimension. -// If not specified, defaults to false +// value: If true, the centers of the 4 corner pixels of the grads and the original_image are +// aligned. If false, rescale by new_height / height, new_width / width. +// If not specified, defaults to false. func ResizeNearestNeighborGradAlignCorners(value bool) ResizeNearestNeighborGradAttr { return func(m optionalAttr) { m["align_corners"] = value diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py index 76da3bed31..2c231ef56c 100644 --- a/tensorflow/python/ops/image_ops_impl.py +++ b/tensorflow/python/ops/image_ops_impl.py @@ -770,8 +770,9 @@ def resize_images(images, size: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The new size for the images. method: ResizeMethod. Defaults to `ResizeMethod.BILINEAR`. - align_corners: bool. If true, exactly align all 4 corners of the input and - output. Defaults to `false`. + align_corners: bool. If True, the centers of the 4 corner pixels of the + input and output tensors are aligned, preserving the values at the + corner pixels. Defaults to `False`. Raises: ValueError: if the shape of `images` is incompatible with the |