We report in this section some implementation details concerning the Mask R-CNN-based algorithm responsible for the prediction of the number of vehicles in the single images. In particular, we trained the modified Mask R-CNN initializing the weights of the ResNet50 backbone with the ones of a pre-trained model on ImageNet [1]}, a popular dataset for classification tasks, and the remaining ones at random. We freeze the backbone for the first ten epochs, and then we trained the whole network for 20 additional epochs. To prevent overfitting, we applied some standard augmentation techniques to the training data: images are horizontally flipped with a 0.5 probability, then their pixels are multiplied by a random value between 0.8 and 1.5, and finally, they are blurred using a Gaussian kernel with a standard deviation of a random value between 0 and 5. Then, to support training multiple images per batch, we resized all pictures to the same size. If an image is not square, we pad it with zeros to preserve the aspect ratio. In the end, we obtained images of size \(1024\times 1024\) . At inference time, images are resized and padded with zeros to get a square picture of size \(1024\times 1024\) , and no other augmentations occur.
