zhiyuanyou / SAFECount

[WACV 2023] Few-shot Object Counting with Similarity-Aware Feature Enhancement
Other
124 stars 22 forks source link

SAFECount

Official PyTorch Implementation of Few-shot Object Counting with Similarity-Aware Feature Enhancement, Accepted by WACV 2023.

SAFECount Image text

1. Quick Start

1.1 FSC147 in Original Setting

|-- data
    |-- FSC147_384_V2
        |-- images_384_VarV2
        |-- gt_density_map_adaptive_384_VarV2
        |-- train.json
        |-- val.json
        |-- test.json
        |-- fold0.json
        |-- fold1.json
        |-- fold2.json
        |-- fold3.json
Platform Val MAE Val RMSE Test MAE Test RMSE Checkpoints
8 GPUs (NVIDIA Tesla V100 16GB) 14.42 51.72 13.56 91.30 here

1.2 FSC147 in Cross Validation Setting

Here we provide one example (3 shot, fold0 as val set), and others are similar.

Shot Val Fold Val MAE Val RMSE Shot Val Fold Val MAE Val RMSE
1 0 15.62 51.20 3 0 13.84 43.99
1 1 7.14 15.77 3 1 6.29 13.89
1 2 14.05 92.48 3 2 11.19 86.81
1 3 13.88 38.38 3 3 11.73 33.85

1.3 Cross-dataset Generalization (FSC147 to CARPK)

MAE (pretrain on FSC147) RMSE (pretrain on FSC147) MAE (finetune on CARPK) RMSE (finetune on CARPK)
17.78 20.95 4.91 6.32

1.4 Class-specific Counting

The train and eval of class-specific counting are similar to FSC147. Here we only provide the construction of the dataset directory. The checkpoints (trained on 8 NVIDIA Tesla V100 16GB GPUs) and the corresponding results are given.

CARPK PUCPR+ UCSD Mall ShanghaiTech PartA ShanghaiTech PartB
MAE 4.91 2.24 1.01 1.77 74.36 9.75
RMSE 6.32 3.44 1.34 2.24 121.15 15.87
checkpoints here here here here here here

1) CARPK

2) PUCPR+

3) UCSD

4) Mall

5) ShanghaiTech

2. Learn More About Our Methods

dataset model circumstance
custom_dataset.py safecount.py The support images are parts of the query image, and annotated by bounding boxes, e.g., FSC147.
custom_exemplar_dataset.py safecount_exemplar.py The support images are sampled then fixed, and not parts of the query image, e.g., CARPK, PUCPR+, UCSD, Mall, and ShanghaiTech.
custom_dataset.py safecount_crossdataset.py In cross-dataset generalization, pretraining a model on FSC147 and finetuning on class-specific counting.

3. Questions