Home

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)
SHAGoogle DriveBaidu Disk, Extraction Code: hg9y
SHBGoogle DriveBaidu Disk Extraction Code: 21x7
QNRFBaidu Disk Extraction Code: 5ns9

Performance

Shanghaitech PartA

MethodMAERMSESSIMPSNR
MARUNet56.991.80.8629.90

Shanghaitech PartB

MethodMAERMSESSIMPSNR
MARUNet6.610.60.9631.04

UCF_CC_50

MethodMAERMSESSIMPSNR
MARUNet233.3313.80.6319.82

UCF-QNRF

MethodMAERMSESSIMPSNR
MARUNet90.8155.10.9032.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.

LinkMAE(MSE/MSL)RMSE(MSE/MSL)
MCNNBaidu Disk Extraction Code: ubx5110.2/89.1173.2/142.9
CSRNetBaidu Disk Extraction Code: iqme68.2/63.4115.0/103.1
CANBaidu Disk Extraction Code: s93r62.3/59.1100.0/90.5