Fixes bug in background power with MS-SSIM, that misattributed loss from dst to src

This commit is contained in:
jh 2021-03-26 06:05:06 -07:00
commit 4c53c3bb04

View file

@ -518,7 +518,7 @@ Examples: df, liae, df-d, df-ud, liae-ud, ...
if self.options['background_power'] > 0: if self.options['background_power'] > 0:
bg_factor = self.options['background_power'] bg_factor = self.options['background_power']
if self.options['ms_ssim_loss']: if self.options['ms_ssim_loss']:
gpu_src_loss += bg_factor * 10 * nn.MsSsim(resolution)(gpu_target_dst, gpu_pred_dst_dst, max_val=1.0) gpu_dst_loss += bg_factor * 10 * nn.MsSsim(resolution)(gpu_target_dst, gpu_pred_dst_dst, max_val=1.0)
else: else:
if resolution < 256: if resolution < 256:
gpu_dst_loss += bg_factor * tf.reduce_mean ( 10*nn.dssim(gpu_target_dst, gpu_pred_dst_dst, max_val=1.0, filter_size=int(resolution/11.6)), axis=[1]) gpu_dst_loss += bg_factor * tf.reduce_mean ( 10*nn.dssim(gpu_target_dst, gpu_pred_dst_dst, max_val=1.0, filter_size=int(resolution/11.6)), axis=[1])