|View source on GitHub|
Calculate and return the total variation for one or more images.
Compat aliases for migration
See Migration guide for more details.
tf.image.total_variation( images, name=None )
The total variation is the sum of the absolute differences for neighboring pixel-values in the input images. This measures how much noise is in the images.
This can be used as a loss-function during optimization so as to suppress noise in images. If you have a batch of images, then you should calculate the scalar loss-value as the sum:
loss = tf.reduce_sum(tf.image.total_variation(images))
This implements the anisotropic 2-D version of the formula described here:
| || 4-D Tensor of shape |
| ||A name for the operation (optional).|
| ||if images.shape is not a 3-D or 4-D vector.|
| The total variation of |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.