{"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/csp-self-supervised-contrastive-spatial-pre","title":"CSP: Self-Supervised Contrastive Spatial Pre-Training for Geospatial-Visual Representations","arxiv_id":"2305.01118","date":"2023-05-01","proceeding":null,"authors":["Gengchen Mai","Ni Lao","Yutong He","Jiaming Song","Stefano Ermon"],"abstract":"Geo-tagged images are publicly available in large quantities, whereas labels such as object classes are rather scarce and expensive to collect. Meanwhile, contrastive learning has achieved tremendous success in various natural image and language tasks with limited labeled data. However, existing methods fail to fully leverage geospatial information, which can be paramount to distinguishing objects that are visually similar. To directly leverage the abundant geospatial information associated with images in pre-training, fine-tuning, and inference stages, we present Contrastive Spatial Pre-Training (CSP), a self-supervised learning framework for geo-tagged images. We use a dual-encoder to separately encode the images and their corresponding geo-locations, and use contrastive objectives to learn effective location representations from images, which can be transferred to downstream supervised tasks such as image classification. Experiments show that CSP can improve model performance on both iNat2018 and fMoW datasets. Especially, on iNat2018, CSP significantly boosts the model performance with 10-34% relative improvement with various labeled training data sampling ratios.","url_abs":"https://arxiv.org/abs/2305.01118v2","url_pdf":"https://arxiv.org/pdf/2305.01118v2.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":"csp-self-supervised-contrastive-spatial-pre","repo_url":"https://github.com/gengchenmai/csp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"csp-self-supervised-contrastive-spatial-pre","repo_url":"https://github.com/kelsdoerksen/giga-connectivity","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"self-supervised-learning","task_name":"Self-Supervised Learning"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"fail","method_name":"fail"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2305.01118","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.01118"}},"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/kelsdoerksen/giga-connectivity","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gengchenmai/csp","reach":null}],"summary":{"ran_draft_wrong":1,"ran_fixture":1,"ran":1,"ran_honours":1,"unverified":1},"by_repo_kind":{"listed":{"samples":5,"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":5,"samples":[{"code_sha256_prefix":"96cda1aea7b63917","entry":"embed_l2_normalize","repo":"gengchenmai/csp","repo_kind":"listed","path":"main/losses.py","file_url":"https://github.com/gengchenmai/csp/blob/HEAD/main/losses.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"96cda1aea7b63917"}},{"code_sha256_prefix":"e48912ff8b1bd157","entry":"encode_loc_time","repo":"gengchenmai/csp","repo_kind":"listed","path":"main/losses.py","file_url":"https://github.com/gengchenmai/csp/blob/HEAD/main/losses.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e48912ff8b1bd157"}},{"code_sha256_prefix":"f52db84260e2e400","entry":"get_spa_enc_list","repo":"gengchenmai/csp","repo_kind":"listed","path":"main/losses.py","file_url":"https://github.com/gengchenmai/csp/blob/HEAD/main/losses.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":"f52db84260e2e400"}},{"code_sha256_prefix":"f8dfc3ef0600fe52","entry":"rand_samples","repo":"gengchenmai/csp","repo_kind":"listed","path":"main/losses.py","file_url":"https://github.com/gengchenmai/csp/blob/HEAD/main/losses.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f8dfc3ef0600fe52"}},{"code_sha256_prefix":"bd753361ca20fe21","entry":"contsoftmax_loss","repo":"gengchenmai/csp","repo_kind":"listed","path":"main/losses.py","file_url":"https://github.com/gengchenmai/csp/blob/HEAD/main/losses.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":"bd753361ca20fe21"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}