Another metric widely employed in the counting by density estimation task is the ssim. Even in this case, like for the game metric, the goal is to assess the quality of the counting results, taking into account also possible mistaken estimations. In particular, here, the goal is to assess the quality of the estimated density maps. ssim, introduced in [1]}, is used in general as a metric to measure the similarity between two images. In the case of the counting by density estimation, the images are represented by the predicted and the ground truth density maps, respectively. A common solution to assess the similarity between two images is to quantify the difference in the values of each of the corresponding pixels between the sample and the reference images by using, for example, Mean Squared Error. However, unlike most of the other methods that attempt to quantify the visibility of errors (differences) between the two images, inspired by the fact that human visual perception is highly adapted for extracting structural information from a scene, the authors of [1]} proposed to introduce an alternative, complementary framework for quality assessment based on the degradation of structural information. In particular, the ssim extracts three key features from an image: i) luminance, ii) contrast, and iii) structure, and the comparison between the two images is performed exploiting and combining these three indices. The ssim value can be a value between -1 and +1. A value of +1 indicates that the two given images are very similar or the same, while a value of -1 indicates the two given images are very different. Often these values are adjusted to be in the range \([0, 1]\) , where the extremes hold the same meaning. It is worth noting that the authors suggested applying the above metrics regionally (i.e., in small sections of the image and taking the mean overall) instead of using them globally (i.e., all over the image at once). The reasons are that the statistical image features are usually highly spatially non-stationary and also because the image distortions, which may or may not depend on the local image statistics, may also be space-variant. The authors used an \(11\times 11\)  circular-symmetric Gaussian Weighing function (basically, an \(11\times 11\)  matrix whose values are derived from a Gaussian distribution) which moves pixel-by-pixel over the entire image. At each step, the local statistics and the ssim index are calculated within the local window. Once computations are performed all over the image, the global ssim is computed taking the mean of all the local ssim values.
