百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
X

X-SAM

> AI 编程
开源

[AAAI2026] X-SAM: 从任意分割到任意分段

386 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

[AAAI2026] X-SAM: 从任意分割到任意分段

:eyes: Notice

Note: X-SAM is under active development, and we will continue to update the code and documentation. Please check TODO to get our development schedule.

Reproducing AAAI 2026 results: To reproduce the results reported in our AAAI 2026 submission, please switch to the AAAI26_Archive branch:

bash
git clone -b AAAI26_Archive https://github.com/wanghao9610/X-SAM.git

We strongly recommend that everyone uses English to communicate in issues. This helps developers from around the world discuss, share experiences, and answer questions together.

If you have any questions or would like to collaborate, please feel free to open an issue or reach out to me at [email protected].

:boom: Updates

  • 2026-07-03: ✨ We update the codebase to align with X2SAM, along with a new training recipe based on Qwen3-VL.
  • 2026-06-18: Congratulations! X2SAM has been accepted by ECCV 2026!
  • 2026-04-28: We release X2SAM, a new project for any segmentation in images and videos. X-SAM training configs are also supported in X2SAM — welcome to try it!
  • 2026-01-29: We update the camera-ready version of our paper and uploaded the official paper poster for AAAI 2026.
  • 2025-11-21: We release the code for X-SAM with Qwen3-4B-Instruct-2507 and Qwen3-1.7B. We will release the weights soon.
  • 2025-11-19: We release the code for Training X-SAM. Welcome to try it! If you have any questions, please feel free to open an issue.
  • 2025-11-08: Congratulations! X-SAM has been accepted by AAAI 2026! We will release all the code in the coming week!
  • 2025-09-28: We update the Local Demo inference script — you can run local inference instead of on the Web Demo.
  • 2025-08-11: Thanks for your great attention to our work! We have deployed another Online Demo2. You can also try it if Online Demo1 is not available.
  • 2025-08-11: We released the effective code for Evaluation on Segmentation Benchmarks. We have updated all code except for Training X-SAM.
  • 2025-08-10: We released the detailed instructions for Demo Deployment.
  • 2025-08-08: We released the simple code for Evaluation on VLM Benchmarks.
  • 2025-08-06: We are excited to publish the Technical Report, please check it out for more technical details.
  • 2025-08-05: We provided the Model Weights on HuggingFace.
  • 2025-07-26: We deployed the Online Demo, you can try it now!

:rocket: Highlights

This repository provides the official PyTorch implementation, pre-trained models, training, evaluation, visualization, and demo code of X-SAM:

  • X-SAM introduces a unified multimodal large language model (MLLM) framework, extending the segmentation paradigm from segment anything to any segmentation, thereby enhancing pixel-level perceptual understanding.

  • X-SAM proposes a novel Visual GrounDed (VGD) segmentation task, which segments all instance objects using interactive visual prompts, empowering the model with visually grounded, pixel-wise interpretative capabilities.

  • X-SAM presents a unified training strategy that enables co-training across multiple datasets. Experimental results demonstrate that X-SAM achieves state-of-the-art performance on various image segmentation benchmarks, highlighting its efficiency in multimodal, pixel-level visual understanding.

✨ This repository provides unified and effective code for training, evaluation, and visualization of segmentation MLLMs. We hope this repository will promote further research on MLLMs. For image-and-video any-segmentation, please also check out our follow-up project X2SAM.

:book: Table of Contents

  • Abstract
  • Overview
  • Benchmarks
  • Quickstart
  • Demo
  • TODO
  • Acknowledge
  • Citation

:bookmark: Abstract

Large Language Models (LLMs) demonstrate strong capabilities in broad knowledge representation, yet they are inherently deficient in pixel-level perceptual understanding. Although the Segment Anything Model (SAM) represents a significant advancement in visual-prompt-driven image segmentation, it exhibits notable limitations in multi-mask prediction and category-specific segmentation tasks, and it cannot integrate all segmentation tasks within a unified model architecture. To address these limitations, we present X-SAM, a streamlined Multimodal Large Language Model (MLLM) framework that extends the segmentation paradigm from segment anything to any segmentation. Specifically, we introduce a novel unified framework that enables more advanced pixel-level perceptual comprehension for MLLMs. Furthermore, we propose a new segmentation task, termed Visual GrounDed (VGD) segmentation, which segments all instance objects with interactive visual prompts and empowers MLLMs with visual grounded, pixel-wise interpretative capabilities. To enable effective training on diverse data sources, we present a unified training strategy that supports co-training across multiple datasets. Experimental results demonstrate that X-SAM achieves state-of-the-art performance on a wide range of image segmentation benchmarks, highlighting its efficiency for multimodal, pixel-level visual understanding.

