Skip to content

Official implementation in PyTorch of SASNet as described in "To Choose or to Fuse? Scale Selection for Crowd Counting"

License

Notifications You must be signed in to change notification settings

TencentYoutuResearch/CrowdCounting-SASNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SASNet (AAAI2021)

Official implementation in PyTorch of SASNet as described in "To Choose or to Fuse? Scale Selection for Crowd Counting" by Qingyu Song *, Changan Wang *, Yabiao Wang, Ying Tai, Chengjie Wang, Jilin Li, Jian Wu, Jiayi Ma.

The codes is tested with PyTorch 1.5.0. It may not run with other versions.

Visualizations for the scale-adaptive selection

The proposed adaptive selection strategy automatically learns the internal relations and the following visualizations demonstrate its effectiveness.

Installation

  • Clone this repo into a directory named SASNet_ROOT
  • Install Python dependencies. We use python 3.6.8 and pytorch >= 1.5.0
pip install -r requirements.txt
  • Download ShanghaiTech dataset and models from GoogleDrive

Preparation

Organizing the datas and models as following:

SASNet_ROOT/
        |->datas/
        |    |->part_A_final/
        |    |->part_B_final/
        |    |->...
        |->models/
        |    |->SHHA.pth
        |    |->SHHB.pth
        |    |->...
        |->main.py

Generating the density maps for the data:

python prepare_dataset.py --data_path ./datas/part_A_final
python prepare_dataset.py --data_path ./datas/part_B_final

Running

Run the following commands to launch inference:

python3 main.py --data_path ./datas/part_A_final --model_path ./models/SHHA.pth 
python3 main.py --data_path ./datas/part_B_final --model_path ./models/SHHB.pth 

The network

The overall architecture of the proposed SASNet mainly consists of three components: U-shape backbone, confidence branch and density branch.

Comparison with state-of-the-art methods

The SASNet achieved state-of-the-art performance on several challenging datasets with various densities.

Qualitative results

The following qualitative results show impressive counting accuracy under various crowd densities.

Citing SASNet

If you think SASNet is useful in your project, please consider citing us.

@article{sasnet,
  title={To Choose or to Fuse? Scale Selection for Crowd Counting},
  author={Qingyu Song and Changan Wang and Yabiao Wang and Ying Tai and Chengjie Wang and Jilin Li and Jian Wu and Jiayi Ma},
  journal={The Thirty-Fifth AAAI Conference on Artificial Intelligence (AAAI-21)},
  year={2021}
}

About

Official implementation in PyTorch of SASNet as described in "To Choose or to Fuse? Scale Selection for Crowd Counting"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages