tfm.vision.augment.unwrap
Stay organized with collections
Save and categorize content based on your preferences.
Unwraps an image produced by wrap.
tfm.vision.augment.unwrap(
image: tf.Tensor, replace: int
) -> tf.Tensor
Where there is a 0 in the last channel for every spatial position,
the rest of the three channels in that spatial dimension are grayed
(set to 128). Operations like translate and shear on a wrapped
Tensor will leave 0s in empty locations. Some transformations look
at the intensity of values to do preprocessing, and we want these
empty pixels to assume the 'average' value, rather than pure black.
Args |
image
|
A 3D Image Tensor with 4 channels.
|
replace
|
A one or three value 1D tensor to fill empty pixels.
|
Returns |
image
|
A 3D image Tensor with 3 channels.
|
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 2024-02-02 UTC.
[null,null,["Last updated 2024-02-02 UTC."],[],[],null,["# tfm.vision.augment.unwrap\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/augment.py#L1046-L1084) |\n\nUnwraps an image produced by wrap. \n\n tfm.vision.augment.unwrap(\n image: tf.Tensor, replace: int\n ) -\u003e tf.Tensor\n\nWhere there is a 0 in the last channel for every spatial position,\nthe rest of the three channels in that spatial dimension are grayed\n(set to 128). Operations like translate and shear on a wrapped\nTensor will leave 0s in empty locations. Some transformations look\nat the intensity of values to do preprocessing, and we want these\nempty pixels to assume the 'average' value, rather than pure black.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------|------------------------------------------------------|\n| `image` | A 3D Image Tensor with 4 channels. |\n| `replace` | A one or three value 1D tensor to fill empty pixels. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------|------------------------------------|\n| `image` | A 3D image Tensor with 3 channels. |\n\n\u003cbr /\u003e"]]