tf.keras.layers.CenterCrop
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
A preprocessing layer which crops images.
Inherits From: Layer
, Module
View aliases
Main aliases
tf.keras.layers.experimental.preprocessing.CenterCrop
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.keras.layers.CenterCrop
, tf.compat.v1.keras.layers.experimental.preprocessing.CenterCrop
tf.keras.layers.CenterCrop(
height, width, **kwargs
)
This layers crops the central portion of the images to a target size. If an
image is smaller than the target size, it will be resized and cropped so as to
return the largest possible window in the image that matches the target aspect
ratio.
For an overview and full list of preprocessing layers, see the preprocessing
guide.
|
3D (unbatched) or 4D (batched) tensor with shape:
(..., height, width, channels) , in "channels_last" format.
|
Output shape |
3D (unbatched) or 4D (batched) tensor with shape:
(..., target_height, target_width, channels) .
|
If the input height/width is even and the target height/width is odd (or
inversely), the input image is left-padded by 1 pixel.
Args |
height
|
Integer, the height of the output shape.
|
width
|
Integer, the width of the output shape.
|
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 2022-09-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-09-07 UTC."],[],[]]