Improve model card: Add pipeline tag, library name, abstract, and usage instructions
Browse filesThis PR significantly improves the model card by:
- Adding `pipeline_tag: image-to-image` and `library_name: diffusers` to the metadata, enhancing discoverability on the Hub and enabling the Hugging Face `use this model` widget.
- Including a link to the paper [Fine-structure Preserved Real-world Image Super-resolution via Transfer VAE Training](https://huggingface.co/papers/2507.20291) and the official GitHub repository [https://github.com/Joyies/TVT](https://github.com/Joyies/TVT).
- Incorporating the paper's abstract for a quick overview of the model's capabilities.
- Providing detailed 'Quick Inference' instructions, including installation steps and command examples, directly from the project's GitHub README, to facilitate easy usage.
README.md
CHANGED
|
@@ -1,3 +1,107 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-to-image
|
| 4 |
+
library_name: diffusers
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Fine-structure Preserved Real-world Image Super-resolution via Transfer VAE Training
|
| 8 |
+
|
| 9 |
+
This repository contains the official model weights for the paper [Fine-structure Preserved Real-world Image Super-resolution via Transfer VAE Training](https://huggingface.co/papers/2507.20291), which introduces the **Transfer VAE Training (TVT)** strategy for real-world image super-resolution.
|
| 10 |
+
|
| 11 |
+
The official code is available at: [https://github.com/Joyies/TVT](https://github.com/Joyies/TVT)
|
| 12 |
+
|
| 13 |
+
<div align="center">
|
| 14 |
+
<img src="https://huggingface.co/Joypop/TVTSR/resolve/main/assets/teaser.png" width="100%"/>
|
| 15 |
+
</div>
|
| 16 |
+
|
| 17 |
+
## Abstract
|
| 18 |
+
|
| 19 |
+
Impressive results on real-world image super-resolution (Real-ISR) have been achieved by employing pre-trained stable diffusion (SD) models. However, one critical issue of such methods lies in their poor reconstruction of image fine structures, such as small characters and textures, due to the aggressive resolution reduction of the VAE (eg., 8$\times$ downsampling) in the SD model. One solution is to employ a VAE with a lower downsampling rate for diffusion; however, adapting its latent features with the pre-trained UNet while mitigating the increased computational cost poses new challenges. To address these issues, we propose a Transfer VAE Training (TVT) strategy to transfer the 8$\times$ downsampled VAE into a 4$\times$ one while adapting to the pre-trained UNet. Specifically, we first train a 4$\times$ decoder based on the output features of the original VAE encoder, then train a 4$\times$ encoder while keeping the newly trained decoder fixed. Such a TVT strategy aligns the new encoder-decoder pair with the original VAE latent space while enhancing image fine details. Additionally, we introduce a compact VAE and compute-efficient UNet by optimizing their network architectures, reducing the computational cost while capturing high-resolution fine-scale features. Experimental results demonstrate that our TVT method significantly improves fine-structure preservation, which is often compromised by other SD-based methods, while requiring fewer FLOPs than state-of-the-art one-step diffusion models.
|
| 20 |
+
|
| 21 |
+
## Quick Inference
|
| 22 |
+
|
| 23 |
+
This section provides instructions on how to perform inference using the pre-trained models.
|
| 24 |
+
|
| 25 |
+
### Installation
|
| 26 |
+
|
| 27 |
+
First, clone the repository and set up the environment:
|
| 28 |
+
|
| 29 |
+
```shell
|
| 30 |
+
git clone https://github.com/Joyies/TVT.git
|
| 31 |
+
cd TVT
|
| 32 |
+
|
| 33 |
+
# create an environment
|
| 34 |
+
conda create -n TVT python=3.10
|
| 35 |
+
conda activate TVT
|
| 36 |
+
pip install --upgrade pip
|
| 37 |
+
pip install -r requirements.txt
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### Step 1: Download the pretrained models
|
| 41 |
+
|
| 42 |
+
- Download the pretrained SD-2.1-base models from [Hugging Face SD 2.1 Base](https://huggingface.co/stabilityai/stable-diffusion-2-1-base).
|
| 43 |
+
- Download the model weights ([VAED4](https://huggingface.co/Joypop/TVTSR/tree/main/ckp), [TVT model](https://huggingface.co/Joypop/TVTSR/tree/main/ckp), [TVTUNet](https://huggingface.co/Joypop/TVTSR/tree/main/ckp), [DAPE](https://huggingface.co/Joypop/TVTSR/tree/main/ckp), and [RAM](https://huggingface.co/Joypop/TVTSR/tree/main/ckp)) from [Hugging Face model weights](https://huggingface.co/Joypop/TVTSR/tree/main) and put them into the `ckp/` directory within your local `TVT` repository.
|
| 44 |
+
|
| 45 |
+
### Step 2: Prepare testing data and run testing command
|
| 46 |
+
|
| 47 |
+
You can modify `input_path` and `output_path` to run the testing command. The `input_path` is the path to your test image and `output_path` is the directory where the output images will be saved.
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
python TVT/inferences/inference.py \
|
| 51 |
+
--input_image input_path \
|
| 52 |
+
--output_dir output_path \
|
| 53 |
+
--pretrained_path ckp/model_TVT.pkl \
|
| 54 |
+
--pretrained_model_name_or_path stabilityai/stable-diffusion-2-1-base \
|
| 55 |
+
--pretrained_unet_path ckp/TVTUNet \
|
| 56 |
+
--vae4d_path ckp/vae.ckpt \
|
| 57 |
+
--ram_ft_path ckp/DAPE.pth \
|
| 58 |
+
--negprompt 'dotted, noise, blur, lowres, smooth' \
|
| 59 |
+
--prompt 'clean, high-resolution, 8k' \
|
| 60 |
+
--upscale 4 \
|
| 61 |
+
--time_step 1
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Alternatively, you can use the provided script:
|
| 65 |
+
```bash
|
| 66 |
+
bash scripts/test/test_realsr.sh
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
We also provide a tiled inference mode to save GPU memory. You can run the following command and adjust the `--tiled_size` and `--tiled_overlap` parameters based on your device's VRAM.
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
python TVT/inferences/inference_tile.py \
|
| 73 |
+
--input_image input_path \
|
| 74 |
+
--output_dir output_path \
|
| 75 |
+
--pretrained_path ckp/model_TVT.pkl \
|
| 76 |
+
--pretrained_model_name_or_path stabilityai/stable-diffusion-2-1-base \
|
| 77 |
+
--pretrained_unet_path ckp/TVTUNet \
|
| 78 |
+
--vae4d_path ckp/vae.ckpt \
|
| 79 |
+
--ram_ft_path ckp/DAPE.pth \
|
| 80 |
+
--negprompt 'dotted, noise, blur, lowres, smooth' \
|
| 81 |
+
--prompt 'clean, high-resolution, 8k' \
|
| 82 |
+
--upscale 4 \
|
| 83 |
+
--time_step 1 \
|
| 84 |
+
--tiled_size 96 \
|
| 85 |
+
--tiled_overlap 32
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## Citation
|
| 89 |
+
|
| 90 |
+
If our code helps your research or work, please consider citing our paper:
|
| 91 |
+
|
| 92 |
+
```bibtex
|
| 93 |
+
@article{yi2025fine,
|
| 94 |
+
title={Fine-structure Preserved Real-world Image Super-resolution via Transfer VAE Training},
|
| 95 |
+
author={Yi, Qiaosi and Li, Shuai and Wu, Rongyuan and Sun, Lingchen and Wu, Yuhui and Zhang, Lei},
|
| 96 |
+
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
|
| 97 |
+
year={2025}
|
| 98 |
+
}
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## License
|
| 102 |
+
|
| 103 |
+
This project is released under the [Apache 2.0 license](LICENSE).
|
| 104 |
+
|
| 105 |
+
## Acknowledgement
|
| 106 |
+
|
| 107 |
+
This project is based on [diffusers](https://github.com/huggingface/diffusers), [LDM](https://github.com/CompVis/latent-diffusion), [OSEDiff](https://github.com/cswry/OSEDiff) and [PiSA-SR](https://github.com/csslc/PiSA-SR). Thanks for the awesome work.
|