--- title: Color Grade Transfer emoji: 😻 colorFrom: purple colorTo: blue sdk: gradio sdk_version: 6.17.3 python_version: '3.12' app_file: app.py pinned: true tags: - backyard-ai - an-adventure-in-thousand-token-wood - well-tuned - gradio short_description: Apply the color grade from one image to another image --- # 🌓 Color Grade Transfer **Transfer color grade directly from reference image to source image without manual color grading.** [![Build Small Hackathon](https://img.shields.io/badge/Build%20Small%20Hackathon-blue)](https://huggingface.co/build-small-hackathon) [![Track 1: Backyard AI](https://img.shields.io/badge/Track%201-Backyard%20AI-blueviolet)](https://huggingface.co/build-small-hackathon) [![Track 2: An Adventure in Thousand Token Wood](https://img.shields.io/badge/Track%202-An%20Adventure%20in%20Thousand%20Token%20Wood-blueviolet)](https://huggingface.co/build-small-hackathon) [![Demo Video](https://img.shields.io/badge/▶_Watch_Demo-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://youtu.be/DqlLDDgV3kQ) [![Social Media Post](https://img.shields.io/badge/Social_Media_Post-000000?style=for-the-badge&logo=x&logoColor=white)](https://x.com/ovi054/status/2064060651706925403) [![Try It Live](https://img.shields.io/badge/🚀_Try_It_Live-7C3AED?style=for-the-badge)](https://huggingface.co/spaces/build-small-hackathon/Color-Grade-Transfer) ## 📖 Overview It transfers the color grading from a reference image directly onto a source image. ## 🏆 Hackathon Patches | Patch | Status | | :--- | :--- | | 🔬 **Small Models Only** — `Qwen-Image-Edit-2511` at 20B parameters, well under the 32B limit | ✅ | | 🔌 **Off the Grid** — No cloud APIs, runs entirely on local GPU | ✅ | | 🎯 **Well-Tuned** — Custom LoRA [`ovi054/QIE-2511-Color-Grade-Transfer-LoRA`](https://huggingface.co/ovi054/QIE-2511-Color-Grade-Transfer-LoRA) published on Hub | ✅ | | 📓 **Field Notes** — [Blog post on what I built and learned](https://huggingface.co/blog/ovi054/color-grade-transfer) | ✅ | ### Key Features * **Direct Color Transfer:** Copies styling from a reference image to a source image without manual grading. * **4-Step Inference:** Uses a lightning adapter for fast, low-step generation. * **Aspect Ratio Alignment:** Uses an internal VAE dimension calculation 1MP to ensure the 2-D RoPE coordinate systems match, eliminating structural pixel shifts during inference. * **Interactive UI:** Features a side-by-side image comparison slider. * **MCP Compliant:** Work as a backend tool for Model Context Protocol clients. --- ## 🧠 LoRA Fine-Tuning Process Curating a clean dataset for custom style mapping is often the bottleneck of training. To overcome this, a systematic data-generation technique was engineered to produce high-fidelity, bidirectional training pairs. ### The Dataset Recipe 1. **Palette Extraction:** Two entirely different content images were chosen. 2. **Homogeneous Grading:** The exact same color palette was applied to both images so they shared an identical color profile. 3. **Cross-Pair Mapping:** * The newly graded version of *Image B* was assigned as the color-style reference for *Image A*. * The inputs were then flipped, mapping the graded version of *Image A* as the reference for *Image B*. 4. This instantly generated **two highly consistent training pairs** per asset set, allowing the dataset to scale efficiently without content bleeding or style loss. ### Versatility & Flexibility Because the dataset decoupling separated semantic structure from global grading parameters, the fine-tuned LoRA natively generalizes across all input configurations: * 👤 ↔️ 👤 **Character to Character** * 🏞️ ↔️ 🏞️ **Scene to Scene** * 👤 ↔️ 🏞️ **Character to Scene** / **Scene to Character** ### ⚙️ Training Hyperparameters The model was fine-tuned using the following precise configuration settings: | Configuration Category | Parameter | Value / Setting | | :--- | :--- | :--- | | **Saving Settings** | Save Precision | `bf16` | | **Learning Rate** | Learning Rate | `0.0001` | | | Optimizer | `AdamW` | | **Dataset Settings** | Base Resolution | 1024 * 1024 | | | Enable Bucket | True (`open`) | | | Min Bucket Reso | `128` | | | Max Bucket Reso | `8192` | | | Bucket Reso Steps | `64` | | **Network Settings** | Network Rank Dim (Rank) | `16` | | | Network Alpha | `16` | --- ## ⚙️ Tech Stack * **Base Model:** `Qwen/Qwen-Image-Edit-2511` * **LoRA Adapters:** * `ovi054/QIE-2511-Color-Grade-Transfer-LoRA` (Color grade transfer fine-tune) * `lightx2v/Qwen-Image-Edit-2511-Lightning` (4-step inference) * **Frontend:** Gradio --- ## 🔗 Project Links ### Live Demo * **Hugging Face Space:** [Color Grade Transfer](https://huggingface.co/spaces/build-small-hackathon/Color-Grade-Transfer) ### Blog * **Blog Post:** [Color Grade Transfer — Instant Cinematic Tone Matching](https://huggingface.co/blog/ovi054/color-grade-transfer) ### Social Media & Demo * **Twitter/X:** [https://x.com/ovi054/status/2064060651706925403](https://x.com/ovi054/status/2064060651706925403) * **Hugging Face Post:** [https://huggingface.co/posts/ovi054/229194823175599](https://huggingface.co/posts/ovi054/229194823175599) * **Youtube Video:** [https://youtu.be/DqlLDDgV3kQ](https://youtu.be/DqlLDDgV3kQ) Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference