{"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/seg-r1-segmentation-can-be-surprisingly","title":"Seg-R1: Segmentation Can Be Surprisingly Simple with Reinforcement Learning","arxiv_id":"2506.22624","date":"2025-06-27","proceeding":null,"authors":["Zuyao You","Zuxuan Wu"],"abstract":"We present Seg-R1, a preliminary exploration of using reinforcement learning (RL) to enhance the pixel-level understanding and reasoning capabilities of large multimodal models (LMMs). Starting with foreground segmentation tasks, specifically camouflaged object detection (COD) and salient object detection (SOD), our approach enables the LMM to generate point and bounding box prompts in the next-token fashion, which are then used to guide SAM2 in producing segmentation masks. We introduce Group Relative Policy Optimization (GRPO) into the segmentation domain, equipping the LMM with pixel-level comprehension through a carefully designed training strategy. Notably, Seg-R1 achieves remarkable performance with purely RL-based training, achieving .873 S-measure on COD10K without complex model modification. Moreover, we found that pure RL training demonstrates strong open-world generalization. Despite being trained solely on foreground segmentation image-mask pairs without text supervision, Seg-R1 achieves impressive zero-shot performance on referring segmentation and reasoning segmentation tasks, with 71.4 cIoU on RefCOCOg test and 56.7 gIoU on ReasonSeg test, outperforming models fully supervised on these datasets.","url_abs":"https://arxiv.org/abs/2506.22624v1","url_pdf":"https://arxiv.org/pdf/2506.22624v1.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":"seg-r1-segmentation-can-be-surprisingly","repo_url":"https://github.com/geshang777/Seg-R1","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"seg-r1-segmentation-can-be-surprisingly","repo_url":"https://github.com/geshang777/FOCUS","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"foreground-segmentation","task_name":"Foreground Segmentation"},{"task_slug":"object-detection","task_name":"Object Detection"},{"task_slug":"reasoning-segmentation","task_name":"Reasoning Segmentation"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":"salient-object-detection-1","task_name":"Salient Object Detection"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"object-detection-1","task_name":"object-detection"}],"methods":[],"datasets_introduced":[{"slug":"fcot","name":"FCoT","full_name":"Foreground Chain-of-Thought"}],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2506.22624","atlas_url":"https://app.syntology.ai/?focus=2506.22624","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2506.22624"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/geshang777/Seg-R1","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/geshang777/FOCUS","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":6,"ran_draft_wrong":8,"ran_fixture":1,"unverified":8},"by_repo_kind":{"official":{"samples":6,"ran":6,"repositories":1},"listed":{"samples":17,"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":"8b40bb3f5347ccd5","entry":"compute_num_params","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/evaluation/utils.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/evaluation/utils.py","link_basis":"harvester_set","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":"8b40bb3f5347ccd5"}},{"code_sha256_prefix":"4b40d7fecc852bbe","entry":"crop_with_mask","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/clip_refiner/utils.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/clip_refiner/utils.py","link_basis":"harvester_set","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":"4b40d7fecc852bbe"}},{"code_sha256_prefix":"63e6e57b587c3aa8","entry":"cross_entropy","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/matcher.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/matcher.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"63e6e57b587c3aa8"}},{"code_sha256_prefix":"2fc0075c2a14b806","entry":"expand_box","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/clip_refiner/utils.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/clip_refiner/utils.py","link_basis":"harvester_set","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":"2fc0075c2a14b806"}},{"code_sha256_prefix":"8073d48cbfc0f7ad","entry":"get_reference_points","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/edge_enhancer/edge_enhancer.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/edge_enhancer/edge_enhancer.py","link_basis":"harvester_set","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":"8073d48cbfc0f7ad"}},{"code_sha256_prefix":"50372092a6e364ac","entry":"mask2box","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/clip_refiner/utils.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/clip_refiner/utils.py","link_basis":"harvester_set","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":"50372092a6e364ac"}},{"code_sha256_prefix":"90862d4542046d4e","entry":"parse_custom_format","repo":"geshang777/Seg-R1","repo_kind":"official","path":"demo/seg_r1_web_demo.py","file_url":"https://github.com/geshang777/Seg-R1/blob/HEAD/demo/seg_r1_web_demo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"90862d4542046d4e"}},{"code_sha256_prefix":"1d256130c02aa3e9","entry":"parse_custom_format","repo":"geshang777/Seg-R1","repo_kind":"official","path":"eval/eval_referring_segmentation.py","file_url":"https://github.com/geshang777/Seg-R1/blob/HEAD/eval/eval_referring_segmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1d256130c02aa3e9"}},{"code_sha256_prefix":"be1289f57ae4d5ad","entry":"prepare_message","repo":"geshang777/Seg-R1","repo_kind":"official","path":"eval/eval_referring_segmentation.py","file_url":"https://github.com/geshang777/Seg-R1/blob/HEAD/eval/eval_referring_segmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"be1289f57ae4d5ad"}},{"code_sha256_prefix":"01df73ec0b6daf48","entry":"prepare_test_messages","repo":"geshang777/Seg-R1","repo_kind":"official","path":"eval/eval_foreground_segmentation.py","file_url":"https://github.com/geshang777/Seg-R1/blob/HEAD/eval/eval_foreground_segmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"01df73ec0b6daf48"}},{"code_sha256_prefix":"f5272a5a345c7d45","entry":"resize_image_to_base64","repo":"geshang777/Seg-R1","repo_kind":"official","path":"eval/eval_foreground_segmentation.py","file_url":"https://github.com/geshang777/Seg-R1/blob/HEAD/eval/eval_foreground_segmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f5272a5a345c7d45"}},{"code_sha256_prefix":"038e4fd33f4e3c0e","entry":"resize_to_base64","repo":"geshang777/Seg-R1","repo_kind":"official","path":"eval/eval_referring_segmentation.py","file_url":"https://github.com/geshang777/Seg-R1/blob/HEAD/eval/eval_referring_segmentation.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"038e4fd33f4e3c0e"}},{"code_sha256_prefix":"14982a5b13861f94","entry":"time_text","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/evaluation/utils.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/evaluation/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"14982a5b13861f94"}},{"code_sha256_prefix":"f9fd6241d935f07b","entry":"window_partition","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/backbone/dinov2.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/backbone/dinov2.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f9fd6241d935f07b"}},{"code_sha256_prefix":"fb32094c6dbece71","entry":"window_reverse","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/backbone/dinov2.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/backbone/dinov2.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fb32094c6dbece71"}},{"code_sha256_prefix":"bc2cb481a75c370d","entry":"batch_dice_loss","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/matcher.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/matcher.py","link_basis":"harvester_set","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":"bc2cb481a75c370d"}},{"code_sha256_prefix":"1edd24985036b0bf","entry":"batch_sigmoid_ce_loss","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/matcher.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/matcher.py","link_basis":"harvester_set","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":"1edd24985036b0bf"}},{"code_sha256_prefix":"2dcb8123d89bb1ff","entry":"calculate_uncertainty","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/criterion.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/criterion.py","link_basis":"harvester_set","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":"2dcb8123d89bb1ff"}},{"code_sha256_prefix":"16369aff5471aa71","entry":"deform_inputs","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/edge_enhancer/edge_enhancer.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/edge_enhancer/edge_enhancer.py","link_basis":"harvester_set","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":"16369aff5471aa71"}},{"code_sha256_prefix":"89f75e54ff128be0","entry":"dice_loss","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/criterion.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/criterion.py","link_basis":"harvester_set","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":"89f75e54ff128be0"}},{"code_sha256_prefix":"4134f673786a2abe","entry":"drop_path","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/edge_enhancer/edge_enhancer.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/edge_enhancer/edge_enhancer.py","link_basis":"harvester_set","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":"4134f673786a2abe"}},{"code_sha256_prefix":"6f80ac05b5e36f8e","entry":"make_optimizer","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/evaluation/utils.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/evaluation/utils.py","link_basis":"harvester_set","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":"6f80ac05b5e36f8e"}},{"code_sha256_prefix":"d0c61e8dba511aa3","entry":"sigmoid_ce_loss","repo":"geshang777/FOCUS","repo_kind":"listed","path":"focus/modeling/criterion.py","file_url":"https://github.com/geshang777/FOCUS/blob/HEAD/focus/modeling/criterion.py","link_basis":"harvester_set","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":"d0c61e8dba511aa3"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}