{"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/sa-med2d-20m-dataset-segment-anything-in-2d","title":"SA-Med2D-20M Dataset: Segment Anything in 2D Medical Imaging with 20 Million masks","arxiv_id":"2311.11969","date":"2023-11-20","proceeding":null,"authors":["Jin Ye","Junlong Cheng","Jianpin Chen","Zhongying Deng","Tianbin Li","Haoyu Wang","Yanzhou Su","Ziyan Huang","Jilong Chen","Lei Jiang","Hui Sun","Min Zhu","Shaoting Zhang","Junjun He","Yu Qiao"],"abstract":"Segment Anything Model (SAM) has achieved impressive results for natural image segmentation with input prompts such as points and bounding boxes. Its success largely owes to massive labeled training data. However, directly applying SAM to medical image segmentation cannot perform well because SAM lacks medical knowledge -- it does not use medical images for training. To incorporate medical knowledge into SAM, we introduce SA-Med2D-20M, a large-scale segmentation dataset of 2D medical images built upon numerous public and private datasets. It consists of 4.6 million 2D medical images and 19.7 million corresponding masks, covering almost the whole body and showing significant diversity. This paper describes all the datasets collected in SA-Med2D-20M and details how to process these datasets. Furthermore, comprehensive statistics of SA-Med2D-20M are presented to facilitate the better use of our dataset, which can help the researchers build medical vision foundation models or apply their models to downstream medical applications. We hope that the large scale and diversity of SA-Med2D-20M can be leveraged to develop medical artificial intelligence for enhancing diagnosis, medical image analysis, knowledge sharing, and education. The data with the redistribution license is publicly available at https://github.com/OpenGVLab/SAM-Med2D.","url_abs":"https://arxiv.org/abs/2311.11969v1","url_pdf":"https://arxiv.org/pdf/2311.11969v1.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":"sa-med2d-20m-dataset-segment-anything-in-2d","repo_url":"https://github.com/OpenGVLab/SAM-Med2D","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"image-segmentation","task_name":"Image Segmentation"},{"task_slug":"medical-image-analysis","task_name":"Medical Image Analysis"},{"task_slug":"medical-image-segmentation","task_name":"Medical Image Segmentation"},{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[{"method_slug":"sam","method_name":"SAM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2311.11969","atlas_url":"https://app.syntology.ai/?focus=2311.11969","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.11969"}},"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/OpenGVLab/SAM-Med2D","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":7,"ran_fixture":2,"unverified":4},"by_repo_kind":{"official":{"samples":13,"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":"757040dbafc5b5a8","entry":"SegMetrics","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"metrics.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/metrics.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":"757040dbafc5b5a8"}},{"code_sha256_prefix":"3c2ecf169a81938f","entry":"dice","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"metrics.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/metrics.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":"3c2ecf169a81938f"}},{"code_sha256_prefix":"69b17f3689f7b247","entry":"get_boxes_from_mask","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"utils.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/utils.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":"69b17f3689f7b247"}},{"code_sha256_prefix":"733d7f0bedcb74c2","entry":"get_rel_pos","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"segment_anything/modeling/image_encoder.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"733d7f0bedcb74c2"}},{"code_sha256_prefix":"89a12fc455e2113d","entry":"init_point_sampling","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"utils.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/utils.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":"89a12fc455e2113d"}},{"code_sha256_prefix":"5f1cca6dc655957a","entry":"iou","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"metrics.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/metrics.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":"5f1cca6dc655957a"}},{"code_sha256_prefix":"b6a85575a3999468","entry":"select_random_points","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"utils.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/utils.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":"b6a85575a3999468"}},{"code_sha256_prefix":"32e8a89b26e59d49","entry":"stack_dict_batched","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"DataLoader.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/DataLoader.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":"32e8a89b26e59d49"}},{"code_sha256_prefix":"105fa08885dc36cc","entry":"window_partition","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"segment_anything/modeling/image_encoder.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"105fa08885dc36cc"}},{"code_sha256_prefix":"c79820579e477987","entry":"build_sam_vit_b","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"segment_anything/build_sam.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/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":"c79820579e477987"}},{"code_sha256_prefix":"61dc61b4f44c36d2","entry":"build_sam_vit_h","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"segment_anything/build_sam.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/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":"61dc61b4f44c36d2"}},{"code_sha256_prefix":"3fb98a1ac23c9741","entry":"build_sam_vit_l","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"segment_anything/build_sam.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/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":"3fb98a1ac23c9741"}},{"code_sha256_prefix":"27be441cc8213e52","entry":"window_unpartition","repo":"OpenGVLab/SAM-Med2D","repo_kind":"official","path":"segment_anything/modeling/image_encoder.py","file_url":"https://github.com/OpenGVLab/SAM-Med2D/blob/HEAD/segment_anything/modeling/image_encoder.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":"27be441cc8213e52"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}