An open API service indexing awesome lists of open source software.

https://github.com/prs-eth/flair


https://github.com/prs-eth/flair

Last synced: 12 months ago
JSON representation

Awesome Lists containing this project

README

          

# FLAIR: Flow-Based Latent Alignment for Image Restoration

**Julius Erbach1,2, Dominik Narnhofer1, Andreas Dombos1, Jan Eric Lenssen2, Bernt Schiele2, Konrad Schindler1**


1 Photogrammetry and Remote Sensing, ETH Zurich
2 Max Planck Institute for Informatics, Saarbrücken

[![Paper](https://img.shields.io/badge/arXiv-PDF-b31b1b)](https://arxiv.org/abs/2506.02680)
[![Page](https://img.shields.io/badge/Project-Page-green)](https://inverseFLAIR.github.io)
[![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/prs-eth/FLAIR)


teaser



FLAIR is a novel approach for solving inverse imaging problems using flow-based posterior sampling.

## Installation

1. Clone the repository:
```bash
git clone git@github.com:prs-eth/FLAIR.git
cd FLAIR
```

2. Create a virtual environment (recommended):
```bash
python3 -m venv venv
source venv/bin/activate
```

3. Install the required dependencies from `requirements.txt`:
```bash
pip install -r requirements.txt
pip install .
```

## Running Inference

To run inference, you can use one of the Python script run_image_inv.py with the according config file.
An example from the FFQH dataset
```bash
python inference_scripts/run_image_inv.py --config configs/inpainting.yaml --target_file examples/girl.png --result_folder output --prompt="a high quality photo of a face"
```
Or an example from the DIV2K dataset with captions provided by DAPE using the degraded input. The masks can be defined as rectanlge coordinates in the config file or provided as .npy file where true pixels are observed and false are masked out.

```bash
python inference_scripts/run_image_inv.py --config configs/inpainting.yaml --target_file examples/sunflowers.png --result_folder output --prompt="a high quality photo of bloom, blue, field, flower, sky, sunflower, sunflower field, yellow" --mask_file DIV2k_mask.npy
```

```bash
python inference_scripts/run_image_inv.py --config configs/x12.yaml --target_file examples/sunflowers.png --result_folder output --prompt="a high quality photo of bloom, blue, field, flower, sky, sunflower, sunflower field, yellow"
```

## Citation

If you find this work useful in your research, please cite our paper:

```bibtex
@article{erbach2025solvinginverseproblemsflair,
title={Solving Inverse Problems with FLAIR},
author={Julius Erbach and Dominik Narnhofer and Andreas Dombos and Bernt Schiele and Jan Eric Lenssen and Konrad Schindler},
year={2025},
eprint={2506.02680},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2506.02680},
}
```