Home

Awesome

PAP-pytorch

This is the official pytorch version repo for [Harnessing Perceptual Adversarial Patches for Crowd Counting].

v4o4YV.png

ATTACK

Prerequisites

We strongly recommend Anaconda as the environment.

Python: 3.X PyTorch: 1.4.0+

Datasets

ShanghaiTech Dataset: Google Drive

Ground Truth

Please follow the CSRNet to generate the ground truth.

Models

In the paper, we totally use six crowd couting models with the repos as follows:

MCNN: https://github.com/CommissarMa/MCNN-pytorch

CSRNet: https://github.com/leeyeehoo/CSRNet-pytorch

CAN: https://github.com/weizheliu/Context-Aware-Crowd-Counting

BL: https://github.com/ZhihengCV/Bayesian-Crowd-Counting

DM-Count: https://github.com/cvlab-stonybrook/DM-Count

SASNet: https://github.com/TencentYoutuResearch/CrowdCounting-SASNet

Here we give the official pre-trained CSRNet. You can also use other crowd counting models.

ShanghaiA Google Drive

ShanghaiB Google Drive

Training Process

Try python patch_attack.py to start training process.

For attacking the CSRNet, you may modify the follow ones:

data_root = './data/attack_shanghai/' #the dataset root

model_path = './pre_trained/PartA_model.pth.tar' #the pre-trained model root

save_path = './results' # the results root, finally you can get the images with our adversarial patches

For attacking other models, you need to modify the patch_attack.py to fit your target model.