We also tested density-estimation approaches known for delivering excellent counting performances, especially in “crowded” scenarios.
Using this approach, we learn a regression model producing a density map \(D = f_\theta (I) \in \mathbb {R}^{H \times W}\)  from an input image of height \(H\)  and width \(W\) .
Each pixel of \(D\)  corresponds to the quantity of the objects present at that precise point.
Thus, the notion of density map loosely corresponds to the physical/mathematical notion of density;
the number of objects \(n\)  in an image sub-region \(P \subseteq I\)  is estimated by integrating \(D\)  over \(P\) , i.e., summing up pixel values in the considered region, \(n = \sum _{p \in P} D_p\) . We refer the reader to sec:back:visual-counting:traditional-approaches for further details.
Although these approaches are not intended to localize objects, a coarse localization can be obtained by analyzing the estimated density map, in particular by finding the top-\(n\)  maximum local peaks of it, as already done in [1]}.
During training, the target density maps are produced by superimposing Gaussian kernels \(G_\sigma \)  centered in the dot-annotated locations;
the spread parameter \(\sigma \)  is fixed and depends on the typical object size in the dataset.
In case of multiple object classes, the network outputs one density map per class, and target generation is performed independently for each class.
An example of a target density map is reported in tab:datasets.
The model is trained by minimizing the mean squared error loss between target and output density maps.
We implement \(f_\theta \)  exploiting the Congested Scene Recognition Network (CSRNet) [2]}, a CNN for density estimation comprised of a modified VGG-16 network [3]} for feature extraction and a series of dilated convolutional layers [4]} to extract deeper information of saliency and, at the same time, maintaining the output resolution (see sec:back:visual-counting:cnn-based for further details). We will refer to this method as D-CSRNet.
