WACV 2027 · Paper · OpenReview · Models
Official implementation of CLEAR (Color-Texture LatEnt Alignment for Single Image Reflection Removal) by Tu Vo, Sheir A. Zaheer and Chan Y. Park (KC Machine Learning Lab).
CLEAR is a deterministic, single-timestep, non-iterative latent framework for single image reflection removal (SIRR). A physics-guided separator predicts transmission, reflection and residue latents in one forward pass; the Hybrid Feature Alignment Module (HFAM) then re-aligns the input-derived skip features to the clean transmission so that real texture is restored without bringing the reflection's edges back.
- Stage 1 — latent disentanglement. A frozen SDv2 VAE encodes the input. Two U-Net branches
initialised from the same pre-trained SDv2 weights exchange information through latent cross-attention
and output the transmission
T, reflectionRand residueΦlatents in a single deterministic step. - Stage 2 — feature alignment. The transmission latent is decoded by a cross-latent decoder that is augmented
at every scale by the HFAM. HFAM builds a color query
Q, a structural keyKand a DWT high-frequency valueVfrom the input skipFⁱ, and reweightsVwith a color-gated channel attentionF̃ⁱ = Proj(Softmax(Q̂K̂ᵀ)V). During training the color and high-frequency heads are supervised with features of the clean transmission extracted by the same frozen encoder. - No sampling. The whole pipeline is one forward pass — no noise schedule, no iterative denoising.
Average over the six real-world benchmarks (Nature, SIR2, Real20, DRR-C, DRR-S, OpenRR-1k — 1,040 images), as reported in the paper:
| Method | PSNR ↑ | SSIM ↑ | LPIPS ↓ | MANIQA ↑ | QUALICLIP ↑ |
|---|---|---|---|---|---|
| RobustSIRR | 21.14 | 0.791 | 0.221 | 0.479 | 0.704 |
| RRW | 23.43 | 0.815 | 0.202 | 0.458 | 0.689 |
| DSIT | 23.99 | 0.817 | 0.198 | 0.479 | 0.706 |
| DSRNet | 21.42 | 0.809 | 0.201 | 0.485 | 0.714 |
| RDNet | 23.92 | 0.822 | 0.192 | 0.486 | 0.707 |
| DAI | 25.98 | 0.869 | 0.159 | 0.460 | 0.696 |
| WindowSeat | 25.48 | 0.810 | 0.208 | 0.465 | 0.674 |
| CLEAR (Ours) | 26.59 | 0.906 | 0.106 | 0.504 | 0.731 |
CLEAR obtains the lowest LPIPS on every dataset, with the largest SSIM and perceptual gains on the harder DRR-C, DRR-S and OpenRR-1k benchmarks. See the paper for the full per-dataset tables, the ablations and the qualitative comparisons.
conda env create -f environment.yml
conda activate clear
pip install -r requirements.txt # optional: only needed for the CLIP polarity lossenvironment.yml pins Python 3.10, PyTorch 2.0.1 (CUDA 11.8) and diffusers==0.30.3. The code also runs
unchanged on newer stacks (verified with PyTorch 2.10 / diffusers 0.39 — bit-identical outputs).
python scripts/download_models.py --save_dir ./modelsThis fetches stabilityai/stable-diffusion-2 (VAE, text encoder, scheduler, U-Net initialisation) and
prs-eth/marigold-depth-v1-0 (second Stage-1 branch in the released training config) into ./models.
The trained Stage-1 and Stage-2 checkpoints are released on the Hugging Face Hub
(ML2/CLEAR):
python scripts/download_models.py --weights --skip_backbones --save_dir ./modelsExpected layout (see models/README.md):
models/clear/
├── config.yaml # training config of the released Stage-1
└── checkpoint/
├── diffusion/
│ ├── unet1/ # transmission branch (diffusion_pytorch_model.bin + config.json)
│ └── unet2/ # reflection branch (diffusion_pytorch_model.bin + config.json)
└── cld/
└── cld_clear.pth # Stage-2 HFAM cross-latent decoder
Note on the Stage-2 checkpoint. Two Stage-2 checkpoints exist from two architecture revisions. The one released here is the final one: its HFAM extracts the high-frequency value with a Haar DWT inside the colour-gated attention, which is the mechanism described in the paper.
clear/stage2/checkpoint.pyloads it and tolerates the fixed wavelet filters (constants, not learned parameters) while failing loudly on any real mismatch.
bash scripts/inference.sh \
models/clear/checkpoint/diffusion \
models/clear/checkpoint/cld/cld_clear.pth \
<DATA_DIR> \
outputs/inference/<DATASET>Use one output folder per dataset; the evaluation script pairs files by name.
<DATA_DIR> must contain a blended/ folder with the input images (and, for the evaluation protocol, a
transmission_layer/ folder with the ground truth). For every image the script writes
<name>_clear.png— the reflection-free transmission (the output of CLEAR),<name>_r.png— the predicted reflection layer,<name>_g1.png— the predicted residueΦ,<name>_composite_img.png— the input,<name>_target_img.png— the ground truth (when available).
The underlying command can also be called directly:
python inference.py \
--config configs/stage1_clear.yaml \
--checkpoint models/clear/checkpoint/diffusion \
--stage2_checkpoint models/clear/checkpoint/cld/cld_clear.pth \
--data_dir <DATA_DIR> \
--output_dir outputs/inference/<DATASET> \
--base_ckpt_dir ./models \
--inference_resolution 768Add --stage2_refiner_type generic to run the parameter-matched generic Stage-2 refiner (ablation), or omit
--stage2_checkpoint to run Stage 1 only.
bash scripts/evaluate.sh outputs/inference/<DATASET> <DATA_DIR>/transmission_layer outputs/inference/<DATASET>/results.jsonThe script reports PSNR, SSIM and LPIPS averaged over the folder.
CLEAR is trained on 84,425 pairs matching DAI's composition: the DRR dataset (23,303 pairs), 60,833 synthetic pairs generated from COCO and PASCAL VOC following Hu et al. (DSRNet), and the Nature (200) and Zhang et al. (89) real training splits.
Each subset folder must follow the DRR layout:
<SUBSET>/blended/ # input image I = T + R
<SUBSET>/transmission_layer/ # clean transmission T
<SUBSET>/reflection_layer/ # reflection R (optional)
<SUBSET>/weight_map_npy/ # per-pixel alpha map (optional)
bash scripts/train_stage1.sh <TRAIN_DATA_ROOT> outputs/training/stage1<TRAIN_DATA_ROOT> contains the four subsets real, nature, DRR and Syn (the synthetic subset is read with
bgr=True). The configuration lives in configs/stage1_clear.yaml. As in the paper, both stages train for ~100K
iterations with AdamW (lr 1e-5, batch size 2) at 512² (Stage 1) and 768² (Stage 2). Multi-GPU training is
supported through torchrun.
First generate the paired data with the trained Stage-1 model:
bash scripts/make_stage2_pairs.sh \
outputs/training/stage1/<RUN>/checkpoint/diffusion \
<TRAIN_DATA_ROOT> \
outputs/stage2_pairsthen train the cross-latent decoder (Stage 1 stays frozen thanks to --preserve_encoder):
bash scripts/train_stage2.sh outputs/stage2_pairs outputs/training/stage2The Stage-1 objective is L_S1 = λ_T L_T + λ_R L_R + λ_rec L_rec + λ_exc L_exc with
λ_T = λ_R = λ_rec = λ_exc = 0.25; Stage 2 optimises L_S2 = λ1 L_T + λ2 L_HFAM with λ1 = λ2 = 0.5, where
the HFAM term combines the color-descriptor loss L_color and the high-frequency feature loss L_feature.
CLEAR/
├── clear/ # the method
│ ├── pipeline.py # Stage-1 diffusion pipeline
│ ├── diffusers_utils.py # checkpoint loading, conv-in/conv-out surgery
│ ├── models/ # DualUNetCondition (dual-branch U-Net + latent cross-attention)
│ ├── trainers/ # Stage-1 trainer
│ ├── stage2/ # cross-latent decoder (HFAM) + Stage-2 data pipeline
│ ├── datasets/ # SIRR datasets
│ └── utils/ # config, logging, losses, metrics, seeding
├── train_stage1.py # Stage-1 entry point
├── train_stage2.py # Stage-2 entry point
├── make_stage2_pairs.py # Stage-1 -> Stage-2 pair generation
├── inference.py # inference
├── evaluate.py # PSNR / SSIM / LPIPS
├── configs/ # YAML configuration tree
├── scripts/ # shell wrappers + model download
├── demo/ # example inputs and outputs
└── docs/ # project page (index.html + assets) and figures
@inproceedings{vo2027clear,
title = {CLEAR: Color-Texture Latent Alignment for Single Image Reflection Removal},
author = {Vo, Tu and Zaheer, Sheir A. and Park, Chan Y.},
booktitle = {The IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
year = {2027},
eprint = {2611.05969},
archivePrefix = {arXiv},
primaryClass = {cs.CV}
}This code builds on the work of
- SLURPP — Single-Step Latent Diffusion for Underwater Image Restoration (Wu et al.), whose latent restoration pipeline and cross-latent decoder CLEAR builds upon;
- Marigold — Marigold: Repurposing Diffusion-Based Image Generators for Monocular Depth Estimation (Ke et al.), which the Stage-1 pipeline and its data pipeline originate from;
- DAI — Single Image Reflection Removal with Physics-based Training Data (Hu et al.), whose training-data composition and evaluation protocol we follow;
- DSRNet — Single Image Reflection Removal with Physically-based Training Data (Hu et al.), for the residue formulation and the synthetic data generation;
- Depth-Pro (Apple) and StableSR, whose open components we reuse.
The code is released under the Apache License 2.0 (see LICENSE). The released checkpoints are
fine-tuned from stable-diffusion-2 and are distributed under the same
CreativeML Open RAIL++-M License.
The pretrained backbones keep their own licenses: stable-diffusion-2 (CreativeML Open RAIL++-M) and
marigold-depth-v1-0 (Apache-2.0).
