Sovereign 8s.is mirror of standardgalactic/ZxCount
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Twiwq 25e55d0c23
Update README with code availability details
Clarified release policy for inference code and weights.
2026-03-15 13:11:21 +08:00
.idea first 2026-03-15 12:00:40 +08:00
configs first 2026-03-15 12:00:40 +08:00
datasets first 2026-03-15 12:00:40 +08:00
models Simplify forward_train method in models.py 2026-03-15 12:08:13 +08:00
trainers Remove unused methods 2026-03-15 12:04:41 +08:00
utils first 2026-03-15 12:00:40 +08:00
inference.py first 2026-03-15 12:00:40 +08:00
LICENSE first 2026-03-15 12:00:40 +08:00
main.py first 2026-03-15 12:00:40 +08:00
README.md Update README with code availability details 2026-03-15 13:11:21 +08:00
requirements.txt first 2026-03-15 12:00:40 +08:00
sta_train.txt first 2026-03-15 12:00:40 +08:00
sta_val.txt first 2026-03-15 12:00:40 +08:00
stb_train.txt first 2026-03-15 12:00:40 +08:00
stb_val.txt first 2026-03-15 12:00:40 +08:00
ucf_train.txt first 2026-03-15 12:00:40 +08:00
ucf_val.txt first 2026-03-15 12:00:40 +08:00

ZxCount:Mask-Guided Hierarchical Memory Alignment for Cross-Domain Crowd Counting

This is an official repository for our work, "ZxCount:Mask-Guided Hierarchical Memory Alignment for Cross-Domain Crowd Counting"

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
    

Training

Run the following command:

python main.py --task train --config configs/sta_train.yml

You may edit the .yml config file as you like.

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

Code Availability

The paper is currently under review. At this stage, we release only the inference code and partial pretrained weights. The complete training code and additional pretrained models will be released once the paper is accepted.

Pretrained Weights

We provide pretrained weights in the table below:

Source Performance Weights
B A: 88.7MAE, 158.1MSE
Q: 157.7MAE, 264.8MSE
Google Drive