This is the official pytorch version repo for [Harnessing Perceptual Adversarial Patches for Crowd Counting].
We strongly recommend Anaconda as the environment.
Python: 3.X PyTorch: 1.4.0+
ShanghaiTech Dataset: Google Drive
Please follow the CSRNet to generate the ground truth.
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
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.