GithubHelp home page GithubHelp logo

rongliangzi / dense-scale-network-for-crowd-counting Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 8.0 42 KB

An unofficial implement of paper "Dense Scale Network for Crowd Counting", link: https://arxiv.org/abs/1906.09707

Python 99.93% Shell 0.07%
crowd-counting convolutional-neural-networks deep-learning

dense-scale-network-for-crowd-counting's Introduction

Dense-Scale-Network-for-Crowd-Counting

An unofficial implement of paper "Dense Scale Network for Crowd Counting".

Dataset setup

Download the shanghaitech dataset from here, UCF-QNRF dataset from here.

Data preparation

In make_sh_gt.py, modify variable root in line 18 to your dataset path and set the min_size in line 16 for image. Then run the .py file. It will save images and .h5 file in root/{dataset}_preprocessed/train/ and root/{dataset}_preprocessed/test/.

Train

In main.py, set train_path to root/{dataset}_preprocessed/train/ and test_path to root/{dataset}_preprocessed/test/ in line 81 and 82. Also specify the save_path. When training shanghaitech PartA dataset, the model shows faster convergence if learning rate is set as 1e-4 compared to 1e-5 which is claimed by the paper.

Test

Test on one image

python test_one_image.py --gpu 0 --model_path pretrained_model_path --test_img_path your_image_path

Test on a dataset

python test_dataset.py --gpu 0 --model_path pretrained_model_path --test_img_dir your_image_directory

Result

Dataset MAE MSE
sha 69.35 104.4
shb 8.58 14.87
qrnf tbd tbd

Anyone interested in implementing crowd counting models is welcomed to contact me.

dense-scale-network-for-crowd-counting's People

Contributors

rongliangzi avatar victorjourne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dense-scale-network-for-crowd-counting's Issues

Network architecture issues

Many thanks for your great work to attempt to reproduce the DSNet paper!
After reading your code, in particular the dsnet.py file, I notice 4 potential issues :

  1. Vgg-18 ten first layers should be no trainable (not clear in the paper)
  2. There is no bias for the dilated convolution layer inside DDCB block. According to the paper, it is similar to DenseASPP layer implementation example
  3. At the end of DDCB block, there is no RELU layer according to the paper
  4. Inside DDCB block again, the last concat should include x1_raw, ie. x3 = torch.cat([x, x1_raw, x2_raw, x3_raw], 1)
    I think there is a typo in the figure 2 of the paper, the DDCB paragraph overlines a full connection of dilation layers.

I am training a network with these changes on ShangaiTech B dataset, let see if I retrieve paper results....

Multi-scale density level consistency loss

Thanks again for your work!
Regarding the Multi-scale density level consistency loss, I think the L1 loss has to be reduced by sum instead of mean (default pytorch paramater).
Indeed, even if it it not specified clearly in the paper, as the norm is divided by the square of the average pooling output size, it is more logical to sum every component of the average pooling operation than average them.

What do you think?

得到人的数量

网络输出一张热力图,最后是dmp.sum()得到一个count,但是这个count是一个小数,怎么获得这张热力图的实际人数呢?

How can I test the model and create.h5 file?

Hi,

I am a newbie who is studying crowd counting.
According to the survey paper, your work performs excellent.
I have traced your code and trained the model, it seems need a h5 to test your model? How can I use a photo from the internet to test your model? And how can I create a h5 file of it?
Thanks

cv2 interpolation to resize the target

It would be more accurate to use the INTER_AREA interpolation than the INTER_CUBIC one for the resize of the target.
Indeed, this downsampling is more natural here because it computes the weighted average of pixels.

Moreover, the rescale should be normalized with int(target.shape[0]) * int(target.shape[1])/ (int(target.shape[1]/ratio) * int(target.shape[0]/ratio)) rather than ratio**2.

It is not that minor, the current resize produces 1% of error.

I will make a PR for that!

Thanks

提示object 'density' doesn't exsit

您好,对于您的程序有几个问题:
1、程序中使用的是python2 还是python3?
2、Shanghaitech的数据集中groundtruth为.mat格式,程序中使用h5py读取,这样读出来之后为什么为空呢?
3、读取groundtruth之后,索引['density']键时,会提示该键不存在,可能是什么原因呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.