Sovereign 8s.is mirror of standardgalactic/SinCount
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-03-13 09:14:28 +08:00
.idea fitst submit 2026-03-10 13:06:08 +08:00
configs fitst submit 2026-03-10 13:06:08 +08:00
datasets fitst submit 2026-03-10 13:06:08 +08:00
models fix a minor bug 2026-03-13 09:14:28 +08:00
trainers fitst submit 2026-03-10 13:06:08 +08:00
utils fitst submit 2026-03-10 13:06:08 +08:00
inference.py fitst submit 2026-03-10 13:06:08 +08:00
LICENSE fitst submit 2026-03-10 13:06:08 +08:00
main.py fitst submit 2026-03-10 13:06:08 +08:00
README.md Fix typo in performance metrics for source B 2026-03-10 13:09:30 +08:00
requirements.txt fitst submit 2026-03-10 13:06:08 +08:00
sta_train.txt fitst submit 2026-03-10 13:06:08 +08:00
sta_val.txt fitst submit 2026-03-10 13:06:08 +08:00
stb_train.txt fitst submit 2026-03-10 13:06:08 +08:00
stb_val.txt fitst submit 2026-03-10 13:06:08 +08:00
ucf_train.txt fitst submit 2026-03-10 13:06:08 +08:00
ucf_val.txt fitst submit 2026-03-10 13:06:08 +08:00

SinCount: Fourier Transform-Based Single Domain Generalization for Crowd Counting

This is the official repository for our work, "SinCount: Fourier Transform-Based Single Domain Generalization for Crowd Counting".

Currently, we only provide the testing and inference code. The full training code will be made open-source after the paper is accepted.

Requirements

  • Python 3.10.12
  • PyTorch 2.0.1
  • Torchvision 0.15.2
  • Others specified in requirements.txt

Data Preparation

  1. Download ShanghaiTech and UCF-QNRF datasets from official sites and unzip them.
  2. Run the following commands to preprocess the datasets:
    python utils/preprocess_data.py --origin-dir [path_to_ShanghaiTech]/part_A --data-dir data/sta
    python utils/preprocess_data.py --origin-dir [path_to_ShanghaiTech]/part_B --data-dir data/stb
    python utils/preprocess_data.py --origin-dir [path_to_UCF-QNRF] --data-dir data/qnrf
    
  3. Run the following commands to generate GT density maps:
    python dmap_gen.py --path data/sta
    python dmap_gen.py --path data/stb
    python dmap_gen.py --path data/qnrf
    

Testing

Run the following commands after you specify the path to the model weight in the config file:

python main.py --task test --config configs/sta_test_stb.yml
python main.py --task test --config configs/sta_test_qnrf.yml

Inference

Run the following command:

python inference.py --img_path [path_to_img_file_or_directory] --model_path [path_to_model_weight] --save_path output.txt --vis_dir vis

Pretrained Weights

We provide pretrained weights in the table below:

Source Performance Weights
A B: 11.8MAE, 20.0MSE
Q: 109.0MAE, 180.0MSE
Google Drive
B A: 104.9MAE, 186.1MSE
Q: 169.2MAE, 298.1MSE
Google Drive