ESRGAN Legacy
ESRGAN Legacy is a package of Tensorflow.js models for upscaling images with UpscalerJS.
This package contains the five models available in pre-1.0.0
versions of UpscalerJS.
The model weights include pretrained weights provided via the image-super-resolution
Python repo, along with a number of custom trained models.
Samples + Demo
Here are some examples of upscaled images using these models.
Original | psnr-small Upscaled | gans Upscaled | div2k/2x Upscaled | div2k/3x Upscaled | div2k/4x Upscaled |
---|---|---|---|---|---|
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
Installation
npm install @upscalerjs/esrgan-legacy
Usage
Import a model:
import Upscaler from 'upscaler';
import gans from '@upscalerjs/esrgan-legacy/gans';
const upscaler = new Upscaler({
model: gans,
})
Available Models
ESRGAN Legacy ships with five models:
GANS
:@upscalerjs/esrgan-legacy/gans
psnr-small
:@upscalerjs/esrgan-legacy/psnr-small
div2k/2x
:@upscalerjs/esrgan-legacy/div2k/2x
div2k/3x
:@upscalerjs/esrgan-legacy/div2k/3x
div2k/4x
:@upscalerjs/esrgan-legacy/div2k/4x
All models are also exported via the root export:
import Upscaler from 'upscaler';
import models from '@upscalerjs/esrgan-legacy';
const upscaler = new Upscaler({
model: models.GANS,
// model: models.PSNRSmall,
// model: models.div2K2x,
// model: models.div2K3x,
// model: models.div2K4x,
})
GANS
The gans
model uses the pretrained gans
weights made available via the original Python repo.
PSNR Small
The psnr-small
model uses the pretrained psnr-small
weights made available via the original Python repo.
Div2k Models
There are three Div2K models available in 2x, 3x, and 4x scales.
These models were an initial attempt at training from scratch on the Div2K dataset. They've been surpassed in performance and speed by the other available models, and should be avoided if possible.
Performance + Speed Measurements
Architecture
This model is trained via a Python implementation of the ESRGAN architecture.
- Paper: https://arxiv.org/abs/1809.00219
- Python Repo: https://github.com/idealo/image-super-resolution
The Python repo has instructions on training from scratch if you are so inclined.