codecamp

TensorFlow函数:tf.image.ssim

tf.image.ssim函数

tf.image.ssim(
    img1,
    img2,
    max_val
)

定义在:tensorflow/python/ops/image_ops_impl.py.

计算img1和img2之间的SSIM索引.

该功能基于标准的SSIM实现的:Wang,Z.,Bovik,AC,Sheikh,HR和Simoncelli,EP(2004).图像质量评价:从错误可见性到结构相似性.IEEE图像处理事物.

注意:真正的SSIM仅在灰度上定义.此功能不执行任何色彩空间转换.(如果输入已经是YUV,那么它将计算平均YUV SSIM.)

由于过滤器尺寸的原因,图像尺寸必须至少为11x11.

示例:

# Read images from file.
im1 = tf.decode_png('path/to/im1.png')
im2 = tf.decode_png('path/to/im2.png')
# Compute SSIM over tf.uint8 Tensors.
ssim1 = tf.image.ssim(im1, im2, max_val=255)

# Compute SSIM over tf.float32 Tensors.
im1 = tf.image.convert_image_dtype(im1, tf.float32)
im2 = tf.image.convert_image_dtype(im2, tf.float32)
ssim2 = tf.image.ssim(im1, im2, max_val=1.0)
# ssim1 and ssim2 both have type tf.float32 and are almost equal.

参数:

  • img1:第一批图像.
  • img2:第二批图像.
  • max_val:图像的动态范围(即最大允许值与最小允许值之间的差值).

返回:

一个包含批处理中每个图像的SSIM值的张量.返回的SSIM值在范围(-1,1)中,当像素值非负时返回形状为:broadcast(img1.shape [: - 3],img2.shape [: - 3])的张量.

TensorFlow函数:tf.image.sobel_edges
TensorFlow函数:tf.image.ssim_multiscale
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }