mirror of
https://github.com/PrimitiveAnything/PrimitiveAnything.git
synced 2026-05-08 00:58:55 +08:00
init
This commit is contained in:
12
primitive_anything/michelangelo/utils/eval.py
Executable file
12
primitive_anything/michelangelo/utils/eval.py
Executable 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
|
||||
|
||||
Reference in New Issue
Block a user