File size: 9,406 Bytes
53becfe |
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# IC-Light
IC-Light is a project to manipulate the illumination of images.
The name "IC-Light" stands for **"Imposing Consistent Light"** (we will briefly describe this at the end of this page).
Currently, we release two types of models: text-conditioned relighting model and background-conditioned model. Both types take foreground images as inputs.
**Note that "iclightai dot com" is a scam website. They have no relationship with us. Do not give scam websites money! This GitHub repo is the only official IC-Light.**
# News
[Alternative model](https://github.com/lllyasviel/IC-Light/discussions/109) for stronger illumination modifications.
Some news about flux is [here](https://github.com/lllyasviel/IC-Light/discussions/98). (A fix [update](https://github.com/lllyasviel/IC-Light/discussions/98#discussioncomment-11370266) is added at Nov 25, more demos will be uploaded soon.)
# Get Started
Below script will run the text-conditioned relighting model:
git clone https://github.com/lllyasviel/IC-Light.git
cd IC-Light
conda create -n iclight python=3.10
conda activate iclight
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
python gradio_demo.py
Or, to use background-conditioned demo:
python gradio_demo_bg.py
Model downloading is automatic.
Note that the "gradio_demo.py" has an official [huggingFace Space here](https://huggingface.co/spaces/lllyasviel/IC-Light).
# Screenshot
### Text-Conditioned Model
(Note that the "Lighting Preference" are just initial latents - eg., if the Lighting Preference is "Left" then initial latent is left white right black.)
---
**Prompt: beautiful woman, detailed face, warm atmosphere, at home, bedroom**
Lighting Preference: Left

---
**Prompt: beautiful woman, detailed face, sunshine from window**
Lighting Preference: Left

---
**beautiful woman, detailed face, neon, Wong Kar-wai, warm**
Lighting Preference: Left

---
**Prompt: beautiful woman, detailed face, sunshine, outdoor, warm atmosphere**
Lighting Preference: Right

---
**Prompt: beautiful woman, detailed face, sunshine, outdoor, warm atmosphere**
Lighting Preference: Left

---
**Prompt: beautiful woman, detailed face, sunshine from window**
Lighting Preference: Right

---
**Prompt: beautiful woman, detailed face, shadow from window**
Lighting Preference: Left

---
**Prompt: beautiful woman, detailed face, sunset over sea**
Lighting Preference: Right

---
**Prompt: handsome boy, detailed face, neon light, city**
Lighting Preference: Left

---
**Prompt: beautiful woman, detailed face, light and shadow**
Lighting Preference: Left

(beautiful woman, detailed face, soft studio lighting)

---
**Prompt: Buddha, detailed face, sci-fi RGB glowing, cyberpunk**
Lighting Preference: Left

---
**Prompt: Buddha, detailed face, natural lighting**
Lighting Preference: Left

---
**Prompt: toy, detailed face, shadow from window**
Lighting Preference: Bottom

---
**Prompt: toy, detailed face, sunset over sea**
Lighting Preference: Right

---
**Prompt: dog, magic lit, sci-fi RGB glowing, studio lighting**
Lighting Preference: Bottom

---
**Prompt: mysteriou human, warm atmosphere, warm atmosphere, at home, bedroom**
Lighting Preference: Right

---
### Background-Conditioned Model
The background conditioned model does not require careful prompting. One can just use simple prompts like "handsome man, cinematic lighting".
---




---
A more structured visualization:

# Imposing Consistent Light
In HDR space, illumination has a property that all light transports are independent.
As a result, the blending of appearances of different light sources is equivalent to the appearance with mixed light sources:

Using the above [light stage](https://www.pauldebevec.com/Research/LS/) as an example, the two images from the "appearance mixture" and "light source mixture" are consistent (mathematically equivalent in HDR space, ideally).
We imposed such consistency (using MLPs in latent space) when training the relighting models.
As a result, the model is able to produce highly consistent relight - **so** consistent that different relightings can even be merged as normal maps! Despite the fact that the models are latent diffusion.

From left to right are inputs, model outputs relighting, devided shadow image, and merged normal maps. Note that the model is not trained with any normal map data. This normal estimation comes from the consistency of relighting.
You can reproduce this experiment using this button (it is 4x slower because it relight image 4 times)


Below are bigger images (feel free to try yourself to get more results!)


For reference, [geowizard](https://fuxiao0719.github.io/projects/geowizard/) (geowizard is a really great work!):

And, [switchlight](https://arxiv.org/pdf/2402.18848) (switchlight is another great work!):

# Model Notes
* **iclight_sd15_fc.safetensors** - The default relighting model, conditioned on text and foreground. You can use initial latent to influence the relighting.
* **iclight_sd15_fcon.safetensors** - Same as "iclight_sd15_fc.safetensors" but trained with offset noise. Note that the default "iclight_sd15_fc.safetensors" outperform this model slightly in a user study. And this is the reason why the default model is the model without offset noise.
* **iclight_sd15_fbc.safetensors** - Relighting model conditioned with text, foreground, and background.
Also, note that the original [BRIA RMBG 1.4](https://huggingface.co/briaai/RMBG-1.4) is for non-commercial use. If you use IC-Light in commercial projects, replace it with other background replacer like [BiRefNet](https://github.com/ZhengPeng7/BiRefNet).
# Cite
@Misc{iclight,
author = {Lvmin Zhang and Anyi Rao and Maneesh Agrawala},
title = {IC-Light GitHub Page},
year = {2024},
}
# Related Work
Also read ...
[Total Relighting: Learning to Relight Portraits for Background Replacement](https://augmentedperception.github.io/total_relighting/)
[Relightful Harmonization: Lighting-aware Portrait Background Replacement](https://arxiv.org/abs/2312.06886)
[SwitchLight: Co-design of Physics-driven Architecture and Pre-training Framework for Human Portrait Relighting](https://arxiv.org/pdf/2402.18848)
|