:mag: Overview

:bar_chart: Benchmarks

More benchmark results can be found in benchmarks.md.

To reproduce these AAAI 2026 submission results, use the AAAI26_Archive branch (see Notice).

:checkered_flag: Quickstart

1. Structure

We provide a detailed project structure for X-SAM. Please follow this structure to organize the project.

Project

…

2. Environment

Basic setup

…

Optional: set CUDA_HOME

bash
export CUDA_HOME="your_cuda12.4_path"
export PATH="$CUDA_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$CUDA_HOME/lib64:$LD_LIBRARY_PATH"
echo -e "CUDA version:\n$(nvcc -V)"

Optional: install gcc 11

bash
conda install gcc=11 gxx=11 -c conda-forge -y

Optional: install VLMEvalKit

bash
cd "$PROJ_HOME"
git clone -b v0.3rc1 https://github.com/open-compass/VLMEvalKit.git
cd VLMEvalKit
pip install -e .

3. Dataset

Please refer to datasets.md for detailed instructions on data preparation.

4. Model

Please refer to models.md for detailed instructions on model preparation.

5. Training

We provide a comprehensive script that covers the entire pipeline, including training, evaluation, and visualization. For detailed instructions, please refer to gpu_run.sh.

…

More Stage-3 configs

Backbone Config
Phi-3-mini-4k-instruct xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py
Qwen3-4B-Instruct-2507 xsam_qwen3_4b_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py
Qwen3-1.7B xsam_qwen3_1x7b_wothinking_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py
Qwen3-VL-4B-Instruct (LoRA) xsam_qwen3_vl_4b_instruct_sam_vit_large_m2f_e1_gpu16_lora.py
Qwen3-VL-2B-Instruct (LoRA) xsam_qwen3_vl_2b_instruct_sam_vit_large_m2f_e1_gpu16_lora.py

6. Evaluation

Segmentation Benchmarks

bash
cd "$PROJ_HOME"
bash runs/gpu_run.sh \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  "segeval"

VLM Benchmarks

bash
cd "$PROJ_HOME"
bash runs/gpu_run.sh \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  "vlmeval"

7. Visualization

bash
cd "$PROJ_HOME"
bash runs/gpu_run.sh \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  "visualize"

8. Tools

Dataset Exploration

We provide a tool for dataset exploration. You can use it to explore the dataset and get visualizations of the samples.

bash
cd "$PROJ_HOME"
python xsam/xsam/tools/explore.py \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  --output-dir "wkdrs/dataset_exploration" \
  --subset train \
  --max-samples 100

Model Conversion

We provide a tool for model conversion. You can use it to convert the checkpoint to the Hugging Face format.

bash
cd "$PROJ_HOME"
python xsam/xsam/tools/model_tools/pth_to_hf.py \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  "wkdrs/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16" \
  --pth_model latest

:computer: Demo

Local Demo

️ Inference

bash
cd "$PROJ_HOME"
python xsam/xsam/demo/demo.py \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  --pth_model "inits/X-SAM/s3_mixed_finetune/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_large_m2f_gpu16_mixed_finetune/pytorch_model.bin" \
  --task-name TASK_NAME \
  --image INPUT_IMAGE/INPUT_DIR \
  --prompt INPUT_PROMPT \
  --vprompt-masks INPUT_VPROMPT_MASKS

️ Examples

…

Web Demo

️ Deployment

bash
cd "$PROJ_HOME"
python xsam/xsam/demo/app.py \
  xsam/xsam/configs/xsam/s3_train/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_vit_large_m2f_e1_gpu16.py \
  --pth_model "inits/X-SAM/s3_mixed_finetune/xsam_phi3_mini_4k_instruct_siglip2_so400m_p14_384_sam_large_m2f_gpu16_mixed_finetune/pytorch_model.bin" \
  --log-dir "wkdrs/app_logs" \
  --seed 0 \
  --port 7860

Then, you can access the demo website at http://localhost:7860.

:white_check_mark: TODO

  • Release the Online Demo.
  • Release the Model Weights.
  • Release the Technical Report.
  • Release the code for Evaluation on VLM Benchmarks.
  • Release the code for Demo Deployment.
  • Release the code for Evaluation on Segmentation Benchmarks.
  • Release the code for Training X-SAM.
  • Release the code and weight for X-SAM with Qwen3.
  • Release the code and weight for X-SAM with Qwen3-VL.
  • Release the inference and demo code supporting transformers.
  • Release the code and instructions f

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonmllmssamsegmentation

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类AI 编程
定价开源

> 相关工具

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.