Awesome
To everyone interested in our work CFANet in WACV2021:
MARUNet in this repo is identical to the the CFANet without Density level estimator, that means only density map estimator and crowd region recognizer are used. The second row w. CRR
means the MARUNet in Table 7 of our paper. The name MARUNet is unchanged since we wrote another manuscript before and upgrade it to CFANet and submit it to WACV2021. I have graduated last summer, so just use MARUNet is ok, which is also a good baseline, since it can get 56.9 MAE on SHA.
MARUNet
Multi-level Attention Refined UNet for crowd counting.
Data preparation
Images and groundtruth are read into dataset via .json file which is specified in json directory. Preprocessed Shanghaitech and UCF-QNRF datasets can be downloaded from:
(1) Baidu disk: link(Extraction Code: xvd2).
(2) Google drive: UCF-QNRF(For images with width or height larger than 1024, we resize the larger side to 1024, e.g., 2048*1024 -> 1024*512), ShanghaiTech
Modifying the path in .json file and data can be read.
Training
python train_generic.py --model MARNet --epochs 100 --dataset qnrf --train_json json/qnrf_train.json --val_json json/qnrf_val.json --loss 3avg-ms-ssim --lazy_val 0
(MARNet
is identical to MARUNet
.)
Testing
Use test_one_image.py to test a given image. You need to set divide
to 50 and ds(downsample)
to 1 in img_test()
to get correct results. Some unused functions are not removed so you need to remove them to run it. If you want to test a model on a dataset, you need to modify it.
Pretrained Models
Download links:
MARUNet(MARNet) | ||
---|---|---|
SHA | Google Drive | Baidu Disk, Extraction Code: hg9y |
SHB | Google Drive | Baidu Disk Extraction Code: 21x7 |
QNRF | Baidu Disk Extraction Code: 5ns9 |
Performance
Shanghaitech PartA
Method | MAE | RMSE | SSIM | PSNR |
---|---|---|---|---|
MARUNet | 56.9 | 91.8 | 0.86 | 29.90 |
Shanghaitech PartB
Method | MAE | RMSE | SSIM | PSNR |
---|---|---|---|---|
MARUNet | 6.6 | 10.6 | 0.96 | 31.04 |
UCF_CC_50
Method | MAE | RMSE | SSIM | PSNR |
---|---|---|---|---|
MARUNet | 233.3 | 313.8 | 0.63 | 19.82 |
UCF-QNRF
Method | MAE | RMSE | SSIM | PSNR |
---|---|---|---|---|
MARUNet | 90.8 | 155.1 | 0.90 | 32.79 |
Other Retrained Models with MSL
We retrain existing models on SHA dataset with our Multi-scale Structural Loss(MSL). Compared to original MSE loss, better performance is achieved.
Link | MAE(MSE/MSL) | RMSE(MSE/MSL) | |
---|---|---|---|
MCNN | Baidu Disk Extraction Code: ubx5 | 110.2/89.1 | 173.2/142.9 |
CSRNet | Baidu Disk Extraction Code: iqme | 68.2/63.4 | 115.0/103.1 |
CAN | Baidu Disk Extraction Code: s93r | 62.3/59.1 | 100.0/90.5 |