Spaces:
Running on Zero
Running on Zero
File size: 5,959 Bytes
5211a56 f8fec54 5211a56 f8fec54 27baaea 5211a56 27baaea 5211a56 e43b19f 87f286e e43b19f 5f338cb e43b19f 87f286e e43b19f 5f338cb 87f286e e43b19f 5f338cb e43b19f 87f286e e43b19f 0d3cb75 e43b19f 5f338cb e43b19f 87f286e e43b19f f8fec54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ---
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.**
[](https://huggingface.co/build-small-hackathon)
[](https://huggingface.co/build-small-hackathon)
[](https://huggingface.co/build-small-hackathon)
[](https://youtu.be/DqlLDDgV3kQ)
[](https://x.com/ovi054/status/2064060651706925403)
[](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.
---
<!-- ### π οΈ Core Constraints
* **Small Models Only:** Powered by the `Qwen-Image-Edit-2511` architecture family running at 20B parameters safely satisfying the 32 Billion parameter limit.
* π **Off the Grid (Local-First):** **No cloud APIs are used.** The pipeline loads the model weights and runs entirely on the host GPU hardware.
* π― **Well-Tuned:** Utilizes a custom fine-tuned LoRA adapter published directly on my Hugging Face Hub (`ovi054/QIE-2511-Color-Grade-Transfer-LoRA`).
---
-->
## π§ 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 |