(img1, img2)
| 15 | return (((img1 - img2)) ** 2).view(img1.shape[0], -1).mean(1, keepdim=True) |
| 16 | |
| 17 | def psnr(img1, img2): |
| 18 | mse = (((img1 - img2)) ** 2).view(img1.shape[0], -1).mean(1, keepdim=True) |
| 19 | return 20 * torch.log10(1.0 / torch.sqrt(mse)) |
| 20 | |
| 21 | def easy_cmap(x: torch.Tensor): |
| 22 | x_rgb = torch.zeros((3, x.shape[0], x.shape[1]), dtype=torch.float32, device=x.device) |
no outgoing calls
no test coverage detected