UNPKG

@upscalerjs/esrgan-medium

Version:

ESRGAN Medium Model for UpscalerJS. Upscale images and increase image resolution with AI using Javascript

1 lines 1.44 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ESRGANMedium2x=t()}(this,function(){"use strict";const r=e=>{return Array.isArray(e)?e[0]:e};var{scale:n,name:e,version:t,meta:{architecture:a,...s},path:i}={scale:e=2,path:`models/x${e}/model.json`,name:"@upscalerjs/esrgan-medium",version:"1.0.0",meta:{C:1,D:10,G:64,G0:64,T:10,architecture:"rdn",patchSize:3===e?129:128,size:"medium",artifactReducing:!1,sharpening:!1,dataset:"div2k",modelFileName:t="rdn-C1-D10-G64-G064-T10-x2-patchsize128-compress100-sharpen0-datadiv2k-vary_cFalse_best-val_generator_PSNR_Y_epoch478"}};return i=i||`models/x${n}/model.json`,"rdn"===a?{scale:n,modelType:"layers",_internals:{path:i,name:e,version:t},meta:{architecture:a,...s},inputRange:[0,255],outputRange:[0,255]}:{setup:a=>{const s=a.layers.Layer;class e extends s{beta;constructor(){super({}),this.beta=.2}call(e){return a.mul(r(e),this.beta)}static className="MultiplyBeta"}[e,(e=>{class t extends s{scale=e;constructor(){super({})}computeOutputShape(e){return[e[0],e[1],e[2],3]}call(e){return a.depthToSpace(r(e),this.scale,"NHWC")}static className=`PixelShuffle${n}x`}return t})(n)].forEach(e=>{a.serialization.registerClass(e)})},scale:n,modelType:"layers",_internals:{path:i,name:e,version:t},meta:{architecture:a,...s},inputRange:[0,1],outputRange:[0,1]}});