/LDM-SRtuning

Train latent diffusion for real-world super-resolution.

Primary LanguagePythonMIT LicenseMIT

Latent Diffusion Models

This repo is used as an example for training and finetuning latent-diffusion used as the baseline in StableSR.

Requirements

A suitable conda environment named ldm can be created and activated with:

conda env create -f environment.yaml
conda activate ldm

Pretrained Models

You can download our finetuned model here.

Train

python main.py --base configs/bsr_sr/config_sr_finetune.yaml -t --gpus 0, --train --scale_lr False

Inference

We use eta=1.0 as a type of DDPM using the offical DDIM sampling code.

python scripts/sr_val_ddim_realsr.py --config configs/bsr_sr/config_sr_finetune.yaml --ckpt CKPT_PATH --outdir OUTPUT_PATH --skip_grid --ddim_steps 200 --init-img INPUT_PATH --ddim_eta 1.0 --color_fix

Acknowledgement

This repo is an extension built on latent-diffusion. Some codes are also borrowing from BasicSR. Thanks for open-sourcing!