{"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/few-shot-segmentation-with-global-and-local","title":"Few-Shot Segmentation with Global and Local Contrastive Learning","arxiv_id":"2108.05293","date":"2021-08-11","proceeding":null,"authors":["Weide Liu","Zhonghua Wu","Henghui Ding","Fayao Liu","Jie Lin","Guosheng Lin"],"abstract":"In this work, we address the challenging task of few-shot segmentation. Previous few-shot segmentation methods mainly employ the information of support images as guidance for query image segmentation. Although some works propose to build cross-reference between support and query images, their extraction of query information still depends on the support images. We here propose to extract the information from the query itself independently to benefit the few-shot segmentation task. To this end, we first propose a prior extractor to learn the query information from the unlabeled images with our proposed global-local contrastive learning. Then, we extract a set of predetermined priors via this prior extractor. With the obtained priors, we generate the prior region maps for query images, which locate the objects, as guidance to perform cross interaction with support features. In such a way, the extraction of query information is detached from the support branch, overcoming the limitation by support, and could obtain more informative query clues to achieve better interaction. Without bells and whistles, the proposed approach achieves new state-of-the-art performance for the few-shot segmentation task on PASCAL-5$^{i}$ and COCO datasets.","url_abs":"https://arxiv.org/abs/2108.05293v1","url_pdf":"https://arxiv.org/pdf/2108.05293v1.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":"few-shot-segmentation-with-global-and-local","repo_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"image-segmentation","task_name":"Image Segmentation"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2108.05293","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2108.05293"}},"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/liuweide01/GQNet-Few-shot-segmentation","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":4,"ran":5,"unverified":6},"by_repo_kind":{"official":{"samples":15,"ran":9,"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":"df77cb77dfe58d6d","entry":"Weighted_GAP","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/PFENet.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/PFENet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"df77cb77dfe58d6d"}},{"code_sha256_prefix":"1dad93b61e98c32e","entry":"colorize","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/util.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/util.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1dad93b61e98c32e"}},{"code_sha256_prefix":"fac5364e2f53c6db","entry":"conv3x3","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/resnet.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fac5364e2f53c6db"}},{"code_sha256_prefix":"ad7ba6c4e516607e","entry":"get_vgg16_layer","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/PFENet.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/PFENet.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ad7ba6c4e516607e"}},{"code_sha256_prefix":"2a66f4ab6863908c","entry":"intersectionAndUnion","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/util.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2a66f4ab6863908c"}},{"code_sha256_prefix":"0684a938c70bf564","entry":"is_image_file","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/dataset.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/dataset.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0684a938c70bf564"}},{"code_sha256_prefix":"e31250b969b51841","entry":"make_layers","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/vgg.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/vgg.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e31250b969b51841"}},{"code_sha256_prefix":"2067e75510fbe85e","entry":"vgg11","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/vgg.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/vgg.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2067e75510fbe85e"}},{"code_sha256_prefix":"bf96fb236a6b1683","entry":"vgg11_bn","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/vgg.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/vgg.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bf96fb236a6b1683"}},{"code_sha256_prefix":"136834d66336e6b9","entry":"intersectionAndUnionGPU","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/util.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/util.py","link_basis":"harvester_set","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":"136834d66336e6b9"}},{"code_sha256_prefix":"277a13798d6d6981","entry":"load_cfg_from_cfg_file","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/config.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/config.py","link_basis":"harvester_set","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":"277a13798d6d6981"}},{"code_sha256_prefix":"2b6740339633d440","entry":"make_dataset","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/dataset.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/dataset.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":"2b6740339633d440"}},{"code_sha256_prefix":"b925dc5fd8492c34","entry":"merge_cfg_from_list","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"util/config.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/util/config.py","link_basis":"plan_row","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":"b925dc5fd8492c34"}},{"code_sha256_prefix":"0d5305ea0adc2098","entry":"resnet18","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/resnet.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/resnet.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":"0d5305ea0adc2098"}},{"code_sha256_prefix":"f8bf3c22835aea80","entry":"resnet34","repo":"liuweide01/GQNet-Few-shot-segmentation","repo_kind":"official","path":"model/resnet.py","file_url":"https://github.com/liuweide01/GQNet-Few-shot-segmentation/blob/HEAD/model/resnet.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":"f8bf3c22835aea80"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}