edsr
eugenesiowEDSR Model Documentation
Introduction
Enhanced Deep Residual Networks (EDSR) are designed for single image super-resolution, aiming to create high-resolution images from low-resolution inputs. Initially introduced by Lim et al. in 2017, the model leverages deeper and wider architectures to enhance performance without batch normalization, using constant scaling layers for stable training and an L1 loss function for better empirical performance.
Architecture
The EDSR model employs 32 ResBlocks and 256 channels, utilizing global and local skip connections with upscaling at the network's end. A simplified version includes just 16 ResBlocks and 64 channels. The architecture avoids batch normalization, applying constant scaling layers to ensure stable training.
Training
Training was conducted using the DIV2K dataset, which includes 800 high-resolution images, augmented to 4000 images, with 100 validation images. The preprocessing involves creating low-resolution images through bicubic interpolation and augmenting training data with five-crop methods. The model was trained on GPUs using the super_image
library, and the training process involves setting training arguments and a configuration for the desired upscaling.
Guide: Running Locally
Basic Steps
- Install the library: Use
pip install super-image
to install the necessary library. - Load and preprocess data: Use the
datasets
library to download and augment data.from datasets import load_dataset from super_image.data import augment_five_crop augmented_dataset = load_dataset('eugenesiow/Div2k', 'bicubic_x4', split='train') \ .map(augment_five_crop, batched=True)
- Train the model: Initialize the model and train using the provided dataset.
from super_image import Trainer, TrainingArguments, EdsrModel, EdsrConfig training_args = TrainingArguments(output_dir='./results', num_train_epochs=1000) config = EdsrConfig(scale=4) model = EdsrModel(config) trainer = Trainer(model=model, args=training_args, train_dataset=train_dataset, eval_dataset=eval_dataset) trainer.train()
- Use a pre-trained model: Load and apply the pre-trained model to upscale images.
from super_image import EdsrModel, ImageLoader model = EdsrModel.from_pretrained('eugenesiow/edsr', scale=2)
Cloud GPUs
For optimal performance, consider using cloud GPUs from platforms like Google Colab, AWS, or Azure to handle the computational demands of training and inference.
License
The EDSR project is licensed under the Apache 2.0 License, allowing for wide usage and modification with proper attribution.