Skip to content

eladc-git/ELIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Efficient Image Restoration via Latent Consistency Flow Matching (BMVC 2025)

πŸ“„ Paper

https://arxiv.org/abs/2502.03500

Abstract

Recent advances in generative image restoration (IR) have demonstrated impressive results. However, these methods are hindered by their substantial size and computational demands, rendering them unsuitable for deployment on edge devices. This work introduces ELIR, an Efficient Latent Image Restoration method. ELIR addresses the distortion-perception trade-off within the latent space and produces high-quality images using a latent consistency flow-based model. In addition, ELIR introduces an efficient and lightweight architecture. Consequently, ELIR is 4x smaller and faster than stateof- the-art diffusion and flow-based approaches for blind face restoration, enabling a deployment on resource-constrained devices. Comprehensive evaluations of various image restoration tasks and datasets show that ELIR achieves competitive performance compared to state-of-the-art methods, effectively balancing distortion and perceptual quality metrics while significantly reducing model size and computational cost.

VideoBlocks

Visual Results

πŸ‘‰ Blind Face Restoration $~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$πŸ‘‰ Blind Super Resolution (x4)

πŸ‘‰ Super Resolution (x8) $~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$πŸ‘‰ Denoising

πŸ‘‰ Inpainting

Installation

To install the necessary dependencies, run the following commands:

git clone https://github.com/yourusername/ELIR.git
cd ELIR
pip install -r requirements.txt

πŸ’Ύ Training Datasets

πŸ§‘πŸ» FFHQ

FFHQ contains 70k high-quality PNG face images at 1024x1024 resolution, diverse in age, ethnicity, and background.

πŸŒ„ ImageNet-Training

ImageNet-1K contains 1.2M general-contnet images at different shapes.

πŸ’Ύ Testing Datasets

CelebA, LFW

Synthesised and in-the-wild face images.

ImageNet-Validation, RealSet80

Synthesised and real-world imges.

πŸ“ˆ Evaluation Metrics

Evaluation is done by Image Quality Assessment (IQA) toolbox for pytorch taken from https://github.com/chaofengc/IQA-PyTorch

πŸ’» Training

  1. Configuration: Edit the yml configuration file:
    • Set out_dir to your desired output directory.
    • Set train_dataset to your training dataset path.
    • Set val_dataset to your validation dataset path.
  2. Training: Execute the training script for the specific task:

Face Restoration

  • Blind Face Restoration:
    python train.py -y configs/elir_train_bfr.yml
  • Super Resolution (x8):
    python train.py -y configs/elir_train_sr.yml
  • Denoising:
    python train.py -y configs/elir_train_denoising.yml
  • Inpainting:
    python train.py -y configs/elir_train_inpainting.yml

Image Restoration

  • Blind Super Resolution (x4):
    python train.py -y configs/elir_train_bsr.yml

⬇️ Pre-trained models

Task Model Weight
blind face restoration elir_bfr.pth
super resolution elir_sr.pth
denoising elir_denoising.pth
inpainting elir_inpainting.pth
blind super resolution elir_bsr.pth

πŸ”¬ Evaluation

  1. Configuration: Edit the yml configuration file:
    • Set path to the path of the trained model.
    • Set val_dataset to your validation dataset path.
  2. Evaluation: Execute the evaluation script for the specific task:

Face Restoration

  • Blind Face Restoration:
    python eval.py -y configs/elir_infer_bfr.yml
  • Super Resolution (x8):
    python eval.py -y configs/elir_infer_sr.yml
  • Denoising:
    python eval.py -y configs/elir_infer_denoising.yml
  • Inpainting:
    python eval.py -y configs/elir_infer_inpainting.yml

Image Restoration

  • Blind Super Resolution (x4):
    python eval.py -y configs/elir_infer_bsr.yml

✈️ Inference

  1. Configuration: Edit the yml configuration file:
    • Set path to the path of the trained model.
    • Set in_folder and out_folder to the directory containing your low-quality images and for output.
  2. Inference: Execute the inference script for the specific task:

Face Restoration

  • Blind Face Restoration:
    python infer.py -y configs/elir_infer_bfr.yml
  • Super Resolution (x8):
    python infer.py -y configs/elir_infer_sr.yml
  • Denoising:
    python infer.py -y configs/elir_infer_denoising.yml
  • Inpainting:
    python infer.py -y configs/elir_infer_inpainting.yml

General-Content Restoration

  • Blind Super Resolution (x4):
    python infer.py -y configs/elir_infer_bsr.yml

πŸ“ Citation

If you find this project useful, please consider cite:

@article{cohen2025efficient,
  title={Efficient Image Restoration via Latent Consistency Flow Matching},
  author={Cohen, Elad and Achituve, Idan and Diamant, Idit and Netzer, Arnon and Habi, Hai Victor},
  journal={arXiv preprint arXiv:2502.03500},
  year={2025}
}

πŸ‘ Thanks

Tiny AutoEncoder for Stable Diffusion: https://github.com/madebyollin/taesd

About

Efficient Latent Image Restoration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages