santa hat
deerdeer nosedeer glow
Sign In

Converter for ESRGAN models

Converter for ESRGAN models

Preface

I implemented ERSGAN in my upscaler application [2]. The upscaler models shipped with the original ERSGAN source code can be used but I wanted to try other models from other sources. Most of the time the upscaler models were not compatible. I prepared a simple converter and the results can be found here [1].

Example and Test Case

I used following image as example, how the converter works and why it is important to have such a converter.

Figure 1: Original image with a resolution of 512 x 512 pixel. Created using AUTOMATIC1111.

Application Case

To show the difference between some upscaling approaches I present images where I zoomed in together with the zoomed in original.

Original Image

OpenCV (INTER_NEAREST_EXACT)

ERSGAN (RRDB_ESRGAN_x4.pth)

ERSGAN (4x-UltraSharp Upscaler)

Conclusion

If one zooms in the original image is blurry. Using standard methods the image is sharper. Zooming in shows then the sharpness in form of a block structure. ERSGAN with the shipped with model looks without zoom good, but zoomed in it shows artifacts of different kind. Using the converted well know Ultrasharp Upscaler gives the best results with and without zoom. Time consumption and power consumption Using ESRGAN is also acceptable. It is much better in performance than using the Stable Diffusion approach.

Failed Conversion

If a conversion fails, the model can be used most of the time, but such a model is senseless. Result output of a buggy converted model is:

In this case two layers could not be converted so far. On this topic I have to work on. Especially the last layer has in this case the wrong shape.

Side Note

The Lazy Image Upscaler version with ESRGAN and RealESRGAN is not yet published. This quick and dirty programmed version needs some more work to do until it can be published.

For my personal needs my Upscaler works better and better from day to day. The aim is to save time as well as power while ensuring the highest image quality.

Final Words

Have a nice day. Have fun. Be inspired!

References

[1] https://github.com/zentrocdot/esrgan_rrbd_converter

[2] https://github.com/zentrocdot/LazyImageUpscaler

0

Comments