File size: 6,036 Bytes
9af1b12 bda69ab 9af1b12 bda69ab 9af1b12 bda69ab 9af1b12 bda69ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | ---
license: bsd-3-clause
language:
- en
tags:
- super-resolution
- image-to-image
- real-esrgan
- esrgan
- pytorch
datasets:
- eugenesiow/Div2k
- yangtao9009/Flickr2K
paper:
- https://arxiv.org/abs/2107.10833
pipeline_tag: image-to-image
---
# Real-ESRGAN x4plus
This repository hosts the **`RealESRGAN_x4plus.pth`** pre-trained generator weights from the [xinntao/Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) project. The file is a 1:1 mirror of the asset originally released by Xintao Wang on **July 22, 2021** as part of [Real-ESRGAN v0.1.0](https://github.com/xinntao/Real-ESRGAN/releases/tag/v0.1.0). Per the v0.1.0 release notes, *"This release is mainly for storing pre-trained models and executable files."*
Real-ESRGAN extends ESRGAN to a practical blind super-resolution setting by training with a high-order degradation model and pure synthetic data ([Wang et al., 2021](https://arxiv.org/abs/2107.10833)). This particular checkpoint is the **general-purpose 4Γ image super-resolution** model and is the default model selected by `inference_realesrgan.py` in the upstream repository.
## π Model Details
| Field | Value |
| --- | --- |
| Original release | [v0.1.0](https://github.com/xinntao/Real-ESRGAN/releases/tag/v0.1.0), 22 Jul 2021 |
| Authors | Xintao Wang, Liangbin Xie, Chao Dong, Ying Shan β Tencent ARC Lab; Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences ([paper](https://arxiv.org/abs/2107.10833)) |
| Architecture | `RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)` ([source](https://github.com/xinntao/Real-ESRGAN/blob/master/inference_realesrgan.py)) |
| Upscale factor | 4Γ |
| Weight file | `RealESRGAN_x4plus.pth` (~67 MB) |
| Paper | [Wang et al., 2021 β *Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data*](https://arxiv.org/abs/2107.10833) (ICCVW 2021) |
| License | [BSD 3-Clause](LICENSE), Copyright (c) 2021 Xintao Wang |
| Source repository | [github.com/xinntao/Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) |
| Original asset URL | [github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth) |
## β‘ Intended Use
`x4plus` is a **general-purpose** super-resolution model β it works well across a broad range of natural images and is the default model recommended by the upstream Real-ESRGAN README for everyday use. For anime / illustration content, the smaller [`amd/realesrgan-x4plus-anime-6b`](https://huggingface.co/amd/realesrgan-x4plus-anime-6b) checkpoint (6-block variant, ~18 MB) is a better fit.
## π οΈ How to Use
The canonical entry point is the upstream [Real-ESRGAN repository](https://github.com/xinntao/Real-ESRGAN). The workflow below mirrors the [Quick Inference](https://github.com/xinntao/Real-ESRGAN#-quick-inference) section of the upstream README:
```bash
# 1. Clone Real-ESRGAN
git clone https://github.com/xinntao/Real-ESRGAN.git
cd Real-ESRGAN
# 2. Install dependencies
pip install basicsr facexlib gfpgan
pip install -r requirements.txt
python setup.py develop
# 3. Download the weights from this Hugging Face repo
huggingface-cli download amd/realesrgan-x4plus RealESRGAN_x4plus.pth --local-dir weights
# 4. Run inference
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --face_enhance
```
See the upstream [README.md](https://github.com/xinntao/Real-ESRGAN/blob/master/README.md) for the full set of CLI options (`--outscale`, `--tile`, `--fp32`, etc.). A portable NCNN executable variant is also available via the `realesrgan-x4plus` model name in [Real-ESRGAN-ncnn-vulkan](https://github.com/xinntao/Real-ESRGAN/releases).
## π Training Data
Per the Real-ESRGAN paper ([Wang et al., 2021](https://arxiv.org/abs/2107.10833), Β§5), the original Real-ESRGAN models were trained on three image datasets:
1. [**DIV2K**](https://github.com/limbee/NTIRE2017) β 800 2K-resolution images for image restoration tasks.
2. [**Flickr2K**](https://github.com/limbee/NTIRE2017) β 2,650 2K-resolution images.
3. [**OutdoorSceneTraining (OST)**](https://mmlab.ie.cuhk.edu.hk/projects/SFTGAN/) β 10,324 1K- to 2K-resolution images of outdoor scenes.
Training inputs are synthetically degraded via the high-order blur / downsample / noise / JPEG pipeline described in the paper.
## β οΈ Caveats and Recommendations
[Wang et al. (2021)](https://arxiv.org/abs/2107.10833) note that Real-ESRGAN can introduce aliasing, unpleasant artifacts, and may fail to remove complicated degradations. Results vary by content type β use `amd/realesrgan-x4plus-anime-6b` for anime/illustration imagery rather than this checkpoint.
## π Citation
If you use this model, please cite the original Real-ESRGAN paper:
```bibtex
@InProceedings{wang2021realesrgan,
author = {Xintao Wang and Liangbin Xie and Chao Dong and Ying Shan},
title = {Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data},
booktitle = {International Conference on Computer Vision Workshops (ICCVW)},
date = {2021}
}
```
## π License
These weights are distributed under the **[BSD 3-Clause License](LICENSE)**, Copyright (c) 2021 Xintao Wang ([upstream LICENSE](https://github.com/xinntao/Real-ESRGAN/blob/master/LICENSE)). This repository re-hosts the original artifact unchanged; please attribute the original authors when using or redistributing the weights.
## π€ Acknowledgments
All credit for the model architecture, training methodology, and weights goes to **[Xintao Wang](https://github.com/xinntao)** and the Real-ESRGAN authors at Tencent ARC Lab and the Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences. This Hugging Face repository exists only as a convenient mirror of the pre-trained weight file alongside its license and citation context.
|