See-through 是一个研究框架(SIGGRAPH 2026,有条件接收),用于将单张动漫插画分解为可操作的分层 PSD 文件,服务于 2.5D 动画工作流。
用途 该框架面向动漫角色的单图图层分解任务:输入一张动漫插画,输出最多 23 个语义独立、经过完整补全的图层,并推断其绘制顺序,导出为分层 PSD 文件。
主要能力
- 将单张动漫图像分解为语义图层(头发、面部、眼睛、服装、配饰等)。
- 对遮挡区域进行补全(inpainting),使每个图层完整。
- 使用微调的 Marigold 模型推断伪深度排序。
- 导出带深度图与分割掩码的分层 .psd 文件。
- 支持基于深度和左右方向的分层,用于进一步细化。
模型 模型托管于 HuggingFace,首次使用时自动下载:
- LayerDiff 3D:layerdifforg/seethroughv0.0.2_layerdiff3d,基于 SDXL 的透明图层生成。
- Marigold Depth:24yearsold/seethroughv0.0.1_marigold,动漫伪深度估计。
- SAM Body Parsing:24yearsold/l2d_sam_iter2,19 部位语义身体分割。
安装
-
创建并激活环境: conda create -n see_through python=3.12 -y conda activate see_through
-
安装 PyTorch(CUDA 12.8): pip install torch==2.8.0+cu128 torchvision==0.23.0+cu128 torchaudio==2.8.0+cu128 --index-url https://download.pytorch.org/whl/cu128
-
安装核心依赖: pip install -r requirements.txt
-
创建 assets 符号链接: ln -sf common/assets assets
可选标注器层级(按需安装):
- 身体解析(detectron2,用于身体属性标注):pip install --no-build-isolation -r requirements-inference-annotators.txt
- SAM2(语言引导分割):pip install --no-build-isolation -r requirements-inference-sam2.txt
- 实例分割(mmcv/mmdet,推荐用于 UI):pip install -r requirements-inference-mmdet.txt
所有脚本必须从仓库根目录作为工作目录运行。
使用方式 主流程:图层分解为 PSD 单张图像 → 分层 PSD: python inference/scripts/inference_psd.py --srcp assets/test_image.png --save_to_psd
整个目录的图像: python inference/scripts/inference_psd.py --srcp path/to/image_folder/ --save_to_psd
输出默认保存到 workspace/layerdiff_output/。每次运行产生:带语义分离图层的 .psd 文件、中间深度图、分割掩码。
启发式后处理 在主流程之后,使用 heuristic_partseg.py 进一步拆分图层:
- 基于深度的分层(例如分离近/远手部服饰): python inference/scripts/heuristic_partseg.py seg_wdepth --srcp workspace/test_samples_output/PV_0047_A0020.psd --target_tags handwear
- 左右分层: python inference/scripts/heuristic_partseg.py seg_wlr --srcp workspace/test_samples_output/PV_0047_A0020_wdepth.psd --target_tags handwear-1
合成训练数据生成: python inference/scripts/syn_data.py
Python API 可通过 subprocess 调用完整流程,支持单图分解、目录批量处理、深度与左右拆分后处理,以及使用 psd_tools 加载与检查 PSD 输出。示例代码见资料中的 decompose_anime_image、batch_decompose、split_by_depth、split_by_lr、inspect_psd_layers 等函数。
交互式身体部位分割 运行提供的演示 notebook: jupyter notebook inference/demo/bodypartseg_sam.ipynb 该 notebook 演示使用 SAM 身体解析模型进行交互式 19 部位身体分割与可视化。
训练数据集准备 See-through 使用 Live2D 模型文件作为训练数据,需要单独的仓库:
- 克隆 CubismPartExtr 工具:git clone https://github.com/shitagaki-lab/CubismPartExtr,按其 README 下载示例模型文件并准备 workspace/。
- 按 README_datapipeline.md 运行数据解析脚本(脚本位于 inference/scripts/,详见 docstring)。
启动 UI 需要仓库根目录下的 workspace/datasets/(包含示例数据)。建议先安装 mmdet 层级:pip install -r requirements-inference-mmdet.txt,然后按 ui/README.md 的说明启动。
目录结构 see-through/ ├── inference/ │ ├── scripts/ │ │ ├── inference_psd.py # 主流程 │ │ ├── heuristic_partseg.py # 深度/左右后处理 │ │ └── syn_data.py # 合成数据生成 │ └── demo/ │ └── bodypartseg_sam.ipynb # 交互式分割演示 ├── common/ │ ├── assets/ # 测试图像等 │ └── live2d/ │ └── scrap_model.py # 完整身体标签定义 ├── ui/ # 用户界面 ├── workspace/ # 运行时输出(自动创建) │ ├── layerdiff_output/ # 默认 PSD 输出位置 │ ├── datasets/ # UI 所需 │ └── test_samples_output/ # 示例输出 ├── requirements.txt ├── requirements-inference-annotators.txt ├── requirements-inference-sam2.txt ├── requirements-inference-mmdet.txt └── README_datapipeline.md
常见模式 端到端单图工作流:
- 分解:python inference/scripts/inference_psd.py --srcp assets/test_image.png --save_to_psd
- 对特定部位标签做深度拆分:python inference/scripts/heuristic_partseg.py seg_wdepth --srcp workspace/layerdiff_output/test_image.psd --target_tags arm sleeve
- 左右拆分:python inference/scripts/heuristic_partseg.py seg_wlr --srcp workspace/layerdiff_output/test_image_wdepth.psd --target_tags arm-1 sleeve-1
查看可用身体标签:身体标签定义位于 common/live2d/scrap_model.py,可通过 importlib 加载该模块并检查其标签常量/枚举。
ComfyUI 集成 社区维护的 ComfyUI 节点:https://github.com/jtydhr88/ComfyUI-See-through,可通过 ComfyUI Manager 安装或克隆到 ComfyUI/custom_nodes/。
故障排除
- detectron2/mmcv 出现 ModuleNotFoundError:安装相应可选层级 pip install --no-build-isolation -r requirements-inference-annotators.txt。
- 脚本路径错误:始终从仓库根目录运行,而非子目录内。
- UI 启动失败:安装 mmdet 层级 pip install -r requirements-inference-mmdet.txt,并确保 workspace/datasets/ 存在。
- CUDA 显存不足:使用 ≥16GB VRAM 的 GPU;基于 SDXL 的 LayerDiff 3D 显存占用较高。
- 找不到 assets:从仓库根目录重新运行 ln -sf common/assets assets。
- SAM2 安装失败:使用 --no-build-isolation 标志。
- 输出 PSD 为空或格式错误:检查 workspace/layerdiff_output/ 中的中间深度/掩码文件以诊断失败阶段。
引用 @article{lin2026seethrough, title={See-through: Single-image Layer Decomposition for Anime Characters}, author={Lin, Jian and Li, Chengze and Qin, Haoyun and Chan, Kwun Wang and Jin, Yanghua and Liu, Hanyuan and Choy, Stephen Chun Wang and Liu, Xueting}, journal={arXiv preprint arXiv:2602.03749}, year={2026} }
限制 资料未提供收费、价格、平台支持范围、具体效果指标或性能基准等信息。