Computer Vision Final Project, Crowd counting + density map
in this project we used P2PNet model [Paper][Github repo] to estimate number of people in crowd scences.
- clone this repository:
git clone https://github.com/amindehnavi/Crowd-Counting-P2PNet
- change the current directory into
CrowdCounting-P2PNet
folder:cd CrowdCounting-P2PNet
- install requirements libraries using
pip install -r requirements.txt
command. - download the vgg16-bn/vgg16 pretrained weight on ImageNet and put it in
checkpoints
folder
to run the model on a some images set video, run the following command
CUDA_VISIBLE_DEVICES=0 python run_test.py --weight_path ./weights/SHTechA.pth --output_dir ./output/ --device cuda --shape 640 480 --threshold 0.75 --images --images_dir ./Dataset --density_map
to test on a video
CUDA_VISIBLE_DEVICES=0 python run_test.py --weight_path ./weights/SHTechA.pth --output_dir ./output/ --device cuda --shape 640 480 --threshold 0.75 --video --video_path /path/to/video
Note 1: to get the density map, set the --density_map
flag in command line.
Note 2: to add the density map on original image, set the --add_density_to_image
flag in command line.