| | --- |
| | license: cc-by-nc-4.0 |
| | base_model: |
| | - stabilityai/stable-diffusion-xl-base-1.0 |
| | tags: |
| | - image-to-image |
| | inference: false |
| | pipeline_tag: image-to-image |
| | --- |
| | # ✨ Latent Bridge Matching for Image Relighting ✨ |
| |
|
| | 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. |
| | This model was trained to relight a foreground object according to a provided background. |
| | See our [live demo](https://huggingface.co/spaces/jasperai/LBM_relighting) and official [Github repo](https://github.com/gojasper/LBM). |
| |
|
| | <p align="center"> |
| | <img style="width:700px;" src="assets/relight.jpg"> |
| | </p> |
| |
|
| | ## How to use? |
| | To use this model you need first to install the associated `lbm` library by running the following |
| | ```bash |
| | pip install git+https://github.com/gojasper/LBM.git |
| | ``` |
| |
|
| | Then, you can infer with the model on your input images |
| | ```python |
| | import torch |
| | from diffusers.utils import load_image |
| | from lbm.inference import evaluate, get_model |
| | |
| | # Load model |
| | model = get_model( |
| | "jasperai/LBM_relighting", |
| | torch_dtype=torch.bfloat16, |
| | device="cuda", |
| | ) |
| | |
| | # Load a source image |
| | source_image = load_image( |
| | "https://huggingface.co/jasperai/LBM_relighting/resolve/main/assets/source_image.jpg" |
| | ) |
| | |
| | # Perform inference |
| | output_image = evaluate(model, source_image, num_sampling_steps=1) |
| | output_image |
| | ``` |
| | <p align="center"> |
| | <img style="width:500px;" src="assets/output.jpg"> |
| | </p> |
| |
|
| | ## License |
| | This code is released under the **Creative Commons BY-NC 4.0 license**. |
| |
|
| | ## Citation |
| | If you find this work useful or use it in your research, please consider citing us |
| | ```bibtex |
| | @article{chadebec2025lbm, |
| | title={LBM: Latent Bridge Matching for Fast Image-to-Image Translation}, |
| | author={Clément Chadebec and Onur Tasar and Sanjeev Sreetharan and Benjamin Aubin}, |
| | year={2025}, |
| | journal = {arXiv preprint arXiv:2503.07535}, |
| | } |
| | ``` |