plenoptic.metric.mse#
- plenoptic.metric.mse(img1, img2)[source]#
Return the MSE between img1 and img2.
Our baseline metric to compare two images is often mean-squared error, MSE. This is not a good approximation of the human visual system, but is handy to compare against.
For two images, \(x\) and \(y\), with \(n\) pixels each:
\[MSE = \frac{1}{n}\sum_i (x_i - y_i)^2\]- Parameters:
- Return type:
- Returns:
mse – The mean-squared error between
img1andimg2.- Raises:
RuntimeError – If
img1andimg2aren’t the same size.
Examples
>>> import plenoptic as po >>> import torch >>> einstein = po.data.einstein() >>> po.set_seed(0) >>> einstein_noisy = einstein + 0.1 * torch.randn_like(einstein) >>> po.metric.mse(einstein, einstein_noisy) tensor([[0.0100]])