This commit is contained in:
hyz317
2025-05-07 16:51:22 +08:00
commit 87c3ed5e40
54 changed files with 8014 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
import torch
def compute_psnr(x, y, data_range: float = 2, eps: float = 1e-7):
mse = torch.mean((x - y) ** 2)
psnr = 10 * torch.log10(data_range / (mse + eps))
return psnr