{"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/customized-segment-anything-model-for-medical","title":"Customized Segment Anything Model for Medical Image Segmentation","arxiv_id":"2304.13785","date":"2023-04-26","proceeding":null,"authors":["Kaidong Zhang","Dong Liu"],"abstract":"We propose SAMed, a general solution for medical image segmentation. Different from the previous methods, SAMed is built upon the large-scale image segmentation model, Segment Anything Model (SAM), to explore the new research paradigm of customizing large-scale models for medical image segmentation. SAMed applies the low-rank-based (LoRA) finetuning strategy to the SAM image encoder and finetunes it together with the prompt encoder and the mask decoder on labeled medical image segmentation datasets. We also observe the warmup finetuning strategy and the AdamW optimizer lead SAMed to successful convergence and lower loss. Different from SAM, SAMed could perform semantic segmentation on medical images. Our trained SAMed model achieves 81.88 DSC and 20.64 HD on the Synapse multi-organ segmentation dataset, which is on par with the state-of-the-art methods. We conduct extensive experiments to validate the effectiveness of our design. Since SAMed only updates a small fraction of the SAM parameters, its deployment cost and storage cost are quite marginal in practical usage. The code of SAMed is available at https://github.com/hitachinsk/SAMed.","url_abs":"https://arxiv.org/abs/2304.13785v2","url_pdf":"https://arxiv.org/pdf/2304.13785v2.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":"customized-segment-anything-model-for-medical","repo_url":"https://github.com/hitachinsk/samed","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"image-segmentation","task_name":"Image Segmentation"},{"task_slug":"medical-image-segmentation","task_name":"Medical Image Segmentation"},{"task_slug":"organ-segmentation","task_name":"Organ Segmentation"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"},{"task_slug":"model","task_name":"model"}],"methods":[{"method_slug":"adamw","method_name":"AdamW"},{"method_slug":"sam","method_name":"SAM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2304.13785","atlas_url":"https://app.syntology.ai/?focus=2304.13785","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2304.13785"}},"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/hitachinsk/samed","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":3,"ran_fixture":3,"unverified":3},"by_repo_kind":{"official":{"samples":9,"ran":6,"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":"ad5471db7ab93cbf","entry":"calc_loss","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/trainer.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/trainer.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":"ad5471db7ab93cbf"}},{"code_sha256_prefix":"733d7f0bedcb74c2","entry":"get_rel_pos","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/segment_anything/modeling/image_encoder.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/segment_anything/modeling/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"733d7f0bedcb74c2"}},{"code_sha256_prefix":"960b785e65a00358","entry":"random_rot_flip","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/datasets/dataset_synapse.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/datasets/dataset_synapse.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":"960b785e65a00358"}},{"code_sha256_prefix":"43fa66325ce3cafd","entry":"random_rotate","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/datasets/dataset_synapse.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/datasets/dataset_synapse.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":"43fa66325ce3cafd"}},{"code_sha256_prefix":"105fa08885dc36cc","entry":"window_partition","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/segment_anything/modeling/image_encoder.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/segment_anything/modeling/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"105fa08885dc36cc"}},{"code_sha256_prefix":"50f37d517e2be27f","entry":"window_unpartition","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/segment_anything/modeling/image_encoder.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/segment_anything/modeling/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"50f37d517e2be27f"}},{"code_sha256_prefix":"4182f118ae5496ec","entry":"build_sam_vit_b","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/segment_anything/build_sam.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/segment_anything/build_sam.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":"4182f118ae5496ec"}},{"code_sha256_prefix":"35ae09d11793c334","entry":"build_sam_vit_h","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/segment_anything/build_sam.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/segment_anything/build_sam.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":"35ae09d11793c334"}},{"code_sha256_prefix":"6c6888a7271fbc94","entry":"build_sam_vit_l","repo":"hitachinsk/samed","repo_kind":"official","path":"SAMed_h/segment_anything/build_sam.py","file_url":"https://github.com/hitachinsk/samed/blob/HEAD/SAMed_h/segment_anything/build_sam.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":"6c6888a7271fbc94"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}