ssim_weight * SSIM(leftImage, leftImage_fromWarp, leftMask) if rightMask is None: rightMask = torch.ones_like(rightImage > 0) loss += self.rms_weight * self.rms(rightImage[rightMask], rightImage_fromWarp[rightMask]) loss += self.ssim_weight * SSIM(rightImage, rightImage_fromWarp, ...
nn.functional.log_softmax(logit, dim=1) logit = logit.view(self.n_sample, batch_sz, self.vocab_size) flatten_x = x.unsqueeze(0).expand(self.n_sample, batch_sz, self.vocab_size) error = torch.mul(flatten_x, logit) error = torch.mean(error, dim=0) recon_loss = -torch.sum(...
ms_ssim, SSIM, MS_SSIM import torchvision import numpy as np topil=torchvision.transforms.ToPILImage() totensor=torchvision.transforms.ToTensor() def ssimcompare(path1:str,path2:str)->fl