  # Per-Pixel Loss Functions

## What is a Per-Pixel Loss Function?

A per-pixel loss function is used as a metric for understanding differences between images on a pixel level. The loss function measures the differences between output pixel values in an image. While the function is valuable for understanding interpolation on a pixel level, the process has drawbacks. For example, data scientists argue that the per-pixel loss function doesn't as accurately address qualities of the image that are important or meaningful. Often this leads to the comparison between per-pixel loss functions and perceptual loss functions.

Source

In the image above, note the differences in output images between functions. A per-pixel loss function uses the absolute error to compare pixel values. In contrast, the perceptual loss function uses the mean squared error to generate the reconstructed output image.

## How does a Per-Pixel Loss Function work?

The per-pixel loss function, while initially seems complicated, is a fairly simple concept. In short, the loss function finds the total of all the absolute errors between each pixel. This means that each pixel value is essentially measured with other values to produce a total representation of the image's pixel loss. The alternative method, perceptual pixel loss, focuses more on comparing images based on high-level representations.