Spaces:
Configuration error
Configuration error
Download primitive_anything/michelangelo/utils/eval.py from abidlabs/PrimitiveAnythingCachedExamples: direct link, hf CLI and curl.
- Browser
- Download file 214 Bytes
-
https://huggingface.co/spaces/abidlabs/PrimitiveAnythingCachedExamples/resolve/main/primitive_anything/michelangelo/utils/eval.py
- Command line
-
hf download hf://spaces/abidlabs/PrimitiveAnythingCachedExamples/primitive_anything/michelangelo/utils/eval.py
-
curl -L -o eval.py https://huggingface.co/spaces/abidlabs/PrimitiveAnythingCachedExamples/resolve/main/primitive_anything/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 | |