[ACCV2024] Official implementation of "A Recipe for CAC: Mosaic-based Generalized Loss for Improved Class-Agnostic Counting"
We have tested with Python 3.10 and Pytorch 2.4.1, please follow the Pytorch official instructions to build your environment. For other required Python packages, use the requirements.txt
for installation.
Follow BMNet to setup your data.
Download the data from here.
We use YAML files in the config
directory to run experiments. Please refer to default.py
for parameter setup.
Download the pretrained weights from here. Then modify DIR.runs
and DIR.exp
in the configuration to set the path to your pretrained weights.
Run python main.py --cfg=config/eval_fsc.yaml
.
Run python mosaic.py --cfg=config/eval_mosaic.yaml
.
Download the pretrained backbone from here, we use CvT-21-384x384-IN-22k.pth
checkpoint. Modify MODEL.BACKBONE.PRETRAINED_PATH
in the configuration.
Run python main.py --cfg=config/train.yaml
.
Our code is based on the works of FamNet, BMNet, and MixFormer, and we appreciate their outstanding work. This work was primarily supported by the National Science and Technology Council (NSTC) and Academia Sinica. We also extend our thanks to the National Center for High-performance Computing (NCHC) of the National Applied Research Laboratories (NARLabs) in Taiwan for providing the necessary computational and storage resources.