Single-Line Deep Learning Documentation

Most of the practicle tasks that require the usage of deep learning models can be simplified to “just do the thing”, e.g., “just upscale the image”. On the other hand, official repositories of the state-of-the-art methods are dedicated to provide a way to reproduce experiments presented in the paper. These two different tasks require different code structure, so I made this library that provides an ultimative single-line solution for practical tasks solved by the SOTA methods.

Installation

You can install SLDL by running the following command:

pip install sldl

Supported Models

Image Super-Resolution

SwinIR-M

SwinIR-L

BSRGAN

BSRGANx2

RealESRGAN

Upscale factor

4

4

4

2

4

Video Super-Resolution

SwinIR-M

SwinIR-L

BSRGAN

BSRGANx2

RealESRGAN

VRT

Upscale factor

4

4

4

2

4

4

Quick Start

Here is a quick example of how to upscale an image using BSRGAN:

from PIL import image
from sldl.image import ImageSR

sr = ImageSR('BSRGAN')
img = Image.open('test.png')
upscaled = sr(img)

If you have a GPU, you can do it faster by moving the module on it:

sr = sr.cuda()

SLDL also supports an easy way to do everything in fp16:

sr = ImageSR('BSRGAN', precision='half')

You can easily apply the same model to upscale a video:

from sldl.video import VideoSR

sr = VideoSR('BSRGAN', precision='half').cuda()
sr('/path/to/your_video.mp4', '/path/to/upscaled_video.mp4')

Reference

Indices and tables