# 需要導入模塊: import utility [as 別名]# 或者: from utility importcalc_psnr[as 別名]deftest(self):#if self.args.test_only:# self.scheduler.step() #just for remake the curve of psnrepoch = self.scheduler.last_epoch +1self.ckp.write_log('\nEvaluation:') self.ckp.add_log(torch.zer...
AttributeError: 'Tensor' object has no attribute 'astype' *change code to: def calc_psnr(img1, img2): img1 = img1.cpu().numpy().astype(np.float64) img2 = img2.cpu().numpy().astype(np.float64) mse = np.mean((img1 - img2) ** 2) if mse == 0: return float('inf') re...