Instructions to use 1038lab/SDMatte with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use 1038lab/SDMatte with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("1038lab/SDMatte", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
| license: gpl-3.0 | |
| pipeline_tag: image-to-image | |
| library_name: diffusers | |
| base_model: | |
| - stabilityai/stable-diffusion-2 | |
| # SDMatte - SafeTensors Models for Interactive Matting | |
| This repository provides **SafeTensors** versions of the SDMatte models for **interactive image matting**, optimized for seamless use with **ComfyUI**. | |
| --- | |
| ## π About SDMatte | |
| **SDMatte: Grafting Diffusion Models for Interactive Matting** is a state-of-the-art model that leverages the power of **diffusion priors** to achieve high-precision matting β especially around fine details and complex edges. | |
| ### β¨ Key Features | |
| - **Diffusion-Powered**: Uses strong priors from diffusion models to extract high-fidelity details | |
| - **Interactive Matting**: Visual prompt-driven control for intuitive editing | |
| - **Edge & Texture Focus**: Excels in handling challenging edge regions and fine textures | |
| - **Coordinate & Opacity Awareness**: Improves matting accuracy with spatial and opacity context | |
| --- | |
| ## π¦ Available Models | |
| - `SDMatte.safetensors` β Standard version for interactive matting | |
| - `SDMatte_plus.safetensors` β Enhanced version with improved performance | |
| --- | |
| ## π§© Built for ComfyUI: `ComfyUI-RMBG` | |
| These models are designed for use with our **ComfyUI custom node**: | |
| β‘οΈ [ComfyUI-RMBG on GitHub](https://github.com/1038lab/ComfyUI-RMBG) | |
| This custom node integrates SDMatte into ComfyUI workflows, enabling high-quality interactive matting inside a visual pipeline. | |
| ### π Latest Update | |
| **Version:** `v2.9.0` | |
| **Date:** `2025-08-18` | |
| π [Read the update changelog](https://github.com/1038lab/ComfyUI-RMBG/blob/main/update.md#v290-20250818) | |
| --- | |
| ## π Credits and Attribution | |
| ### π Original Work | |
| - **Authors**: vivoCameraResearch Team | |
| - **Model Repository**: [Hugging Face β LongfeiHuang/SDMatte](https://huggingface.co/LongfeiHuang/SDMatte) | |
| - **Official Code**: [GitHub β vivoCameraResearch/SDMatte](https://github.com/vivoCameraResearch/SDMatte) | |
| - **Paper**: *SDMatte: Grafting Diffusion Models for Interactive Matting* | |
| ### π Abstract (from the original paper) | |
| > Recent interactive matting methods have shown satisfactory performance in capturing the primary regions of objects, but they fall short in extracting fine-grained details in edge regions. Diffusion models trained on billions of image-text pairs demonstrate exceptional capability in modeling highly complex data distributions and synthesizing realistic texture details, while exhibiting robust text-driven interaction capabilities β making them an attractive solution for interactive matting. | |
| --- | |