Skip to content

Brian90709/diff-reflection-separation-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiffRS logo Reflection Separation from a Single Image via Joint Latent Diffusion

project page  arXiv  Hugging Face 

Zheng-Hui Huang1,2, Zhixiang Wang1*, Yu-Lun Liu3, Yung-Yu Chuang2

1Shanda AI Research Tokyo   2National Taiwan University   3National Yang Ming Chiao Tung University

*Corresponding author


Separate a single photo taken through glass into a transmission layer (the reflection-free image) and a reflection layer, using a Stable Diffusion 2 model fine-tuned to generate both at once. See the project page for the method.

🛠️ Install

conda create -y -n diffrs python=3.10 && conda activate diffrs
pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt

Download the pre-trained weights into ./checkpoints:

huggingface-cli download Brian9999/diff-reflection-separation --repo-type model --local-dir ./checkpoints

The SD-2 base model is fetched automatically on first run (default sd2-community/stable-diffusion-2-1; override with --base_model).

🚀 Run

python infer_layersep.py --input_dir ./samples --save_to_dir ./outputs

The defaults match the paper setting (960×960, w = 0.8, disjoint sampling k = 0.2, latent optimization on). Point --input_dir at any folder of images. Each input yields three files: *_transmission.png (the result), *_reflection.png, and *_ori_transmission.png (transmission before CFW refinement). Run with -h for all options.

🎛️ Ablation switches

All are on by default; disable individually to study their effect.

Flag Effect
--no-optimization Turn off latent optimization (learned composition module, LRM).
--no-s_sampling Turn off disjoint sampling (strength k = 0.2).
--w <float> FGFM/CFW refiner strength on the transmission (default 0.8; 0 = off).

Latent optimization is used in the paper and is on by default. For faster inference, turn it off with --no-optimization (at a small quality trade-off).

🗂️ Data

We use the same training and test data as DSRNet. Please refer to their repository for dataset preparation and download links.

📑 Citation

@inproceedings{huang2026reflection,
  title     = {Reflection Separation from a Single Image via Joint Latent Diffusion},
  author    = {Huang, Zheng-Hui and Wang, Zhixiang and Liu, Yu-Lun and Chuang, Yung-Yu},
  booktitle = {CVPR},
  year      = {2026}
}

About

Reflection Separation from a Single Image via Joint Latent Diffusion (CVPR 2026)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages