Skip to content

This is the official implementation of: Learning to Count Anything: Reference-less Class-agnostic Counting with Weak Supervision Michael Hobley, Victor Prisacariu

License

Notifications You must be signed in to change notification settings

SinicaGroup/LearningToCountAnything

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning To Count Anything: Reference-less Class-agnostic Counting with Weak Supervision

Project Page | Latest arXiv

Michael Hobley, Victor Adrian Prisacariu.

Active Vision Lab (AVL), University of Oxford.

image

Environment

We provide a environment.yml file to set up a conda environment:

git clone https://github.com/ActiveVisionLab/LearningToCountAnything.git
cd LearningToCountAnything
conda env create -f environment.yml

Dataset download

FSC-147

The data is the same as in Learning To Count Everything, Ranjan et al. as are the annotation, image class and train/test/val split files we include.

Dowload FSC-147 Images and the precomputed density maps.

If you are not using data/ then specify your data_path directory in configs/_DEFAULT. yml.

data/FSC-147
├── annotation_FSC147_384.json
├── ImageClasses_FSC147.txt
├── gt_density_map_adaptive_384_VarV2
│   ├── 2.npy
│   ├── 3.npy
│   ├── ...
├── images_384_VarV2
│   ├── 2.jpg
│   ├── 3.jpg
│   ├── ...
└── Train_Test_Val_FSC_147.json

FSC-133

As discussed in the paper, we found FSC-147 contained 448 non-unique images. Some of the duplicated images appear with different associated counts, and/or in the training set and one of the validation or testing sets. We propose FSC-133, which removes these errors, ambiguities, and repeated images from FSC-147.

As FSC-133 is a subset of FSC-147 the images and precomputed density maps are as above. The annotations, class labels and data splits have been updated.

data/FSC-133
├── annotation_FSC133_384.json
├── ImageClasses_FSC133.txt
├── gt_density_map_adaptive_384_VarV2
│   ├── 2.npy
│   ├── 3.npy
│   ├── ...
├── images_384_VarV2
│   ├── 2.jpg
│   ├── 3.jpg
│   ├── ...
└── Train_Test_Val_FSC_133.json

Example Training

python main.py --config example

Example Testing

To test a trained model on the validation set:

python main.py --config example --val

To test a trained model on the test set:

python main.py --config example --test

Citation

If you find the code or FSC-133 useful, please cite:


@article{hobley2022-LTCA,
  title={Learning to Count Anything: Reference-less Class-agnostic Counting with Weak Supervision},
  author={Hobley, Michael and Prisacariu, Victor},
  journal={arXiv preprint arXiv:2205.10203},
  year={2022}
}

About

This is the official implementation of: Learning to Count Anything: Reference-less Class-agnostic Counting with Weak Supervision Michael Hobley, Victor Prisacariu

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%