Skip to main content

ESRGAN Thick

These models are the best ESRGAN upscaling models, at the cost of slower inference. They are best suited to a Node.js environment with a GPU, although can be used in the browser with significant latency.

The model weights were trained using the image-super-resolution Python repo and subsequently converted to Tensorflow.js models.

Samples + Demo

Here are some examples of upscaled images using these models.

Original2x Upscaled3x Upscaled4x Upscaled8x Upscaled
Original imageUpscaled image using esrgan-thick/2xUpscaled image using esrgan-thick/3xUpscaled image using esrgan-thick/4xUpscaled image using esrgan-thick/8x

Installation

npm install @upscalerjs/esrgan-thick

Usage

Import a model, specified by its scale:

import Upscaler from 'upscaler';
import x2 from '@upscalerjs/esrgan-thick/2x';

const upscaler = new Upscaler({
model: x2,
})

Available Models

ESRGAN thick ships with four models corresponding to the desired scale of the upscaled image:

  • 2x: @upscalerjs/esrgan-thick/2x
  • 3x: @upscalerjs/esrgan-thick/3x
  • 4x: @upscalerjs/esrgan-thick/4x
  • 8x: @upscalerjs/esrgan-thick/8x

All models are also exported via the root export:

import Upscaler from 'upscaler';
import models from '@upscalerjs/esrgan-thick';

const upscaler = new Upscaler({
model: models.x2,
// model: models.x3,
// model: models.x4,
// model: models.x8,
})

Performance + Speed Measurements

  • Note: Speed measurements are not recorded for the 8x model. Speed measurements are performed against mobile devices in order to measure against fixed hardware, and the 8x model does not work reliably in a browser.

Architecture

This model is trained via a Python implementation of the ESRGAN architecture.

The Python repo has instructions on training from scratch if you are so inclined.

Training Details

The model is trained on 4 scales.

The model is trained on the Div2k dataset.

It was trained for 500 epochs, with the following hyperparameters:

  • architecture: rrdn
  • C: 4
  • D: 3
  • G: 32
  • G0: 64
  • T: 10

The batch size was 12, and the batches per epoch was 20. The learning rate was set to 0.0004. The HR patch size was set to 128 or 129 depending on the scale (ensuring it is divisible by the scale) with the LR patch size being the resultant scale HR_patch_size / scale.

License

MIT License © Kevin Scott