This commit is contained in:
jh 2021-03-17 11:22:02 -07:00
commit 607863f3fa

View file

@ -24,6 +24,6 @@ class MsSsim(nn.LayerBase):
ms_ssim_val = tf.image.ssim_multiscale(y_true_t, y_pred_t, max_val, power_factors=self.power_factors, filter_size=self.kernel_size) ms_ssim_val = tf.image.ssim_multiscale(y_true_t, y_pred_t, max_val, power_factors=self.power_factors, filter_size=self.kernel_size)
# ssim_multiscale returns values in range [0, 1] (where 1 is completely identical) # ssim_multiscale returns values in range [0, 1] (where 1 is completely identical)
# subtract from 1 to get loss # subtract from 1 to get loss
return 1 - ms_ssim_val return 1.0 - ms_ssim_val
nn.MsSsim = MsSsim nn.MsSsim = MsSsim