Skip to content

MartinMa28/vehicle_counting

Repository files navigation

Vehicle counting

Count vehicle using density map regression.

Installation

pip3 install requirements.txt

CityCam dataset

Download the dataset from the link down below. After that, extract the datasets in the project folder. Each car in the frames is annotated by a bounding box.
CityCam dataset

Note that CityCam contains some bad-formed xml files, in which the annotator failed to escape '&'. I also found that in one specific image frame the 'y_min' of the bounding box is out of the image border. All of invalid data I found has been listed in the CityCam_invalid_frames.txt.

Density map

original image frame

generated density map

Gernally speaking, I put a gaussian kernel at the center of every car to generate a density map for a specific image frame. As for the standard deviation (sigma) of the gaussian kernel, it is determined by the sum of the distances to the k nearest neighbors. Please read this MCNN paper for more details. You could find my implementation over here k_nearest_gaussian_kernel.

To generate the density maps, just type python3 counting_datasets/CityCam_maker.py in the project directory.

How to train

First of all, set up your hyper parameters in hyper_param_conf.py. And then, execute the main.py script python3 main.py. The trained model will be stored in checkpoints/, logs will be saved in logs/ for your reference.

Releases

No releases published

Packages

No packages published