Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,63 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-4.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
base_model:
|
4 |
+
- stabilityai/stable-diffusion-xl-base-1.0
|
5 |
+
tags:
|
6 |
+
- image-to-image
|
7 |
+
inference: False
|
8 |
+
---
|
9 |
+
# ✨ Latent Bridge Matching for Image Relighting ✨
|
10 |
+
|
11 |
+
Latent Bridge Matching (LBM) is a new, versatile and scalable method proposed in [LBM: Latent Bridge Matching for Fast Image-to-Image Translation](https://arxiv.org/abs/2503.07535) that relies on Bridge Matching in a latent space to achieve fast image-to-image translation.
|
12 |
+
This model was trained to relight a foreground object according to a provided background.
|
13 |
+
See our [live demo](https://huggingface.co/spaces/jasperai/LBM_relighting) and official [Github repo](https://github.com/gojasper/LBM).
|
14 |
+
|
15 |
+
<p align="center">
|
16 |
+
<img style="width:700px;" src="assets/relight.jpg">
|
17 |
+
</p>
|
18 |
+
|
19 |
+
## How to use?
|
20 |
+
To use this model you need first to install the associated `lbm` library by running the following
|
21 |
+
```bash
|
22 |
+
pip install git+https://github.com/gojasper/LBM.git
|
23 |
+
```
|
24 |
+
|
25 |
+
Then, you can infer with the model on your input images
|
26 |
+
```python
|
27 |
+
import torch
|
28 |
+
from diffusers.utils import load_image
|
29 |
+
from lbm.inference import evaluate, get_model
|
30 |
+
|
31 |
+
# Load model
|
32 |
+
model = get_model(
|
33 |
+
"jasperai/LBM_relighting",
|
34 |
+
torch_dtype=torch.bfloat16,
|
35 |
+
device="cuda",
|
36 |
+
)
|
37 |
+
|
38 |
+
# Load a source image
|
39 |
+
source_image = load_image(
|
40 |
+
"https://huggingface.co/jasperai/jasperai/LBM_relighting/resolve/main/examples/source_image.jpg"
|
41 |
+
)
|
42 |
+
|
43 |
+
# Perform inference
|
44 |
+
output_image = evaluate(model, source_image, num_sampling_steps=1)
|
45 |
+
output_image
|
46 |
+
```
|
47 |
+
<p align="center">
|
48 |
+
<img style="width:500px;" src="examples/output.jpg">
|
49 |
+
</p>
|
50 |
+
|
51 |
+
## License
|
52 |
+
This code is released under the Creative Commons BY-NC 4.0 license.
|
53 |
+
|
54 |
+
## Citation
|
55 |
+
If you find this work useful or use it in your research, please consider citing us
|
56 |
+
```bibtex
|
57 |
+
@article{chadebec2025lbm,
|
58 |
+
title={LBM: Latent Bridge Matching for Fast Image-to-Image Translation},
|
59 |
+
author={Clément Chadebec and Onur Tasar and Sanjeev Sreetharan and Benjamin Aubin},
|
60 |
+
year={2025},
|
61 |
+
journal = {arXiv preprint arXiv:2503.07535},
|
62 |
+
}
|
63 |
+
```
|