Sovereign 8s.is mirror of standardgalactic/SinCount
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .idea | ||
| configs | ||
| datasets | ||
| models | ||
| trainers | ||
| utils | ||
| inference.py | ||
| LICENSE | ||
| main.py | ||
| README.md | ||
| requirements.txt | ||
| sta_train.txt | ||
| sta_val.txt | ||
| stb_train.txt | ||
| stb_val.txt | ||
| ucf_train.txt | ||
| ucf_val.txt | ||
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
- Download ShanghaiTech and UCF-QNRF datasets from official sites and unzip them.
- 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 - 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 |