{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/learning-to-count-everything","title":"Learning To Count Everything","arxiv_id":"2104.08391","date":"2021-04-16","proceeding":"CVPR 2021 1","authors":["Viresh Ranjan","Udbhav Sharma","Thu Nguyen","Minh Hoai"],"abstract":"Existing works on visual counting primarily focus on one specific category at a time, such as people, animals, and cells. In this paper, we are interested in counting everything, that is to count objects from any category given only a few annotated instances from that category. To this end, we pose counting as a few-shot regression task. To tackle this task, we present a novel method that takes a query image together with a few exemplar objects from the query image and predicts a density map for the presence of all objects of interest in the query image. We also present a novel adaptation strategy to adapt our network to any novel visual category at test time, using only a few exemplar objects from the novel category. We also introduce a dataset of 147 object categories containing over 6000 images that are suitable for the few-shot counting task. The images are annotated with two types of annotation, dots and bounding boxes, and they can be used for developing few-shot counting models. Experiments on this dataset shows that our method outperforms several state-of-the-art object detectors and few-shot counting approaches. Our code and dataset can be found at https://github.com/cvlab-stonybrook/LearningToCountEverything.","url_abs":"https://arxiv.org/abs/2104.08391v1","url_pdf":"https://arxiv.org/pdf/2104.08391v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"learning-to-count-everything","repo_url":"https://github.com/cvlab-stonybrook/LearningToCountEverything","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"exemplar-free-counting","task_name":"Exemplar-Free Counting"},{"task_slug":"object-counting","task_name":"Object Counting"}],"methods":[],"datasets_introduced":[{"slug":"fsc147","name":"FSC147","full_name":""}],"methods_introduced":[],"results":[{"leaderboard":"/sota/exemplar-free-counting-on-fsc147","task":"Exemplar-Free Counting","dataset":"FSC147","model":"FamNet","rank_in_archive_order":9,"of":9,"metrics":{"MAE(test)":"32.27","MAE(val)":"32.15","RMSE(test)":"131.46","RMSE(val)":"98.75"},"uses_additional_data":false},{"leaderboard":"/sota/object-counting-on-fsc147","task":"Object Counting","dataset":"FSC147","model":"FamNet","rank_in_archive_order":19,"of":19,"metrics":{"MAE(test)":"22.08","MAE(val)":"23.75","RMSE(test)":"99.54","RMSE(val)":"69.07"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.08391","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.08391"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cvlab-stonybrook/LearningToCountEverything","reach":null}],"summary":{"unverified":1},"by_repo_kind":{"official":{"samples":1,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"818d9e6e4b97a51b","entry":"CountRegressor","repo":"cvlab-stonybrook/LearningToCountEverything","repo_kind":"official","path":"model.py","file_url":"https://github.com/cvlab-stonybrook/LearningToCountEverything/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"818d9e6e4b97a51b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}