TensorFlow函數(shù):tf.image.psnr

2018-06-07 10:54 更新

tf.image.psnr函數(shù)

tf.image.psnr(
    a,
    b,
    max_val,
    name=None
)

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

返回a和b之間的峰值信噪比.

這旨在用于信號(hào)(或圖像).在批處理中為每個(gè)圖像生成一個(gè)信噪比(PSNR)值.

輸入的最后三個(gè)維度預(yù)計(jì)為[height, width, depth].

示例:

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

# Compute PSNR over tf.float32 Tensors.
im1 = tf.image.convert_image_dtype(im1, tf.float32)
im2 = tf.image.convert_image_dtype(im2, tf.float32)
psnr2 = tf.image.psnr(im1, im2, max_val=1.0)
# psnr1 and psnr2 both have type tf.float32 and are almost equal.

參數(shù):

  • a:第一組圖像.
  • b:第二組圖像.
  • max_val:圖像的動(dòng)態(tài)范圍(即最大允許值和最小允許值之間的差值).
  • name:用于嵌入計(jì)算的命名空間.

返回:

a和b之間的標(biāo)量PSNR,返回的張量具有tf.float32類(lèi)型和形狀[batch_size,1].

以上內(nèi)容是否對(duì)您有幫助:
在線(xiàn)筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)