Basic usage
Get an image:
Downscale the image by a factor of 3:
Upscale the downscaled image using the net:
Compare the details with a naively upscaled version and the original:
Evaluate the peak signal-to-noise ratio:
Control the time-quality tradeoff
When upscaling by factors of 4 or less, as in the examples in the previous section, ESRGAN is applied once. If necessary, the image is downscaled to match the required factor. It is possible to choose whether to downscale before or after ESRGAN is applied, affecting both the running time and the quality of the final result. Get an image:
Downscale the image by a factor of 3:
When setting PerformanceGoal to "Speed", the input image is first downscaled by a factor of 3/4 and then upscaled, using ESRGAN, by a factor of 4. This will make the network operate on the smallest possible image but will throw away some details of the original, yielding a lower quality result:
When setting PerformanceGoal to "Quality", the input image is first upscaled, using ESRGAN, by a factor of 4 and then downscaled by a factor of 3/4. This is the default setting for factors of 4 or less and will make the network operate on the full-sized image, yielding a higher-quality result:
Compare the details with a naively upscaled version and the original:
When upscaling by factors of more than 4, ESRGAN must be applied multiple times. Get an image:
Downscale the image by a factor of 6:
When setting PerformanceGoal to "Speed", the downscaling happens before the last evaluation of ERSGAN. Hence, for a factor of 6, the input image is first upscaled by a factor of 4, then downscaled by a factor of 6/16 and finally upscaled by a factor of 4 again. This is the default setting for factors larger than 4:
When setting PerformanceGoal to "Quality", the downscaling happens after the last evaluation of ERSGAN. Hence, for a factor of 6, the input image is first upscaled by a factor of 4 twice and then downscaled by a factor of 6/16 (if available, set TargetDevice -> "GPU" for faster evaluation time):
Compare the details with a naively upscaled version and the original:
Net information
Inspect the number of parameters of all arrays in the net:
Obtain the total number of parameters:
Obtain the layer type counts:
Display the summary graphic:
Export to MXNet
Export the net into a format that can be opened in MXNet:
Export also creates a net.params file containing parameters:
Get the size of the parameter file:
The size is similar to the byte count of the resource object: