see-through-anime-layer-decomposition
Expertise in See-through, a framework for single-image layer decomposition of anime characters into manipulatable 2.5D PSD files using diffusion models.
What this skill does
# See-through: Anime Character Layer Decomposition
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
See-through is a research framework (SIGGRAPH 2026, conditionally accepted) that decomposes a single anime illustration into up to **23 fully inpainted, semantically distinct layers** with inferred drawing orders — exporting a layered PSD file suitable for 2.5D animation workflows.
## What It Does
- Decomposes a single anime image into semantic layers (hair, face, eyes, clothing, accessories, etc.)
- Inpaints occluded regions so each layer is complete
- Infers pseudo-depth ordering using a fine-tuned Marigold model
- Exports layered `.psd` files with depth maps and segmentation masks
- Supports depth-based and left-right stratification for further refinement
## Installation
```bash
# 1. Create and activate environment
conda create -n see_through python=3.12 -y
conda activate see_through
# 2. Install PyTorch with 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
# 3. Install core dependencies
pip install -r requirements.txt
# 4. Create assets symlink
ln -sf common/assets assets
```
### Optional Annotator Tiers
Install only what you need:
```bash
# Body parsing (detectron2 — for body attribute tagging)
pip install --no-build-isolation -r requirements-inference-annotators.txt
# SAM2 (language-guided segmentation)
pip install --no-build-isolation -r requirements-inference-sam2.txt
# Instance segmentation (mmcv/mmdet — recommended for UI)
pip install -r requirements-inference-mmdet.txt
```
> Always run all scripts from the **repository root** as the working directory.
## Models
Models are hosted on HuggingFace and downloaded automatically on first use:
| Model | HuggingFace ID | Purpose |
|-------|---------------|---------|
| LayerDiff 3D | `layerdifforg/seethroughv0.0.2_layerdiff3d` | SDXL-based transparent layer generation |
| Marigold Depth | `24yearsold/seethroughv0.0.1_marigold` | Anime pseudo-depth estimation |
| SAM Body Parsing | `24yearsold/l2d_sam_iter2` | 19-part semantic body segmentation |
## Key CLI Commands
### Main Pipeline: Layer Decomposition to PSD
```bash
# Single image → layered PSD
python inference/scripts/inference_psd.py \
--srcp assets/test_image.png \
--save_to_psd
# Entire directory of images
python inference/scripts/inference_psd.py \
--srcp path/to/image_folder/ \
--save_to_psd
```
Output is saved to `workspace/layerdiff_output/` by default. Each run produces:
- A layered `.psd` file with semantically separated layers
- Intermediate depth maps
- Segmentation masks
### Heuristic Post-Processing
After the main pipeline, further split layers using `heuristic_partseg.py`:
```bash
# Depth-based stratification (e.g., separate near/far handwear)
python inference/scripts/heuristic_partseg.py seg_wdepth \
--srcp workspace/test_samples_output/PV_0047_A0020.psd \
--target_tags handwear
# Left-right stratification
python inference/scripts/heuristic_partseg.py seg_wlr \
--srcp workspace/test_samples_output/PV_0047_A0020_wdepth.psd \
--target_tags handwear-1
```
### Synthetic Training Data Generation
```bash
python inference/scripts/syn_data.py
```
## Python API Usage
### Running the Full Pipeline Programmatically
```python
import subprocess
import os
def decompose_anime_image(image_path: str, output_dir: str = "workspace/layerdiff_output") -> str:
"""
Run See-through layer decomposition on a single anime image.
Returns path to the output PSD file.
"""
result = subprocess.run(
[
"python", "inference/scripts/inference_psd.py",
"--srcp", image_path,
"--save_to_psd",
],
capture_output=True,
text=True,
cwd=os.getcwd() # Must run from repo root
)
if result.returncode != 0:
raise RuntimeError(f"Decomposition failed:\n{result.stderr}")
# Derive expected output filename
base_name = os.path.splitext(os.path.basename(image_path))[0]
psd_path = os.path.join(output_dir, f"{base_name}.psd")
return psd_path
# Example usage
psd_output = decompose_anime_image("assets/test_image.png")
print(f"PSD saved to: {psd_output}")
```
### Batch Processing a Directory
```python
import subprocess
from pathlib import Path
def batch_decompose(input_dir: str, output_dir: str = "workspace/layerdiff_output"):
"""Process all images in a directory."""
result = subprocess.run(
[
"python", "inference/scripts/inference_psd.py",
"--srcp", input_dir,
"--save_to_psd",
],
capture_output=True,
text=True,
)
if result.returncode != 0:
raise RuntimeError(f"Batch processing failed:\n{result.stderr}")
output_psds = list(Path(output_dir).glob("*.psd"))
print(f"Generated {len(output_psds)} PSD files in {output_dir}")
return output_psds
# Example
psds = batch_decompose("path/to/my_anime_images/")
```
### Post-Processing: Depth and LR Splits
```python
import subprocess
def split_by_depth(psd_path: str, target_tags: list[str]) -> str:
"""Apply depth-based layer stratification to a PSD."""
tags_str = " ".join(target_tags)
result = subprocess.run(
[
"python", "inference/scripts/heuristic_partseg.py",
"seg_wdepth",
"--srcp", psd_path,
"--target_tags", *target_tags,
],
capture_output=True, text=True,
)
if result.returncode != 0:
raise RuntimeError(result.stderr)
# Output naming convention: original name + _wdepth suffix
base = psd_path.replace(".psd", "_wdepth.psd")
return base
def split_by_lr(psd_path: str, target_tags: list[str]) -> str:
"""Apply left-right layer stratification to a PSD."""
result = subprocess.run(
[
"python", "inference/scripts/heuristic_partseg.py",
"seg_wlr",
"--srcp", psd_path,
"--target_tags", *target_tags,
],
capture_output=True, text=True,
)
if result.returncode != 0:
raise RuntimeError(result.stderr)
return psd_path.replace(".psd", "_wlr.psd")
# Full post-processing pipeline example
psd = "workspace/test_samples_output/PV_0047_A0020.psd"
depth_psd = split_by_depth(psd, ["handwear"])
lr_psd = split_by_lr(depth_psd, ["handwear-1"])
print(f"Final PSD with depth+LR splits: {lr_psd}")
```
### Loading and Inspecting PSD Output
```python
from psd_tools import PSDImage # pip install psd-tools
def inspect_psd_layers(psd_path: str):
"""List all layers in a See-through output PSD."""
psd = PSDImage.open(psd_path)
print(f"Canvas size: {psd.width}x{psd.height}")
print(f"Total layers: {len(list(psd.descendants()))}")
print("\nLayer structure:")
for layer in psd:
print(f" [{layer.kind}] '{layer.name}' — "
f"bbox: {layer.bbox}, visible: {layer.is_visible()}")
return psd
psd = inspect_psd_layers("workspace/layerdiff_output/my_character.psd")
```
### Interactive Body Part Segmentation (Notebook)
Open and run the provided demo notebook:
```bash
jupyter notebook inference/demo/bodypartseg_sam.ipynb
```
This demonstrates interactive 19-part body segmentation with visualization using the SAM body parsing model.
## Dataset Preparation for Training
See-through uses Live2D model files as training data. Setup requires a separate repo:
```bash
# 1. Clone the CubismPartExtr utility
git clone https://github.com/shitagaki-lab/CubismPartExtr
# Follow its README to download sample model files and prepare workspace/
# 2. Run data parsing scripts per README_datapipeline.md
# (scripts are in inference/scripts/ — check docstrings for details)
```
## Launching the UI
```bash
# Requires workspace/datasets/ at repo root (contains sample data)
# Recommended: install mmdet tier first
pip install -r requirements-inference-mmdeRelated in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.