Image_Layered / README.md
Rushikesh1907's picture
Update README.md
ad098bd verified
|
Raw History Blame Contribute Delete
7.13 kB
---
license: apache-2.0
language:
- en
- zh
base_model:
- Qwen/Qwen-Image-Layered
pipeline_tag: image-text-to-image
library_name: ggml
tags:
- gguf
- quantized
- unsloth
- qwen
- lora
- psd
- photoshop
- image-decomposition
---
> [!NOTE]
> This repository features **Qwen-Image-Layered (Designer PSD Fine-Tune)** โ€” adapted and quantized for designer workflows.
> - **Custom LoRA Fine-Tuning**: Trained on paired designer PSD layouts to deliver clean object separation, distinct text/graphics isolation, and reliable alpha channels.
> - **End-to-End PSD Packaging**: Bundled with a packaging pipeline that exports generated layers directly into a multi-layer Adobe Photoshop (`.psd`) file.
> - **GGUF Quantization & Web Studio**: Optimized with [Unsloth Dynamic 2.0](https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs) GGUFs for lightweight local inference, accompanied by a local **Layer Studio** web UI.
<div>
<div style="display: flex; gap: 5px; align-items: center; ">
<a href="https://github.com/unslothai/unsloth/">
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
</a>
<a href="https://discord.gg/unsloth">
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
</a>
<a href="https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs">
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
</a>
</div>
</div>
---
<p align="center">
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/layered/layered.JPG" width="1024"/>
</p>
<p align="center">
๐Ÿค— <a href="https://huggingface.co/Qwen/Qwen-Image-Layered">Original Base Model</a> &nbsp;|&nbsp;
๐Ÿ“‘ <a href="https://arxiv.org/abs/2512.15603">Research Paper</a> &nbsp;|&nbsp;
๐Ÿ“‘ <a href="https://qwenlm.github.io/blog/qwen-image-layered/">Blog</a> &nbsp;|&nbsp;
๐Ÿค— <a href="https://huggingface.co/spaces/Qwen/Qwen-Image-Layered">Official Demo</a>
</p>
## Introduction
This model is a **custom-adapted, designer-focused version of Qwen-Image-Layered**, enhanced to convert flat visual designs into fully editable, production-ready layered assets.
While the base Qwen-Image-Layered model introduces the ability to decompose an image into multiple RGBA layers, we have tailored and extended the ecosystem with several key custom additions:
### ๐ŸŽจ Custom Modifications & Key Features
1. **Designer-Layer LoRA Fine-Tuning**:
- **Targeted Training**: Fine-tuned using a transformer LoRA adapter on curated, permissioned multi-layer graphic designs and campaign materials.
- **Semantic Separation**: Specialized in distinguishing foreground text, product imagery, badges, decorative elements, and clean background plates into separate, logical layers.
- **Edge Quality & Transparency**: Focuses on preserving crisp alpha masks and canvas alignment, minimizing artifact bleeding when individual layers are moved or hidden.
2. **Automated Photoshop PSD Packaging**:
- Includes custom downstream packaging tools (`package_psd.py` / `run_layered_diffusers.py`) that bundle decomposed RGBA layers into standard, editable **Adobe Photoshop (`.psd`)** documents.
- Preserves layer stack order, naming conventions, exact canvas coordinates, and blend properties ready for professional editing workflows.
3. **GGUF Quantization & Local Inference**:
- Provides quantized GGUF weights (Q5_0, Q5_1, Q5_K_M, Q5_K_S, Q6_K) leveraging the **Unsloth Dynamic 2.0** methodology to enable fast, low-VRAM local execution on consumer GPUs.
4. **Interactive Layer Studio UI**:
- Accompanied by a lightweight local web interface (**Editable-Image-Layers-REA**) and REST API, allowing users to upload images, preview live decompositions, inspect individual layers, and export PSD or ZIP archives with a single click.
---
## Quick Start
### 1. Using Diffusers with the Designer LoRA Adapter
```python
from diffusers import QwenImageLayeredPipeline
import torch
from PIL import Image
# Load base pipeline
pipeline = QwenImageLayeredPipeline.from_pretrained("Qwen/Qwen-Image-Layered", torch_dtype=torch.bfloat16)
pipeline = pipeline.to("cuda")
# (Optional) Load custom designer LoRA adapter
# pipeline.load_lora_weights("path/to/designer-lora")
image = Image.open("input_design.png").convert("RGBA")
inputs = {
"image": image,
"generator": torch.Generator(device='cuda').manual_seed(42),
"true_cfg_scale": 4.0,
"negative_prompt": " ",
"num_inference_steps": 50,
"num_images_per_prompt": 1,
"layers": 4, # Number of layers to extract
"resolution": 640, # Recommended resolution bucket (640 or 1024)
"cfg_normalize": True,
"use_en_prompt": True,
}
with torch.inference_mode():
output = pipeline(**inputs)
layers = output.images[0]
# Save individual layer PNGs
for i, layer in enumerate(layers):
layer.save(f"layer_{i:02d}.png")
```
### 2. Exporting to Layered Photoshop PSD
You can package the exported layer PNGs directly into a layered `.psd` file:
```bash
python package_psd.py --composite source.png --layers layer_00.png layer_01.png layer_02.png layer_03.png --output decomposition.psd
```
---
## Capabilities
### Layer Decomposition in Application
Given an input design, the model decomposes it into several RGBA layers:
- **Independent Manipulation**: Edits can be applied exclusively to targeted layers, physically isolating changes from the rest of the canvas.
- **Subject & Text Replacement**: Replace specific layer elements (e.g. swap subjects or text) without altering backgrounds.
- **Recoloring & Styling**: Recolor specific graphics, badges, or backgrounds while preserving unaffected elements.
- **Elementary Operations**:
- **Clean Object Removal**: Erase elements cleanly by simply hiding or deleting layers.
- **Repositioning & Resizing**: Move or resize objects freely on the canvas without distortion or background hole-filling issues.
### Flexible and Iterative Decomposition
- **Variable Layer Counts**: Supports decomposing images into arbitrary layer counts (e.g., 2, 4, 6, 8+ layers) depending on complexity.
- **Recursive Decomposition**: Any decomposed layer can be recursively passed back into the model to break it down further into sub-components.
---
## License Agreement
Qwen-Image-Layered is licensed under Apache 2.0.
## Citation
```bibtex
@misc{yin2025qwenimagelayered,
title={Qwen-Image-Layered: Towards Inherent Editability via Layer Decomposition},
author={Shengming Yin, Zekai Zhang, Zecheng Tang, Kaiyuan Gao, Xiao Xu, Kun Yan, Jiahao Li, Yilei Chen, Yuxiang Chen, Heung-Yeung Shum, Lionel M. Ni, Jingren Zhou, Junyang Lin, Chenfei Wu},
year={2025},
eprint={2512.15603},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2512.15603},
}
```