{"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/ma-sam-modality-agnostic-sam-adaptation-for","title":"MA-SAM: Modality-agnostic SAM Adaptation for 3D Medical Image Segmentation","arxiv_id":"2309.08842","date":"2023-09-16","proceeding":null,"authors":["Cheng Chen","Juzheng Miao","Dufan Wu","Zhiling Yan","Sekeun Kim","Jiang Hu","Aoxiao Zhong","Zhengliang Liu","Lichao Sun","Xiang Li","Tianming Liu","Pheng-Ann Heng","Quanzheng Li"],"abstract":"The Segment Anything Model (SAM), a foundation model for general image segmentation, has demonstrated impressive zero-shot performance across numerous natural image segmentation tasks. However, SAM's performance significantly declines when applied to medical images, primarily due to the substantial disparity between natural and medical image domains. To effectively adapt SAM to medical images, it is important to incorporate critical third-dimensional information, i.e., volumetric or temporal knowledge, during fine-tuning. Simultaneously, we aim to harness SAM's pre-trained weights within its original 2D backbone to the fullest extent. In this paper, we introduce a modality-agnostic SAM adaptation framework, named as MA-SAM, that is applicable to various volumetric and video medical data. Our method roots in the parameter-efficient fine-tuning strategy to update only a small portion of weight increments while preserving the majority of SAM's pre-trained weights. By injecting a series of 3D adapters into the transformer blocks of the image encoder, our method enables the pre-trained 2D backbone to extract third-dimensional information from input data. The effectiveness of our method has been comprehensively evaluated on four medical image segmentation tasks, by using 10 public datasets across CT, MRI, and surgical video data. Remarkably, without using any prompt, our method consistently outperforms various state-of-the-art 3D approaches, surpassing nnU-Net by 0.9%, 2.6%, and 9.9% in Dice for CT multi-organ segmentation, MRI prostate segmentation, and surgical scene segmentation respectively. Our model also demonstrates strong generalization, and excels in challenging tumor segmentation when prompts are used. Our code is available at: https://github.com/cchen-cc/MA-SAM.","url_abs":"https://arxiv.org/abs/2309.08842v1","url_pdf":"https://arxiv.org/pdf/2309.08842v1.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":"ma-sam-modality-agnostic-sam-adaptation-for","repo_url":"https://github.com/cchen-cc/ma-sam","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"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":"scene-segmentation","task_name":"Scene Segmentation"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"},{"task_slug":"tumor-segmentation","task_name":"Tumor Segmentation"},{"task_slug":"parameter-efficient-fine-tuning","task_name":"parameter-efficient fine-tuning"}],"methods":[{"method_slug":"sam","method_name":"SAM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2309.08842","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.08842"}},"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/cchen-cc/ma-sam","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":7,"ran_fixture":3,"unverified":3},"by_repo_kind":{"official":{"samples":13,"ran":10,"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":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/trainer.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/trainer.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":"ad5471db7ab93cbf"}},{"code_sha256_prefix":"733d7f0bedcb74c2","entry":"get_rel_pos","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/sam_fact_tt_image_encoder.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/sam_fact_tt_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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"733d7f0bedcb74c2"}},{"code_sha256_prefix":"e342c37accbba41e","entry":"random_rot_flip","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/datasets/dataset.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/datasets/dataset.py","link_basis":"first_harvest_node","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":"e342c37accbba41e"}},{"code_sha256_prefix":"6e9c7d00f201c759","entry":"random_rotate","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/datasets/dataset.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/datasets/dataset.py","link_basis":"first_harvest_node","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":"6e9c7d00f201c759"}},{"code_sha256_prefix":"e687b7f95896fbe2","entry":"read_image","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/datasets/dataset.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/datasets/dataset.py","link_basis":"first_harvest_node","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":"e687b7f95896fbe2"}},{"code_sha256_prefix":"f9c4eb53eae87cfc","entry":"rotate_bounding_box","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/datasets/dataset_bbox.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/datasets/dataset_bbox.py","link_basis":"first_harvest_node","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":"f9c4eb53eae87cfc"}},{"code_sha256_prefix":"84e32807aefaffde","entry":"rotate_point","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/datasets/dataset_bbox.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/datasets/dataset_bbox.py","link_basis":"first_harvest_node","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":"84e32807aefaffde"}},{"code_sha256_prefix":"00686008e1ddcfbb","entry":"transform_bounding_box","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/datasets/dataset_bbox.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/datasets/dataset_bbox.py","link_basis":"first_harvest_node","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":"00686008e1ddcfbb"}},{"code_sha256_prefix":"105fa08885dc36cc","entry":"window_partition","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/sam_fact_tt_image_encoder.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/sam_fact_tt_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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"105fa08885dc36cc"}},{"code_sha256_prefix":"50f37d517e2be27f","entry":"window_unpartition","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/sam_fact_tt_image_encoder.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/sam_fact_tt_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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"50f37d517e2be27f"}},{"code_sha256_prefix":"4182f118ae5496ec","entry":"build_sam_vit_b","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/segment_anything/build_sam.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/segment_anything/build_sam.py","link_basis":"first_harvest_node","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":"4182f118ae5496ec"}},{"code_sha256_prefix":"35ae09d11793c334","entry":"build_sam_vit_h","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/segment_anything/build_sam.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/segment_anything/build_sam.py","link_basis":"first_harvest_node","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":"35ae09d11793c334"}},{"code_sha256_prefix":"6c6888a7271fbc94","entry":"build_sam_vit_l","repo":"cchen-cc/ma-sam","repo_kind":"official","path":"MA-SAM/segment_anything/build_sam.py","file_url":"https://github.com/cchen-cc/ma-sam/blob/HEAD/MA-SAM/segment_anything/build_sam.py","link_basis":"first_harvest_node","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":"6c6888a7271fbc94"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}