{"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-spatial-similarity-distribution-for","title":"Learning Spatial Similarity Distribution for Few-shot Object Counting","arxiv_id":"2405.11770","date":"2024-05-20","proceeding":null,"authors":["Yuanwu Xu","Feifan Song","Haofeng Zhang"],"abstract":"Few-shot object counting aims to count the number of objects in a query image that belong to the same class as the given exemplar images. Existing methods compute the similarity between the query image and exemplars in the 2D spatial domain and perform regression to obtain the counting number. However, these methods overlook the rich information about the spatial distribution of similarity on the exemplar images, leading to significant impact on matching accuracy. To address this issue, we propose a network learning Spatial Similarity Distribution (SSD) for few-shot object counting, which preserves the spatial structure of exemplar features and calculates a 4D similarity pyramid point-to-point between the query features and exemplar features, capturing the complete distribution information for each point in the 4D similarity space. We propose a Similarity Learning Module (SLM) which applies the efficient center-pivot 4D convolutions on the similarity pyramid to map different similarity distributions to distinct predicted density values, thereby obtaining accurate count. Furthermore, we also introduce a Feature Cross Enhancement (FCE) module that enhances query and exemplar features mutually to improve the accuracy of feature matching. Our approach outperforms state-of-the-art methods on multiple datasets, including FSC-147 and CARPK. Code is available at https://github.com/CBalance/SSD.","url_abs":"https://arxiv.org/abs/2405.11770v1","url_pdf":"https://arxiv.org/pdf/2405.11770v1.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-spatial-similarity-distribution-for","repo_url":"https://github.com/CBalance/SSD","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"object-counting","task_name":"Object Counting"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/object-counting-on-fsc147","task":"Object Counting","dataset":"FSC147","model":"SSD","rank_in_archive_order":5,"of":19,"metrics":{"MAE(test)":"9.58","MAE(val)":"9.73","RMSE(test)":"64.13","RMSE(val)":"29.72"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.11770","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.11770"}},"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/CBalance/SSD","reach":{"status":"ok"}}],"summary":{"ran":3,"ran_honours":1,"unverified":6},"by_repo_kind":{"official":{"samples":10,"ran":4,"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":10,"samples":[{"code_sha256_prefix":"e35a4b2e4114b1a5","entry":"build_optimizer","repo":"CBalance/SSD","repo_kind":"official","path":"optimizer.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/optimizer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e35a4b2e4114b1a5"}},{"code_sha256_prefix":"eec1e7cba51d5e8e","entry":"get_grad_norm","repo":"CBalance/SSD","repo_kind":"official","path":"utils.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"eec1e7cba51d5e8e"}},{"code_sha256_prefix":"b682400e00259df7","entry":"load_checkpoint","repo":"CBalance/SSD","repo_kind":"official","path":"utils.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b682400e00259df7"}},{"code_sha256_prefix":"b33222a09fc93bec","entry":"set_weight_decay","repo":"CBalance/SSD","repo_kind":"official","path":"optimizer.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/optimizer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b33222a09fc93bec"}},{"code_sha256_prefix":"0c32459bef92ff8c","entry":"auto_resume_helper","repo":"CBalance/SSD","repo_kind":"official","path":"utils.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0c32459bef92ff8c"}},{"code_sha256_prefix":"c02cc4e0b5720211","entry":"build_scheduler","repo":"CBalance/SSD","repo_kind":"official","path":"lr_scheduler.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/lr_scheduler.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c02cc4e0b5720211"}},{"code_sha256_prefix":"b0a5beb34716d5a6","entry":"check_keywords_in_name","repo":"CBalance/SSD","repo_kind":"official","path":"optimizer.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/optimizer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b0a5beb34716d5a6"}},{"code_sha256_prefix":"80450600f7f09b0a","entry":"create_logger","repo":"CBalance/SSD","repo_kind":"official","path":"logger.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/logger.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"80450600f7f09b0a"}},{"code_sha256_prefix":"6fd524f318462840","entry":"get_config","repo":"CBalance/SSD","repo_kind":"official","path":"config.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/config.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6fd524f318462840"}},{"code_sha256_prefix":"9349da30d2edc90b","entry":"validate","repo":"CBalance/SSD","repo_kind":"official","path":"CARPK.py","file_url":"https://github.com/CBalance/SSD/blob/HEAD/CARPK.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9349da30d2edc90b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}