
A principle component analysis (PCA) model [1]}, which is capable of image reconstruction, is trained on purely non-anomalous images of a particular object/class.

The input image is passed through this PCA model and its reconstructed image is obtained.
Due to the model's training, the non-anomalous parts of the input image are reconstructed correctly, but the model fails to reconstruct any anomalies in the image that it hasn't seen during its training.
This effect can further be enhanced by reducing the number of PCA components used to reconstruct the image.

Next, the pixelwise PSE (with a set \(\sigma \)  parameter) between the original and reconstructed image is computed. This pixelwise PSE `image' can essentially be seen as a heatmap of differences between the two images.

Finally, the maximum PSE value in this computed heatmap is chosen denoting the area with the highest difference, and this value provides and estimate of anomalousness in the image.

