Spaces:
Running on Zero
Running on Zero
Download src/model/michelangelo/utils/eval.py from brainable/SkinTokens: direct link, hf CLI and curl.
- Browser
- Download file 214 Bytes
-
https://huggingface.co/spaces/brainable/SkinTokens/resolve/main/src/model/michelangelo/utils/eval.py
- Command line
-
hf download hf://spaces/brainable/SkinTokens/src/model/michelangelo/utils/eval.py
-
curl -L -o eval.py https://huggingface.co/spaces/brainable/SkinTokens/resolve/main/src/model/michelangelo/utils/eval.py
214 Bytes
| # -*- 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 | |