tf.keras.layers.Resizing
Stay organized with collections
Save and categorize content based on your preferences.
Image resizing layer.
Inherits From: Layer
, Module
tf.keras.layers.Resizing(
height, width, interpolation='bilinear', crop_to_aspect_ratio=False,
**kwargs
)
Resize the batched image input to target height and width. The input should
be a 4D (batched) or 3D (unbatched) tensor in "channels_last"
format.
Args |
height
|
Integer, the height of the output shape.
|
width
|
Integer, the width of the output shape.
|
interpolation
|
String, the interpolation method. Defaults to "bilinear" .
Supports "bilinear" , "nearest" , "bicubic" , "area" , "lanczos3" ,
"lanczos5" , "gaussian" , "mitchellcubic" .
|
crop_to_aspect_ratio
|
If True, resize the images without aspect
ratio distortion. When the original aspect ratio differs from the target
aspect ratio, the output image will be cropped so as to return the largest
possible window in the image (of size (height, width) ) that matches
the target aspect ratio. By default (crop_to_aspect_ratio=False ),
aspect ratio may not be preserved.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[],null,["# tf.keras.layers.Resizing\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/master/keras/layers/preprocessing/image_preprocessing.py#L58-L119) |\n\nImage resizing layer.\n\nInherits From: [`Layer`](../../../tf/keras/layers/Layer), [`Module`](../../../tf/Module)\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf.keras.layers.experimental.preprocessing.Resizing`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Resizing)\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.layers.Resizing`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Resizing), [`tf.compat.v1.keras.layers.experimental.preprocessing.Resizing`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Resizing)\n\n\u003cbr /\u003e\n\n tf.keras.layers.Resizing(\n height, width, interpolation='bilinear', crop_to_aspect_ratio=False,\n **kwargs\n )\n\nResize the batched image input to target height and width. The input should\nbe a 4D (batched) or 3D (unbatched) tensor in `\"channels_last\"` format.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `height` | Integer, the height of the output shape. |\n| `width` | Integer, the width of the output shape. |\n| `interpolation` | String, the interpolation method. Defaults to `\"bilinear\"`. Supports `\"bilinear\"`, `\"nearest\"`, `\"bicubic\"`, `\"area\"`, `\"lanczos3\"`, `\"lanczos5\"`, `\"gaussian\"`, `\"mitchellcubic\"`. |\n| `crop_to_aspect_ratio` | If True, resize the images without aspect ratio distortion. When the original aspect ratio differs from the target aspect ratio, the output image will be cropped so as to return the largest possible window in the image (of size `(height, width)`) that matches the target aspect ratio. By default (`crop_to_aspect_ratio=False`), aspect ratio may not be preserved. |\n\n\u003cbr /\u003e"]]