enhance-me / enhance_me /commons.py
geekyrakshit's picture
added mirnet model + charbonnier loss
6fd61b9
raw
history blame
355 Bytes
import tensorflow as tf
def read_image(image_path):
image = tf.io.read_file(image_path)
image = tf.image.decode_png(image, channels=3)
image.set_shape([None, None, 3])
image = tf.cast(image, dtype=tf.float32) / 255.0
return image
def peak_signal_noise_ratio(y_true, y_pred):
return tf.image.psnr(y_pred, y_true, max_val=255.0)