TL;DR
Chameleon is a novel training-based framework for cross-domain object compositing that seamlessly inserts a foreground object from one visual domain (e.g., a real photo) into a background of another (e.g., a watercolor painting or sketch). By introducing a "reverse" data generation pipeline to create a massive real-supervised dataset, alongside explicit style-content feature disentanglement, Chameleon successfully adapts objects to target background styles while strictly preserving their unique structural identity.
What Problem Does This Paper Address?
Image compositing—inserting a foreground object into a new background—has advanced significantly with diffusion models, but primarily when both images share the same domain (e.g., photorealistic natural images). Cross-domain compositing (e.g., placing a real car into a rough sketch or a cartoon character into an oil painting) remains a massive challenge.
Existing methods typically rely on training-free blending techniques over frozen text-to-image diffusion models. This setup suffers from three major flaws:
- Identity Drift: Relying on text prompts fails to capture the specific instance details of the foreground object.
- Style Inconsistency: Blending methods often only align low-level color tones rather than capturing complex artistic textures and styles.
- Plausibility Issues: Frozen models lack the context to generate realistic shadows or align the geometry of the inserted object with the background scene.
The root cause of these limitations is the lack of large-scale, paired training datasets for cross-domain compositing, preventing researchers from training end-to-end models.
Methods
To solve these issues, the authors present Chameleon, a two-stage training-based framework built on top of a Diffusion Transformer (DiT).
Stage 1: Style-Content Disentanglement via JHCL
Standard vision encoders (like DINOv3) are excellent at capturing semantics, but they inherently entangle style and content. If you naively feed background style features into a diffusion model, background objects leak into the composite area (a phenomenon the authors call "content leakage").
To fix this, the authors propose Joint Hard Contrastive Learning (JHCL). They train a dual-headed encoder (ChameleonEncoder) that explicitly splits features into pure-style and pure-content tokens, mapping them to separate projection heads. This ensures that the style network only captures the artistic medium, while the content network preserves the object's geometry and identity.
Stage 2: Spatio-Temporal Attention Gating (STAG)
Once style and content are separated, they must be injected into the main DiT network. Naively applying style tokens uniformly across the entire image degrades the background. The authors introduce Spatio-Temporal Attention Gating (STAG) to adaptively regulate style injection:
- Spatially: It uses the foreground mask to focus style attention strictly on the inserted object.
- Temporally: It modulates style injection across diffusion timesteps. Because early timesteps establish global layout and structure, STAG suppresses style injection early on and amplifies it during later denoising steps when fine textures emerge.
Datasets
The paper introduces two major dataset contributions:
- ChameleonDataset_tr (200K samples): To bypass the lack of paired data, the authors engineered a reverse data generation pipeline. Instead of taking a foreground and background and trying to synthesize a composite, they start with a real stylized composite image (from curated artwork datasets). They segment out a real object, mask it to create the background, and then synthetically degrade the extracted object to act as the foreground input. Crucially, because the supervision target is a real image, the model learns a clean, artifact-free mapping.
- ChameleonDataset_ev: A comprehensive evaluation benchmark containing 70 high-quality scenes across 25 distinct style families (including pixel art, mosaics, and traditional East Asian art) to test both stylistic fidelity and compositional plausibility.
Key Insights and Ideas
- The Power of Reversing the Pipeline: Training on purely synthetic composites forces models to learn and replicate generative artifacts. By flipping the problem—using real artwork as the ground truth target and synthetic images as the input—the model learns to output authentic, high-fidelity styles.
- Style Timing in Diffusion: Style shouldn't be treated as a constant bias. Suppressing style tokens during the initial structural phase of diffusion prevents geometric distortion, while ramping it up later ensures rich texture transfer.
- Mitigating Content Leakage: t-SNE visualizations demonstrate that standard contrastive learning fails to isolate style from content. JHCL successfully groups identical styles together regardless of their underlying semantic content.
Key Results
Chameleon was evaluated against several state-of-the-art baselines (including TF-ICON, TALE, and AIComposer) across multiple benchmarks:
- Quantitative Performance: On the AIComposer benchmark, Chameleon achieved top-tier performance, significantly outperforming baselines in style consistency (CSD score of 0.4885 vs. AIComposer's 0.4729) and image quality (AES score of 7.0380).
- User Study: In a 15-participant user study evaluating identity preservation, style alignment, and overall quality, Chameleon achieved a dominant 63.7% overall win rate compared to its closest competitors.
- Qualitative Excellence: Visual results demonstrate that Chameleon naturally grounds objects into complex backgrounds, generating realistic shadows and seamlessly matching challenging textures like pixel art without losing the object's core identity.
Limitations and Future Work
The authors note that their current framework is strictly limited to image-level cross-domain compositing. Extending this approach to video compositing remains an open and difficult challenge. In a video sequence, the background scene, lighting conditions, and object geometry shift continuously over time, making it highly complex to maintain temporal consistency for both style adaptation and scene-level harmonization.
Summary updated