{"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/single-domain-generalization-for-crowd","title":"Single Domain Generalization for Crowd Counting","arxiv_id":"2403.09124","date":"2024-03-14","proceeding":"CVPR 2024 1","authors":["Zhuoxuan Peng","S. -H. Gary Chan"],"abstract":"Due to its promising results, density map regression has been widely employed for image-based crowd counting. The approach, however, often suffers from severe performance degradation when tested on data from unseen scenarios, the so-called \"domain shift\" problem. To address the problem, we investigate in this work single domain generalization (SDG) for crowd counting. The existing SDG approaches are mainly for image classification and segmentation, and can hardly be extended to our case due to its regression nature and label ambiguity (i.e., ambiguous pixel-level ground truths). We propose MPCount, a novel effective SDG approach even for narrow source distribution. MPCount stores diverse density values for density map regression and reconstructs domain-invariant features by means of only one memory bank, a content error mask and attention consistency loss. By partitioning the image into grids, it employs patch-wise classification as an auxiliary task to mitigate label ambiguity. Through extensive experiments on different datasets, MPCount is shown to significantly improve counting accuracy compared to the state of the art under diverse scenarios unobserved in the training data characterized by narrow source distribution. Code is available at https://github.com/Shimmer93/MPCount.","url_abs":"https://arxiv.org/abs/2403.09124v2","url_pdf":"https://arxiv.org/pdf/2403.09124v2.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":"single-domain-generalization-for-crowd","repo_url":"https://github.com/shimmer93/mpcount","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"crowd-counting","task_name":"Crowd Counting"},{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"image-classification","task_name":"image-classification"},{"task_slug":"regression-1","task_name":"regression"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2403.09124","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.09124"}},"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":"deterministic:regex_extraction","url":"https://github.com/Shimmer93/MPCount","reach":null}],"summary":{"ran":4,"ran_fixture":1,"unverified":3},"by_repo_kind":{"official":{"samples":8,"ran":5,"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":"0f7a94821f315ab4","entry":"ConvBlock","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0f7a94821f315ab4"}},{"code_sha256_prefix":"654b2204f17e6090","entry":"DGModel_base","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"654b2204f17e6090"}},{"code_sha256_prefix":"a1993ae8d26fd478","entry":"FixedUpsample","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a1993ae8d26fd478"}},{"code_sha256_prefix":"0f423a2fc5d91aae","entry":"Upsample","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0f423a2fc5d91aae"}},{"code_sha256_prefix":"a90ac42da7d36f79","entry":"upsample","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a90ac42da7d36f79"}},{"code_sha256_prefix":"c4f1af0b30285bbb","entry":"DGModel_final","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c4f1af0b30285bbb"}},{"code_sha256_prefix":"100d6caede439e5f","entry":"DGModel_mem","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"100d6caede439e5f"}},{"code_sha256_prefix":"43287c89abbbe015","entry":"DGModel_memcls","repo":"Shimmer93/MPCount","repo_kind":"official","path":"models/models.py","file_url":"https://github.com/Shimmer93/MPCount/blob/HEAD/models/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"43287c89abbbe015"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}