Eugene Siow
commited on
Commit
•
967fc29
1
Parent(s):
3c1ce73
Initial commit.
Browse files- README.md +85 -0
- config.json +11 -0
- pytorch_model_2x.pt +3 -0
- pytorch_model_4x.pt +3 -0
README.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- image-super-resolution
|
5 |
+
datasets:
|
6 |
+
- div2k
|
7 |
+
metrics:
|
8 |
+
- pnsr
|
9 |
+
- ssim
|
10 |
+
---
|
11 |
+
# Enhanced Deep Residual Networks for Single Image Super-Resolution (EDSR)
|
12 |
+
EDSR model pre-trained on DIV2K (800 images training, augmented to 4000 images, 100 images validation) for 2x, 3x and 4x image super resolution. It was introduced in the paper [Enhanced Deep Residual Networks for Single Image Super-Resolution](https://arxiv.org/abs/1707.02921) by Lim et al. and first released in [this repository](https://github.com/sanghyun-son/EDSR-PyTorch).
|
13 |
+
|
14 |
+
The goal of image super resolution is to restore a high resolution (HR) image from a single low resolution (LR) image.
|
15 |
+
## Model description
|
16 |
+
EDSR is a model that uses both deeper and wider architecture (32 ResBlocks and 256 channels) to improve performance. It uses both global and local skip connections, and up-scaling is done at the end of the network. It doesn't use batch normalization layers (input and output have similar distributions, normalizing intermediate features may not be desirable) instead it uses constant scaling layers to ensure stable training. An L1 loss function (absolute error) is used instead of L2 (MSE), the authors showed better performance empirically and it requires less computation.
|
17 |
+
|
18 |
+
This is a base model (~5mb vs ~100mb) that includes just 16 ResBlocks and 64 channels.
|
19 |
+
## Intended uses & limitations
|
20 |
+
You can use the pre-trained models for upscaling your images 2x, 3x and 4x. You can also use the trainer to train an EDSR model on your own dataset.
|
21 |
+
### How to use
|
22 |
+
The model can be used with the [super_image](https://github.com/eugenesiow/super-image) library:
|
23 |
+
```bash
|
24 |
+
pip install super-image
|
25 |
+
```
|
26 |
+
Here is how to use a pre-trained model to upscale your image:
|
27 |
+
```python
|
28 |
+
from super_image import EdsrModel, DataLoader
|
29 |
+
from PIL import Image
|
30 |
+
import requests
|
31 |
+
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
32 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
33 |
+
model = EdsrModel.from_pretrained('edsr')
|
34 |
+
inputs = DataLoader(images=image)
|
35 |
+
preds = model(inputs)
|
36 |
+
```
|
37 |
+
## Training data
|
38 |
+
The EDSR models for 2x, 3x and 4x image super resolution were pretrained on [DIV2K](https://data.vision.ee.ethz.ch/cvl/DIV2K/), a dataset of 800 high-quality (2K resolution) images for training, augmented to 4000 images and uses a dev set of 100 validation images (images numbered 801 to 900).
|
39 |
+
## Training procedure
|
40 |
+
### Preprocessing
|
41 |
+
We follow the pre-processing and training method of [Wang et. al](https://arxiv.org/abs/2104.07566).
|
42 |
+
Low Resolution (LR) images are created by using bicubic interpolation as the resizing method to reduce the size of the High Resolution (HR) images by x2, x3 and x4 times.
|
43 |
+
During training, RGB patches with size of 64×64 from the LR input are used together with their corresponding HR patches.
|
44 |
+
Data augmentation is applied to the training set in the pre-processing stage where five images are created from the four corners and center of the original image.
|
45 |
+
### Pretraining
|
46 |
+
The model was trained on GPU. The training code is provided below:
|
47 |
+
```python
|
48 |
+
from super_image import Trainer
|
49 |
+
```
|
50 |
+
## Evaluation results
|
51 |
+
The evaluation metrics include [PSNR](https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio#Quality_estimation_with_PSNR) and [SSIM](https://en.wikipedia.org/wiki/Structural_similarity#Algorithm).
|
52 |
+
|
53 |
+
Evaluation datasets include:
|
54 |
+
- Set5 - [Bevilacqua et al. (2012)](http://people.rennes.inria.fr/Aline.Roumy/results/SR_BMVC12.html)
|
55 |
+
- Set14 - [Zeyde et al. (2010)](https://sites.google.com/site/romanzeyde/research-interests)
|
56 |
+
- BSD100 - [Martin et al. (2001)](https://www.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/)
|
57 |
+
- Urban100 - [Huang et al. (2015)](https://sites.google.com/site/jbhuang0604/publications/struct_sr)
|
58 |
+
|
59 |
+
The results columns below are represented below as `PSNR/SSIM`. They are compared against a Bicubic baseline.
|
60 |
+
|
61 |
+
|Dataset |Scale |Bicubic |edsr-base |
|
62 |
+
|--- |--- |--- |--- |
|
63 |
+
|Set5 |2x |33.64/0.9292 |**38.02/0.9607** |
|
64 |
+
|Set5 |3x |30.39/0.8678 | |
|
65 |
+
|Set5 |4x |28.42/0.8101 |**32.12/0.8947** |
|
66 |
+
|Set14 |2x |30.22/0.8683 | |
|
67 |
+
|Set14 |3x |27.53/0.7737 | |
|
68 |
+
|Set14 |4x |25.99/0.7023 |**28.60/0.7815** |
|
69 |
+
|BSD100 |2x |29.55/0.8425 | |
|
70 |
+
|BSD100 |3x |27.20/0.7382 | |
|
71 |
+
|BSD100 |4x |25.96/0.6672 |**27.61/0.7363** |
|
72 |
+
|Urban100 |2x |26.66/0.8408 | |
|
73 |
+
|Urban100 |3x | | |
|
74 |
+
|Urban100 |4x |23.14/0.6573 |**26.02/0.7832** |
|
75 |
+
|
76 |
+
## BibTeX entry and citation info
|
77 |
+
```bibtex
|
78 |
+
@InProceedings{Lim_2017_CVPR_Workshops,
|
79 |
+
author = {Lim, Bee and Son, Sanghyun and Kim, Heewon and Nah, Seungjun and Lee, Kyoung Mu},
|
80 |
+
title = {Enhanced Deep Residual Networks for Single Image Super-Resolution},
|
81 |
+
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
|
82 |
+
month = {July},
|
83 |
+
year = {2017}
|
84 |
+
}
|
85 |
+
```
|
config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "eugenesiow/edsr-base",
|
3 |
+
"data_parallel": true,
|
4 |
+
"model_type": "EDSR",
|
5 |
+
"n_colors": 3,
|
6 |
+
"n_feats": 64,
|
7 |
+
"n_resblocks": 16,
|
8 |
+
"res_scale": 1,
|
9 |
+
"rgb_range": 255,
|
10 |
+
"supported_scales": [2, 4]
|
11 |
+
}
|
pytorch_model_2x.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b709bea0d3e3a7a1c84eb1eaa6e5e777f176edcfca00b3b5acde5320eb630211
|
3 |
+
size 5506753
|
pytorch_model_4x.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9302a679cf3e656a8aefd4ae7cfae4dd86ca60b2e1c50fbe9e06dde9767d32ad
|
3 |
+
size 6098299
|