是否有针对TensorFlow的SSIM甚至MS-SSIM实现?
SSIM(结构相似性指数度量)是用于测量图像质量或图像相似性的度量.它受人类感知的启发,根据一些论文,与l1/l2相比,它具有更好的损失功能.例如,请参阅用于图像处理的神经网络的损失函数.
到目前为止,我在TensorFlow中找不到实现.在尝试通过从C++或python代码(例如Github:VQMT/SSIM)移植它来自己做之后,我陷入了将高斯模糊应用于TensorFlow中的图像的方法.
有人已经试图自己实施吗?
从Tensorflow CNN示例开始,我试图修改模型以将多个图像作为输入(这样输入不仅仅有3个输入通道,而是通过堆叠图像的3倍).为了增加输入,我尝试使用随机图像操作,例如TensorFlow中提供的翻转,对比度和亮度.我目前的解决方案是对所有输入图像应用相同的随机失真是为这些操作使用固定的种子值:
def distort_image(image):
flipped_image = tf.image.random_flip_left_right(image, seed=42)
contrast_image = tf.image.random_contrast(flipped_image, lower=0.2, upper=1.8, seed=43)
brightness_image = tf.image.random_brightness(contrast_image, max_delta=0.2, seed=44)
return brightness_image
Run Code Online (Sandbox Code Playgroud)
在图形构造时,每个图像都会多次调用此方法,因此我认为对于每个图像,它将使用相同的随机数序列,因此,它将导致对我的图像输入序列具有相同的应用图像操作.
# ...
# distort images
distorted_prediction = distort_image(seq_record.prediction)
distorted_input = []
for i in xrange(INPUT_SEQ_LENGTH):
distorted_input.append(distort_image(seq_record.input[i,:,:,:]))
stacked_distorted_input = tf.concat(2, distorted_input)
# Ensure that the random shuffling has good mixing properties.
min_queue_examples = int(num_examples_per_epoch *
MIN_FRACTION_EXAMPLES_IN_QUEUE)
# Generate a batch of sequences and prediction by building up a queue of examples.
return generate_sequence_batch(stacked_distorted_input, distorted_prediction, min_queue_examples, …Run Code Online (Sandbox Code Playgroud)