{"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/contrastive-grouping-with-transformer-for-1","title":"Contrastive Grouping with Transformer for Referring Image Segmentation","arxiv_id":"2309.01017","date":"2023-09-02","proceeding":"CVPR 2023 1","authors":["Jiajin Tang","Ge Zheng","Cheng Shi","Sibei Yang"],"abstract":"Referring image segmentation aims to segment the target referent in an image conditioning on a natural language expression. Existing one-stage methods employ per-pixel classification frameworks, which attempt straightforwardly to align vision and language at the pixel level, thus failing to capture critical object-level information. In this paper, we propose a mask classification framework, Contrastive Grouping with Transformer network (CGFormer), which explicitly captures object-level information via token-based querying and grouping strategy. Specifically, CGFormer first introduces learnable query tokens to represent objects and then alternately queries linguistic features and groups visual features into the query tokens for object-aware cross-modal reasoning. In addition, CGFormer achieves cross-level interaction by jointly updating the query tokens and decoding masks in every two consecutive layers. Finally, CGFormer cooperates contrastive learning to the grouping strategy to identify the token and its mask corresponding to the referent. Experimental results demonstrate that CGFormer outperforms state-of-the-art methods in both segmentation and generalization settings consistently and significantly.","url_abs":"https://arxiv.org/abs/2309.01017v1","url_pdf":"https://arxiv.org/pdf/2309.01017v1.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":"contrastive-grouping-with-transformer-for-1","repo_url":"https://github.com/toneyaya/cgformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"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":"object","task_name":"Object"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[{"method_slug":"align","method_name":"ALIGN"},{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2309.01017","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.01017"}},"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/toneyaya/cgformer","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":8,"ran_fixture":1,"ran":13,"unverified":1},"by_repo_kind":{"official":{"samples":23,"ran":22,"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":"0f786c407fb1ee4c","entry":"swish","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/activations.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/activations.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0f786c407fb1ee4c"}},{"code_sha256_prefix":"cf9ffa02a42184af","entry":"whitespace_tokenize","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/tokenization_bert.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/tokenization_bert.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cf9ffa02a42184af"}},{"code_sha256_prefix":"144d10b49baeb8a6","entry":"window_partition","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/backbone.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/backbone.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":2,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"144d10b49baeb8a6"}},{"code_sha256_prefix":"e3ead4161d5e3d4a","entry":"calc_banned_bad_words_ids","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/generation_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/generation_utils.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":"e3ead4161d5e3d4a"}},{"code_sha256_prefix":"8d77347cfa15b834","entry":"calc_banned_ngram_tokens","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/generation_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/generation_utils.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":"8d77347cfa15b834"}},{"code_sha256_prefix":"dbfe3357dc25ca5f","entry":"conv_layer","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/layers.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/layers.py","link_basis":"harvester_set","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":"dbfe3357dc25ca5f"}},{"code_sha256_prefix":"206e880de1f589bc","entry":"dice_loss","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/segmenter.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/segmenter.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"206e880de1f589bc"}},{"code_sha256_prefix":"b239247b87d4f3dc","entry":"find_pruneable_heads_and_indices","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/modeling_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/modeling_utils.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":"b239247b87d4f3dc"}},{"code_sha256_prefix":"a4475703ff58ecf9","entry":"gelu_fast","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/activations.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/activations.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":"a4475703ff58ecf9"}},{"code_sha256_prefix":"dc9ffc0f29e7fa3d","entry":"gelu_new","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/activations.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/activations.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":"dc9ffc0f29e7fa3d"}},{"code_sha256_prefix":"cb0acca1ea9ead1e","entry":"hard_softmax","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/layers.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/layers.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":"cb0acca1ea9ead1e"}},{"code_sha256_prefix":"070b5bdeecd71825","entry":"hf_bucket_url","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/file_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/file_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"070b5bdeecd71825"}},{"code_sha256_prefix":"899d1e2736236351","entry":"is_remote_url","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/file_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/file_utils.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":"899d1e2736236351"}},{"code_sha256_prefix":"1f0f760eab66c082","entry":"l2norm","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/layers.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/layers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1f0f760eab66c082"}},{"code_sha256_prefix":"e7fbc7a74a3457c7","entry":"load_vocab","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/tokenization_bert.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/tokenization_bert.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":"e7fbc7a74a3457c7"}},{"code_sha256_prefix":"22b41155e451683b","entry":"mish","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/modeling_bert.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/modeling_bert.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"22b41155e451683b"}},{"code_sha256_prefix":"b3ee64494a3b6d38","entry":"prune_conv1d_layer","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/modeling_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/modeling_utils.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":"b3ee64494a3b6d38"}},{"code_sha256_prefix":"a37615738b3ddcd3","entry":"prune_linear_layer","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/modeling_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/modeling_utils.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":"a37615738b3ddcd3"}},{"code_sha256_prefix":"e71d9c7dd14f39b8","entry":"sigmoid_focal_loss","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/segmenter.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/segmenter.py","link_basis":"first_harvest_node","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":"e71d9c7dd14f39b8"}},{"code_sha256_prefix":"0dc219ab6716a127","entry":"top_k_top_p_filtering","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/generation_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/generation_utils.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":"0dc219ab6716a127"}},{"code_sha256_prefix":"e827d94caab33f59","entry":"url_to_filename","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/file_utils.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/file_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e827d94caab33f59"}},{"code_sha256_prefix":"61bf152e6a42a184","entry":"window_reverse","repo":"toneyaya/cgformer","repo_kind":"official","path":"model/backbone.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/model/backbone.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"61bf152e6a42a184"}},{"code_sha256_prefix":"fb9398de2966d6de","entry":"load_tf_weights_in_bert","repo":"toneyaya/cgformer","repo_kind":"official","path":"bert/modeling_bert.py","file_url":"https://github.com/toneyaya/cgformer/blob/HEAD/bert/modeling_bert.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":"fb9398de2966d6de"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}