[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-facebookresearch--sam3":3,"tool-facebookresearch--sam3":62},[4,18,26,35,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,2,"2026-04-18T11:18:24",[14,15,13],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":32,"last_commit_at":41,"category_tags":42,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[43,13,15,14],"插件",{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[52,15,13,14],"语言模型",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,61],"视频",{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":68,"readme_en":69,"readme_zh":70,"quickstart_zh":71,"use_case_zh":72,"hero_image_url":73,"owner_login":74,"owner_name":75,"owner_avatar_url":76,"owner_bio":77,"owner_company":78,"owner_location":78,"owner_email":78,"owner_twitter":78,"owner_website":79,"owner_url":80,"languages":81,"stars":86,"forks":87,"last_commit_at":88,"license":89,"difficulty_score":90,"env_os":91,"env_gpu":92,"env_ram":91,"env_deps":93,"category_tags":103,"github_topics":78,"view_count":32,"oss_zip_url":78,"oss_zip_packed_at":78,"status":17,"created_at":105,"updated_at":106,"faqs":107,"releases":136},9250,"facebookresearch\u002Fsam3","sam3","The repository provides code for running inference and finetuning with the Meta Segment Anything Model 3 (SAM 3), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.","SAM 3 是 Meta 推出的新一代通用基础模型，专注于图像与视频中的“概念级”分割任务。它不仅继承了前代模型通过点、框或掩码进行交互式分割的能力，更实现了突破性升级：能够根据简短的文字描述（如“穿红衣的球员”）或少量示例，自动识别并分割出画面中所有符合该开放词汇概念的物体，甚至能在视频中持续追踪它们。\n\n这一进展解决了传统模型难以处理海量未知类别、无法精准区分细微语义差异（如不同颜色的同类物体）的痛点。SAM 3 在包含 27 万种独特概念的新基准测试中，达到了人类表现水平的 75%-80%，其背后得益于一个自动标注了超 400 万概念的大规模数据引擎。\n\n技术上，SAM 3 引入了独特的“存在令牌（presence token）”机制，显著提升了对相似文本提示的辨别力；同时采用检测器与追踪器解耦的架构设计，有效减少了任务间的干扰，使模型能更高效地利用数据进行扩展。\n\n这款工具非常适合计算机视觉研究人员、AI 开发者以及需要处理复杂视频分析任务的专业人士使用。无论是构建新的多模态应用，还是探索开放词汇下的物体感知边界，SAM 3 都提供了强大的代码库、预训练权重及示例笔记，帮助用户","SAM 3 是 Meta 推出的新一代通用基础模型，专注于图像与视频中的“概念级”分割任务。它不仅继承了前代模型通过点、框或掩码进行交互式分割的能力，更实现了突破性升级：能够根据简短的文字描述（如“穿红衣的球员”）或少量示例，自动识别并分割出画面中所有符合该开放词汇概念的物体，甚至能在视频中持续追踪它们。\n\n这一进展解决了传统模型难以处理海量未知类别、无法精准区分细微语义差异（如不同颜色的同类物体）的痛点。SAM 3 在包含 27 万种独特概念的新基准测试中，达到了人类表现水平的 75%-80%，其背后得益于一个自动标注了超 400 万概念的大规模数据引擎。\n\n技术上，SAM 3 引入了独特的“存在令牌（presence token）”机制，显著提升了对相似文本提示的辨别力；同时采用检测器与追踪器解耦的架构设计，有效减少了任务间的干扰，使模型能更高效地利用数据进行扩展。\n\n这款工具非常适合计算机视觉研究人员、AI 开发者以及需要处理复杂视频分析任务的专业人士使用。无论是构建新的多模态应用，还是探索开放词汇下的物体感知边界，SAM 3 都提供了强大的代码库、预训练权重及示例笔记，帮助用户快速上手并推动前沿探索。","# SAM 3: Segment Anything with Concepts\n\nMeta Superintelligence Labs\n\n[Nicolas Carion](https:\u002F\u002Fwww.nicolascarion.com\u002F)\\*,\n[Laura Gustafson](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=c8IpF9gAAAAJ&hl=en)\\*,\n[Yuan-Ting Hu](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=E8DVVYQAAAAJ&hl=en)\\*,\n[Shoubhik Debnath](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=fb6FOfsAAAAJ&hl=en)\\*,\n[Ronghang Hu](https:\u002F\u002Fronghanghu.com\u002F)\\*,\n[Didac Suris](https:\u002F\u002Fwww.didacsuris.com\u002F)\\*,\n[Chaitanya Ryali](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=4LWx24UAAAAJ&hl=en)\\*,\n[Kalyan Vasudev Alwala](https:\u002F\u002Fscholar.google.co.in\u002Fcitations?user=m34oaWEAAAAJ&hl=en)\\*,\n[Haitham Khedr](https:\u002F\u002Fhkhedr.com\u002F)\\*, Andrew Huang,\n[Jie Lei](https:\u002F\u002Fjayleicn.github.io\u002F),\n[Tengyu Ma](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=VeTSl0wAAAAJ&hl=en),\n[Baishan Guo](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=BC5wDu8AAAAJ&hl=en),\nArpit Kalla, [Markus Marks](https:\u002F\u002Fdamaggu.github.io\u002F),\n[Joseph Greer](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=guL96CkAAAAJ&hl=en),\nMeng Wang, [Peize Sun](https:\u002F\u002Fpeizesun.github.io\u002F),\n[Roman Rädle](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=Tpt57v0AAAAJ&hl=en),\n[Triantafyllos Afouras](https:\u002F\u002Fwww.robots.ox.ac.uk\u002F~afourast\u002F),\n[Effrosyni Mavroudi](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=vYRzGGEAAAAJ&hl=en),\n[Katherine Xu](https:\u002F\u002Fk8xu.github.io\u002F)°,\n[Tsung-Han Wu](https:\u002F\u002Fpatrickthwu.com\u002F)°,\n[Yu Zhou](https:\u002F\u002Fyu-bryan-zhou.github.io\u002F)°,\n[Liliane Momeni](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=Lb-KgVYAAAAJ&hl=en)°,\n[Rishi Hazra](https:\u002F\u002Frishihazra.github.io\u002F)°,\n[Shuangrui Ding](https:\u002F\u002Fmark12ding.github.io\u002F)°,\n[Sagar Vaze](https:\u002F\u002Fsgvaze.github.io\u002F)°,\n[Francois Porcher](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=LgHZ8hUAAAAJ&hl=en)°,\n[Feng Li](https:\u002F\u002Ffengli-ust.github.io\u002F)°,\n[Siyuan Li](https:\u002F\u002Fsiyuanliii.github.io\u002F)°,\n[Aishwarya Kamath](https:\u002F\u002Fashkamath.github.io\u002F)°,\n[Ho Kei Cheng](https:\u002F\u002Fhkchengrex.com\u002F)°,\n[Piotr Dollar](https:\u002F\u002Fpdollar.github.io\u002F)†,\n[Nikhila Ravi](https:\u002F\u002Fnikhilaravi.com\u002F)†,\n[Kate Saenko](https:\u002F\u002Fai.bu.edu\u002Fksaenko.html)†,\n[Pengchuan Zhang](https:\u002F\u002Fpzzhang.github.io\u002Fpzzhang\u002F)†,\n[Christoph Feichtenhofer](https:\u002F\u002Ffeichtenhofer.github.io\u002F)†\n\n\\* core contributor, ° intern, † project lead, order is random within groups\n\n[[`Paper`](https:\u002F\u002Fai.meta.com\u002Fresearch\u002Fpublications\u002Fsam-3-segment-anything-with-concepts\u002F)]\n[[`Project`](https:\u002F\u002Fai.meta.com\u002Fsam3)]\n[[`Demo`](https:\u002F\u002Fsegment-anything.com\u002F)]\n[[`Blog`](https:\u002F\u002Fai.meta.com\u002Fblog\u002Fsegment-anything-model-3\u002F)]\n[[`BibTeX`](#citing-sam-3)]\n\n![SAM 3 architecture](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_0690ded02f3c.png) SAM 3 is a unified foundation model for promptable segmentation in images and videos. It can detect, segment, and track objects using text or visual prompts such as points, boxes, and masks. Compared to its predecessor [SAM 2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam2), SAM 3 introduces the ability to exhaustively segment all instances of an open-vocabulary concept specified by a short text phrase or exemplars. Unlike prior work, SAM 3 can handle a vastly larger set of open-vocabulary prompts. It achieves 75-80% of human performance on our new [SA-CO benchmark](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3?tab=readme-ov-file#sa-co-dataset) which contains 270K unique concepts, over 50 times more than existing benchmarks.\n\nThis breakthrough is driven by an innovative data engine that has automatically annotated over 4 million unique concepts, creating the largest high-quality open-vocabulary segmentation dataset to date. In addition, SAM 3 introduces a new model architecture featuring a presence token that improves discrimination between closely related text prompts (e.g., “a player in white” vs. “a player in red”), as well as a decoupled detector–tracker design that minimizes task interference and scales efficiently with data.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_e0e9336f0afb.gif\" width=380 \u002F>\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_81658fba6b5e.gif\" width=380 \u002F>\n\u003C\u002Fp>\n\n## Latest updates\n\n**03\u002F27\u002F2026 -- SAM 3.1 Object Multiplex is released. It introduces a shared-memory approach for joint multi-object tracking that is significantly faster without sacrificing accuracy.**\n\n- A new suite of improved model checkpoints (denoted as **SAM 3.1**) are released on [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Ffacebook\u002Fsam3.1). See [`RELEASE_SAM3p1.md`](RELEASE_SAM3p1.md) for full details.\n  * To use the new SAM 3.1 checkpoints, you need the latest model code from this repo. If you have installed an earlier version of this repo, pull the latest code from this repo (with `git pull`), and then reinstall the repo following [Installation](#installation) below.\n\n## Installation\n\n### Prerequisites\n\n- Python 3.12 or higher\n- PyTorch 2.7 or higher\n- CUDA-compatible GPU with CUDA 12.6 or higher\n\n1. **Create a new Conda environment:**\n\n```bash\nconda create -n sam3 python=3.12\nconda deactivate\nconda activate sam3\n```\n\n2. **Install PyTorch with CUDA support:**\n\n```bash\npip install torch==2.10.0 torchvision --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\n3. **Clone the repository and install the package:**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3.git\ncd sam3\npip install -e .\n```\n\n4. **Install additional dependencies for example notebooks or development:**\n\n```bash\n# For running example notebooks\npip install -e \".[notebooks]\"\n\n# For development\npip install -e \".[train,dev]\"\n```\n\n5. **Optional dependencies for faster inference**\n```bash\npip install einops ninja && pip install flash-attn-3 --no-deps --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\npip install git+https:\u002F\u002Fgithub.com\u002Fronghanghu\u002Fcc_torch.git\n```\n\n## Getting Started\n\n⚠️ Before using SAM 3, please request access to the checkpoints on the SAM 3\nHugging Face [repo](https:\u002F\u002Fhuggingface.co\u002Ffacebook\u002Fsam3). Once accepted, you\nneed to be authenticated to download the checkpoints. You can do this by running\nthe following [steps](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fhuggingface_hub\u002Fen\u002Fquick-start#authentication)\n(e.g. `hf auth login` after generating an access token.)\n\n### Basic Usage\n\n```python\nimport torch\n#################################### For Image ####################################\nfrom PIL import Image\nfrom sam3.model_builder import build_sam3_image_model\nfrom sam3.model.sam3_image_processor import Sam3Processor\n# Load the model\nmodel = build_sam3_image_model()\nprocessor = Sam3Processor(model)\n# Load an image\nimage = Image.open(\"\u003CYOUR_IMAGE_PATH.jpg>\")\ninference_state = processor.set_image(image)\n# Prompt the model with text\noutput = processor.set_text_prompt(state=inference_state, prompt=\"\u003CYOUR_TEXT_PROMPT>\")\n\n# Get the masks, bounding boxes, and scores\nmasks, boxes, scores = output[\"masks\"], output[\"boxes\"], output[\"scores\"]\n\n#################################### For Video ####################################\n\nfrom sam3.model_builder import build_sam3_video_predictor\n\nvideo_predictor = build_sam3_video_predictor()\nvideo_path = \"\u003CYOUR_VIDEO_PATH>\" # a JPEG folder or an MP4 video file\n# Start a session\nresponse = video_predictor.handle_request(\n    request=dict(\n        type=\"start_session\",\n        resource_path=video_path,\n    )\n)\nresponse = video_predictor.handle_request(\n    request=dict(\n        type=\"add_prompt\",\n        session_id=response[\"session_id\"],\n        frame_index=0, # Arbitrary frame index\n        text=\"\u003CYOUR_TEXT_PROMPT>\",\n    )\n)\noutput = response[\"outputs\"]\n```\n\n## Examples\n\nThe `examples` directory contains notebooks demonstrating how to use SAM3 with\nvarious types of prompts:\n\n- [`sam3_image_predictor_example.ipynb`](examples\u002Fsam3_image_predictor_example.ipynb)\n  : Demonstrates how to prompt SAM 3 with text and visual box prompts on images.\n- [`sam3_video_predictor_example.ipynb`](examples\u002Fsam3_video_predictor_example.ipynb)\n  : Demonstrates how to prompt SAM 3 with text prompts on videos, and doing\n  further interactive refinements with points.\n- [`sam3_image_batched_inference.ipynb`](examples\u002Fsam3_image_batched_inference.ipynb)\n  : Demonstrates how to run batched inference with SAM 3 on images.\n- [`sam3_agent.ipynb`](examples\u002Fsam3_agent.ipynb): Demonsterates the use of SAM\n  3 Agent to segment complex text prompt on images.\n- [`saco_gold_silver_vis_example.ipynb`](examples\u002Fsaco_gold_silver_vis_example.ipynb)\n  : Shows a few examples from SA-Co image evaluation set.\n- [`saco_veval_vis_example.ipynb`](examples\u002Fsaco_veval_vis_example.ipynb) :\n  Shows a few examples from SA-Co video evaluation set.\n\nThere are additional notebooks in the examples directory that demonstrate how to\nuse SAM 3 for interactive instance segmentation in images and videos (SAM 1\u002F2\ntasks), or as a tool for an MLLM, and how to run evaluations on the SA-Co\ndataset.\n\nTo run the Jupyter notebook examples:\n\n```bash\n# Make sure you have the notebooks dependencies installed\npip install -e \".[notebooks]\"\n\n# Start Jupyter notebook\njupyter notebook examples\u002Fsam3_image_predictor_example.ipynb\n```\n\n## Model\n\nSAM 3 consists of a detector and a tracker that share a vision encoder. It has 848M parameters. The\ndetector is a DETR-based model conditioned on text, geometry, and image\nexemplars. The tracker inherits the SAM 2 transformer encoder-decoder\narchitecture, supporting video segmentation and interactive refinement.\n\n## Image Results\n\n\u003Cdiv align=\"center\">\n\u003Ctable style=\"min-width: 80%; border: 2px solid #ddd; border-collapse: collapse\">\n  \u003Cthead>\n    \u003Ctr>\n      \u003Cth rowspan=\"3\" style=\"border-right: 2px solid #ddd; padding: 12px 20px\">Model\u003C\u002Fth>\n      \u003Cth colspan=\"3\" style=\"text-align: center; border-right: 2px solid #ddd; padding: 12px 20px\">Instance Segmentation\u003C\u002Fth>\n      \u003Cth colspan=\"5\" style=\"text-align: center; padding: 12px 20px\">Box Detection\u003C\u002Fth>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">LVIS\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 2px solid #ddd; padding: 12px 20px\">SA-Co\u002FGold\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">LVIS\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">COCO\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">SA-Co\u002FGold\u003C\u002Fth>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">AP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 2px solid #ddd; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">AP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">AP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">AP\u003Csub>o\u003C\u002Fsub>\n\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n    \u003C\u002Ftr>\n  \u003C\u002Fthead>\n  \u003Ctbody>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">Human\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">72.8\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">74.0\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">OWLv2*\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px; color: #999\">29.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px; color: #999\">43.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">24.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px; color: #999\">30.2\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px; color: #999\">45.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">46.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">23.9\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">24.5\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">DINO-X\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">38.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">21.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">52.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">56.0\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">22.5\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">Gemini 2.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">13.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">13.0\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">16.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">14.4\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr style=\"border-top: 2px solid #b19c9cff\">\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">SAM 3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">37.2\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">48.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">54.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">40.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">53.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">56.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">55.7\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">55.7\u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\u003Cp style=\"text-align: center; margin-top: 10px; font-size: 0.9em; color: #ddd;\">* Partially trained on LVIS, AP\u003Csub>o\u003C\u002Fsub> refers to COCO-O accuracy\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n## Video Results\n\n\u003Cdiv align=\"center\">\n\u003Ctable style=\"min-width: 80%; border: 2px solid #ddd; border-collapse: collapse\">\n  \u003Cthead>\n    \u003Ctr>\n      \u003Cth rowspan=\"2\" style=\"border-right: 2px solid #ddd; padding: 12px 20px\">Model\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">SA-V test\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">YT-Temporal-1B test\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">SmartGlasses test\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">LVVIS test\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">BURST test\u003C\u002Fth>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">pHOTA\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">pHOTA\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">pHOTA\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">mAP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">HOTA\u003C\u002Fth>\n    \u003C\u002Ftr>\n  \u003C\u002Fthead>\n  \u003Ctbody>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">Human\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">53.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">70.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">71.2\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">78.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">58.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">72.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr style=\"border-top: 2px solid #b19c9cff\">\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">SAM 3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">30.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">58.0\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">50.8\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">69.9\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">36.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">63.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">36.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">44.5\u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003C\u002Fdiv>\n\n## SA-Co Dataset\n\nWe release 2 image benchmarks, [SA-Co\u002FGold](scripts\u002Feval\u002Fgold\u002FREADME.md) and\n[SA-Co\u002FSilver](scripts\u002Feval\u002Fsilver\u002FREADME.md), and a video benchmark\n[SA-Co\u002FVEval](scripts\u002Feval\u002Fveval\u002FREADME.md). The datasets contain images (or videos) with annotated noun phrases. Each image\u002Fvideo and noun phrase pair is annotated with instance masks and unique IDs of each object matching the phrase. Phrases that have no matching objects (negative prompts) have no masks, shown in red font in the figure. See the linked READMEs for more details on how to download and run evaluations on the datasets.\n\n* HuggingFace host: [SA-Co\u002FGold](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffacebook\u002FSACo-Gold), [SA-Co\u002FSilver](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffacebook\u002FSACo-Silver) and [SA-Co\u002FVEval](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffacebook\u002FSACo-VEval)\n* Roboflow host: [SA-Co\u002FGold](https:\u002F\u002Funiverse.roboflow.com\u002Fsa-co-gold), [SA-Co\u002FSilver](https:\u002F\u002Funiverse.roboflow.com\u002Fsa-co-silver) and [SA-Co\u002FVEval](https:\u002F\u002Funiverse.roboflow.com\u002Fsa-co-veval)\n\n![SA-Co dataset](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_0ad979c65152.jpg)\n\n## Development\n\nTo set up the development environment:\n\n```bash\npip install -e \".[dev,train]\"\n```\n\nTo format the code:\n\n```bash\nufmt format .\n```\n\n## Contributing\n\nSee [contributing](CONTRIBUTING.md) and the\n[code of conduct](CODE_OF_CONDUCT.md).\n\n## License\n\nThis project is licensed under the SAM License - see the [LICENSE](LICENSE) file\nfor details.\n\n## Acknowledgements\n\nWe would like to thank the following people for their contributions to the SAM 3 project: Alex He, Alexander Kirillov,\nAlyssa Newcomb, Ana Paula Kirschner Mofarrej, Andrea Madotto, Andrew Westbury, Ashley Gabriel, Azita Shokpour,\nBen Samples, Bernie Huang, Carleigh Wood, Ching-Feng Yeh, Christian Puhrsch, Claudette Ward, Daniel Bolya,\nDaniel Li, Facundo Figueroa, Fazila Vhora, George Orlin, Hanzi Mao, Helen Klein, Hu Xu, Ida Cheng, Jake Kinney,\nJiale Zhi, Jo Sampaio, Joel Schlosser, Justin Johnson, Kai Brown, Karen Bergan, Karla Martucci, Kenny Lehmann,\nMaddie Mintz, Mallika Malhotra, Matt Ward, Michelle Chan, Michelle Restrepo, Miranda Hartley, Muhammad Maaz,\nNisha Deo, Peter Park, Phillip Thomas, Raghu Nayani, Rene Martinez Doehner, Robbie Adkins, Ross Girshik, Sasha\nMitts, Shashank Jain, Spencer Whitehead, Ty Toledano, Valentin Gabeur, Vincent Cho, Vivian Lee, William Ngan,\nXuehai He, Yael Yungster, Ziqi Pang, Ziyi Dou, Zoe Quake.\n\n## Citing SAM 3\n\nIf you use SAM 3 or the SA-Co dataset in your research, please use the following BibTeX entry.\n\n```bibtex\n@misc{carion2025sam3segmentconcepts,\n      title={SAM 3: Segment Anything with Concepts},\n      author={Nicolas Carion and Laura Gustafson and Yuan-Ting Hu and Shoubhik Debnath and Ronghang Hu and Didac Suris and Chaitanya Ryali and Kalyan Vasudev Alwala and Haitham Khedr and Andrew Huang and Jie Lei and Tengyu Ma and Baishan Guo and Arpit Kalla and Markus Marks and Joseph Greer and Meng Wang and Peize Sun and Roman Rädle and Triantafyllos Afouras and Effrosyni Mavroudi and Katherine Xu and Tsung-Han Wu and Yu Zhou and Liliane Momeni and Rishi Hazra and Shuangrui Ding and Sagar Vaze and Francois Porcher and Feng Li and Siyuan Li and Aishwarya Kamath and Ho Kei Cheng and Piotr Dollár and Nikhila Ravi and Kate Saenko and Pengchuan Zhang and Christoph Feichtenhofer},\n      year={2025},\n      eprint={2511.16719},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2511.16719},\n}\n```\n","# SAM 3：基于概念的任意分割\n\nMeta 超级智能实验室\n\n[Nicolas Carion](https:\u002F\u002Fwww.nicolascarion.com\u002F)\\*，\n[Laura Gustafson](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=c8IpF9gAAAAJ&hl=en)\\*，\n[Yuan-Ting Hu](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=E8DVVYQAAAAJ&hl=en)\\*，\n[Shoubhik Debnath](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=fb6FOfsAAAAJ&hl=en)\\*，\n[Ronghang Hu](https:\u002F\u002Fronghanghu.com\u002F)\\*，\n[Didac Suris](https:\u002F\u002Fwww.didacsuris.com\u002F)\\*，\n[Chaitanya Ryali](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=4LWx24UAAAAJ&hl=en)\\*，\n[Kalyan Vasudev Alwala](https:\u002F\u002Fscholar.google.co.in\u002Fcitations?user=m34oaWEAAAAJ&hl=en)\\*，\n[Haitham Khedr](https:\u002F\u002Fhkhedr.com\u002F)\\*，Andrew Huang，\n[Jie Lei](https:\u002F\u002Fjayleicn.github.io\u002F)，\n[Tengyu Ma](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=VeTSl0wAAAAJ&hl=en)，\n[Baishan Guo](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=BC5wDu8AAAAJ&hl=en)，\nArpit Kalla，[Markus Marks](https:\u002F\u002Fdamaggu.github.io\u002F)，\n[Joseph Greer](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=guL96CkAAAAJ&hl=en)，\nMeng Wang，[Peize Sun](https:\u002F\u002Fpeizesun.github.io\u002F)，\n[Roman Rädle](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=Tpt57v0AAAAJ&hl=en)，\n[Triantafyllos Afouras](https:\u002F\u002Fwww.robots.ox.ac.uk\u002F~afourast\u002F)，\n[Effrosyni Mavroudi](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=vYRzGGEAAAAJ&hl=en)，\n[Katherine Xu](https:\u002F\u002Fk8xu.github.io\u002F)°，\n[Tsung-Han Wu](https:\u002F\u002Fpatrickthwu.com\u002F)°，\n[Yu Zhou](https:\u002F\u002Fyu-bryan-zhou.github.io\u002F)°，\n[Liliane Momeni](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=Lb-KgVYAAAAJ&hl=en)°，\n[Rishi Hazra](https:\u002F\u002Frishihazra.github.io\u002F)°，\n[Shuangrui Ding](https:\u002F\u002Fmark12ding.github.io\u002F)°，\n[Sagar Vaze](https:\u002F\u002Fsgvaze.github.io\u002F)°，\n[Francois Porcher](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=LgHZ8hUAAAAJ&hl=en)°，\n[Feng Li](https:\u002F\u002Ffengli-ust.github.io\u002F)°，\n[Siyuan Li](https:\u002F\u002Fsiyuanliii.github.io\u002F)°，\n[Aishwarya Kamath](https:\u002F\u002Fashkamath.github.io\u002F)°，\n[Ho Kei Cheng](https:\u002F\u002Fhkchengrex.com\u002F)°，\n[Piotr Dollar](https:\u002F\u002Fpdollar.github.io\u002F)†，\n[Nikhila Ravi](https:\u002F\u002Fnikhilaravi.com\u002F)†，\n[Kate Saenko](https:\u002F\u002Fai.bu.edu\u002Fksaenko.html)†，\n[Pengchuan Zhang](https:\u002F\u002Fpzzhang.github.io\u002Fpzzhang\u002F)†，\n[Christoph Feichtenhofer](https:\u002F\u002Ffeichtenhofer.github.io\u002F)†\n\n\\* 核心贡献者，° 实习生，† 项目负责人，组内顺序随机\n\n[[`论文`](https:\u002F\u002Fai.meta.com\u002Fresearch\u002Fpublications\u002Fsam-3-segment-anything-with-concepts\u002F)]\n[[`项目`](https:\u002F\u002Fai.meta.com\u002Fsam3)]\n[[`演示`](https:\u002F\u002Fsegment-anything.com\u002F)]\n[[`博客`](https:\u002F\u002Fai.meta.com\u002Fblog\u002Fsegment-anything-model-3\u002F)]\n[[`BibTeX`](#citing-sam-3)]\n\n![SAM 3 架构](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_0690ded02f3c.png) SAM 3 是一种统一的基础模型，用于对图像和视频进行可提示分割。它能够使用文本或视觉提示（如点、框和掩码）来检测、分割和跟踪目标。与前代模型 [SAM 2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam2) 相比，SAM 3 引入了通过简短的文本短语或示例来详尽地分割由开放词汇概念指定的所有实例的能力。不同于以往的工作，SAM 3 可以处理规模大得多的开放词汇提示集。在我们新的 [SA-CO 基准测试](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3?tab=readme-ov-file#sa-co-dataset) 上，SAM 3 达到了人类水平的 75%–80%，该基准包含 27 万个独特概念，数量是现有基准的 50 多倍。\n\n这一突破得益于创新的数据引擎，该引擎自动标注了超过 400 万个独特概念，从而创建了迄今为止最大的高质量开放词汇分割数据集。此外，SAM 3 还引入了一种新的模型架构，其中包含一个存在性标记，可提高对密切相关的文本提示（例如“穿白色球衣的球员”与“穿红色球衣的球员”）的区分能力；同时采用解耦的检测—跟踪设计，以最小化任务间的干扰，并随着数据量的增加而高效扩展。\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_e0e9336f0afb.gif\" width=380 \u002F>\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_81658fba6b5e.gif\" width=380 \u002F>\n\u003C\u002Fp>\n\n## 最新更新\n\n**2026年3月27日——SAM 3.1 Object Multiplex 发布。它引入了一种共享内存的联合多目标跟踪方法，速度显著提升且不牺牲精度。**\n\n- 一套改进后的模型检查点（称为 **SAM 3.1**）已在 [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Ffacebook\u002Fsam3.1) 上发布。完整详情请参阅 [`RELEASE_SAM3p1.md`](RELEASE_SAM3p1.md)。\n  * 若要使用新的 SAM 3.1 检查点，您需要从本仓库获取最新版本的模型代码。如果您已安装本仓库的早期版本，请先使用 `git pull` 更新到最新代码，然后按照下方的 [安装说明](#installation) 重新安装本仓库。\n\n## 安装\n\n### 先决条件\n\n- Python 3.12 或更高版本\n- PyTorch 2.7 或更高版本\n- 兼容 CUDA 的 GPU，且 CUDA 版本为 12.6 或更高\n\n1. **创建一个新的 Conda 环境：**\n\n```bash\nconda create -n sam3 python=3.12\nconda deactivate\nconda activate sam3\n```\n\n2. **安装支持 CUDA 的 PyTorch：**\n\n```bash\npip install torch==2.10.0 torchvision --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n\n3. **克隆仓库并安装软件包：**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3.git\ncd sam3\npip install -e .\n```\n\n4. **安装示例笔记本或开发所需的额外依赖：**\n\n```bash\n# 运行示例笔记本时\npip install -e \".[notebooks]\"\n\n# 开发时\npip install -e \".[train,dev]\"\n```\n\n5. **用于加速推理的可选依赖**\n```bash\npip install einops ninja && pip install flash-attn-3 --no-deps --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\npip install git+https:\u002F\u002Fgithub.com\u002Fronghanghu\u002Fcc_torch.git\n```\n\n## 使用入门\n\n⚠️ 在使用 SAM 3 之前，请先在 SAM 3 的 Hugging Face [仓库](https:\u002F\u002Fhuggingface.co\u002Ffacebook\u002Fsam3) 上申请访问检查点的权限。获批后，您需要进行身份验证才能下载检查点。您可以按照以下步骤操作（例如，在生成访问令牌后运行 `hf auth login`）。\n\n### 基本用法\n\n```python\nimport torch\n#################################### 图像处理 ####################################\nfrom PIL import Image\nfrom sam3.model_builder import build_sam3_image_model\nfrom sam3.model.sam3_image_processor import Sam3Processor\n# 加载模型\nmodel = build_sam3_image_model()\nprocessor = Sam3Processor(model)\n# 加载一张图片\nimage = Image.open(\"\u003CYOUR_IMAGE_PATH.jpg>\")\ninference_state = processor.set_image(image)\n# 使用文本提示调用模型\noutput = processor.set_text_prompt(state=inference_state, prompt=\"\u003CYOUR_TEXT_PROMPT>\")\n\n# 获取掩码、边界框和置信度分数\nmasks、boxes、scores = output[\"masks\"]、output[\"boxes\"]、output[\"scores\"]\n\n#################################### 视频处理 ####################################\n\nfrom sam3.model_builder import build_sam3_video_predictor\n\nvideo_predictor = build_sam3_video_predictor()\nvideo_path = \"\u003CYOUR_VIDEO_PATH>\" # 一个 JPEG 文件夹或 MP4 视频文件\n\n# 开始会话\nresponse = video_predictor.handle_request(\n    request=dict(\n        type=\"start_session\",\n        resource_path=video_path,\n    )\n)\nresponse = video_predictor.handle_request(\n    request=dict(\n        type=\"add_prompt\",\n        session_id=response[\"session_id\"],\n        frame_index=0, # 任意帧索引\n        text=\"\u003CYOUR_TEXT_PROMPT>\",\n    )\n)\noutput = response[\"outputs\"]\n```\n\n## 示例\n\n`examples` 目录包含演示如何使用 SAM3 及其各种类型提示的笔记本：\n\n- [`sam3_image_predictor_example.ipynb`](examples\u002Fsam3_image_predictor_example.ipynb)：\n  展示如何在图像上结合文本和视觉框提示来引导 SAM3。\n- [`sam3_video_predictor_example.ipynb`](examples\u002Fsam3_video_predictor_example.ipynb)：\n  展示如何在视频中使用文本提示引导 SAM3，并通过点选进行进一步的交互式优化。\n- [`sam3_image_batched_inference.ipynb`](examples\u002Fsam3_image_batched_inference.ipynb)：\n  展示如何在图像上使用 SAM3 进行批量推理。\n- [`sam3_agent.ipynb`](examples\u002Fsam3_agent.ipynb)：演示如何利用 SAM3 Agent 对图像上的复杂文本提示进行分割。\n- [`saco_gold_silver_vis_example.ipynb`](examples\u002Fsaco_gold_silver_vis_example.ipynb)：\n  展示 SA-Co 图像评估集中的几个示例。\n- [`saco_veval_vis_example.ipynb`](examples\u002Fsaco_veval_vis_example.ipynb)：\n  展示 SA-Co 视频评估集中的几个示例。\n\n此外，`examples` 目录中还有其他笔记本，展示了如何将 SAM3 用于图像和视频中的交互式实例分割（SAM 1\u002F2 任务），或将其作为多模态大语言模型的工具，以及如何在 SA-Co 数据集上运行评估。\n\n要运行 Jupyter 笔记本示例：\n\n```bash\n# 确保已安装笔记本所需的依赖\npip install -e \".[notebooks]\"\n\n# 启动 Jupyter Notebook\njupyter notebook examples\u002Fsam3_image_predictor_example.ipynb\n```\n\n## 模型\n\nSAM3 由一个共享视觉编码器的检测器和跟踪器组成。它拥有 8.48 亿个参数。检测器是一种基于 DETR 的模型，可接受文本、几何形状和图像样例的条件输入。跟踪器则继承了 SAM2 的 Transformer 编码器-解码器架构，支持视频分割及交互式优化。\n\n## 图像结果\n\n\u003Cdiv align=\"center\">\n\u003Ctable style=\"min-width: 80%; border: 2px solid #ddd; border-collapse: collapse\">\n  \u003Cthead>\n    \u003Ctr>\n      \u003Cth rowspan=\"3\" style=\"border-right: 2px solid #ddd; padding: 12px 20px\">模型\u003C\u002Fth>\n      \u003Cth colspan=\"3\" style=\"text-align: center; border-right: 2px solid #ddd; padding: 12px 20px\">实例分割\u003C\u002Fth>\n      \u003Cth colspan=\"5\" style=\"text-align: center; padding: 12px 20px\">边界框检测\u003C\u002Fth>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">LVIS\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 2px solid #ddd; padding: 12px 20px\">SA-Co\u002F金牌\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">LVIS\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">COCO\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">SA-Co\u002F金牌\u003C\u002Fth>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">AP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 2px solid #ddd; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">AP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">AP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">AP\u003Csub>o\u003C\u002Fsub>\n\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n    \u003C\u002Ftr>\n  \u003C\u002Fthead>\n  \u003Ctbody>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">人类\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">72.8\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">74.0\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">OWLv2*\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px; color: #999\">29.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px; color: #999\">43.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">24.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px; color: #999\">30.2\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px; color: #999\">45.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">46.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">23.9\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">24.5\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">DINO-X\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">38.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">21.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">52.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">56.0\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">22.5\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">Gemini 2.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">13.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">13.0\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">16.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">14.4\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr style=\"border-top: 2px solid #b19c9cff\">\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">SAM 3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">37.2\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">48.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 2px solid #ddd; padding: 10px 20px\">54.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">40.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">53.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">56.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">55.7\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">55.7\u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\u003Cp style=\"text-align: center; margin-top: 10px; font-size: 0.9em; color: #ddd;\">* 部分在LVIS上训练，AP\u003Csub>o\u003C\u002Fsub>指COCO-O的准确率\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n## 视频结果\n\n\u003Cdiv align=\"center\">\n\u003Ctable style=\"min-width: 80%; border: 2px solid #ddd; border-collapse: collapse\">\n  \u003Cthead>\n    \u003Ctr>\n      \u003Cth rowspan=\"2\" style=\"border-right: 2px solid #ddd; padding: 12px 20px\">模型\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">SA-V 测试\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">YT-Temporal-1B 测试\u003C\u002Fth>\n      \u003Cth colspan=\"2\" style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">SmartGlasses 测试\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">LVVIS 测试\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">BURST 测试\u003C\u002Fth>\n    \u003C\u002Ftr>\n    \u003Ctr>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">pHOTA\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">pHOTA\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">cgF1\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">pHOTA\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; border-right: 1px solid #eee; padding: 12px 20px\">mAP\u003C\u002Fth>\n      \u003Cth style=\"text-align: center; padding: 12px 20px\">HOTA\u003C\u002Fth>\n    \u003C\u002Ftr>\n  \u003C\u002Fthead>\n  \u003Ctbody>\n    \u003Ctr>\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">人类\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">53.1\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">70.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">71.2\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">78.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">58.5\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">72.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">-\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">-\u003C\u002Ftd>\n    \u003C\u002Ftr>\n    \u003Ctr style=\"border-top: 2px solid #b19c9cff\">\n      \u003Ctd style=\"border-right: 2px solid #ddd; padding: 10px 20px\">SAM 3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">30.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">58.0\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">50.8\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">69.9\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">36.4\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">63.6\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; border-right: 1px solid #eee; padding: 10px 20px\">36.3\u003C\u002Ftd>\n      \u003Ctd style=\"text-align: center; padding: 10px 20px\">44.5\u003C\u002Ftd>\n    \u003C\u002Ftr>\n  \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003C\u002Fdiv>\n\n## SA-Co 数据集\n\n我们发布了两个图像基准测试：[SA-Co\u002FGold](scripts\u002Feval\u002Fgold\u002FREADME.md) 和 [SA-Co\u002FSilver](scripts\u002Feval\u002Fsilver\u002FREADME.md)，以及一个视频基准测试 [SA-Co\u002FVEval](scripts\u002Feval\u002Fveval\u002FREADME.md)。这些数据集包含带有名词短语标注的图像（或视频）。每张图像\u002F视频与对应的名词短语都附有实例掩码和与该短语匹配的每个对象的唯一 ID。对于没有匹配对象的短语（即负样本），则不提供掩码，如图中红色字体所示。有关如何下载和运行这些数据集评估的更多详细信息，请参阅链接中的 README 文件。\n\n* HuggingFace 主机：[SA-Co\u002FGold](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffacebook\u002FSACo-Gold)、[SA-Co\u002FSilver](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffacebook\u002FSACo-Silver) 和 [SA-Co\u002FVEval](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffacebook\u002FSACo-VEval)\n* Roboflow 主机：[SA-Co\u002FGold](https:\u002F\u002Funiverse.roboflow.com\u002Fsa-co-gold)、[SA-Co\u002FSilver](https:\u002F\u002Funiverse.roboflow.com\u002Fsa-co-silver) 和 [SA-Co\u002FVEval](https:\u002F\u002Funiverse.roboflow.com\u002Fsa-co-veval)\n\n![SA-Co 数据集](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_readme_0ad979c65152.jpg)\n\n## 开发\n\n要设置开发环境：\n\n```bash\npip install -e \".[dev,train]\"\n```\n\n要格式化代码：\n\n```bash\nufmt format .\n```\n\n## 贡献\n\n请参阅 [贡献指南](CONTRIBUTING.md) 和 [行为准则](CODE_OF_CONDUCT.md)。\n\n## 许可证\n\n本项目采用 SAM 许可证授权——详情请参阅 [LICENSE](LICENSE) 文件。\n\n## 致谢\n\n我们衷心感谢以下人士对 SAM 3 项目的贡献：Alex He、Alexander Kirillov、Alyssa Newcomb、Ana Paula Kirschner Mofarrej、Andrea Madotto、Andrew Westbury、Ashley Gabriel、Azita Shokpour、Ben Samples、Bernie Huang、Carleigh Wood、Ching-Feng Yeh、Christian Puhrsch、Claudette Ward、Daniel Bolya、Daniel Li、Facundo Figueroa、Fazila Vhora、George Orlin、Hanzi Mao、Helen Klein、Hu Xu、Ida Cheng、Jake Kinney、Jiale Zhi、Jo Sampaio、Joel Schlosser、Justin Johnson、Kai Brown、Karen Bergan、Karla Martucci、Kenny Lehmann、Maddie Mintz、Mallika Malhotra、Matt Ward、Michelle Chan、Michelle Restrepo、Miranda Hartley、Muhammad Maaz、Nisha Deo、Peter Park、Phillip Thomas、Raghu Nayani、Rene Martinez Doehner、Robbie Adkins、Ross Girshik、Sasha Mitts、Shashank Jain、Spencer Whitehead、Ty Toledano、Valentin Gabeur、Vincent Cho、Vivian Lee、William Ngan、Xuehai He、Yael Yungster、Ziqi Pang、Ziyi Dou、Zoe Quake。\n\n## 引用 SAM 3\n\n如果您在研究中使用了 SAM 3 或 SA-Co 数据集，请使用以下 BibTeX 条目。\n\n```bibtex\n@misc{carion2025sam3segmentconcepts,\n      title={SAM 3：用概念分割一切},\n      author={Nicolas Carion、Laura Gustafson、Yuan-Ting Hu、Shoubhik Debnath、Ronghang Hu、Didac Suris、Chaitanya Ryali、Kalyan Vasudev Alwala、Haitham Khedr、Andrew Huang、Jie Lei、Tengyu Ma、Baishan Guo、Arpit Kalla、Markus Marks、Joseph Greer、Meng Wang、Peize Sun、Roman Rädle、Triantafyllos Afouras、Effrosyni Mavroudi、Katherine Xu、Tsung-Han Wu、Yu Zhou、Liliane Momeni、Rishi Hazra、Shuangrui Ding、Sagar Vaze、Francois Porcher、Feng Li、Siyuan Li、Aishwarya Kamath、Ho Kei Cheng、Piotr Dollár、Nikhila Ravi、Kate Saenko、Pengchuan Zhang、Christoph Feichtenhofer},\n      year={2025},\n      eprint={2511.16719},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2511.16719},\n}\n```","# SAM 3 快速上手指南\n\nSAM 3 (Segment Anything with Concepts) 是 Meta 推出的统一基础模型，支持通过文本或视觉提示（点、框、掩码）对图像和视频中的对象进行检测、分割和跟踪。相比前代，SAM 3 具备强大的开放词汇概念分割能力。\n\n## 环境准备\n\n在开始之前，请确保您的系统满足以下要求：\n\n*   **操作系统**: Linux (推荐)\n*   **Python**: 3.12 或更高版本\n*   **PyTorch**: 2.7 或更高版本\n*   **GPU**: 支持 CUDA 的显卡，且安装 CUDA 12.6 或更高版本驱动\n*   **包管理工具**: Conda (推荐)\n\n## 安装步骤\n\n### 1. 创建 Conda 环境\n```bash\nconda create -n sam3 python=3.12\nconda deactivate\nconda activate sam3\n```\n\n### 2. 安装 PyTorch (CUDA 版本)\n根据官方要求安装特定版本的 PyTorch：\n```bash\npip install torch==2.10.0 torchvision --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\n```\n> **国内加速建议**：如果下载速度慢，可尝试使用清华源替代官方源（注意需确保版本兼容性）：\n> `pip install torch==2.10.0 torchvision --index-url https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple` (若清华源无对应 CUDA 版本 wheel，请回退至官方源)\n\n### 3. 克隆仓库并安装 SAM 3\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3.git\ncd sam3\npip install -e .\n```\n\n### 4. 安装可选依赖（推荐）\n为了运行示例 Notebook 或获得更快的推理速度，建议安装以下依赖：\n```bash\n# 安装 Notebook 运行依赖\npip install -e \".[notebooks]\"\n\n# 安装加速依赖 (Flash Attention 等)\npip install einops ninja && pip install flash-attn-3 --no-deps --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\npip install git+https:\u002F\u002Fgithub.com\u002Fronghanghu\u002Fcc_torch.git\n```\n\n### 5. 获取模型权重\n⚠️ **重要**：在使用前，您必须前往 Hugging Face [SAM 3 仓库](https:\u002F\u002Fhuggingface.co\u002Ffacebook\u002Fsam3) 申请访问权限。\n获得批准后，请在终端登录以下载权重：\n```bash\nhf auth login\n# 输入您在 Hugging Face 生成的 Access Token\n```\n\n## 基本使用\n\n以下是使用 SAM 3 进行图像和视频分割的最简代码示例。\n\n### 图像分割示例\n通过文本提示对图像进行分割：\n\n```python\nimport torch\nfrom PIL import Image\nfrom sam3.model_builder import build_sam3_image_model\nfrom sam3.model.sam3_image_processor import Sam3Processor\n\n# 加载模型\nmodel = build_sam3_image_model()\nprocessor = Sam3Processor(model)\n\n# 加载图片\nimage = Image.open(\"\u003CYOUR_IMAGE_PATH.jpg>\")\ninference_state = processor.set_image(image)\n\n# 设置文本提示 (例如：\"a red player\")\noutput = processor.set_text_prompt(state=inference_state, prompt=\"\u003CYOUR_TEXT_PROMPT>\")\n\n# 获取结果\nmasks, boxes, scores = output[\"masks\"], output[\"boxes\"], output[\"scores\"]\n```\n\n### 视频分割示例\n通过文本提示对视频进行分割：\n\n```python\nfrom sam3.model_builder import build_sam3_video_predictor\n\n# 加载视频预测器\nvideo_predictor = build_sam3_video_predictor()\nvideo_path = \"\u003CYOUR_VIDEO_PATH>\" # 可以是 JPEG 文件夹或 MP4 文件\n\n# 开始会话\nresponse = video_predictor.handle_request(\n    request=dict(\n        type=\"start_session\",\n        resource_path=video_path,\n    )\n)\n\n# 添加文本提示 (在第 0 帧)\nresponse = video_predictor.handle_request(\n    request=dict(\n        type=\"add_prompt\",\n        session_id=response[\"session_id\"],\n        frame_index=0, \n        text=\"\u003CYOUR_TEXT_PROMPT>\",\n    )\n)\n\n# 获取输出\noutput = response[\"outputs\"]\n```\n\n更多高级用法（如批量推理、多轮交互优化等）请参考项目 `examples` 目录下的 Jupyter Notebook 文件。","某体育科技公司正在开发一套自动化的足球比赛视频分析系统，需要从海量比赛录像中精准提取特定球队球员的跑动轨迹与触球瞬间。\n\n### 没有 sam3 时\n- **语义理解局限**：传统模型无法直接理解“身穿红色球衣的守门员”这类复杂文本指令，必须预先为每支球队训练专用的检测器，成本极高。\n- **细粒度区分困难**：当场上出现多名穿着相似队服的球员时，旧模型极易混淆目标，难以区分“白衣前锋”与“白衣后卫”，导致跟踪轨迹错乱。\n- **长尾概念缺失**：对于“庆祝动作”或“特定犯规姿态”等罕见概念，由于缺乏标注数据，模型完全无法识别，只能依赖人工逐帧标注。\n- **多任务协作低效**：检测、分割与跟踪通常由三个独立模型串联完成，误差会在流程中逐级累积，且推理速度缓慢，无法满足实时分析需求。\n\n### 使用 sam3 后\n- **开放词汇即时响应**：sam3 支持直接输入自然语言提示（如“所有正在滑铲的球员”），无需重新训练即可零样本分割出符合描述的所有实例。\n- **高精度语义判别**：借助独特的“存在令牌（presence token）”架构，sam3 能敏锐捕捉文本细微差别，精准分离视觉上极度相似但语义不同的目标。\n- **海量概念覆盖**：基于 400 万独特概念的数据引擎，sam3 能轻松识别各类长尾战术动作或特殊装备，将原本需要数周的人工标注工作缩短至分钟级。\n- **端到端统一处理**：sam3 采用解耦的检测 - 跟踪设计，单次推理即可同时完成目标发现、像素级分割及跨帧跟踪，大幅降低延迟并提升轨迹连贯性。\n\nsam3 通过将开放词汇理解与高精度视频跟踪融为一体，让非技术人员也能通过自然语言指令，瞬间从复杂视频流中提取出极具价值的战术洞察。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookresearch_sam3_0ad979c6.jpg","facebookresearch","Meta Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Ffacebookresearch_449342bd.png","",null,"https:\u002F\u002Fopensource.fb.com","https:\u002F\u002Fgithub.com\u002Ffacebookresearch",[82],{"name":83,"color":84,"percentage":85},"Python","#3572A5",100,9080,1335,"2026-04-18T13:53:01","NOASSERTION",4,"未说明","必需，需兼容 CUDA 的 NVIDIA GPU，CUDA 版本需 12.6 或更高（安装示例使用 cu128）",{"notes":94,"python":95,"dependencies":96},"模型权重托管在 Hugging Face，使用前需申请访问权限并通过 hf auth login 进行身份验证。官方安装示例基于 CUDA 12.8 (cu128) 和 PyTorch 2.10.0。可选安装 flash-attn-3 和 cc_torch 以加速推理。","3.12+",[97,98,99,100,101,102],"torch>=2.7","torchvision","einops","ninja","flash-attn-3","cc_torch",[15,61,104],"其他","2026-03-27T02:49:30.150509","2026-04-19T03:05:57.025417",[108,113,118,123,128,132],{"id":109,"question_zh":110,"answer_zh":111,"source_url":112},41517,"如何在显存有限（如 24GB）的显卡上微调 SAM3 模型？","在 24GB 显存的显卡上无法微调整个 SAM3 模型，即使批量大小（Batch Size）设为 1 也会显存溢出。必须冻结语言骨干网络（language backbone）和视觉骨干网络（vision backbone）。如果此方案不满足需求，则需要使用更大显存的 GPU。\n此外需注意：\n1. `train_batch_size` 是有效批量大小，而非微批量大小。\n2. 若需使用大于 1 的批量大小，必须将 `collate_fn_api` 替换为 `collate_fn_api_with_chunking`。\n3. 在每个 collate 函数下添加 `num_chunks` 参数，且 `num_chunks` 应等于梯度累积步数（gradient_accumulation_steps）。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3\u002Fissues\u002F200",{"id":114,"question_zh":115,"answer_zh":116,"source_url":117},41518,"加载微调后的模型时出现“缺失键”或“意外键”警告怎么办？","这通常是因为训练和推理时的配置不一致导致的。常见原因及解决方法如下：\n1. **配置不匹配**：如果你训练时设置了 `enable_segmentation=False`，但在推理加载模型时使用了默认值（True），就会报错。请确保 `build_sam3_image_model` 中的参数与训练时一致。\n2. **代码逻辑问题**：如果是目标检测模型，可能是 `_load_checkpoints` 函数过滤了必要的键。可以尝试注释掉相关的过滤逻辑（例如移除 `if \"detector\" in k` 的判断），以便正确加载权重。\n3. **保存方式**：不要直接使用 `torch.save()` 保存模型权重，建议使用 Huggingface 缓存目录中的权重或官方推荐的检查点保存方式。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3\u002Fissues\u002F260",{"id":119,"question_zh":120,"answer_zh":121,"source_url":122},41519,"为什么在 SAM3 中单独使用边界框（Box）提示进行视频跟踪会失败或返回无对象？","这是 SAM3 的预期行为。SAM3 支持两种主要任务：\n1. **PCS (Promptable Category Segmentation)**：这是 SAM3 的新功能，适用于文本、框或其组合，会返回所有匹配查询的对象。单独使用框提示时，模型可能将其视为 PCS 任务，导致结果不符合预期（如返回多个对象或后续帧丢失）。\n2. **PVS (Promptable Video Segmentation)**：这是 SAM1\u002F2 已有的功能，专门针对框或点提示，用于检测并跟踪**单个**特定实例。\n\n如果你只想跟踪框选定的单个物体，应该使用 PVS 模式。请参考官方示例笔记本：`examples\u002Fsam3_for_sam2_video_task_example.ipynb`。使用 PVS 头通常能获得最佳结果且速度更快。\n*非官方技巧*：尝试将文本提示设置为 \"geometric\"，可能在常规头中模拟 PVS 行为，但不保证性能且无官方支持。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3\u002Fissues\u002F204",{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},41520,"如何使用纯文本提示在一个视频中跟踪多个不同类别的物体？","目前直接循环添加多个文本提示会导致跟踪失效，这是因为模型处理多提示的逻辑限制。虽然提供的 Issue 数据中未包含完整的最终解决方案代码，但根据上下文，正确的做法通常不是简单地循环添加提示，而是需要构建一个包含所有类别的复合提示或利用模型的多标签处理能力。建议参考官方关于多类别跟踪的示例或文档，避免逐个添加提示导致状态重置。若需实时动态添加新物体坐标（如每 2 秒刷新），需重新设计请求会话（session）管理逻辑，确保在现有会话中更新提示而非创建冲突的新会话。","https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3\u002Fissues\u002F206",{"id":129,"question_zh":130,"answer_zh":131,"source_url":112},41521,"设置梯度累积（Gradient Accumulation）大于 1 时总是报错怎么办？","如果在设置梯度累积步数大于 1 时遇到 DataLoader worker 被杀死或运行时错误，通常是因为显存不足或配置不当。解决方案包括：\n1. **降低负载**：确保已冻结不必要的模型部分（如语言和视觉骨干）以减少显存占用。\n2. **调整 Collate 函数**：如果使用大于 1 的批量大小，必须将默认的 `collate_fn_api` 替换为 `collate_fn_api_with_chunking`。\n3. **配置分块**：在 collate 函数中设置 `num_chunks` 参数，使其等于梯度累积步数（gradient_accumulation_steps），以正确处理数据分块加载。",{"id":133,"question_zh":134,"answer_zh":135,"source_url":122},41522,"SAM3 中的 PCS 和 PVS 任务有什么区别？","SAM3 支持两种不同的跟踪任务模式：\n- **PCS (Promptable Category Segmentation)**：SAM3 新增功能。接受文本、边界框或两者的组合作为提示，目标是返回视频中**所有**匹配该查询的对象实例。适用于需要检测某类所有物体的场景。\n- **PVS (Promptable Video Segmentation)**：继承自 SAM1\u002F2 的功能。接受边界框或点作为提示，目标是检测并跟踪**唯一**被指定的那个实例。适用于单物体跟踪场景。\n\n选择错误的模式（例如想用框跟踪单个物体却触发了 PCS 逻辑）会导致结果异常。对于单物体跟踪，请优先使用 PVS 模式及相关示例代码。",[]]